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 new file mode 100644 index 00000000000..866600b1d1a --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,64 @@ +--- +alice3: + - changed-files: + - any-glob-to-any-file: ['ALICE3/**'] + +common: + - changed-files: + - any-glob-to-any-file: ['Common/**'] + +infrastructure: + - changed-files: + - any-glob-to-any-file: + - '.clang-format' + - '.clang-tidy' + - '.flake8' + - '.github/**' + - '.checkov.yml' + - '.mega-linter.yml' + - 'cmake/**' + - 'CODEOWNERS' + - 'CPPLINT.cfg' + - 'dependencies/**' + - 'packaging/**' + - 'pyproject.toml' + +dpg: + - changed-files: + - any-glob-to-any-file: ['DPG/**'] + +pwgcf: + - changed-files: + - any-glob-to-any-file: ['PWGCF/**', '*/PWGCF/**'] + +pwgdq: + - changed-files: + - any-glob-to-any-file: ['PWGDQ/**', '*/PWGDQ/**'] + +pwgem: + - changed-files: + - any-glob-to-any-file: ['PWGEM/**', '*/PWGEM/**'] + +pwghf: + - changed-files: + - any-glob-to-any-file: ['PWGHF/**', '*/PWGHF/**'] + +pwgje: + - changed-files: + - any-glob-to-any-file: ['PWGJE/**', '*/PWGJE/**'] + +pwglf: + - changed-files: + - any-glob-to-any-file: ['PWGLF/**', '*/PWGLF/**', 'PWGMM/**', '*/PWGMM/**'] + +pwgud: + - changed-files: + - any-glob-to-any-file: ['PWGUD/**', '*/PWGUD/**'] + +trigger: + - changed-files: + - any-glob-to-any-file: ['EventFiltering/**'] + +tutorial: + - changed-files: + - any-glob-to-any-file: ['Tutorials/**'] 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/codeowner-self-approval.yml b/.github/workflows/codeowner-self-approval.yml index bd4d3182682..149213effc5 100644 --- a/.github/workflows/codeowner-self-approval.yml +++ b/.github/workflows/codeowner-self-approval.yml @@ -13,7 +13,7 @@ permissions: jobs: approve: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 # Only run if the PR author enabled auto-merge, not someone else. # Also run if a new approval was created, as this affects whether we can # auto-approve. There is a risk of infinite loops here, though -- when we diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000000..3f8fa9bc1b6 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,122 @@ +--- +name: "Pull Request Labeler" +'on': + pull_request_target: + types: [opened, synchronize, reopened, edited] +permissions: read-all + +jobs: + labeler: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + outputs: + labels: ${{ steps.labeler.outputs.all-labels }} + steps: + - 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/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 523a5a8cf64..ab99fb8e954 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -27,30 +27,42 @@ /EventFiltering/PWGCF @alibuild @lauraser @mpuccio @lietava /EventFiltering/PWGMM @alibuild @aortizve @mpuccio @lietava /EventFiltering/PWGJE @alibuild @fkrizek @nzardosh @mpuccio @lietava -/PWGCF @alibuild @saganatt @victor-gonzalez @zchochul -/PWGCF/Core @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul -/PWGCF/DataModel @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul -/PWGCF/TableProducer @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul -/PWGCF/Tasks @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul +/PWGCF @alibuild @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye +/PWGCF/Core @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye +/PWGCF/DataModel @alibuild @jgrosseo @saganatt @victor-gonzalez @zchochul @lgraczykCern @prchakra @lauraser @ariedel-cern @EmilGorm @otonvd @shouqiye +/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/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 -/PWGLF @alibuild @ercolessi @fmazzasc @chiarapinto @BongHwi @smaff92 @mbombara @ChiaraDeMartin95 @njacazio @skundu692 -/PWGMM @alibuild @aalkin +# PWG-LF +/PWGLF @alibuild @njacazio @skundu692 +/PWGLF/Tasks/GlobalEventProperties @alibuild @njacazio @skundu692 @gbencedi @omvazque +/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/Strangeness @alibuild @njacazio @skundu692 @ercolessi @ChiaraDeMartin95 +/PWGLF/TableProducer/Strangeness @alibuild @njacazio @skundu692 @ercolessi @ChiaraDeMartin95 + +# PWG-MM +/PWGMM @alibuild @njacazio @skundu692 @aalkin +/PWGMM/Mult @alibuild @njacazio @skundu692 @aalkin @aortizve @ddobrigk /PWGMM/Lumi @alibuild @aalkin -/PWGMM/Mult @alibuild @aalkin @aortizve @ddobrigk -/PWGMM/UE @alibuild @aalkin @aortizve +/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 /Tutorials/PWGDQ @alibuild @iarsene @dsekihat @feisenhu @lucamicheletti93 /Tutorials/PWGEM @alibuild @mikesas @rbailhac @dsekihat @ivorobye @feisenhu /Tutorials/PWGHF @alibuild @vkucera @fcolamar @fgrosa -/Tutorials/PWGJE @alibuild @lhavener @maoyx @nzardosh @ddobrigk @mfasDa +/Tutorials/PWGJE @alibuild @lhavener @maoyx @nzardosh @mfasDa @fjonasALICE /Tutorials/PWGLF @alibuild @alcaliva @lbariogl @chiarapinto @BongHwi @lbarnby @mbombara @iravasen @njacazio @ChiaraDeMartin95 @skundu692 /Tutorials/PWGMM @alibuild @aalkin @ddobrigk /Tutorials/PWGUD @alibuild @pbuehler 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 55ff1d04af1..86bf76a6419 100644 --- a/Common/CCDB/EventSelectionParams.cxx +++ b/Common/CCDB/EventSelectionParams.cxx @@ -55,13 +55,12 @@ const char* selectionLabels[kNsel] = { "kIsVertexITSTPC", "kIsVertexTOFmatched", "kIsVertexTRDmatched", - "kNoHighOccupancyAgressive", - "kNoHighOccupancyStrict", - "kNoHighOccupancyMedium", - "kNoHighOccupancyRelaxed", - "kNoHighOccupancyGentle", + "kNoCollInTimeRangeNarrow", + "kNoCollInTimeRangeStrict", "kNoCollInTimeRangeStandard", - "kNoCollInTimeRangeNarrow"}; + "kNoCollInTimeRangeVzDependent", + "kNoCollInRofStrict", + "kNoCollInRofStandard"}; } // namespace o2::aod::evsel using namespace o2::aod::evsel; diff --git a/Common/CCDB/EventSelectionParams.h b/Common/CCDB/EventSelectionParams.h index dfedfd1e12f..143de878bc5 100644 --- a/Common/CCDB/EventSelectionParams.h +++ b/Common/CCDB/EventSelectionParams.h @@ -19,55 +19,54 @@ namespace o2::aod::evsel { // Event selection criteria enum EventSelectionFlags { - kIsBBV0A = 0, // cell-averaged time in V0A in beam-beam window - kIsBBV0C, // cell-averaged time in V0C in beam-beam window (for Run 2 only) - kIsBBFDA, // cell-averaged time in FDA (or AD in Run2) in beam-beam window - kIsBBFDC, // cell-averaged time in FDC (or AD in Run2) in beam-beam window - kIsBBT0A, // cell-averaged time in T0A in beam-beam window - kIsBBT0C, // cell-averaged time in T0C in beam-beam window - kNoBGV0A, // cell-averaged time in V0A in beam-gas window - kNoBGV0C, // cell-averaged time in V0C in beam-gas window (for Run 2 only) - kNoBGFDA, // cell-averaged time in FDA (AD in Run2) in beam-gas window - kNoBGFDC, // cell-averaged time in FDC (AD in Run2) in beam-gas window - kNoBGT0A, // cell-averaged time in T0A in beam-gas window - kNoBGT0C, // cell-averaged time in T0C in beam-gas window - kIsBBZNA, // time in common ZNA channel in beam-beam window - kIsBBZNC, // time in common ZNC channel in beam-beam window - kIsBBZAC, // time in ZNA and ZNC in beam-beam window - circular cut in ZNA-ZNC plane - kNoBGZNA, // time in common ZNA channel is outside of beam-gas window - kNoBGZNC, // time in common ZNC channel is outside of beam-gas window - kNoV0MOnVsOfPileup, // no out-of-bunch pileup according to online-vs-offline VOM correlation - kNoSPDOnVsOfPileup, // no out-of-bunch pileup according to online-vs-offline SPD correlation - kNoV0Casymmetry, // no beam-gas according to correlation of V0C multiplicities in V0C3 and V0C012 - kIsGoodTimeRange, // good time range - kNoIncompleteDAQ, // complete event according to DAQ flags - kNoTPCLaserWarmUp, // no TPC laser warm-up event (used in Run 1) - kNoTPCHVdip, // no TPC HV dip - kNoPileupFromSPD, // no pileup according to SPD vertexer - kNoV0PFPileup, // no out-of-bunch pileup according to V0 past-future info - kNoSPDClsVsTklBG, // no beam-gas according to cluster-vs-tracklet correlation - kNoV0C012vsTklBG, // no beam-gas according to V0C012-vs-tracklet correlation - kNoInconsistentVtx, // no inconsistency in SPD and Track vertices - kNoPileupInMultBins, // no pileup according to multiplicity-differential pileup checks - kNoPileupMV, // no pileup according to multi-vertexer - kNoPileupTPC, // no pileup in TPC - kIsTriggerTVX, // FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level - kIsINT1, // SPDGFO >= 1 || V0A || V0C - kNoITSROFrameBorder, // bunch crossing is far from ITS RO Frame border - kNoTimeFrameBorder, // bunch crossing is far from Time Frame borders - kNoSameBunchPileup, // reject collisions in case of pileup with another collision in the same foundBC - kIsGoodZvtxFT0vsPV, // small difference between z-vertex from PV and from FT0 - kIsVertexITSTPC, // at least one ITS-TPC track (reject vertices built from ITS-only tracks) - kIsVertexTOFmatched, // at least one of vertex contributors is matched to TOF - kIsVertexTRDmatched, // at least one of vertex contributors is matched to TRD - kNoHighOccupancyAgressive, // no occupancy according to the agressive cuts - kNoHighOccupancyStrict, // no occupancy according to the strict cuts - kNoHighOccupancyMedium, // no occupancy according to the medium cuts - kNoHighOccupancyRelaxed, // no occupancy according to the relaxed cuts - kNoHighOccupancyGentle, // no occupancy according to the gentle cuts - kNoCollInTimeRangeStandard, // no collisions in specified time range - kNoCollInTimeRangeNarrow, // no collisions in specified time range (narrower than Standard) - kNsel // counter + kIsBBV0A = 0, // cell-averaged time in V0A in beam-beam window + kIsBBV0C, // cell-averaged time in V0C in beam-beam window (for Run 2 only) + kIsBBFDA, // cell-averaged time in FDA (or AD in Run2) in beam-beam window + kIsBBFDC, // cell-averaged time in FDC (or AD in Run2) in beam-beam window + kIsBBT0A, // cell-averaged time in T0A in beam-beam window + kIsBBT0C, // cell-averaged time in T0C in beam-beam window + kNoBGV0A, // cell-averaged time in V0A in beam-gas window + kNoBGV0C, // cell-averaged time in V0C in beam-gas window (for Run 2 only) + kNoBGFDA, // cell-averaged time in FDA (AD in Run2) in beam-gas window + kNoBGFDC, // cell-averaged time in FDC (AD in Run2) in beam-gas window + kNoBGT0A, // cell-averaged time in T0A in beam-gas window + kNoBGT0C, // cell-averaged time in T0C in beam-gas window + kIsBBZNA, // time in common ZNA channel in beam-beam window + kIsBBZNC, // time in common ZNC channel in beam-beam window + kIsBBZAC, // time in ZNA and ZNC in beam-beam window - circular cut in ZNA-ZNC plane + kNoBGZNA, // time in common ZNA channel is outside of beam-gas window + kNoBGZNC, // time in common ZNC channel is outside of beam-gas window + kNoV0MOnVsOfPileup, // no out-of-bunch pileup according to online-vs-offline VOM correlation + kNoSPDOnVsOfPileup, // no out-of-bunch pileup according to online-vs-offline SPD correlation + kNoV0Casymmetry, // no beam-gas according to correlation of V0C multiplicities in V0C3 and V0C012 + kIsGoodTimeRange, // good time range + kNoIncompleteDAQ, // complete event according to DAQ flags + kNoTPCLaserWarmUp, // no TPC laser warm-up event (used in Run 1) + kNoTPCHVdip, // no TPC HV dip + kNoPileupFromSPD, // no pileup according to SPD vertexer + kNoV0PFPileup, // no out-of-bunch pileup according to V0 past-future info + kNoSPDClsVsTklBG, // no beam-gas according to cluster-vs-tracklet correlation + kNoV0C012vsTklBG, // no beam-gas according to V0C012-vs-tracklet correlation + kNoInconsistentVtx, // no inconsistency in SPD and Track vertices + kNoPileupInMultBins, // no pileup according to multiplicity-differential pileup checks + kNoPileupMV, // no pileup according to multi-vertexer + kNoPileupTPC, // no pileup in TPC + kIsTriggerTVX, // FT0 vertex (acceptable FT0C-FT0A time difference) at trigger level + kIsINT1, // SPDGFO >= 1 || V0A || V0C + kNoITSROFrameBorder, // bunch crossing is far from ITS RO Frame border + kNoTimeFrameBorder, // bunch crossing is far from Time Frame borders + kNoSameBunchPileup, // reject collisions in case of pileup with another collision in the same foundBC + kIsGoodZvtxFT0vsPV, // small difference between z-vertex from PV and from FT0 + kIsVertexITSTPC, // at least one ITS-TPC track (reject vertices built from ITS-only tracks) + kIsVertexTOFmatched, // at least one of vertex contributors is matched to TOF + kIsVertexTRDmatched, // at least one of vertex contributors is matched to TRD + kNoCollInTimeRangeNarrow, // no other collisions in specified time range (narrower than Strict) + kNoCollInTimeRangeStrict, // no other collisions in specified time range + kNoCollInTimeRangeStandard, // no other collisions in specified time range with per-collision multiplicity above threshold + 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 + kNsel // counter }; extern const char* selectionLabels[kNsel]; diff --git a/Common/Core/AnalysisCoreLinkDef.h b/Common/Core/AnalysisCoreLinkDef.h index b376ccc7f10..ae4c91e9589 100644 --- a/Common/Core/AnalysisCoreLinkDef.h +++ b/Common/Core/AnalysisCoreLinkDef.h @@ -26,4 +26,6 @@ #pragma link C++ class OrbitRange + ; +#pragma link C++ class FFitWeights + ; + #endif // COMMON_CORE_ANALYSISCORELINKDEF_H_ diff --git a/Common/Core/CMakeLists.txt b/Common/Core/CMakeLists.txt index babf1a6ccdc..c51c9dbfa2a 100644 --- a/Common/Core/CMakeLists.txt +++ b/Common/Core/CMakeLists.txt @@ -19,6 +19,7 @@ o2physics_add_library(AnalysisCore TableHelper.cxx MetadataHelper.cxx CollisionTypeHelper.cxx + FFitWeights.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsParameters ROOT::EG O2::CCDB ROOT::Physics O2::FT0Base O2::FV0Base) o2physics_target_root_dictionary(AnalysisCore @@ -33,6 +34,7 @@ o2physics_target_root_dictionary(AnalysisCore PID/PIDTOF.h PID/TPCPIDResponse.h CollisionTypeHelper.h + FFitWeights.h LINKDEF AnalysisCoreLinkDef.h) o2physics_add_header_only_library(TPCDriftManager diff --git a/Common/Core/FFitWeights.cxx b/Common/Core/FFitWeights.cxx new file mode 100644 index 00000000000..9c98479627d --- /dev/null +++ b/Common/Core/FFitWeights.cxx @@ -0,0 +1,170 @@ +// 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 FFitWeights.cxx +/// \brief Implementation file for FFitWeights.h, see the header for more information +/// +/// \author Joachim C. K. B. Hansen + +#include "FFitWeights.h" + +#include + +ClassImp(FFitWeights) + + FFitWeights::FFitWeights() : TNamed("", ""), + fW_data{nullptr}, + CentBin{100}, + qAxis{nullptr}, + nResolution{3000}, + qnTYPE{0} +{ +} + +FFitWeights::FFitWeights(const char* name) : TNamed(name, name), + fW_data{nullptr}, + CentBin{100}, + qAxis{nullptr}, + nResolution{3000}, + qnTYPE{0} {} + +FFitWeights::~FFitWeights() +{ + delete fW_data; + if (qAxis) + delete qAxis; +}; + +void FFitWeights::Init() +{ + fW_data = new TObjArray(); + fW_data->SetName("FFitWeights_Data"); + fW_data->SetOwner(kTRUE); + + 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::Fill(float centrality, float qn, int nh, const char* pf) +{ + TObjArray* tar{nullptr}; + + tar = fW_data; + if (!tar) + return; + + TH2D* th2 = reinterpret_cast(tar->FindObject(this->GetQName(nh, pf))); + if (!th2) { + 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(centrality, qn); +}; + +Long64_t FFitWeights::Merge(TCollection* collist) +{ + 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++; + } + return nmerged; +}; +void FFitWeights::AddArray(TObjArray* targ, TObjArray* sour) +{ + if (!sour) { + printf("Source array does not exist!\n"); + return; + } + 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 { + targh->Add(sourh); + } + } +}; + +void FFitWeights::qSelectionSpline(std::vector nhv, std::vector stv) /* only execute OFFLINE */ +{ + TObjArray* tar{nullptr}; + + tar = fW_data; + if (!tar) + return; + + 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); + } + } + } +}; + +float FFitWeights::EvalSplines(float centr, const float& dqn, const int nh, const char* pf) +{ + TObjArray* tar{nullptr}; + + tar = fW_data; + if (!tar) + return -1; + + int isp = static_cast(centr); + if (isp < 0 || isp > 90) { + return -1; + } + + TSpline3* spline = nullptr; + spline = reinterpret_cast(tar->FindObject(Form("sp_q%i%s_%i", nh, pf, isp))); + if (!spline) { + return -1; + } + + float qn_val = 100. * spline->Eval(dqn); + if (qn_val < 0) { + return -1; + } + + return qn_val; +}; diff --git a/Common/Core/FFitWeights.h b/Common/Core/FFitWeights.h new file mode 100644 index 00000000000..0a3d285176e --- /dev/null +++ b/Common/Core/FFitWeights.h @@ -0,0 +1,82 @@ +// 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 FFitWeights.h +/// \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 + +#ifndef COMMON_CORE_FFITWEIGHTS_H_ +#define COMMON_CORE_FFITWEIGHTS_H_ + +#include +#include +#include +#include +#include +#include + +#include "TNamed.h" +#include "TObjArray.h" +#include "TH3D.h" +#include "TH2D.h" +#include "TH1D.h" +#include "TFile.h" +#include "TCollection.h" +#include "TString.h" +#include "TMath.h" + +class FFitWeights : public TNamed +{ + public: + FFitWeights(); + explicit FFitWeights(const char* name); + ~FFitWeights(); + + void Init(); + void Fill(float centrality, float qn, int nh, const char* pf = ""); + TObjArray* GetDataArray() { return fW_data; } + + void SetCentBin(int bin) { CentBin = bin; } + void SetBinAxis(int bin, float min, float max) + { + qAxis = new TAxis(bin, min, max); + } + TAxis* GetqVecAx() { return qAxis; } + + 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; + + int CentBin; + TAxis* qAxis; //! + int nResolution; + + std::vector> qnTYPE; + + 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, 1); // calibration class +}; +#endif // COMMON_CORE_FFITWEIGHTS_H_ diff --git a/Common/Core/RecoDecay.h b/Common/Core/RecoDecay.h index f772ba40e09..ce2469e66e7 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 @@ -662,6 +664,8 @@ 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 @@ -669,19 +673,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 @@ -707,6 +717,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) { @@ -726,7 +751,7 @@ struct RecoDecay { return -1; } // Check that the number of direct daughters is not larger than the number of expected final daughters. - if constexpr (!checkProcess) { + if constexpr (!acceptIncompleteReco && !checkProcess) { if (particleMother.daughtersIds().back() - particleMother.daughtersIds().front() + 1 > static_cast(N)) { // Printf("MC Rec: Rejected: too many direct daughters: %d (expected %ld final)", particleMother.daughtersIds().back() - particleMother.daughtersIds().front() + 1, N); return -1; @@ -740,7 +765,7 @@ struct RecoDecay { // } // printf("\n"); // Check whether the number of actual final daughters is equal to the number of expected final daughters (i.e. the number of provided prongs). - if (arrAllDaughtersIndex.size() != N) { + if (!acceptIncompleteReco && arrAllDaughtersIndex.size() != N) { // Printf("MC Rec: Rejected: incorrect number of final daughters: %ld (expected %ld)", arrAllDaughtersIndex.size(), N); return -1; } @@ -779,6 +804,14 @@ struct RecoDecay { if (sign) { *sign = sgn; } + if constexpr (acceptTrackDecay) { + if (nPiToMu) { + *nPiToMu = nPiToMuLocal; + } + if (nKaToPi) { + *nKaToPi = nKaToPiLocal; + } + } return indexMother; } 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/Core/TrackSelectorPID.h b/Common/Core/TrackSelectorPID.h index e09969ba946..214627a2d72 100644 --- a/Common/Core/TrackSelectorPID.h +++ b/Common/Core/TrackSelectorPID.h @@ -103,9 +103,10 @@ class TrackSelectorPidBase /// Checks if track is compatible with given particle species hypothesis within given TPC nσ range. /// \param track track /// \param conditionalTof variable to store the result of selection with looser cuts for conditional accepting of track if combined with TOF + /// \param tpcNSigmaCustom custom TPC nσ value to be used for the selection, in case the desired value cannot be taken from the track table /// \return true if track satisfies TPC PID hypothesis for given TPC nσ range template - bool isSelectedByTpc(const T& track, bool& conditionalTof) + bool isSelectedByTpc(const T& track, bool& conditionalTof, float tpcNSigmaCustom = -999.f) { // Accept if selection is disabled via large values. if (mNSigmaTpcMin < -999. && mNSigmaTpcMax > 999.) { @@ -128,6 +129,11 @@ class TrackSelectorPidBase errorPdg(); } + /// use custom TPC nσ, if a valid value is provided + if (tpcNSigmaCustom > -999.f) { + nSigma = tpcNSigmaCustom; + } + if (mNSigmaTpcMinCondTof < -999. && mNSigmaTpcMaxCondTof > 999.) { conditionalTof = true; } else { @@ -140,13 +146,13 @@ class TrackSelectorPidBase /// \param track track /// \return TPC selection status (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTpc(const T& track) + TrackSelectorPID::Status statusTpc(const T& track, float tpcNSigmaCustom = -999.f) { if (!isValidForTpc(track)) { return TrackSelectorPID::NotApplicable; } bool condTof = false; - if (isSelectedByTpc(track, condTof)) { + if (isSelectedByTpc(track, condTof, tpcNSigmaCustom)) { return TrackSelectorPID::Accepted; } else if (condTof) { return TrackSelectorPID::Conditional; // potential to be accepted if combined with TOF @@ -191,9 +197,10 @@ class TrackSelectorPidBase /// Checks if track is compatible with given particle species hypothesis within given TOF nσ range. /// \param track track /// \param conditionalTpc variable to store the result of selection with looser cuts for conditional accepting of track if combined with TPC + /// \param tofNSigmaCustom custom TOF nσ value to be used for the selection, in case the desired value cannot be taken from the track table /// \return true if track satisfies TOF PID hypothesis for given TOF nσ range template - bool isSelectedByTof(const T& track, bool& conditionalTpc) + bool isSelectedByTof(const T& track, bool& conditionalTpc, float tofNSigmaCustom = -999.f) { // Accept if selection is disabled via large values. if (mNSigmaTofMin < -999. && mNSigmaTofMax > 999.) { @@ -216,6 +223,11 @@ class TrackSelectorPidBase errorPdg(); } + /// use custom TOF nσ, if a valid value is provided + if (tofNSigmaCustom > -999.f) { + nSigma = tofNSigmaCustom; + } + if (mNSigmaTofMinCondTpc < -999. && mNSigmaTofMaxCondTpc > 999.) { conditionalTpc = true; } else { @@ -228,13 +240,13 @@ class TrackSelectorPidBase /// \param track track /// \return TOF selection status (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTof(const T& track) + TrackSelectorPID::Status statusTof(const T& track, float tofNSigmaCustom = -999.f) { if (!isValidForTof(track)) { return TrackSelectorPID::NotApplicable; } bool condTpc = false; - if (isSelectedByTof(track, condTpc)) { + if (isSelectedByTof(track, condTpc, tofNSigmaCustom)) { return TrackSelectorPID::Accepted; } else if (condTpc) { return TrackSelectorPID::Conditional; // potential to be accepted if combined with TPC @@ -391,10 +403,10 @@ class TrackSelectorPidBase /// \param track track /// \return status of combined PID (TPC or TOF) (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTpcOrTof(const T& track) + TrackSelectorPID::Status statusTpcOrTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f) { - int pidTpc = statusTpc(track); - int pidTof = statusTof(track); + int pidTpc = statusTpc(track, tpcNSigmaCustom); + int pidTof = statusTof(track, tofNSigmaCustom); if (pidTpc == TrackSelectorPID::Accepted || pidTof == TrackSelectorPID::Accepted) { return TrackSelectorPID::Accepted; @@ -412,15 +424,15 @@ class TrackSelectorPidBase /// \param track track /// \return status of combined PID (TPC and TOF) (see TrackSelectorPID::Status) template - TrackSelectorPID::Status statusTpcAndTof(const T& track) + TrackSelectorPID::Status statusTpcAndTof(const T& track, float tpcNSigmaCustom = -999.f, float tofNSigmaCustom = -999.f) { int pidTpc = TrackSelectorPID::NotApplicable; if (track.hasTPC()) { - pidTpc = statusTpc(track); + pidTpc = statusTpc(track, tpcNSigmaCustom); } int pidTof = TrackSelectorPID::NotApplicable; if (track.hasTOF()) { - pidTof = statusTof(track); + pidTof = statusTof(track, tofNSigmaCustom); } if (pidTpc == TrackSelectorPID::Accepted && pidTof == TrackSelectorPID::Accepted) { diff --git a/Common/DataModel/CMakeLists.txt b/Common/DataModel/CMakeLists.txt index f4428d908c0..39e83d2a2dd 100644 --- a/Common/DataModel/CMakeLists.txt +++ b/Common/DataModel/CMakeLists.txt @@ -21,4 +21,6 @@ o2physics_add_header_only_library(DataModel McCollisionExtra.h Qvectors.h MatchMFTFT0.h - MftmchMatchingML.h) + MftmchMatchingML.h + ZDCInterCalib.h + EseTable.h) diff --git a/Common/DataModel/EseTable.h b/Common/DataModel/EseTable.h new file mode 100644 index 00000000000..ca9bd41357e --- /dev/null +++ b/Common/DataModel/EseTable.h @@ -0,0 +1,49 @@ +// 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. + +// q vector framework with ESE (20/08/2024) +// +/// \author Joachim Hansen +// + +#ifndef COMMON_DATAMODEL_ESETABLE_H_ +#define COMMON_DATAMODEL_ESETABLE_H_ + +#include + +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" + +namespace o2::aod +{ +namespace q_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(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 QPercentileFT0C = QPercentileFT0Cs::iterator; +using QPercentileFT0A = QPercentileFT0As::iterator; +using QPercentileFV0A = QPercentileFV0As::iterator; +using QPercentileTPC = QPercentileTPCs::iterator; +using FEseCol = FEseCols::iterator; + +} // namespace o2::aod + +#endif // COMMON_DATAMODEL_ESETABLE_H_ diff --git a/Common/DataModel/EventSelection.h b/Common/DataModel/EventSelection.h index ea1cce4ebbb..7b7b4ac9ae0 100644 --- a/Common/DataModel/EventSelection.h +++ b/Common/DataModel/EventSelection.h @@ -54,7 +54,9 @@ DECLARE_SOA_INDEX_COLUMN_FULL(FoundFT0, foundFT0, int, FT0s, "_foundFT0"); //! DECLARE_SOA_INDEX_COLUMN_FULL(FoundFV0, foundFV0, int, FV0As, "_foundFV0"); //! FV0 entry index in FV0As table (-1 if doesn't exist) DECLARE_SOA_INDEX_COLUMN_FULL(FoundFDD, foundFDD, int, FDDs, "_foundFDD"); //! FDD entry index in FDDs table (-1 if doesn't exist) DECLARE_SOA_INDEX_COLUMN_FULL(FoundZDC, foundZDC, int, Zdcs, "_foundZDC"); //! ZDC entry index in ZDCs table (-1 if doesn't exist) -DECLARE_SOA_COLUMN(NumTracksInTimeRange, trackOccupancyInTimeRange, int); //! Occupancy in specified time interval +DECLARE_SOA_COLUMN(BcInTF, bcInTF, int); //! Position of a (found) bunch crossing inside a given timeframe +DECLARE_SOA_COLUMN(NumTracksInTimeRange, trackOccupancyInTimeRange, int); //! Occupancy in specified time interval by a number of tracks from nearby collisions +DECLARE_SOA_COLUMN(SumAmpFT0CInTimeRange, ft0cOccupancyInTimeRange, float); //! Occupancy in specified time interval by a sum of FT0C amplitudes from nearby collisions } // namespace evsel // bc-joinable event selection decisions @@ -64,7 +66,18 @@ using BcSel = BcSels::iterator; // collision-joinable event selection decisions DECLARE_SOA_TABLE(EvSels, "AOD", "EVSEL", //! - evsel::Alias, evsel::Selection, evsel::Sel7, evsel::Sel8, evsel::FoundBCId, evsel::FoundFT0Id, evsel::FoundFV0Id, evsel::FoundFDDId, evsel::FoundZDCId, evsel::NumTracksInTimeRange); + evsel::Alias, + evsel::Selection, + evsel::Sel7, + evsel::Sel8, + evsel::FoundBCId, + evsel::FoundFT0Id, + evsel::FoundFV0Id, + evsel::FoundFDDId, + evsel::FoundZDCId, + evsel::BcInTF, + evsel::NumTracksInTimeRange, + evsel::SumAmpFT0CInTimeRange); using EvSel = EvSels::iterator; } // namespace o2::aod diff --git a/Common/DataModel/Multiplicity.h b/Common/DataModel/Multiplicity.h index 19ef25b0591..3583095ee67 100644 --- a/Common/DataModel/Multiplicity.h +++ b/Common/DataModel/Multiplicity.h @@ -110,12 +110,24 @@ using Mults = soa::Join; using FT0Mult = FT0Mults::iterator; using Mult = Mults::iterator; -DECLARE_SOA_TABLE(MultsExtra, "AOD", "MULTEXTRA", //! +DECLARE_SOA_TABLE(MultsExtra_000, "AOD", "MULTEXTRA", //! mult::MultPVTotalContributors, mult::MultPVChi2, mult::MultCollisionTimeRes, mult::MultRunNumber, mult::MultPVz, mult::MultSel8, mult::MultNTracksHasITS, mult::MultNTracksHasTPC, mult::MultNTracksHasTOF, mult::MultNTracksHasTRD, mult::MultNTracksITSOnly, mult::MultNTracksTPCOnly, mult::MultNTracksITSTPC, mult::MultAllTracksTPCOnly, mult::MultAllTracksITSTPC, - evsel::NumTracksInTimeRange); + evsel::NumTracksInTimeRange, + collision::Flags); + +DECLARE_SOA_TABLE_VERSIONED(MultsExtra_001, "AOD", "MULTEXTRA", 1, //! debug information + mult::MultPVTotalContributors, mult::MultPVChi2, mult::MultCollisionTimeRes, mult::MultRunNumber, mult::MultPVz, mult::MultSel8, + mult::MultNTracksHasITS, mult::MultNTracksHasTPC, mult::MultNTracksHasTOF, mult::MultNTracksHasTRD, + mult::MultNTracksITSOnly, mult::MultNTracksTPCOnly, mult::MultNTracksITSTPC, + mult::MultAllTracksTPCOnly, mult::MultAllTracksITSTPC, + evsel::NumTracksInTimeRange, + evsel::SumAmpFT0CInTimeRange, + collision::Flags); + +using MultsExtra = MultsExtra_001; DECLARE_SOA_TABLE(MultNeighs, "AOD", "MULTNEIGH", //! mult::TimeToPrePrevious, mult::TimeToPrevious, @@ -151,7 +163,7 @@ namespace mult DECLARE_SOA_INDEX_COLUMN(MultMCExtra, multMCExtra); } -DECLARE_SOA_TABLE(MC2Mults, "AOD", "MC2MULTS", //! Relate BC -> mult +DECLARE_SOA_TABLE(Mult2MCExtras, "AOD", "Mult2MCEXTRA", //! Relate reco mult entry to MC extras entry o2::soa::Index<>, mult::MultMCExtraId); namespace multZeq @@ -221,7 +233,8 @@ DECLARE_SOA_TABLE(MultBCs, "AOD", "MULTBC", //! multBC::MultBCT0triggerBits, multBC::MultBCFDDtriggerBits, multBC::MultBCTriggerMask, - multBC::MultBCColliding); + multBC::MultBCColliding, + bc::Flags); using MultBC = MultBCs::iterator; // crosslinks diff --git a/Common/DataModel/PIDResponseITS.h b/Common/DataModel/PIDResponseITS.h new file mode 100644 index 00000000000..ab95018c708 --- /dev/null +++ b/Common/DataModel/PIDResponseITS.h @@ -0,0 +1,155 @@ +// 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 +/// \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; + return (mITSRespParams[0] / (std::pow(bg, mITSRespParams[1])) + mITSRespParams[2]) * std::pow(charge, mChargeFactor); + } + + template + static float nSigmaITS(uint32_t itsClusterSizes, float momentum) + { + const float exp = expSignal(momentum); + const float average = averageClusterSize(itsClusterSizes); + const float resolution = mResolution * exp; + return (average - exp) / resolution; + }; + + static void setParameters(float p0, float p1, float p2, float chargeFactor, float resolution) + { + if (mIsInitialized) { + LOG(fatal) << "ITSResponse parameters already initialized"; + } + mIsInitialized = true; + mITSRespParams[0] = p0; + mITSRespParams[1] = p1; + mITSRespParams[2] = p2; + mChargeFactor = chargeFactor; + mResolution = resolution; + } + + private: + static std::array mITSRespParams; + static float mChargeFactor; + static float mResolution; + static bool mIsInitialized; +}; + +std::array ITSResponse::mITSRespParams = {0.903, 2.014, 2.440}; +float ITSResponse::mChargeFactor = 2.299999952316284f; +float ITSResponse::mResolution = 0.15f; +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 { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaMuImp, itsNSigmaMu, //! Nsigma separation with the ITS detector for muons + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPiImp, itsNSigmaPi, //! Nsigma separation with the ITS detector for pions + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaKaImp, itsNSigmaKa, //! Nsigma separation with the ITS detector for kaons + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaPrImp, itsNSigmaPr, //! Nsigma separation with the ITS detector for protons + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaDeImp, itsNSigmaDe, //! Nsigma separation with the ITS detector for deuterons + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaTrImp, itsNSigmaTr, //! Nsigma separation with the ITS detector for tritons + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaHeImp, itsNSigmaHe, //! Nsigma separation with the ITS detector for helium3 + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +DECLARE_SOA_DYNAMIC_COLUMN(ITSNSigmaAlImp, itsNSigmaAl, //! Nsigma separation with the ITS detector for alphas + [](uint32_t itsClusterSizes, float momentum) -> float { + return ITSResponse::nSigmaITS(itsClusterSizes, momentum); + }); + +// 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/DataModel/ZDCInterCalib.h b/Common/DataModel/ZDCInterCalib.h new file mode 100644 index 00000000000..5ab722452af --- /dev/null +++ b/Common/DataModel/ZDCInterCalib.h @@ -0,0 +1,46 @@ +// 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 COMMON_DATAMODEL_ZDCINTERCALIB_H_ +#define COMMON_DATAMODEL_ZDCINTERCALIB_H_ + +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace znoutput +{ +DECLARE_SOA_COLUMN(pmcZNA, ZNAcommonPM, float); //! PMC ZNA +DECLARE_SOA_COLUMN(pm1ZNA, ZNAPM1, float); //! PM1 ZNA +DECLARE_SOA_COLUMN(pm2ZNA, ZNAPM2, float); //! PM2 ZNA +DECLARE_SOA_COLUMN(pm3ZNA, ZNAPM3, float); //! PM3 ZNA +DECLARE_SOA_COLUMN(pm4ZNA, ZNAPM4, float); //! PM4 ZNA +DECLARE_SOA_COLUMN(pmcZNC, ZNCcommonPM, float); //! PMC ZNC +DECLARE_SOA_COLUMN(pm1ZNC, ZNCPM1, float); //! PM1 ZNC +DECLARE_SOA_COLUMN(pm2ZNC, ZNCPM2, float); //! PM2 ZNC +DECLARE_SOA_COLUMN(pm3ZNC, ZNCPM3, float); //! PM3 ZNC +DECLARE_SOA_COLUMN(pm4ZNC, ZNCPM4, float); //! PM4 ZNC + +} // namespace znoutput + +DECLARE_SOA_TABLE(ZDCInterCalib, "AOD", "ZDCIC", o2::soa::Index<>, + znoutput::pmcZNA, + znoutput::pm1ZNA, + znoutput::pm2ZNA, + znoutput::pm3ZNA, + znoutput::pm4ZNA, + znoutput::pmcZNC, + znoutput::pm1ZNC, + znoutput::pm2ZNC, + znoutput::pm3ZNC, + znoutput::pm4ZNC); +} // namespace o2::aod + +#endif // COMMON_DATAMODEL_ZDCINTERCALIB_H_ diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index 399ba4b4fa6..7e9ca8dea40 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -119,3 +119,13 @@ o2physics_add_dpl_workflow(match-mft-ft0 O2::ReconstructionDataFormats O2::DetectorsBase O2::DetectorsCommonDataFormats COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(zdc-task-intercalib + SOURCES zdc-task-intercalib.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(ese-table-producer + SOURCES eseTableProducer.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/Common/TableProducer/Converters/CMakeLists.txt b/Common/TableProducer/Converters/CMakeLists.txt index 989b58bdab8..aedc7257229 100644 --- a/Common/TableProducer/Converters/CMakeLists.txt +++ b/Common/TableProducer/Converters/CMakeLists.txt @@ -49,6 +49,11 @@ o2physics_add_dpl_workflow(bc-converter PUBLIC_LINK_LIBRARIES O2::Framework COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(bc-flags-creator + SOURCES bcFlagsCreator.cxx + PUBLIC_LINK_LIBRARIES O2::Framework + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(calo-label-converter SOURCES caloLabelConverter.cxx PUBLIC_LINK_LIBRARIES @@ -64,3 +69,8 @@ o2physics_add_dpl_workflow(hmpid-converter PUBLIC_LINK_LIBRARIES COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(multsextra-converter + SOURCES multsExtraConverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/Common/TableProducer/Converters/bcFlagsCreator.cxx b/Common/TableProducer/Converters/bcFlagsCreator.cxx new file mode 100644 index 00000000000..972832716b5 --- /dev/null +++ b/Common/TableProducer/Converters/bcFlagsCreator.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" + +using namespace o2; +using namespace o2::framework; + +// Creates an empty BCFlags for data that doesn't have it to be used seamlessly +// n.b. this will overwrite existing BCFlags, to be discussed if data in mixed condition +struct bcFlagsCreator { + Produces bcFlags; + + void process(aod::BCs const& bcTable) + { + for (int64_t i = 0; i < bcTable.size(); ++i) { + bcFlags(0); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/Common/TableProducer/Converters/multsExtraConverter.cxx b/Common/TableProducer/Converters/multsExtraConverter.cxx new file mode 100644 index 00000000000..d62b34508b8 --- /dev/null +++ b/Common/TableProducer/Converters/multsExtraConverter.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. + +#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 MultsExtraConverter { + Produces multsExtra_001; + void process(aod::MultsExtra_000 const& multsExtra_000) + { + for (const auto& r : multsExtra_000) { + multsExtra_001(r.multPVTotalContributors(), r.multPVChi2(), + r.multCollisionTimeRes(), r.multRunNumber(), r.multPVz(), r.multSel8(), + r.multNTracksHasITS(), r.multNTracksHasTPC(), r.multNTracksHasTOF(), + r.multNTracksHasTRD(), r.multNTracksITSOnly(), + r.multNTracksTPCOnly(), r.multNTracksITSTPC(), + r.multAllTracksTPCOnly(), r.multAllTracksITSTPC(), + r.trackOccupancyInTimeRange(), + 0.0f, + r.flags()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + 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..225108528bf --- /dev/null +++ b/Common/TableProducer/PID/pidITS.cxx @@ -0,0 +1,110 @@ +// 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 +/// \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 = 5; +static const std::vector casesNames{"Data", "MC"}; +static const std::vector parameterNames{"bb1", "bb2", "bb3", "Charge exponent", "Resolution"}; +static constexpr float defaultParameters[nCases][nParameters]{{0.903, 2.014, 2.440, 2.299999952316284f, 0.15f}, + {0.903, 2.014, 2.440, 2.299999952316284f, 0.15f}}; + +/// Task to produce the ITS PID information for each particle species +/// The parametrization is: [p0/(bg)**p1 + p2] * pow(q, p3), being bg = p/m and q the charge +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, "bb1"), + itsParams->get(key, "bb2"), + itsParams->get(key, "bb3"), + itsParams->get(key, "Charge exponent"), + itsParams->get(key, "Resolution")); + } + } + + /// 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 68bd490f041..cfd3c566c2b 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -210,9 +210,9 @@ struct TOFCalibConfig { mTimestamp = bc.timestamp(); // Check the beam type - o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(mPathGrpLhcIf, - mTimestamp); if (mCollisionSystem == -1) { + o2::parameters::GRPLHCIFData* grpo = ccdb->template getForTimeStamp(mPathGrpLhcIf, + mTimestamp); mCollisionSystem = CollisionSystemType::getCollisionTypeFromGrp(grpo); } else { LOG(debug) << "Not setting collisions system as already set to " << mCollisionSystem << " " << CollisionSystemType::getCollisionSystemName(mCollisionSystem); @@ -838,11 +838,23 @@ struct tofPidMerge { } if (mEnabledParticlesFull.size() == 0 && mEnabledParticles.size() == 0) { LOG(info) << "No PID tables are required, disabling the task"; - doprocessData.value = false; + doprocessRun3.value = false; + doprocessRun2.value = false; return; - } else if (doprocessData.value == false) { + } else if (doprocessRun3.value == false && doprocessRun2.value == false) { LOG(fatal) << "PID tables are required but process data is disabled. Please enable it"; } + if (doprocessRun3.value == true && doprocessRun2.value == true) { + LOG(fatal) << "Both processRun2 and processRun3 are enabled. Pick one of the two"; + } + if (metadataInfo.isFullyDefined()) { + if (metadataInfo.isRun3() && doprocessRun2) { + LOG(fatal) << "Run2 process function is enabled but the metadata says it is Run3"; + } + if (!metadataInfo.isRun3() && doprocessRun3) { + LOG(fatal) << "Run3 process function is enabled but the metadata says it is Run2"; + } + } mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters // Printing enabled tables and enabling QA histograms if needed @@ -1033,7 +1045,7 @@ struct tofPidMerge { template using ResponseImplementation = o2::pid::tof::ExpTimes; - void processData(Run3TrksWtofWevTime const& tracks, + void processRun3(Run3TrksWtofWevTime const& tracks, Run3Cols const&, aod::BCsWithTimestamps const&) { @@ -1201,7 +1213,179 @@ struct tofPidMerge { } } } - PROCESS_SWITCH(tofPidMerge, processData, "Produce tables. Set to off if the tables are not required", true); + PROCESS_SWITCH(tofPidMerge, processRun3, "Produce tables. Set to off if the tables are not required", true); + + template + using ResponseImplementationRun2 = o2::pid::tof::ExpTimes; + void processRun2(Run2TrksWtofWevTime const& tracks, + Run3Cols const&, + aod::BCsWithTimestamps const&) + { + constexpr auto responseEl = ResponseImplementationRun2(); + constexpr auto responseMu = ResponseImplementationRun2(); + constexpr auto responsePi = ResponseImplementationRun2(); + constexpr auto responseKa = ResponseImplementationRun2(); + constexpr auto responsePr = ResponseImplementationRun2(); + constexpr auto responseDe = ResponseImplementationRun2(); + constexpr auto responseTr = ResponseImplementationRun2(); + 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; + } + + for (auto const& pidId : mEnabledParticles) { + reserveTable(pidId, tracks.size(), false); + } + + for (auto const& pidId : mEnabledParticlesFull) { + reserveTable(pidId, tracks.size(), true); + } + + 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, false); + } + for (auto const& pidId : mEnabledParticlesFull) { + makeTableEmpty(pidId, true); + } + continue; + } + + for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses + switch (pidId) { + case idxEl: { + nsigma = responseEl.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDEl); + break; + } + case idxMu: { + nsigma = responseMu.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDMu); + break; + } + case idxPi: { + nsigma = responsePi.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDPi); + break; + } + case idxKa: { + nsigma = responseKa.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDKa); + break; + } + case idxPr: { + nsigma = responsePr.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDPr); + break; + } + case idxDe: { + nsigma = responseDe.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDDe); + break; + } + case idxTr: { + nsigma = responseTr.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDTr); + break; + } + case idxHe: { + nsigma = responseHe.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDHe); + break; + } + case idxAl: { + nsigma = responseAl.GetSeparation(mRespParamsV3, trk); + aod::pidutils::packInTable(nsigma, tablePIDAl); + break; + } + default: + LOG(fatal) << "Wrong particle ID for standard tables"; + break; + } + if (enableQaHistograms) { + hnsigma[pidId]->Fill(trk.p(), nsigma); + } + } + for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses with full tables + switch (pidId) { + case idxEl: { + resolution = responseEl.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseEl.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullEl(resolution, nsigma); + break; + } + case idxMu: { + resolution = responseMu.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseMu.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullMu(resolution, nsigma); + break; + } + case idxPi: { + resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responsePi.GetSeparation(mRespParamsV3, trk); + tablePIDFullPi(resolution, nsigma); + break; + } + case idxKa: { + resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullKa(resolution, nsigma); + break; + } + case idxPr: { + resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullPr(resolution, nsigma); + break; + } + case idxDe: { + resolution = responseDe.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseDe.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullDe(resolution, nsigma); + break; + } + case idxTr: { + resolution = responseTr.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseTr.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullTr(resolution, nsigma); + break; + } + case idxHe: { + resolution = responseHe.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseHe.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullHe(resolution, nsigma); + break; + } + case idxAl: { + resolution = responseAl.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseAl.GetSeparation(mRespParamsV3, trk, resolution); + tablePIDFullAl(resolution, nsigma); + break; + } + default: + LOG(fatal) << "Wrong particle ID for full tables"; + break; + } + if (enableQaHistograms) { + hnsigmaFull[pidId]->Fill(trk.p(), nsigma); + } + } + } + } + PROCESS_SWITCH(tofPidMerge, processRun2, "Produce tables. Set to off if the tables are not required", false); }; // Part 4 Beta and TOF mass computation diff --git a/Common/TableProducer/centralityTable.cxx b/Common/TableProducer/centralityTable.cxx index 439ed0aad29..6b18bcf6882 100644 --- a/Common/TableProducer/centralityTable.cxx +++ b/Common/TableProducer/centralityTable.cxx @@ -249,18 +249,21 @@ struct CentralityTable { /* check the previous run number */ auto bc = collision.bc_as(); if (bc.runNumber() != mRunNumber) { + mRunNumber = bc.runNumber(); // mark that this run has been attempted already regardless of outcome LOGF(debug, "timestamp=%llu", bc.timestamp()); TList* callst = nullptr; if (ccdbConfig.reconstructionPass.value == "") { - callst = ccdb->getForTimeStamp(ccdbConfig.ccdbPath, bc.timestamp()); + callst = ccdb->getForRun(ccdbConfig.ccdbPath, bc.runNumber()); } else if (ccdbConfig.reconstructionPass.value == "metadata") { std::map metadata; metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); - callst = ccdb->getSpecific(ccdbConfig.ccdbPath, bc.timestamp(), metadata); + LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName")); + callst = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, bc.runNumber(), metadata); } else { std::map metadata; metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value; - callst = ccdb->getSpecific(ccdbConfig.ccdbPath, bc.timestamp(), metadata); + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value); + callst = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, bc.runNumber(), metadata); } Run2V0MInfo.mCalibrationStored = false; @@ -350,15 +353,11 @@ struct CentralityTable { LOGF(fatal, "Calibration information from CL1 multiplicity for run %d corrupted", bc.runNumber()); } } - if (Run2V0MInfo.mCalibrationStored || Run2V0AInfo.mCalibrationStored || Run2SPDTksInfo.mCalibrationStored || Run2SPDClsInfo.mCalibrationStored || Run2CL0Info.mCalibrationStored || Run2CL1Info.mCalibrationStored) { - mRunNumber = bc.runNumber(); - } } else { if (!ccdbConfig.doNotCrashOnNull) { // default behaviour: crash LOGF(fatal, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); } else { // only if asked: continue filling with non-valid values (105) LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp()); - mRunNumber = bc.runNumber(); } } } @@ -473,6 +472,7 @@ struct CentralityTable { /* check the previous run number */ auto bc = collision.template bc_as(); if (bc.runNumber() != mRunNumber) { + mRunNumber = bc.runNumber(); // mark that this run has been attempted already regardless of outcome LOGF(info, "timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber()); TList* callst = nullptr; // Check if the ccdb path is a root file @@ -485,15 +485,17 @@ struct CentralityTable { } } else { if (ccdbConfig.reconstructionPass.value == "") { - callst = ccdb->getForTimeStamp(ccdbConfig.ccdbPath, bc.timestamp()); + callst = ccdb->getForRun(ccdbConfig.ccdbPath, bc.runNumber()); } else if (ccdbConfig.reconstructionPass.value == "metadata") { std::map metadata; metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); - callst = ccdb->getSpecific(ccdbConfig.ccdbPath, bc.timestamp(), metadata); + LOGF(info, "Loading CCDB for reconstruction pass (from metadata): %s", metadataInfo.get("RecoPassName")); + callst = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, bc.runNumber(), metadata); } else { std::map metadata; metadata["RecoPassName"] = ccdbConfig.reconstructionPass.value; - callst = ccdb->getSpecific(ccdbConfig.ccdbPath, bc.timestamp(), metadata); + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value); + callst = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, bc.runNumber(), metadata); } } @@ -555,13 +557,11 @@ struct CentralityTable { break; } } - mRunNumber = bc.runNumber(); } else { if (!ccdbConfig.doNotCrashOnNull) { // default behaviour: crash LOGF(fatal, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp()); } else { // only if asked: continue filling with non-valid values (105) LOGF(info, "Centrality calibration is not available in CCDB for run=%d at timestamp=%llu, will fill tables with dummy values", bc.runNumber(), bc.timestamp()); - mRunNumber = bc.runNumber(); } } } diff --git a/Common/TableProducer/eseTableProducer.cxx b/Common/TableProducer/eseTableProducer.cxx new file mode 100644 index 00000000000..34f534dc700 --- /dev/null +++ b/Common/TableProducer/eseTableProducer.cxx @@ -0,0 +1,236 @@ +// 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 eseTableProducer.cxx +/// \brief Producer for the ESE table +/// +/// \author Joachim C. K. B. Hansen + +#include + +#include +#include +#include +#include +#include + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/runDataProcessing.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/Core/TrackSelection.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/Centrality.h" + +#include "Common/DataModel/EseTable.h" +#include "Common/DataModel/Qvectors.h" +#include "FFitWeights.h" + +using namespace o2; +using namespace o2::framework; + +using CollWithMults = soa::Join; + +struct EseTableProducer { + Produces qPercsFT0C; + Produces qPercsFT0A; + Produces qPercsFV0A; + Produces qPercsTPC; + Produces fEseCol; + + OutputObj FFitObj{FFitWeights("weights")}; + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + 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> cfgaxisqn{"cfgaxisqn", {500, 0, 25}, "q_n amplitude range"}; + Configurable cfgnResolution{"cfgnResolution", 3000, "resolution of splines"}; + + int runNumber{-1}; + + FFitWeights* splines{nullptr}; + + Service ccdb; + + void init(o2::framework::InitContext&) + { + + LOGF(info, "ESETable::init()"); + + 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); + ccdb->setLocalObjectValidityChecking(); + + 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) + { + + auto timestamp = bc.timestamp(); + + if (cfgESE) { + splines = ccdb->getForTimeStamp(cfgEsePath, timestamp); + if (!splines) + LOGF(fatal, "failed loading splines with ese flag"); + LOGF(info, "successfully loaded splines"); + } + } + + float Calcqn(const float& Qx, const float& Qy, const float& Mult) + { + float dqn{0.0f}; + float qn{0.0f}; + + dqn = Qx * Qx + Qy * Qy; + qn = TMath::Sqrt(dqn) / TMath::Sqrt(Mult); + return qn; + } + + bool validQvec(const float& qVec) + { + if (qVec == 999. || qVec == -999) { + return false; + } else { + return true; + } + }; + + void doSpline(float& splineVal, int& eseval, const float& centr, const float& nHarm, const char* pf, const auto& QX, const auto& QY, const auto& Ampl) + { + 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; + } + } + } + + template + void calculateESE(T const& collision, + std::vector& qnpFT0C, + std::vector& qnpFT0A, + std::vector& qnpFV0A, + std::vector& qnpTPC, + std::vector& fIsEseAvailable) + { + + 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); + } + 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); + } + 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); + } + qnpFV0A.push_back(splineValFV0A); + } + }; + + 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 fIsEseAvailable{}; + + auto bc = collision.bc_as(); + int currentRun = bc.runNumber(); + if (runNumber != currentRun) { + runNumber = currentRun; + initCCDB(bc); + } + registry.fill(HIST("hEventCounter"), counter++); + calculateESE(collision, qnpFT0C, qnpFT0A, qnpFV0A, qnpTPC, fIsEseAvailable); + + qPercsFT0C(qnpFT0C); + qPercsFT0A(qnpFT0A); + qPercsFV0A(qnpFV0A); + qPercsTPC(qnpTPC); + fEseCol(fIsEseAvailable); + registry.fill(HIST("hEventCounter"), counter++); + } + 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 0801ee29a39..ff55f0e4299 100644 --- a/Common/TableProducer/eventSelection.cxx +++ b/Common/TableProducer/eventSelection.cxx @@ -24,6 +24,7 @@ #include "DataFormatsParameters/GRPECSObject.h" #include "ITSMFTBase/DPLAlpideParam.h" #include "MetadataHelper.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" #include "TH1D.h" @@ -36,8 +37,10 @@ MetadataHelper metadataInfo; // Metadata helper using BCsWithRun2InfosTimestampsAndMatches = soa::Join; using BCsWithRun3Matchings = soa::Join; using BCsWithBcSelsRun2 = soa::Join; -using BCsWithBcSelsRun3 = soa::Join; +using BCsWithBcSelsRun3 = soa::Join; +using FullTracks = soa::Join; using FullTracksIU = soa::Join; +const double bcNS = o2::constants::lhc::LHCBunchSpacingNS; struct BcSelectionTask { Produces bcsel; @@ -259,24 +262,12 @@ struct BcSelectionTask { mITSROFrameEndBorderMargin = confITSROFrameEndBorderMargin < 0 ? par->fITSROFrameEndBorderMargin : confITSROFrameEndBorderMargin; mTimeFrameStartBorderMargin = confTimeFrameStartBorderMargin < 0 ? par->fTimeFrameStartBorderMargin : confTimeFrameStartBorderMargin; mTimeFrameEndBorderMargin = confTimeFrameEndBorderMargin < 0 ? par->fTimeFrameEndBorderMargin : confTimeFrameEndBorderMargin; - // 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", run); - auto grpecs = ccdb->getSpecific("GLO/Config/GRPECS", ts, metadata); - uint32_t nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023 - int64_t tsSOR = grpecs->getTimeStart(); // ms - // calculate SOR orbit - int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; - // adjust to the nearest TF edge - orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; - // first bc of the first orbit (should coincide with TF start) - bcSOR = orbitSOR * o2::constants::lhc::LHCMaxBunches; + + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + // 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, orbitSOR = {}, nBCsPerTF = {}", tsOrbitReset, tsSOR, orbitSOR, nBCsPerTF); + nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches; } } @@ -352,8 +343,7 @@ struct BcSelectionTask { selection |= !(fabs(timeZNC) > par->fZNCBGlower && fabs(timeZNC) < par->fZNCBGupper) ? BIT(kNoBGZNC) : 0; selection |= (bc.has_ft0() ? (bc.ft0().triggerMask() & BIT(o2::ft0::Triggers::bitVertex)) > 0 : 0) ? BIT(kIsTriggerTVX) : 0; - // check if bc is far (at least confITSROFrameBorderMargin) from the end of ITS RO Frame border - // 2bc margin is also introduced at ehe beginning of ITS RO Frame to account for the uncertainty of the roFrameBiasInBC + // check if bc is far from start and end of the ITS RO Frame border uint16_t bcInITSROF = (globalBC + 3564 - alppar->roFrameBiasInBC) % alppar->roFrameLengthInBC; LOGP(debug, "bcInITSROF={}", bcInITSROF); selection |= bcInITSROF > mITSROFrameStartBorderMargin && bcInITSROF < alppar->roFrameLengthInBC - mITSROFrameEndBorderMargin ? BIT(kNoITSROFrameBorder) : 0; @@ -443,20 +433,26 @@ struct BcSelectionTask { struct EventSelectionTask { SliceCache cache; Produces evsel; - Configurable syst{"syst", "PbPb", "pp, pPb, Pbp, PbPb, XeXe"}; // TODO determine from AOD metadata or from CCDB 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"}; - Configurable> confTimeBinsForOccupancyCalculation{"TimeBinsForOccupancyCalculation", {-40, -20, 0, 25, 50, 75, 100}, "Time bins for occupancy calculation and corresponding cuts (us)"}; - Configurable> confReferenceOccupanciesInTimeBins{"ReferenceOccupanciesInTimeBins", {3000, 1400, 750, 1000, 1750, 4000}, "Occupancy cuts in time bins (n tracks)"}; - Configurable confTimeRangeVetoOnCollStandard{"TimeRangeVetoOnCollStandard", 10, "Exclusion of a collision if there are other collisions nearby, +/- us"}; - Configurable confTimeRangeVetoOnCollNarrow{"TimeRangeVetoOnCollNarrow", 4, "Exclusion of a collision if there are other collisions nearby, +/- us"}; + Configurable confTimeRangeVetoOnCollStandard{"TimeRangeVetoOnCollStandard", 10.0, "Exclusion of a collision if there are other collisions nearby, +/- us"}; + Configurable confTimeRangeVetoOnCollNarrow{"TimeRangeVetoOnCollNarrow", 2.0, "Exclusion of a collision if there are other collisions nearby, +/- us"}; + Configurable confFT0CamplCutVetoOnCollInTimeRange{"FT0CamplPerCollCutVetoOnCollInTimeRange", 8000, "Max allowed FT0C amplitude for each nearby collision in +/- time range"}; + Configurable confEpsilonDistanceForVzDependentVetoTPC{"EpsilonDistanceForVzDependentVetoTPC", 2.5, "Epsilon for vZ-dependent veto on drifting TPC tracks from nearby collisions, cm"}; + Configurable confFT0CamplCutVetoOnCollInROF{"FT0CamplPerCollCutVetoOnCollInROF", 5000, "Max allowed FT0C amplitude for each nearby collision inside this ITS ROF"}; + Configurable confEpsilonVzDiffVetoInROF{"EpsilonVzDiffVetoInROF", 0.3, "Minumum distance to nearby collisions along z inside this ITS ROF, cm"}; Configurable confUseWeightsForOccupancyVariable{"UseWeightsForOccupancyEstimator", 1, "Use or not the delta-time weights for the occupancy estimator"}; - Partition tracklets = (aod::track::trackType == static_cast(o2::aod::track::TrackTypeEnum::Run2Tracklet)); + Partition tracklets = (aod::track::trackType == static_cast(o2::aod::track::TrackTypeEnum::Run2Tracklet)); + + Preslice perCollision = aod::track::collisionId; + Preslice perCollisionIU = aod::track::collisionId; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -466,6 +462,8 @@ struct EventSelectionTask { 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) { @@ -481,6 +479,44 @@ struct EventSelectionTask { 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) + { + // protection against + if (sigmaBC < 1) + sigmaBC = 1; + + 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(static_cast(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) @@ -502,7 +538,6 @@ struct EventSelectionTask { } } - // ccdb->setURL("http://ccdb-test.cern.ch:8080"); ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -510,7 +545,6 @@ struct EventSelectionTask { histos.add("hColCounterAll", "", kTH1D, {{1, 0., 1.}}); histos.add("hColCounterTVX", "", kTH1D, {{1, 0., 1.}}); histos.add("hColCounterAcc", "", kTH1D, {{1, 0., 1.}}); - // histos.add("hOccupancy", "", kTH1D, {{200, 0., 10000}}); } void process(aod::Collisions const& collisions) @@ -518,7 +552,7 @@ struct EventSelectionTask { evsel.reserve(collisions.size()); } - void processRun2(aod::Collision const& col, BCsWithBcSelsRun2 const&, aod::Tracks const&, aod::FV0Cs const&) + void processRun2(aod::Collision const& col, BCsWithBcSelsRun2 const&, FullTracks const&, aod::FV0Cs const&) { auto bc = col.bc_as(); EventSelectionParams* par = ccdb->getForTimeStamp("EventSelection/EventSelectionParams", bc.timestamp()); @@ -586,62 +620,52 @@ struct EventSelectionTask { } } - evsel(alias, selection, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, 0); + evsel(alias, selection, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, 0, 0, 0); } PROCESS_SWITCH(EventSelectionTask, processRun2, "Process Run2 event selection", true); - Preslice perCollision = aod::track::collisionId; - void processRun3(aod::Collisions const& cols, FullTracksIU const& tracks, BCsWithBcSelsRun3 const& bcs, aod::FT0s const&) + Partition pvTracks = ((aod::track::flags & (uint32_t)o2::aod::track::PVContributor) == (uint32_t)o2::aod::track::PVContributor); + void processRun3(aod::Collisions const& cols, FullTracksIU const&, BCsWithBcSelsRun3 const& bcs, aod::FT0s const&) { int run = bcs.iteratorAt(0).runNumber(); // extract bc pattern from CCDB for data or anchored MC only if (run != lastRun && run >= 500000) { lastRun = run; + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + // first bc of the first orbit + 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(); - // - 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 timestamp from ECS GRP - std::map metadata; - metadata["runNumber"] = Form("%d", run); - auto grpecs = ccdb->getSpecific("GLO/Config/GRPECS", ts, metadata); - uint32_t nOrbitsPerTF = grpecs->getNHBFPerTF(); // assuming 1 orbit = 1 HBF; nOrbitsPerTF=128 in 2022, 32 in 2023 - int64_t tsSOR = grpecs->getTimeStart(); // ms - // calculate SOR orbit - int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; - // adjust to the nearest TF edge - orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF + par->fTimeFrameOrbitShift; - // 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; + // extract ITS ROF parameters + auto alppar = ccdb->getForTimeStamp>("ITS/Config/AlpideParam", ts); + rofOffset = alppar->roFrameBiasInBC; + rofLength = alppar->roFrameLengthInBC; + LOGP(debug, "ITS ROF Offset={} ITS ROF Length={}", rofOffset, rofLength); } - // create maps from globalBC to bc index for TVX or FT0-OR fired bcs - // to be used for closest TVX (FT0-OR) searches + // create maps from globalBC to bc index for TVX-fired bcs + // to be used for closest TVX searches std::map mapGlobalBcWithTVX; - std::map mapGlobalBcWithTOR; + 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(kIsBBT0A) || bc.selection_bit(kIsBBT0C)) { - mapGlobalBcWithTOR[globalBC] = bc.globalIndex(); - } if (bc.selection_bit(kIsTriggerTVX)) { mapGlobalBcWithTVX[globalBC] = bc.globalIndex(); + mapGlobalBcVtxZ[globalBC] = bc.has_ft0() ? bc.ft0().posZ() : 0; } } // protection against empty FT0 maps - if (mapGlobalBcWithTOR.size() == 0 || mapGlobalBcWithTVX.size() == 0) { + if (mapGlobalBcWithTVX.size() == 0) { LOGP(error, "FT0 table is empty or corrupted. Filling evsel table with dummy values"); for (auto& col : cols) { auto bc = col.bc_as(); @@ -650,114 +674,212 @@ struct EventSelectionTask { int32_t foundFV0 = bc.foundFV0Id(); int32_t foundFDD = bc.foundFDDId(); int32_t foundZDC = bc.foundZDCId(); - evsel(bc.alias_raw(), bc.selection_raw(), kFALSE, kFALSE, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, -1); + int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; + evsel(bc.alias_raw(), bc.selection_raw(), kFALSE, kFALSE, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF, -1, -1); } return; } - - std::vector vFoundBCindex(cols.size(), -1); // indices of found bcs - std::vector vIsVertexITSTPC(cols.size(), 0); // at least one of vertex contributors is ITS-TPC track - 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 - - // for the occupancy study - std::vector vFoundGlobalBC(cols.size(), 0); // global BCs for collisions - std::vector vTracksITS567perColl(cols.size(), 0); // counter of tracks per found bc for occupancy studies + std::vector vTracksITS567perColl(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 - // const double timeWinOccupancyExclusionRangeNS = confExclusionIntervalForOccupancyCalculation * 1e3; // ns - const double bcNS = o2::constants::lhc::LHCBunchSpacingNS; - - // loop to find nearest bc with FT0 entry -> foundBC index + std::vector vIsVertexITSTPC(cols.size(), 0); // at least one of vertex contributors is ITS-TPC track + 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 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); + + // temporary vectors to find tracks with median time + std::vector vTrackTimesTOF; + std::vector vTrackTimesTRDnoTOF; + + // first loop to match collisions to TVX, also extract other per-collision information for further use for (auto& col : cols) { + int32_t colIndex = col.globalIndex(); auto bc = col.bc_as(); - int64_t meanBC = bc.globalBC(); - const double bcNS = o2::constants::lhc::LHCBunchSpacingNS; - int64_t deltaBC = std::ceil(col.collisionTimeRes() / bcNS * 4); - - // count tracks of different types - int nITS567cls = 0; - int nITSTPCtracks = 0; - int nTOFtracks = 0; - int nTRDtracks = 0; - double timeFromTOFtracks = 0; - auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex()); - for (auto& track : tracksGrouped) { - if (!track.isPVContributor()) { - continue; - } - nITSTPCtracks += track.hasITS() && track.hasTPC(); - nTOFtracks += track.hasTOF(); - nTRDtracks += track.hasTRD(); - // calculate average time using TOF tracks - if (track.hasTOF()) { - timeFromTOFtracks += track.trackTime(); - } + vCollVz[colIndex] = col.posZ(); + + int64_t globalBC = bc.globalBC(); + int 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); + 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) - nITS567cls++; + vTracksITS567perColl[colIndex]++; + 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++; + } + } } - LOGP(debug, "nContrib={} nITSTPCtracks={} nTOFtracks={} nTRDtracks={}", col.numContrib(), nITSTPCtracks, nTOFtracks, nTRDtracks); - - if (nTOFtracks > 0) { - meanBC += TMath::FloorNint(timeFromTOFtracks / nTOFtracks / bcNS); // assign collision bc using TOF-matched tracks - deltaBC = 4; // use precise bc from TOF tracks with +/-4 bc margin - } else if (nITSTPCtracks > 0) { - deltaBC += 30; // extend deltaBC for collisions built with ITS-TPC tracks only + 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; + } + } 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; + } + } 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]; + } } - int64_t minBC = meanBC - deltaBC; - int64_t maxBC = meanBC + deltaBC; + // 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; - int32_t indexClosestTVX = findClosest(meanBC, mapGlobalBcWithTVX); - int64_t tvxBC = bcs.iteratorAt(indexClosestTVX).globalBC(); - if (tvxBC >= minBC && tvxBC <= maxBC) { // closest TVX within search region - bc.setCursor(indexClosestTVX); - } else { // no TVX within search region, searching for TOR = T0A | T0C - int32_t indexClosestTOR = findClosest(meanBC, mapGlobalBcWithTOR); - int64_t torBC = bcs.iteratorAt(indexClosestTOR).globalBC(); - if (torBC >= minBC && torBC <= maxBC) { - bc.setCursor(indexClosestTOR); - } - } - int32_t foundBC = bc.globalIndex(); + // 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); + } + + // second loop to match remaining low-pt TPCnoTOFnoTRD collisions + for (auto& col : cols) { int32_t colIndex = col.globalIndex(); - LOGP(debug, "foundBC = {} globalBC = {}", foundBC, bc.globalBC()); - vFoundBCindex[colIndex] = foundBC; - vIsVertexITSTPC[colIndex] = nITSTPCtracks > 0; - vIsVertexTOFmatched[colIndex] = nTOFtracks > 0; - vIsVertexTRDmatched[colIndex] = nTRDtracks > 0; - vCollisionsPerBc[foundBC]++; - vTracksITS567perColl[colIndex] = nITS567cls; - vFoundGlobalBC[colIndex] = bc.globalBC(); - - // check that this collision has full information inside the time window (taking into account TF borders) - int64_t bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; - vIsFullInfoForOccupancy[colIndex] = ((bcInTF - 300) * bcNS > -timeWinOccupancyCalcMinNS) && ((nBCsPerTF - 4000 - bcInTF) * bcNS > timeWinOccupancyCalcMaxNS) ? true : false; + 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 sigmaBC = TMath::CeilNint(weightedSigma / bcNS); + int64_t bestGlobalBC = findBestGlobalBC(meanBC, sigmaBC, vNcontributors[colIndex], col.posZ(), mapGlobalBcVtxZ); + vFoundGlobalBC[colIndex] = bestGlobalBC > 0 ? bestGlobalBC : globalBC; + vFoundBCindex[colIndex] = bestGlobalBC > 0 ? mapGlobalBcWithTVX[bestGlobalBC] : bc.globalIndex(); + } + // fill pileup counter + vCollisionsPerBc[vFoundBCindex[colIndex]]++; } - // save indices of collisions in time range for occupancy calculation + // save indices of collisions for occupancy calculation (both in ROF and in time range) std::vector> vCollsInTimeWin; + std::vector> vCollsInSameITSROF; std::vector> vTimeDeltaForColls; // delta time wrt a given collision for (auto& col : cols) { 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(); + + int64_t TFid = (foundGlobalBC - bcSOR) / nBCsPerTF; + int64_t rofId = (foundGlobalBC + 3564 - rofOffset) / rofLength; + + // ### for in-ROF occupancy + std::vector vAssocToSameROF; + // find all collisions in the same ROF before a given collision + int32_t 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; + // int thisRofIdInTF = (thisBC - rofOffset) / rofLength; + int64_t thisRofId = (thisBC + 3564 - rofOffset) / rofLength; + + // check if we are within the same ROF + if (thisRofId != rofId) + break; + vAssocToSameROF.push_back(minColIndex); + minColIndex--; + } + // find all collisions in the same ROF after the current one + int32_t maxColIndex = colIndex + 1; + while (maxColIndex < cols.size()) { + int64_t thisBC = vFoundGlobalBC[maxColIndex]; + 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); + maxColIndex++; + } + vCollsInSameITSROF.push_back(vAssocToSameROF); + + // ### for occupancy in time windows std::vector vAssocToThisCol; std::vector vCollsTimeDeltaWrtGivenColl; - // protection against the TF borders if (!vIsFullInfoForOccupancy[colIndex]) { vCollsInTimeWin.push_back(vAssocToThisCol); vTimeDeltaForColls.push_back(vCollsTimeDeltaWrtGivenColl); continue; } - - int64_t foundGlobalBC = vFoundGlobalBC[colIndex]; - int64_t TFid = (foundGlobalBC - bcSOR) / nBCsPerTF; - - // find all collisions in time window before the current one (start with the current collision) - int32_t minColIndex = colIndex; + // find all collisions in time window before the current one + minColIndex = colIndex - 1; while (minColIndex >= 0) { int64_t thisBC = vFoundGlobalBC[minColIndex]; // check if this is still the same TF @@ -765,7 +887,6 @@ struct EventSelectionTask { if (thisTFid != TFid) break; float dt = (thisBC - foundGlobalBC) * bcNS; // ns - // check if we are within the chosen time range if (dt < timeWinOccupancyCalcMinNS) break; @@ -774,7 +895,7 @@ struct EventSelectionTask { minColIndex--; } // find all collisions in time window after the current one - int32_t maxColIndex = colIndex + 1; + maxColIndex = colIndex + 1; while (maxColIndex < cols.size()) { int64_t thisBC = vFoundGlobalBC[maxColIndex]; int64_t thisTFid = (thisBC - bcSOR) / nBCsPerTF; @@ -791,83 +912,118 @@ struct EventSelectionTask { vTimeDeltaForColls.push_back(vCollsTimeDeltaWrtGivenColl); } - // perform the occupancy calculation in the pre-defined time window - std::vector vNumTracksITS567inFullTimeWin(cols.size(), 0); // counter of tracks in full time window for occupancy studies - std::vector vNoOccupAggressiveCuts(cols.size(), 0); // no occupancy according to the agressive cuts - std::vector vNoOccupStrictCuts(cols.size(), 0); // no occupancy according to the strict cuts - std::vector vNoOccupMediumCuts(cols.size(), 0); // no occupancy according to the medium cuts - std::vector vNoOccupRelaxedCuts(cols.size(), 0); // no occupancy according to the relaxed cuts - std::vector vNoOccupGentleCuts(cols.size(), 0); // no occupancy according to the gentle cuts - std::vector vNoCollInTimeRangeStandard(cols.size(), 0); // no collisions in a specified time range - std::vector vNoCollInTimeRangeNarrow(cols.size(), 0); // no collisions in a specified time range + // perform the occupancy calculation per ITS ROF and also in the pre-defined time window + std::vector vNumTracksITS567inFullTimeWin(cols.size(), 0); // counter of tracks in full time window for occupancy studies (excluding given event) + std::vector vSumAmpFT0CinFullTimeWin(cols.size(), 0); // sum of FT0C of tracks in full time window for occupancy studies (excluding given event) + + std::vector vNoCollInTimeRangeStrict(cols.size(), 0); // no collisions in a specified time range + std::vector vNoCollInTimeRangeNarrow(cols.size(), 0); // no collisions in a specified time range (narrow) + std::vector vNoHighMultCollInTimeRange(cols.size(), 0); // no high-mult collisions in a specified time range + std::vector vNoCollInVzDependentTimeRange(cols.size(), 0); // no collisions in a vZ-dependent time range - // time ranges for occupancy calculation - const int nTimeIntervals = 6; - const float coeffOccupInTimeBins[] = {0.2, 0.4, 0.6, 1.}; + 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 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 + 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]; + if (vAmpFT0CperColl[thisColIndex] > confFT0CamplCutVetoOnCollInROF) + nCollsInRofWithFT0CAboveVetoStandard++; + if (fabs(vCollVz[thisColIndex] - vZ) < confEpsilonVzDiffVetoInROF) + nITS567tracksForRofVetoOnCloseVz += vTracksITS567perColl[thisColIndex]; + } + // in-ROF occupancy flags + vNoCollInSameRofStrict[colIndex] = (nITS567tracksForRofVetoStrict == 0); + vNoCollInSameRofStandard[colIndex] = (nCollsInRofWithFT0CAboveVetoStandard == 0); + vNoCollInSameRofWithCloseVz[colIndex] = (nITS567tracksForRofVetoOnCloseVz == 0); + + // ### occupancy in time windows // protection against TF borders - if (!vIsFullInfoForOccupancy[colIndex]) { - vNumTracksITS567inFullTimeWin[colIndex] = -1; // occupancy in undefined (too close to TF borders) + if (!vIsFullInfoForOccupancy[colIndex]) { // occupancy in undefined (too close to TF borders) + vNumTracksITS567inFullTimeWin[colIndex] = -1; + vSumAmpFT0CinFullTimeWin[colIndex] = -1; continue; } std::vector vAssocToThisCol = vCollsInTimeWin[colIndex]; std::vector vCollsTimeDeltaWrtGivenColl = vTimeDeltaForColls[colIndex]; int nITS567tracksInFullTimeWindow = 0; - int nITS567tracksInTimeBins[nTimeIntervals] = {}; - int nITS567tracksForVetoStandard = 0; // to veto events with nearby collisions - int nITS567tracksForVetoNarrow = 0; // to veto events with nearby collisions (narrower range) - for (int iCol = 0; iCol < vAssocToThisCol.size(); iCol++) { + float sumAmpFT0CInFullTimeWindow = 0; + int nITS567tracksForVetoNarrow = 0; // to veto events with nearby collisions (narrower range) + int nITS567tracksForVetoStrict = 0; // to veto events with nearby collisions + int nCollsWithFT0CAboveVetoStandard = 0; // to veto events with per-collision multiplicity above threshold + int nITS567tracksForVetoVzDependent = 0; // to veto events with nearby collisions, vZ-dependent time cut + for (uint32_t iCol = 0; iCol < vAssocToThisCol.size(); iCol++) { int thisColIndex = vAssocToThisCol[iCol]; - if (thisColIndex == colIndex) // skip the same collision - continue; float dt = vCollsTimeDeltaWrtGivenColl[iCol] / 1e3; // ns -> us - - if (!confUseWeightsForOccupancyVariable) { - nITS567tracksInFullTimeWindow += vTracksITS567perColl[thisColIndex]; - } else { + float wOccup = 1.; + if (confUseWeightsForOccupancyVariable) { // weighted occupancy - float wOccup = 0; + wOccup = 0; if (dt >= -40 && dt < -5) // collisions in the past wOccup = 1. / 1225 * (dt + 40) * (dt + 40); else if (dt >= -5 && dt < 15) // collisions near a given one wOccup = 1; - else if (dt >= 15 && dt < 100) // collisions from the future - wOccup = -1. / 85 * dt + 20. / 17; - if (wOccup > 0) - nITS567tracksInFullTimeWindow += wOccup * vTracksITS567perColl[thisColIndex]; + // else if (dt >= 15 && dt < 100) // collisions from the future + // wOccup = -1. / 85 * dt + 20. / 17; + else if (dt >= 15 && dt < 40) // collisions from the future + wOccup = -0.4 / 25 * dt + 1.24; + else if (dt >= 40 && dt < 100) // collisions from the distant future + wOccup = -0.4 / 60 * dt + 0.6 + 0.8 / 3; } - - for (int iTime = 0; iTime < nTimeIntervals; iTime++) { - if (confTimeBinsForOccupancyCalculation->at(iTime) < dt && dt <= confTimeBinsForOccupancyCalculation->at(iTime + 1)) - nITS567tracksInTimeBins[iTime] += vTracksITS567perColl[thisColIndex]; - if (fabs(dt) < confTimeRangeVetoOnCollStandard) - nITS567tracksForVetoStandard += vTracksITS567perColl[thisColIndex]; - if (fabs(dt) < confTimeRangeVetoOnCollNarrow) - nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; + nITS567tracksInFullTimeWindow += wOccup * vTracksITS567perColl[thisColIndex]; + sumAmpFT0CInFullTimeWindow += wOccup * vAmpFT0CperColl[thisColIndex]; + + // counting tracks from other collisions in fixed time windows + if (fabs(dt) < confTimeRangeVetoOnCollNarrow) + nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; + if (fabs(dt) < confTimeRangeVetoOnCollStandard) + nITS567tracksForVetoStrict += vTracksITS567perColl[thisColIndex]; + + // standard cut on other collisions vs delta-times + const float driftV = 2.5; // drift velocity in cm/us, TPC drift_length / drift_time = 250 cm / 100 us + if (fabs(dt) < 2.0) { // us, complete veto on other collisions + nCollsWithFT0CAboveVetoStandard++; + } else if (dt > -4.0 && dt <= -2.0) { // us, strict veto to suppress fake ITS-TPC matches more + if (vAmpFT0CperColl[thisColIndex] > confFT0CamplCutVetoOnCollInTimeRange / 5) + nCollsWithFT0CAboveVetoStandard++; + } else if (fabs(dt) < 8 + fabs(vZ) / driftV) { // loose veto, 8 us corresponds to maximum possible |vZ|, which is ~20 cm + // counting number of other collisions with multiplicity above threshold + if (vAmpFT0CperColl[thisColIndex] > confFT0CamplCutVetoOnCollInTimeRange) + nCollsWithFT0CAboveVetoStandard++; } - } - vNumTracksITS567inFullTimeWin[colIndex] = nITS567tracksInFullTimeWindow; // occupancy (without a current collision) - // decisions based on occupancies in time bins - bool decisions[4]; - for (int iCut = 0; iCut < 4; iCut++) { - decisions[iCut] = true; - for (int iTime = 0; iTime < nTimeIntervals; iTime++) { - if (nITS567tracksInTimeBins[iTime] >= coeffOccupInTimeBins[iCut] * confReferenceOccupanciesInTimeBins->at(iTime)) { - decisions[iCut] = false; - break; + // vZ-dependent time cut to avoid collinear tracks from other collisions (experimental) + if (fabs(dt) < 8 + fabs(vZ) / driftV) { + if (dt < 0) { + // check distance between given vZ and (moving in two directions) vZ of drifting tracks from past collisions + if ((fabs(vCollVz[thisColIndex] - fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC) || + (fabs(vCollVz[thisColIndex] + fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC)) + nITS567tracksForVetoVzDependent += vTracksITS567perColl[thisColIndex]; + } else { // dt>0 + // check distance between drifted vZ of given collision (in two directions) and vZ of future collisions + if ((fabs(vZ - dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC) || + (fabs(vZ + dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC)) + nITS567tracksForVetoVzDependent += vTracksITS567perColl[thisColIndex]; } } } - vNoOccupStrictCuts[colIndex] = decisions[0]; - vNoOccupMediumCuts[colIndex] = decisions[1]; - vNoOccupRelaxedCuts[colIndex] = decisions[2]; - vNoOccupGentleCuts[colIndex] = decisions[3]; - vNoOccupAggressiveCuts[colIndex] = ((nITS567tracksInTimeBins[0] < 300) && (nITS567tracksInTimeBins[1] == 0) && (nITS567tracksInTimeBins[2] == 0) && (nITS567tracksInTimeBins[3] == 0) && (nITS567tracksInTimeBins[4] < 200) && (nITS567tracksInTimeBins[5] < 400)); - vNoCollInTimeRangeStandard[colIndex] = (nITS567tracksForVetoStandard == 0); + vNumTracksITS567inFullTimeWin[colIndex] = nITS567tracksInFullTimeWindow; // occupancy by a sum of number of ITS tracks (without a current collision) + vSumAmpFT0CinFullTimeWin[colIndex] = sumAmpFT0CInFullTimeWindow; // occupancy by a sum of FT0C amplitudes (without a current collision) + // occupancy flags based on nearby collisions vNoCollInTimeRangeNarrow[colIndex] = (nITS567tracksForVetoNarrow == 0); + vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0); + vNoHighMultCollInTimeRange[colIndex] = (nCollsWithFT0CAboveVetoStandard == 0); + vNoCollInVzDependentTimeRange[colIndex] = (nITS567tracksForVetoVzDependent == 0); // experimental } for (auto& col : cols) { @@ -893,14 +1049,15 @@ struct EventSelectionTask { selection |= vIsVertexTRDmatched[colIndex] ? BIT(kIsVertexTRDmatched) : 0; selection |= isGoodZvtxFT0vsPV ? BIT(kIsGoodZvtxFT0vsPV) : 0; - // selection bits based on occupancy pattern - selection |= vNoOccupAggressiveCuts[colIndex] ? BIT(kNoHighOccupancyAgressive) : 0; - selection |= vNoOccupStrictCuts[colIndex] && vNoCollInTimeRangeStandard[colIndex] ? BIT(kNoHighOccupancyStrict) : 0; - selection |= vNoOccupMediumCuts[colIndex] && vNoCollInTimeRangeStandard[colIndex] ? BIT(kNoHighOccupancyMedium) : 0; - selection |= vNoOccupRelaxedCuts[colIndex] && vNoCollInTimeRangeStandard[colIndex] ? BIT(kNoHighOccupancyRelaxed) : 0; - selection |= vNoOccupGentleCuts[colIndex] && vNoCollInTimeRangeNarrow[colIndex] ? BIT(kNoHighOccupancyGentle) : 0; - selection |= vNoCollInTimeRangeStandard[colIndex] ? BIT(kNoCollInTimeRangeStandard) : 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 bits based on ITS in-ROF occupancy + selection |= vNoCollInSameRofStrict[colIndex] ? BIT(kNoCollInRofStrict) : 0; + selection |= (vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) ? BIT(kNoCollInRofStandard) : 0; // apply int7-like selections bool sel7 = 0; @@ -919,10 +1076,10 @@ struct EventSelectionTask { histos.get(HIST("hColCounterAcc"))->Fill(Form("%d", bc.runNumber()), 1); } - int nTracksITS567inFullTimeWin = vNumTracksITS567inFullTimeWin[colIndex]; - // histos.get(HIST("hOccupancy"))->Fill(nTracksITS567inFullTimeWin); + int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; - evsel(alias, selection, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, nTracksITS567inFullTimeWin); + evsel(alias, selection, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF, + vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); } } diff --git a/Common/TableProducer/ft0CorrectedTable.cxx b/Common/TableProducer/ft0CorrectedTable.cxx index 49e6e8bea1c..877cb40111f 100644 --- a/Common/TableProducer/ft0CorrectedTable.cxx +++ b/Common/TableProducer/ft0CorrectedTable.cxx @@ -10,38 +10,89 @@ // or submit itself to any jurisdiction. #include -#include "Common/DataModel/FT0Corrected.h" #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"}; + Configurable resoFT0C{"resoFT0C", 20.f, "FT0C resolution"}; + 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; - void process(BCsWithMatchings const&, soa::Join const& collisions, aod::FT0s const&) + 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 (!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 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 +103,100 @@ 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; + } + } + 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-ft0.cxx b/Common/TableProducer/match-mft-ft0.cxx index 268548255cd..a4b208a03c9 100644 --- a/Common/TableProducer/match-mft-ft0.cxx +++ b/Common/TableProducer/match-mft-ft0.cxx @@ -109,11 +109,9 @@ T getCompatibleBCs(aod::AmbiguousMFTTrack const& atrack, aod::Collision const& c } int64_t maxBCId = bcIt.globalIndex(); - auto maxGlobalBC = bcIt.globalBC(); while (bcIt != bcs.end() && bcIt.globalBC() < lastBC + deltaBC) { maxBCId = bcIt.globalIndex(); - maxGlobalBC = bcIt.globalBC(); ++bcIt; } @@ -149,12 +147,10 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const& // int64_t collLastBC = collFirstBC + 2*collOrig.collisionTimeRes()/o2::constants::lhc::LHCBunchSpacingNS +1; int64_t minBCId = bcIt.globalIndex(); - uint64_t minGlobalBC = bcIt.globalBC(); if ((int64_t)bcIt.globalBC() < firstBC + deltaBC) { while (bcIt != bcs.end() && (int64_t)bcIt.globalBC() < firstBC + deltaBC) { minBCId = bcIt.globalIndex(); - minGlobalBC = bcIt.globalBC(); ++bcIt; } @@ -164,19 +160,16 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const& } // minGlobalBC needs to be >= to firstBC+deltaBC minBCId = bcIt.globalIndex(); - minGlobalBC = bcIt.globalBC(); } else { // here bcIt.globalBC() >= firstBC + deltaBC while (bcIt != bcs.begin() && (int64_t)bcIt.globalBC() >= (int64_t)firstBC + deltaBC) { minBCId = bcIt.globalIndex(); - minGlobalBC = bcIt.globalBC(); --bcIt; } if (bcIt == bcs.begin() && (int64_t)bcIt.globalBC() >= (int64_t)firstBC + deltaBC) { minBCId = bcIt.globalIndex(); - minGlobalBC = bcIt.globalBC(); } ++bcIt; // retrieve the pointer which gave minBCId and minGlobalBC if (bcIt == bcs.end()) { @@ -185,7 +178,6 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const& } int64_t maxBCId = bcIt.globalIndex(); - uint64_t maxGlobalBC = bcIt.globalBC(); if ((int64_t)bcIt.globalBC() > (int64_t)lastBC + deltaBC) { // the previous minimum is actually bigger than the right boundary @@ -218,7 +210,6 @@ T getCompatibleBCs(aod::MFTTracks::iterator const& track, aod::Collision const& while (bcIt != bcs.end() && (int64_t)bcIt.globalBC() <= (int64_t)lastBC + deltaBC) { maxBCId = bcIt.globalIndex(); - maxGlobalBC = bcIt.globalBC(); ++bcIt; } 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 075b0d108ee..216a1b7acc6 100644 --- a/Common/TableProducer/multiplicityExtraTable.cxx +++ b/Common/TableProducer/multiplicityExtraTable.cxx @@ -39,6 +39,16 @@ struct MultiplicityExtraTable { // Allow for downscaling of BC table for less space use in derived data Configurable bcDownscaleFactor{"bcDownscaleFactor", 2, "Downscale factor for BC table (0: save nothing, 1: save all)"}; Configurable minFT0CforBCTable{"minFT0CforBCTable", 25.0f, "Minimum FT0C amplitude to fill BC table to reduce data"}; + Configurable saveOnlyBCsWithCollisions{"saveOnlyBCsWithCollisions", true, "save only BCs with collisions in them"}; + + Configurable bcTableFloatPrecision{"bcTableFloatPrecision", 0.1, "float precision in bc table for data reduction"}; + + float tru(float value) + { + if (bcTableFloatPrecision < 1e-4) + return value; // make sure nothing bad happens in case zero (best precision) + return bcTableFloatPrecision * std::round(value / bcTableFloatPrecision) + 0.5f * bcTableFloatPrecision; + }; // needed for downscale unsigned int randomSeed = 0; @@ -62,17 +72,28 @@ struct MultiplicityExtraTable { using BCsWithRun3Matchings = soa::Join; - void processBCs(BCsWithRun3Matchings const& bcs, aod::FV0As const&, aod::FT0s const&, aod::FDDs const&, aod::Zdcs const&, aod::Collisions const& collisions) + void processBCs(soa::Join const& bcs, aod::FV0As const&, aod::FT0s const&, aod::FDDs const&, aod::Zdcs const&, soa::Join const& collisions) { //+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ // determine saved BCs and corresponding new BC table index + std::vector bcHasCollision(bcs.size()); std::vector newBCindex(bcs.size()); std::vector bc2multArray(bcs.size()); int atIndex = 0; for (const auto& bc : bcs) { + bcHasCollision[bc.globalIndex()] = false; newBCindex[bc.globalIndex()] = -1; bc2multArray[bc.globalIndex()] = -1; + } + //+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ + // tag BCs that have a collision (from evsel foundBC) + for (const auto& collision : collisions) { + bcHasCollision[collision.foundBCId()] = true; + } + //+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ + + for (const auto& bc : bcs) { // downscale if requested to do so if (bcDownscaleFactor < 1.f && (static_cast(rand_r(&randomSeed)) / static_cast(RAND_MAX)) > bcDownscaleFactor) { continue; @@ -91,6 +112,11 @@ struct MultiplicityExtraTable { if (multFT0C < minFT0CforBCTable) { continue; // skip this event } + + if (saveOnlyBCsWithCollisions && !bcHasCollision[bc.globalIndex()]) { + continue; // skip if no collision is assigned to this BC (from evSel assignment) + } + newBCindex[bc.globalIndex()] = atIndex++; } //+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ @@ -98,8 +124,8 @@ struct MultiplicityExtraTable { //+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ // interlink: collision -> valid BC, BC -> collision for (const auto& collision : collisions) { - mult2bc(newBCindex[collision.bcId()]); - bc2multArray[collision.bcId()] = collision.globalIndex(); + mult2bc(newBCindex[collision.foundBCId()]); + bc2multArray[collision.foundBCId()] = collision.globalIndex(); } //+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ @@ -213,7 +239,13 @@ struct MultiplicityExtraTable { } bc2mult(bc2multArray[bc.globalIndex()]); - multBC(multFT0A, multFT0C, posZFT0, posZFT0valid, multFV0A, multFDDA, multFDDC, multZNA, multZNC, multZEM1, multZEM2, multZPA, multZPC, Tvx, isFV0OrA, multFV0TriggerBits, multFT0TriggerBits, multFDDTriggerBits, multBCTriggerMask, collidingBC); + multBC( + tru(multFT0A), tru(multFT0C), + tru(posZFT0), posZFT0valid, tru(multFV0A), + tru(multFDDA), tru(multFDDC), tru(multZNA), tru(multZNC), tru(multZEM1), + tru(multZEM2), tru(multZPA), tru(multZPC), Tvx, isFV0OrA, + multFV0TriggerBits, multFT0TriggerBits, multFDDTriggerBits, multBCTriggerMask, collidingBC, + bc.flags()); } } diff --git a/Common/TableProducer/multiplicityTable.cxx b/Common/TableProducer/multiplicityTable.cxx index 8991c38cd10..30ae0c226fd 100644 --- a/Common/TableProducer/multiplicityTable.cxx +++ b/Common/TableProducer/multiplicityTable.cxx @@ -86,7 +86,7 @@ struct MultiplicityTable { Produces tableFDDZeqs; // 11 Produces tablePVZeqs; // 12 Produces tableExtraMc; // 13 - Produces tableExtraMc2Mults; + Produces tableExtraMult2MCExtras; Produces multsGlobal; // Not accounted for, produced based on process function processGlobalTrackingCounters // For vertex-Z corrections in calibration @@ -167,7 +167,6 @@ struct MultiplicityTable { if (tEnabled[kMultMCExtras]) { if (enabledTables->get(tableNames[kMultMCExtras].c_str(), "Enable") == -1) { doprocessMC.value = true; - doprocessMC2Mults.value = true; LOG(info) << "Enabling MC processing due to " << tableNames[kMultMCExtras] << " table being enabled."; } } @@ -380,15 +379,17 @@ struct MultiplicityTable { if (bc.runNumber() != mRunNumber) { mRunNumber = bc.runNumber(); // mark this run as at least tried if (ccdbConfig.reconstructionPass.value == "") { - lCalibObjects = ccdb->getForTimeStamp(ccdbConfig.ccdbPath, bc.timestamp()); + lCalibObjects = ccdb->getForRun(ccdbConfig.ccdbPath, mRunNumber); } else if (ccdbConfig.reconstructionPass.value == "metadata") { std::map metadata; metadata["RecoPassName"] = metadataInfo.get("RecoPassName"); - lCalibObjects = ccdb->getSpecific(ccdbConfig.ccdbPath, bc.timestamp(), metadata); + 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; - lCalibObjects = ccdb->getSpecific(ccdbConfig.ccdbPath, bc.timestamp(), metadata); + LOGF(info, "Loading CCDB for reconstruction pass (from provided argument): %s", ccdbConfig.reconstructionPass.value); + lCalibObjects = ccdb->getSpecificForRun(ccdbConfig.ccdbPath, mRunNumber, metadata); } if (lCalibObjects) { @@ -564,12 +565,13 @@ struct MultiplicityTable { } } - int bcNumber = bc.globalBC() % 3564; - tableExtra(collision.numContrib(), collision.chi2(), collision.collisionTimeRes(), mRunNumber, collision.posZ(), collision.sel8(), nHasITS, nHasTPC, nHasTOF, nHasTRD, nITSonly, nTPConly, nITSTPC, - nAllTracksTPCOnly, nAllTracksITSTPC, collision.trackOccupancyInTimeRange()); + nAllTracksTPCOnly, nAllTracksITSTPC, + collision.trackOccupancyInTimeRange(), + collision.ft0cOccupancyInTimeRange(), + collision.flags()); } break; case kMultSelections: // Multiplicity selections { @@ -669,7 +671,7 @@ struct MultiplicityTable { void processMC2Mults(soa::Join::iterator const& collision) { - tableExtraMc2Mults(collision.mcCollisionId()); // interlink + tableExtraMult2MCExtras(collision.mcCollisionId()); // interlink } Configurable min_pt_globaltrack{"min_pt_globaltrack", 0.15, "min. pT for global tracks"}; diff --git a/Common/TableProducer/qVectorsTable.cxx b/Common/TableProducer/qVectorsTable.cxx index c878b78b988..9de8faf028f 100644 --- a/Common/TableProducer/qVectorsTable.cxx +++ b/Common/TableProducer/qVectorsTable.cxx @@ -82,6 +82,7 @@ struct qVectorsTable { Configurable> cfgnMods{"cfgnMods", {2, 3}, "Modulation of interest"}; Configurable cfgMaxCentrality{"cfgMaxCentrality", 100.f, "max. centrality for Q vector calibration"}; + Configurable useCorrectionForRun{"useCorrectionForRun", true, "Get Qvector corrections based on run number instead of timestamp"}; Configurable cfgGainEqPath{"cfgGainEqPath", "Users/j/junlee/Qvector/GainEq", "CCDB path for gain equalization constants"}; Configurable cfgQvecCalibPath{"cfgQvecCalibPath", "Analysis/EventPlane/QVecCorrections", "CCDB pasth for Q-vecteor calibration constants"}; @@ -219,9 +220,10 @@ struct qVectorsTable { std::string fullPath; auto timestamp = bc.timestamp(); + auto runnumber = bc.runNumber(); - auto offsetFT0 = ccdb->getForTimeStamp>("FT0/Calib/Align", timestamp); - auto offsetFV0 = ccdb->getForTimeStamp>("FV0/Calib/Align", timestamp); + auto offsetFT0 = getForTsOrRun>("FT0/Calib/Align", timestamp, runnumber); + auto offsetFV0 = getForTsOrRun>("FV0/Calib/Align", timestamp, runnumber); if (offsetFT0 != nullptr) { helperEP.SetOffsetFT0A((*offsetFT0)[0].getX(), (*offsetFT0)[0].getY()); @@ -243,17 +245,17 @@ struct qVectorsTable { fullPath = cfgQvecCalibPath; fullPath += "/v"; fullPath += std::to_string(ind); - auto objqvec = ccdb->getForTimeStamp(fullPath, timestamp); + auto objqvec = getForTsOrRun(fullPath, timestamp, runnumber); if (!objqvec) { fullPath = cfgQvecCalibPath; fullPath += "/v2"; - objqvec = ccdb->getForTimeStamp(fullPath, timestamp); + objqvec = getForTsOrRun(fullPath, timestamp, runnumber); } objQvec.push_back(objqvec); } fullPath = cfgGainEqPath; fullPath += "/FT0"; - auto objft0Gain = ccdb->getForTimeStamp>(fullPath, timestamp); + auto objft0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); if (!objft0Gain || cfgCorrLevel == 0) { for (auto i{0u}; i < 208; i++) { FT0RelGainConst.push_back(1.); @@ -264,7 +266,7 @@ struct qVectorsTable { fullPath = cfgGainEqPath; fullPath += "/FV0"; - auto objfv0Gain = ccdb->getForTimeStamp>(fullPath, timestamp); + auto objfv0Gain = getForTsOrRun>(fullPath, timestamp, runnumber); if (!objfv0Gain || cfgCorrLevel == 0) { for (auto i{0u}; i < 48; i++) { FV0RelGainConst.push_back(1.); @@ -299,6 +301,21 @@ struct qVectorsTable { return true; } + /// Function to get corrections from CCDB eithr using the timestamp or the runnumber + /// \param fullPath is the path to correction in CCDB + /// \param timestamp is the collision timestamp + /// \param runNumber is the collision run number + /// \return CCDB correction + template + CorrectionType* getForTsOrRun(std::string const& fullPath, int64_t timestamp, int runNumber) + { + if (useCorrectionForRun) { + return ccdb->getForRun(fullPath, runNumber); + } else { + return ccdb->getForTimeStamp(fullPath, timestamp); + } + } + template void CalQvec(const Nmode nmode, const CollType& coll, const TrackType& track, std::vector& QvecRe, std::vector& QvecIm, std::vector& QvecAmp, std::vector& TrkTPCposLabel, std::vector& TrkTPCnegLabel, std::vector& TrkTPCallLabel) { diff --git a/Common/TableProducer/timestamp.cxx b/Common/TableProducer/timestamp.cxx index ceaa8acd25d..e3d37f7129b 100644 --- a/Common/TableProducer/timestamp.cxx +++ b/Common/TableProducer/timestamp.cxx @@ -120,7 +120,7 @@ struct TimestampTask { if (fatalOnInvalidTimestamp.value) { LOGF(fatal, "Timestamp %llu us is out of run duration [%llu, %llu] ms", timestamp, runDuration.first, runDuration.second); } else { - LOGF(warn, "Timestamp %llu us is out of run duration [%llu, %llu] ms", timestamp, runDuration.first, runDuration.second); + LOGF(debug, "Timestamp %llu us is out of run duration [%llu, %llu] ms", timestamp, runDuration.first, runDuration.second); } } timestampTable(timestamp); diff --git a/Common/TableProducer/trackPropagation.cxx b/Common/TableProducer/trackPropagation.cxx index ac8a4e60e0e..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,13 +120,23 @@ 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"); - trackTunedTracks->GetXaxis()->SetBinLabel(2, "tracks tuned (no negative detXY)"); - trackTunedTracks->GetXaxis()->SetBinLabel(3, "untouched tracks due to negative detXY"); - trackTunedTracks->GetXaxis()->SetBinLabel(4, "original detXY<0"); } } diff --git a/Common/TableProducer/zdc-task-intercalib.cxx b/Common/TableProducer/zdc-task-intercalib.cxx new file mode 100644 index 00000000000..e8b541c45b8 --- /dev/null +++ b/Common/TableProducer/zdc-task-intercalib.cxx @@ -0,0 +1,150 @@ +// 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 Task for ZDC tower inter-calibration +/// \author chiara.oppedisano@cern.ch +// Minimal example to run this task: +// export OPTIONS="-b --configuration json://config.json --aod-file AO2D.root" +// o2-analysis-timestamp ${OPTIONS} | +// o2-analysis-event-selection ${OPTIONS} | +// o2-analysis-track-propagation ${OPTIONS} | +// o2-analysis-mm-zdc-task-intercalib ${OPTIONS} + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/TriggerAliases.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/ZDCInterCalib.h" + +#include "TH1F.h" +#include "TH2F.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod::evsel; + +constexpr double kVeryNegative = -1.e12; + +using BCsRun3 = soa::Join; +using ColEvSels = soa::Join; + +struct zdcInterCalib { + + Produces zTab; + + // Configurable parameters + // + Configurable nBins{"nBins", 400, "n bins"}; + Configurable MaxZN{"MaxZN", 399.5, "Max ZN signal"}; + // + HistogramRegistry registry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + registry.add("ZNApmc", "ZNApmc; ZNA PMC; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNCpmc", "ZNCpmc; ZNC PMC; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNApm1", "ZNApm1; ZNA PM1; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNApm2", "ZNApm2; ZNA PM2; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNApm3", "ZNApm3; ZNA PM3; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNApm4", "ZNApm4; ZNA PM4; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNCpm1", "ZNCpm1; ZNC PM1; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNCpm2", "ZNCpm2; ZNC PM2; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNCpm3", "ZNCpm3; ZNC PM3; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNCpm4", "ZNCpm4; ZNC PM4; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}}); + } + + void process(ColEvSels const& cols, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/) + { + // collision-based event selection + for (auto& collision : cols) { + const auto& foundBC = collision.foundBC_as(); + if (foundBC.has_zdc()) { + const auto& zdc = foundBC.zdc(); + + // To assure that ZN have a genuine signal (tagged by the relative TDC) + // we can check that the amplitude is >0 or that ADC is NOT very negative (-inf) + // If this is not the case, signals are set to kVeryNegative values + double pmcZNC = zdc.energyCommonZNC(); + double pmcZNA = zdc.energyCommonZNA(); + // + // double tdcZNC = zdc.zdc.timeZNC(); + // double tdcZNA = zdc.zdc.timeZNA(); + // + bool isZNChit = true, isZNAhit = true; + if (pmcZNC < kVeryNegative) { + pmcZNC = kVeryNegative; + isZNChit = false; + } + if (pmcZNA < kVeryNegative) { + pmcZNA = kVeryNegative; + isZNAhit = false; + } + // + double sumZNC = 0; + double sumZNA = 0; + double pmqZNC[4] = { + 0, + 0, + 0, + 0, + }; + double pmqZNA[4] = { + 0, + 0, + 0, + 0, + }; + // + if (isZNChit) { + for (int it = 0; it < 4; it++) { + pmqZNC[it] = (zdc.energySectorZNC())[it]; + sumZNC += pmqZNC[it]; + } + registry.get(HIST("ZNCpmc"))->Fill(pmcZNC); + registry.get(HIST("ZNCpm1"))->Fill(pmqZNC[0]); + registry.get(HIST("ZNCpm2"))->Fill(pmqZNC[1]); + registry.get(HIST("ZNCpm3"))->Fill(pmqZNC[2]); + registry.get(HIST("ZNCpm4"))->Fill(pmqZNC[3]); + registry.get(HIST("ZNCsumq"))->Fill(sumZNC); + } + if (isZNAhit) { + for (int it = 0; it < 4; it++) { + pmqZNA[it] = (zdc.energySectorZNA())[it]; + sumZNA += pmqZNA[it]; + } + // + registry.get(HIST("ZNApmc"))->Fill(pmcZNA); + registry.get(HIST("ZNApm1"))->Fill(pmqZNA[0]); + registry.get(HIST("ZNApm2"))->Fill(pmqZNA[1]); + registry.get(HIST("ZNApm3"))->Fill(pmqZNA[2]); + registry.get(HIST("ZNApm4"))->Fill(pmqZNA[3]); + registry.get(HIST("ZNAsumq"))->Fill(sumZNA); + } + if (isZNAhit || isZNChit) + zTab(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3]); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Common/Tasks/centralityStudy.cxx b/Common/Tasks/centralityStudy.cxx index 1ba72958a37..9d5fe997fbc 100644 --- a/Common/Tasks/centralityStudy.cxx +++ b/Common/Tasks/centralityStudy.cxx @@ -46,13 +46,32 @@ 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 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"}; // Configurable Axes ConfigurableAxis axisMultFT0C{"axisMultFT0C", {2000, 0, 100000}, "FT0C amplitude"}; ConfigurableAxis axisMultPVContributors{"axisMultPVContributors", {200, 0, 6000}, "Number of PV Contributors"}; // 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"}; @@ -64,6 +83,9 @@ 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)"}; + void init(InitContext&) { if (doprocessCollisions || doprocessCollisionsWithCentrality) { @@ -80,14 +102,28 @@ 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("hNPVContributors", "hNPVContributors", kTH1D, {axisMultUltraFinePVContributors}); + + histos.add("hFT0CvsPVz_Collisions_All", "hFT0CvsPVz_Collisions_All", kTProfile, {axisPVz}); + histos.add("hFT0CvsPVz_Collisions", "hFT0CvsPVz_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}); } if (do2DPlots) { @@ -97,6 +133,7 @@ struct centralityStudy { 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}); @@ -168,18 +205,44 @@ 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 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("hFT0CvsPVz_Collisions_All"), collision.multPVz(), collision.multFT0C() * scaleSignalFT0C); + 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("hFT0CvsNContribs"), collision.multNTracksPV(), collision.multFT0C() * scaleSignalFT0C); histos.fill(HIST("hMatchedVsITSOnly"), collision.multNTracksITSOnly(), collision.multNTracksITSTPC()); } // 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()); @@ -203,23 +266,45 @@ 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.multBCColliding()) return; histos.fill(HIST("hBCSelection"), 1); // colliding - if (!multbc.multBCTVX()) + if (selectTVX && !multbc.multBCTVX()) return; histos.fill(HIST("hBCSelection"), 2); // TVX - if (!multbc.multBCFV0OrA()) + if (selectFV0OrA && !multbc.multBCFV0OrA()) return; histos.fill(HIST("hBCSelection"), 3); // FV0OrA + if (vertexZwithT0 < 100.0f) { + if (!multbc.multBCFT0PosZValid()) + return; + if (TMath::Abs(multbc.multBCFT0PosZ()) > vertexZwithT0) + return; + } + histos.fill(HIST("hBCSelection"), 4); // FV0OrA // 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.multBCFT0C() * scaleSignalFT0C); + histos.fill(HIST("hFT0M_BCs"), (multbc.multBCFT0A() + multbc.multBCFT0C()) * scaleSignalFT0M); + histos.fill(HIST("hFV0A_BCs"), multbc.multBCFV0A() * scaleSignalFV0A); + if (multbc.multBCFT0PosZValid()) { + histos.fill(HIST("hFT0CvsPVz_BCs_All"), multbc.multBCFT0PosZ(), multbc.multBCFT0C() * scaleSignalFT0C); + if (multbc.multBCFT0C() > minFT0CforVertexZ) { + histos.fill(HIST("hFT0CvsPVz_BCs"), multbc.multBCFT0PosZ(), multbc.multBCFT0C() * scaleSignalFT0C); + } + } + + if (multbc.has_ft0Mult()) { + auto multco = multbc.ft0Mult_as>(); + if (multbc.multBCFT0PosZValid()) { + histos.fill(HIST("hVertexZ_BCvsCO"), multco.multPVz(), multbc.multBCFT0PosZ()); + } + } } PROCESS_SWITCH(centralityStudy, processCollisions, "per-collision analysis", false); diff --git a/Common/Tasks/qVectorsCorrection.cxx b/Common/Tasks/qVectorsCorrection.cxx index bc9c555e154..10e37a4c210 100644 --- a/Common/Tasks/qVectorsCorrection.cxx +++ b/Common/Tasks/qVectorsCorrection.cxx @@ -75,6 +75,7 @@ struct qVectorsCorrection { Configurable cfgQAFinal{"cfgQAFinal", false, "draw final q-vector steps"}; Configurable cfgQAFlowStudy{"cfgQAFlowStudy", false, "configurable for flow study"}; Configurable cfgQAOccupancyStudy{"cfgQAOccupancyStudy", false, "configurable for occupancy study"}; + Configurable cfgAddEvtSelPileup{"cfgAddEvtSelPileup", false, "configurable for pileup selection"}; Configurable cfgMinPt{"cfgMinPt", 0.15, "Minimum transverse momentum for charged track"}; Configurable cfgMaxEta{"cfgMaxEta", 0.8, "Maximum pseudorapidiy for charged track"}; @@ -548,6 +549,9 @@ struct qVectorsCorrection { if (cfgAddEvtSel && (qVec.trackOccupancyInTimeRange() > cfgMaxOccupancy || qVec.trackOccupancyInTimeRange() < cfgMinOccupancy)) { return; } + if (cfgAddEvtSelPileup && !qVec.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return; + } for (uint i = 0; i < cfgnMods->size(); i++) { fillHistosQvec(qVec, cfgnMods->at(i)); 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/CMakeLists.txt b/DPG/Tasks/AOTEvent/CMakeLists.txt index 97476f860a4..3c537de6b47 100644 --- a/DPG/Tasks/AOTEvent/CMakeLists.txt +++ b/DPG/Tasks/AOTEvent/CMakeLists.txt @@ -28,8 +28,18 @@ o2physics_add_dpl_workflow(detector-occupancy-qa SOURCES detectorOccupancyQa.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(rof-border-qa SOURCES rofBorderQa.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(matching-qa + SOURCES matchingQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(rof-occupancy-qa + SOURCES rofOccupancyQa.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase + COMPONENT_NAME Analysis) diff --git a/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx b/DPG/Tasks/AOTEvent/detectorOccupancyQa.cxx index b41bc1faef4..96f82b8d3a2 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" @@ -39,7 +41,8 @@ using BCsRun2 = soa::Join; // using ColEvSels = soa::Join; using ColEvSels = soa::Join; -using FullTracksIU = soa::Join; +// using FullTracksIU = soa::Join; +using FullTracksIU = soa::Join; struct DetectorOccupancyQaTask { // configurables for study of occupancy in time windows @@ -78,6 +81,8 @@ struct DetectorOccupancyQaTask { Configurable nBinsOccupancy{"nBinsOccupancy", 150, "N bins for occupancy axis"}; Configurable nMaxOccupancy{"nMaxOccupancy", 15000, "N for max of the occupancy axis"}; + Configurable nMaxBcInTFforAnalysis{"nMaxBcInTFforAnalysis", -1, "When to stop taking collisions in TF, if -1: take all collisions"}; + uint64_t minGlobalBC = 0; Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -101,21 +106,15 @@ struct DetectorOccupancyQaTask { ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); + const AxisSpec axisBCinTF{static_cast(nBCsPerTF), 0, static_cast(nBCsPerTF), "bc in TF"}; + histos.add("hNcolVsBcInTF", ";bc in TF; n collisions", kTH1F, {axisBCinTF}); + histos.add("hNcolVsBcInTFafterMaxBcCut", ";bc in TF; n collisions", kTH1F, {axisBCinTF}); + // histograms for occupancy-in-time-window study double kMaxOccup = confOccupancyHistCoeffNtracksForOccupancy; double kMaxThisEv = confCoeffMaxNtracksThisEvent; - AxisSpec axisBC{3601, -0.5, 3600.5, "bc"}; - histos.add("h2D_diff_FoundBC_vs_BC", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_multAbove10", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_multAbove20", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_multAbove50", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_multAbove100", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_hasTOF", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_hasTRD", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_hasTOF_multAbove10", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - histos.add("h2D_diff_FoundBC_vs_BC_hasTRD_multAbove10", "", kTH2D, {axisBC, {201, -100.5, 100.5, "foundBC-BC"}}); - + // 1D, dE/dx, etc. if (confAddBasicQAhistos) { int nMax1D = kMaxThisEv * 8000; histos.add("hNumITS567tracksPerCollision", ";n tracks;n events", kTH1D, {{nMax1D, -0.5, nMax1D - 0.5}}); @@ -132,8 +131,72 @@ struct DetectorOccupancyQaTask { histos.add("hNumCollInTimeWindowSel", ";n collisions;n events", kTH1D, {{201, -0.5, 200.5}}); histos.add("hNumCollInTimeWindowSelITSTPC", ";n collisions;n events", kTH1D, {{201, -0.5, 200.5}}); histos.add("hNumCollInTimeWindowSelIfTOF", ";n collisions;n events", kTH1D, {{201, -0.5, 200.5}}); + histos.add("hNumCollInTimeWindowVsOrbit", ";orbit id;n collisions;n events", kTH2F, {{128, -0.5, 127.5}, {201, -0.5, 200.5}}); histos.add("hNumUniqueBCInTimeWindow", ";n collisions;n events", kTH1D, {{201, -0.5, 200.5}}); + + // dE/dx + histos.add("dEdx_vs_Momentum", "dE/dx", kTH2F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}}); + histos.add("dEdx_vs_Momentum_occupBelow200", "dE/dx", kTH2F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}}); + histos.add("dEdx_vs_Momentum_occupBelow200_kNoCollStd", "dE/dx", kTH2F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}}); + histos.add("dEdx_vs_Momentum_occupAbove4000", "dE/dx", kTH2F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}}); + AxisSpec axisBinsOccupStudy_dEdx{{0., 500, 1000, 2000, 4000, 6000, 8000, 15000}, "p_{T}"}; + histos.add("dEdx_vs_Momentum_vs_occup", "dE/dx", kTH3F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}, axisBinsOccupStudy_dEdx}); + histos.add("dEdx_vs_Momentum_vs_occup_eta_02_04", "dE/dx", kTH3F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}, axisBinsOccupStudy_dEdx}); + histos.add("dEdx_vs_Momentum_vs_occup_eta_04_02", "dE/dx", kTH3F, {{1000, -5.0, 5.0, "#it{p}/Z (GeV/c)"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}, axisBinsOccupStudy_dEdx}); + + histos.add("dEdx_vs_centr_vs_occup_narrow_p_win", "dE/dx", kTH3F, {{20, 0, 4000, "nITStrk cls567"}, {60, 0, 15000, "occupancy"}, {800, 0.0, 800.0, "dE/dx (a. u.)"}}); + + // ### kinematic distributions for events with high occupancy at specified dt ranges + histos.add("track_distr_nITStrThisEv_10_200/hEventCount", ";delta-time bin id;n events", kTH1D, {{5, -0.5, 4.5}}); + histos.add("track_distr_nITStrThisEv_above_2000/hEventCount", ";delta-time bin id;n events", kTH1D, {{5, -0.5, 4.5}}); + + const int nEtaBins = 800; + histos.add("track_distr_nITStrThisEv_10_200/hEta_lowOccupInTPC", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_10_200/hEta_highOccupInRecentPast", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_10_200/hEta_highOccupInCloseFuture", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_10_200/hEta_highOccupInDistantFuture", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_10_200/hEta_highOccupInNeighbourEvents", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + + histos.add("track_distr_nITStrThisEv_above_2000/hEta_lowOccupInTPC", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInRecentPast", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInCloseFuture", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInDistantFuture", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + histos.add("track_distr_nITStrThisEv_above_2000/hEta_highOccupInNeighbourEvents", ";#eta;n tracks", kTH1D, {{nEtaBins, -1.0, 1.0}}); + + const int nPhiBins = 800; + histos.add("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInCloseFuture", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + + histos.add("track_distr_nITStrThisEv_above_2000/hPhi_lowOccupInTPC", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInRecentPast", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInCloseFuture", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInDistantFuture", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + histos.add("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInNeighbourEvents", ";#varphi;n tracks", kTH1D, {{nPhiBins, 0, TMath::TwoPi()}}); + + // const int nPtBins = 800; + AxisSpec axisLogPt{200, 0.05, 40, "p_{T}"}; + axisLogPt.makeLogarithmic(); + histos.add("track_distr_nITStrThisEv_10_200/hPt_lowOccupInTPC", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_10_200/hPt_highOccupInRecentPast", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_10_200/hPt_highOccupInCloseFuture", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_10_200/hPt_highOccupInDistantFuture", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_10_200/hPt_highOccupInNeighbourEvents", ";p_{T};n tracks", kTH1D, {axisLogPt}); + + histos.add("track_distr_nITStrThisEv_above_2000/hPt_lowOccupInTPC", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_above_2000/hPt_highOccupInRecentPast", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_above_2000/hPt_highOccupInCloseFuture", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_above_2000/hPt_highOccupInDistantFuture", ";p_{T};n tracks", kTH1D, {axisLogPt}); + histos.add("track_distr_nITStrThisEv_above_2000/hPt_highOccupInNeighbourEvents", ";p_{T};n tracks", kTH1D, {axisLogPt}); + + // 3D: pt vs centr vs occup + histos.add("ptGlobal_vs_centr_vs_occup", "", kTH3F, {{20, 0, 4000, "nITStrk cls567"}, {60, 0, 15000, "occupancy"}, axisLogPt}); + histos.add("ptPV_vs_centr_vs_occup", "", kTH3F, {{20, 0, 4000, "nITStrk cls567"}, {60, 0, 15000, "occupancy"}, axisLogPt}); + histos.add("ptGlobal_vs_centr_vs_occup_NoCollStd", "", kTH3F, {{20, 0, 4000, "nITStrk cls567"}, {60, 0, 15000, "occupancy"}, axisLogPt}); + histos.add("ptPV_vs_centr_vs_occup_NoCollStd", "", kTH3F, {{20, 0, 4000, "nITStrk cls567"}, {60, 0, 15000, "occupancy"}, axisLogPt}); } // 2D int nBins3D = 80 * confOccupancyHistCoeffNbins3D; @@ -156,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; @@ -165,68 +235,77 @@ 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}); + histos.add("qaForHighOccupITStracksInTimeBinFuture2", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); + histos.add("qaForHighOccupITStracksForNeighbourEvents", ";time bin (#mus);n tracks", kTH1F, {axisTimeBins}); // save dt information for several first collisions for QA histos.add("histOccupInTimeBinsQA", ";dt;this coll id", kTH2F, {axisTimeBins, {nCollisionsForTimeBinQA, -0.5, nCollisionsForTimeBinQA - 0.5}}); // QA of occupancy-based event selection histos.add("hOccupancy", "", kTH1D, {{15002, -1.5, 15000.5}}); + histos.add("hOccupancyVsOrbit", ";orbit id;weighted occupancy;n events", kTH2F, {{128, -0.5, 127.5}, {600, 0, 15000}}); - AxisSpec axisOccupancy{nBinsOccupancy, 0., nMaxOccupancy, "occupancy (n ITS tracks weighted)"}; + AxisSpec axisOccupancyTracks{nBinsOccupancy, 0., nMaxOccupancy, "occupancy (n ITS tracks weighted)"}; AxisSpec axisCentrality{100, 0, 100, "centrality, %"}; - histos.add("hCentrVsOccupancy", "hCentrVsOccupancy", kTH2F, {axisCentrality, axisOccupancy}); + histos.add("hCentrVsOccupancy", "hCentrVsOccupancy", kTH2F, {axisCentrality, axisOccupancyTracks}); + histos.add("hCentrVsOccupancyNoCollStd", "hCentrVsOccupancyNoCollStd", kTH2F, {axisCentrality, axisOccupancyTracks}); if (confAddTracksVsFwdHistos) { AxisSpec axisNtracks{nBinsTracks, -0.5, nMaxTracks - 0.5, "n tracks"}; AxisSpec axisNtracksGlobal{nBinsTracks, -0.5, nMaxGlobalTracks - 0.5, "n tracks"}; - AxisSpec axisMultFw{nBinsMultFwd, 0., static_cast(nMaxMultFwd), "mult Fwd"}; - - histos.add("nTracksPV_vs_V0A_kNoHighOccupancyAgressive", "nTracksPV_vs_V0A_kNoHighOccupancyAgressive", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_kNoHighOccupancyStrict", "nTracksPV_vs_V0A_kNoHighOccupancyStrict", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_kNoHighOccupancyMedium", "nTracksPV_vs_V0A_kNoHighOccupancyMedium", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_kNoHighOccupancyRelaxed", "nTracksPV_vs_V0A_kNoHighOccupancyRelaxed", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_kNoHighOccupancyGentle", "nTracksPV_vs_V0A_kNoHighOccupancyGentle", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_kNoCollInTimeRangeStandard", "nTracksPV_vs_V0A_kNoCollInTimeRangeStandard", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_kNoCollInTimeRangeNarrow", "nTracksPV_vs_V0A_kNoCollInTimeRangeNarrow", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_0_250", "nTracksPV_vs_V0A_occup_0_250", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_0_500", "nTracksPV_vs_V0A_occup_0_500", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_0_750", "nTracksPV_vs_V0A_occup_0_750", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", "nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", "nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_noOccupSel", "nTracksPV_vs_V0A_noOccupSel", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", "nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_ABOVE_750", "nTracksPV_vs_V0A_occup_ABOVE_750", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_occup_Minus1", "nTracksPV_vs_V0A_occup_Minus1", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_AntiNoCollInTimeRangeStandard", "nTracksPV_vs_V0A_AntiNoCollInTimeRangeStandard", kTH2F, {axisMultFw, axisNtracks}); - histos.add("nTracksPV_vs_V0A_AntiNoCollInTimeRangeNarrow", "nTracksPV_vs_V0A_AntiNoCollInTimeRangeNarrow", kTH2F, {axisMultFw, axisNtracks}); - - histos.add("nTracksGlobal_vs_V0A_kNoHighOccupancyAgressive", "nTracksGlobal_vs_V0A_kNoHighOccupancyAgressive", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_kNoHighOccupancyStrict", "nTracksGlobal_vs_V0A_kNoHighOccupancyStrict", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_kNoHighOccupancyMedium", "nTracksGlobal_vs_V0A_kNoHighOccupancyMedium", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_kNoHighOccupancyRelaxed", "nTracksGlobal_vs_V0A_kNoHighOccupancyRelaxed", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_kNoHighOccupancyGentle", "nTracksGlobal_vs_V0A_kNoHighOccupancyGentle", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_kNoCollInTimeRangeStandard", "nTracksGlobal_vs_V0A_kNoCollInTimeRangeStandard", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_kNoCollInTimeRangeNarrow", "nTracksGlobal_vs_V0A_kNoCollInTimeRangeNarrow", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_0_250", "nTracksGlobal_vs_V0A_occup_0_250", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_0_500", "nTracksGlobal_vs_V0A_occup_0_500", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_0_750", "nTracksGlobal_vs_V0A_occup_0_750", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", "nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", "nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_noOccupSel", "nTracksGlobal_vs_V0A_noOccupSel", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", "nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_ABOVE_750", "nTracksGlobal_vs_V0A_occup_ABOVE_750", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_occup_Minus1", "nTracksGlobal_vs_V0A_occup_Minus1", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeStandard", "nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeStandard", kTH2F, {axisMultFw, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeNarrow", "nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeNarrow", kTH2F, {axisMultFw, axisNtracksGlobal}); - - histos.add("nTracksGlobal_vs_nPV_kNoHighOccupancyAgressive", "nTracksGlobal_vs_nPV_kNoHighOccupancyAgressive", kTH2F, {axisNtracks, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_nPV_kNoHighOccupancyStrict", "nTracksGlobal_vs_nPV_kNoHighOccupancyStrict", kTH2F, {axisNtracks, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_nPV_kNoHighOccupancyMedium", "nTracksGlobal_vs_nPV_kNoHighOccupancyMedium", kTH2F, {axisNtracks, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_nPV_kNoHighOccupancyRelaxed", "nTracksGlobal_vs_nPV_kNoHighOccupancyRelaxed", kTH2F, {axisNtracks, axisNtracksGlobal}); - histos.add("nTracksGlobal_vs_nPV_kNoHighOccupancyGentle", "nTracksGlobal_vs_nPV_kNoHighOccupancyGentle", kTH2F, {axisNtracks, axisNtracksGlobal}); + AxisSpec axisMultV0A{nBinsMultFwd, 0., static_cast(nMaxMultFwd), "mult V0A"}; + AxisSpec axisMultFT0C{nBinsMultFwd, 0., static_cast(nMaxMultFwd * 0.4), "mult FT0C"}; + + histos.add("nTracksPV_vs_V0A_kNoCollInTimeRangeStandard", "nTracksPV_vs_V0A_kNoCollInTimeRangeStandard", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_kNoCollInTimeRangeNarrow", "nTracksPV_vs_V0A_kNoCollInTimeRangeNarrow", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_0_250", "nTracksPV_vs_V0A_occup_0_250", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_0_500", "nTracksPV_vs_V0A_occup_0_500", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_0_750", "nTracksPV_vs_V0A_occup_0_750", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", "nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", "nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_noOccupSel", "nTracksPV_vs_V0A_noOccupSel", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", "nTracksPV_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_ABOVE_750", "nTracksPV_vs_V0A_occup_ABOVE_750", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_occup_Minus1", "nTracksPV_vs_V0A_occup_Minus1", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_AntiNoCollInTimeRangeStandard", "nTracksPV_vs_V0A_AntiNoCollInTimeRangeStandard", kTH2F, {axisMultV0A, axisNtracks}); + histos.add("nTracksPV_vs_V0A_AntiNoCollInTimeRangeNarrow", "nTracksPV_vs_V0A_AntiNoCollInTimeRangeNarrow", kTH2F, {axisMultV0A, axisNtracks}); + + histos.add("nTracksGlobal_vs_V0A_kNoCollInTimeRangeStandard", "nTracksGlobal_vs_V0A_kNoCollInTimeRangeStandard", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_kNoCollInTimeRangeNarrow", "nTracksGlobal_vs_V0A_kNoCollInTimeRangeNarrow", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_0_250", "nTracksGlobal_vs_V0A_occup_0_250", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_0_500", "nTracksGlobal_vs_V0A_occup_0_500", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_0_750", "nTracksGlobal_vs_V0A_occup_0_750", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", "nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", "nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeNarrow", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_noOccupSel", "nTracksGlobal_vs_V0A_noOccupSel", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", "nTracksGlobal_vs_V0A_occup_0_500_kNoCollInTimeRangeStandard_extraCuts", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_ABOVE_750", "nTracksGlobal_vs_V0A_occup_ABOVE_750", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_occup_Minus1", "nTracksGlobal_vs_V0A_occup_Minus1", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeStandard", "nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeStandard", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeNarrow", "nTracksGlobal_vs_V0A_AntiNoCollInTimeRangeNarrow", kTH2F, {axisMultV0A, axisNtracksGlobal}); + histos.add("nTracksGlobal_vs_nPV_kNoCollInTimeRangeStandard", "nTracksGlobal_vs_nPV_kNoCollInTimeRangeStandard", kTH2F, {axisNtracks, axisNtracksGlobal}); histos.add("nTracksGlobal_vs_nPV_kNoCollInTimeRangeNarrow", "nTracksGlobal_vs_nPV_kNoCollInTimeRangeNarrow", kTH2F, {axisNtracks, axisNtracksGlobal}); histos.add("nTracksGlobal_vs_nPV_occup_0_250", "nTracksGlobal_vs_nPV_occup_0_250", kTH2F, {axisNtracks, axisNtracksGlobal}); @@ -246,10 +325,28 @@ 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, axisOccupancy}); - histos.add("nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard", "nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard", kTH3F, {axisNtracks, axisNtracksGlobal, axisOccupancy}); - histos.add("nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeNarrow", "nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeNarrow", kTH3F, {axisNtracks, axisNtracksGlobal, axisOccupancy}); + 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}); + histos.add("nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeNarrow", "nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeNarrow", kTH3F, {axisNtracks, axisNtracksGlobal, axisOccupancyTracks}); + histos.add("nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard_extraCuts", "nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard_extraCuts", kTH3F, {axisNtracks, axisNtracksGlobal, axisOccupancyTracks}); + + // 3D histograms: nGlobalTracks with cls567 as y-axis, V0A as x-axis: + histos.add("nTracksGlobal_vs_V0A_vs_occup_pure", "", kTH3F, {axisMultV0A, axisNtracksGlobal, axisOccupancyTracks}); + histos.add("nTracksGlobal_vs_V0A_vs_occup_kNoCollInTimeRangeStandard_extraCuts", "", kTH3F, {axisMultV0A, axisNtracksGlobal, axisOccupancyTracks}); + // FT0C as x-axis: + histos.add("nTracksGlobal_vs_FT0C_vs_occup_pure", "", kTH3F, {axisMultFT0C, axisNtracksGlobal, axisOccupancyTracks}); + histos.add("nTracksGlobal_vs_FT0C_vs_occup_kNoCollInTimeRangeStandard_extraCuts", "", kTH3F, {axisMultFT0C, axisNtracksGlobal, axisOccupancyTracks}); + + // 3D histograms: now - nITStracks with cls567 as y-axis, V0A as x-axis: + histos.add("nPV_vs_V0A_vs_occup_pure", "", kTH3F, {axisMultV0A, axisNtracks, axisOccupancyTracks}); + histos.add("nPV_vs_V0A_vs_occup_kNoCollInTimeRangeStandard_extraCuts", "", kTH3F, {axisMultV0A, axisNtracks, axisOccupancyTracks}); + // FT0C as x-axis: + histos.add("nPV_vs_FT0C_vs_occup_pure", "", kTH3F, {axisMultFT0C, axisNtracks, axisOccupancyTracks}); + histos.add("nPV_vs_FT0C_vs_occup_kNoCollInTimeRangeStandard_extraCuts", "", kTH3F, {axisMultFT0C, axisNtracks, axisOccupancyTracks}); } } @@ -262,40 +359,20 @@ struct DetectorOccupancyQaTask { aod::FT0s 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; + 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); } } @@ -308,8 +385,13 @@ 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 + + std::vector vFlagsForEtaQAvsOccupancyInDeltaTimeWins(cols.size(), 0); const double timeWinOccupancyCalcNS = confTimeIntervalForOccupancyCalculation * 1e3; // ns, to be compared with TPC drift time const double bcNS = o2::constants::lhc::LHCBunchSpacingNS; @@ -324,7 +406,7 @@ struct DetectorOccupancyQaTask { int nITSTPCtracks = 0; int nITSTPCtracksPtEtaCuts = 0; int nTOFtracks = 0; - int nTRDtracks = 0; + // int nTRDtracks = 0; auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex()); for (auto& track : tracksGrouped) { if (!track.isPVContributor()) { @@ -334,7 +416,7 @@ struct DetectorOccupancyQaTask { nITS567cls++; nITSTPCtracks += track.hasITS() && track.hasTPC(); nTOFtracks += track.hasTOF(); - nTRDtracks += track.hasTRD(); + // nTRDtracks += track.hasTRD(); if (track.pt() < confCutPtMinThisEvent || track.pt() > confCutPtMaxThisEvent) continue; @@ -358,6 +440,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; @@ -375,34 +460,9 @@ struct DetectorOccupancyQaTask { int64_t bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF; vIsFullInfoForOccupancy[colIndex] = ((bcInTF - 300) * bcNS > timeWinOccupancyCalcNS) && ((nBCsPerTF - 4000 - bcInTF) * bcNS > timeWinOccupancyCalcNS) ? true : false; + // cut on the max bc in the time frame + vIsMarkedCollForAnalysis[colIndex] = nMaxBcInTFforAnalysis == -1 ? 1 : (bcInTF >= 300 && bcInTF < nMaxBcInTFforAnalysis); LOGP(debug, "### check bcInTF cut: colIndex={} bcInTF={} vIsFullInfoForOccupancy={}", colIndex, bcInTF, static_cast(vIsFullInfoForOccupancy[colIndex])); - - // additional QA: - if (col.selection_bit(kNoTimeFrameBorder) && col.selection_bit(kNoITSROFrameBorder)) { - auto bcFoundId = bc.globalBC() % 3564; - auto bcNonFound = col.bc_as(); - auto bcNonFoundId = bcNonFound.globalBC() % 3564; - int64_t diffFoundBC_vs_BC = (int64_t)bcFoundId - (int64_t)bcNonFoundId; - histos.fill(HIST("h2D_diff_FoundBC_vs_BC"), bcNonFoundId, diffFoundBC_vs_BC); - if (nITS567cls > 10) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove10"), bcNonFoundId, diffFoundBC_vs_BC); - if (nITS567cls > 20) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove20"), bcNonFoundId, diffFoundBC_vs_BC); - if (nITS567cls > 50) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove50"), bcNonFoundId, diffFoundBC_vs_BC); - if (nITS567cls > 100) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_multAbove100"), bcNonFoundId, diffFoundBC_vs_BC); - - if (nTOFtracks > 0) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTOF"), bcNonFoundId, diffFoundBC_vs_BC); - if (nTRDtracks > 0) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTRD"), bcNonFoundId, diffFoundBC_vs_BC); - - if (nITS567cls > 10 && nTOFtracks > 0) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTOF_multAbove10"), bcNonFoundId, diffFoundBC_vs_BC); - if (nITS567cls > 10 && nTRDtracks > 0) - histos.fill(HIST("h2D_diff_FoundBC_vs_BC_hasTRD_multAbove10"), bcNonFoundId, diffFoundBC_vs_BC); - } } // find for each collision all collisions within the defined time window @@ -476,6 +536,10 @@ struct DetectorOccupancyQaTask { if (!vIsFullInfoForOccupancy[colIndex]) continue; + // cut on the max bcId in the time frame (to avoid the artificial fade-out tail in the MC productions) + if (!vIsMarkedCollForAnalysis[colIndex]) + continue; + // cut on vZ for a given collision if (col.posZ() < confCutVertZMinThisEvent || col.posZ() > confCutVertZMaxThisEvent) continue; @@ -514,7 +578,7 @@ struct DetectorOccupancyQaTask { bool sel = col.selection_bit(kIsTriggerTVX); // loop over nearby collisions - for (int iCol = 0; iCol < vCollsAssocToGivenColl.size(); iCol++) { + for (unsigned int iCol = 0; iCol < vCollsAssocToGivenColl.size(); iCol++) { int thisColIndex = vCollsAssocToGivenColl[iCol]; int64_t thisGlobBC = vFoundGlobalBC[thisColIndex]; float thisColTimeDiff = vCollsTimeDeltaWrtGivenColl[iCol] / 1e3; // ns -> us @@ -523,6 +587,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++; @@ -557,47 +622,93 @@ 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.fill(HIST("hNumITSTPCtracksPerCollision"), vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hNumITS567tracksPerCollision"), vTracksITS567perColl[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("hNumITSTPCtracksPerCollision"))->Fill(vTracksITSTPCperColl[colIndex]); - histos.get(HIST("hNumITS567tracksPerCollision"))->Fill(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("hNumITSTPCtracksInTimeWindow_vs_TracksPerColl"))->Fill(vTracksITSTPCperColl[colIndex], nITSTPCtracksInTimeWindow); - histos.get(HIST("hNumITSTPCtracksInTimeWindow_vs_TracksPerColl_withoutThisCol"))->Fill(vTracksITSTPCperColl[colIndex], nITSTPCtracksInTimeWindow - vTracksITSTPCperColl[colIndex]); + histos.fill(HIST("hNumCollInTimeWindow"), nCollInTimeWindow); - histos.get(HIST("hNumITS567tracksInTimeWindow_vs_TracksPerColl"))->Fill(vTracksITS567perColl[colIndex], nITS567tracksInTimeWindow); - histos.get(HIST("hNumITS567tracksInTimeWindow_vs_TracksPerColl_withoutThisCol"))->Fill(vTracksITS567perColl[colIndex], nITS567tracksInTimeWindow - vTracksITS567perColl[colIndex]); + int64_t bcInTF = (vFoundGlobalBC[colIndex] - bcSOR) % nBCsPerTF; + int orbitId = bcInTF / o2::constants::lhc::LHCMaxBunches; + histos.fill(HIST("hNumCollInTimeWindowVsOrbit"), orbitId, nCollInTimeWindow); - histos.get(HIST("hNumCollInTimeWindow"))->Fill(nCollInTimeWindow); + histos.fill(HIST("hNumUniqueBCInTimeWindow"), mUniqueBC.size()); - histos.get(HIST("hNumUniqueBCInTimeWindow"))->Fill(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.fill(HIST("hNumITS567tracksInTimeWindow_vs_FT0Campl"), multFT0CInTimeWindow, nITS567tracksInTimeWindow); + histos.fill(HIST("hNumITSTPCtracksInTimeWindow_vs_FT0Campl"), multFT0CInTimeWindow, nITSTPCtracksInTimeWindow); + histos.fill(HIST("hNumITSTPCtracksInTimeWindow_vs_ITS567tracks"), 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]); - - // 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 + float integralFullDeltaTime = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(); + int binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(-39.5); // us + int binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(-10.5); + float integralPast = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); + binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(20.5); + binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(49.5); + float integralFuture1 = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); + binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(50.5); + binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(79.5); + float integralFuture2 = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); + binMin = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(-9.5); + binMax = histos.get(HIST("thisEventITStracksInTimeBins"))->FindBin(19.5); + float integralNeighbourEvents = histos.get(HIST("thisEventITStracksInTimeBins"))->Integral(binMin, binMax); + + // recent past + if (integralFullDeltaTime < 150) // ~empty detector + vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] = 1; + // recent past + if (integralPast > /*3000*/ 2500 && (integralFullDeltaTime - integralPast) < 120) // low occupancy outside the dt region of interest + vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] = 2; + // close future + if (integralFuture1 > /*3000*/ 2500 && (integralFullDeltaTime - integralFuture1) < 120) + vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] = 3; + // distant future + if (integralFuture2 > /*3000*/ 2500 && (integralFullDeltaTime - integralFuture2) < 120) + vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] = 4; + // neighbour events + if (integralNeighbourEvents > /*3000*/ 2500 && (integralFullDeltaTime - integralNeighbourEvents) < 120) + vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] = 5; + // loop over time axis in nD histograms: for (int iT = 0; iT < histos.get(HIST("thisEventITStracksInTimeBins"))->GetNbinsX(); iT++) { int nITStrInTimeBin = histos.get(HIST("thisEventITStracksInTimeBins"))->GetBinContent(iT + 1); @@ -606,13 +717,48 @@ 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); + + // QA for high occup in time bins + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 2) + histos.fill(HIST("qaForHighOccupITStracksInTimeBinPast"), dt, nITStrInTimeBin); + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 3) + histos.fill(HIST("qaForHighOccupITStracksInTimeBinFuture1"), dt, nITStrInTimeBin); + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 4) + histos.fill(HIST("qaForHighOccupITStracksInTimeBinFuture2"), dt, nITStrInTimeBin); + if (vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex] == 5) + histos.fill(HIST("qaForHighOccupITStracksForNeighbourEvents"), dt, nITStrInTimeBin); } + + // 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 @@ -623,17 +769,28 @@ struct DetectorOccupancyQaTask { // } if (!col.selection_bit(kIsTriggerTVX)) continue; - // cut on vZ for a given collision if (col.posZ() < confCutVertZMinThisEvent || col.posZ() > confCutVertZMaxThisEvent) continue; + int32_t colIndex = col.globalIndex(); + int64_t bcInTF = (vFoundGlobalBC[colIndex] - bcSOR) % nBCsPerTF; + histos.fill(HIST("hNcolVsBcInTF"), bcInTF); + + // cut on the max bcId in the time frame (to avoid the artificial fade-out tail in the MC productions) + if (!vIsMarkedCollForAnalysis[colIndex]) + continue; + + histos.fill(HIST("hNcolVsBcInTFafterMaxBcCut"), bcInTF); + auto multV0A = col.multFV0A(); // auto multT0A = col.multFT0A(); - // auto multT0C = col.multFT0C(); + auto multT0C = col.multFT0C(); int nPV = 0; // col.multNTracksPV(); int nGlobalTracks = 0; + int occupancy = col.trackOccupancyInTimeRange(); + auto tracksGrouped = tracks.sliceBy(perCollision, col.globalIndex()); for (auto& track : tracksGrouped) { if (!track.isPVContributor()) @@ -646,8 +803,34 @@ struct DetectorOccupancyQaTask { continue; nPV++; - if (track.isGlobalTrack() && track.tpcNClsFound() >= confCutMinTPCcls) + if (track.isGlobalTrack() && track.tpcNClsFound() >= confCutMinTPCcls) { nGlobalTracks++; + + if (track.passedTPCRefit()) { + float signedP = track.sign() * track.tpcInnerParam(); + histos.fill(HIST("dEdx_vs_Momentum"), signedP, track.tpcSignal()); + if (occupancy >= 0 && occupancy < 200) { + histos.fill(HIST("dEdx_vs_Momentum_occupBelow200"), signedP, track.tpcSignal()); + if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) + histos.fill(HIST("dEdx_vs_Momentum_occupBelow200_kNoCollStd"), signedP, track.tpcSignal()); + } + if (occupancy > 4000) + histos.fill(HIST("dEdx_vs_Momentum_occupAbove4000"), signedP, track.tpcSignal()); + + if (occupancy >= 0) { + histos.fill(HIST("dEdx_vs_Momentum_vs_occup"), signedP, track.tpcSignal(), occupancy); + + if (track.eta() > 0.2 && track.eta() < 0.4) + histos.fill(HIST("dEdx_vs_Momentum_vs_occup_eta_02_04"), signedP, track.tpcSignal(), occupancy); + if (track.eta() > -0.4 && track.eta() < -0.2) + histos.fill(HIST("dEdx_vs_Momentum_vs_occup_eta_04_02"), signedP, track.tpcSignal(), occupancy); + + // dE/dx in narrow mom bin vs centrality and occupancy + if (signedP > 0.38 && signedP < 0.4) + histos.fill(HIST("dEdx_vs_centr_vs_occup_narrow_p_win"), nPV, occupancy, track.tpcSignal()); + } + } + } } if (confAddTracksVsFwdHistos) @@ -664,11 +847,113 @@ struct DetectorOccupancyQaTask { if (confFlagApplyROFborderCut && !col.selection_bit(kNoITSROFrameBorder)) continue; - int occupancy = col.trackOccupancyInTimeRange(); histos.fill(HIST("hOccupancy"), occupancy); + if (occupancy >= 0) { + int orbitId = bcInTF / o2::constants::lhc::LHCMaxBunches; + histos.fill(HIST("hOccupancyVsOrbit"), orbitId, occupancy); + } + + // another track loop to fill track-level histograms + if (confAddBasicQAhistos) { + int flagWhichDeltaTimeWin = vFlagsForEtaQAvsOccupancyInDeltaTimeWins[colIndex]; + bool flagNoCollNearby = col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard); + + if (occupancy >= 0) { + if (nPV >= 10 && nPV < 200) { + if (flagNoCollNearby && flagWhichDeltaTimeWin != 5) + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEventCount"), flagWhichDeltaTimeWin); + if (flagWhichDeltaTimeWin == 5) // nearby collisions --> avoid checking the flagNoCollNearby flag + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEventCount"), flagWhichDeltaTimeWin); + } + if (nPV >= 2000) { + if (flagNoCollNearby && flagWhichDeltaTimeWin != 5) + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hEventCount"), flagWhichDeltaTimeWin); + if (flagWhichDeltaTimeWin == 5) // nearby collisions --> avoid checking the flagNoCollNearby flag + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hEventCount"), flagWhichDeltaTimeWin); + } + } + for (auto& track : tracksGrouped) { + if (!track.isPVContributor()) + continue; + if (track.itsNCls() < 5) + continue; + if (!(track.isGlobalTrack() && track.tpcNClsFound() >= confCutMinTPCcls)) + continue; + + // pt vs centr vs occup + if (occupancy >= 0) { + histos.fill(HIST("ptGlobal_vs_centr_vs_occup"), nPV, occupancy, track.pt()); + histos.fill(HIST("ptPV_vs_centr_vs_occup"), nPV, occupancy, track.pt()); + if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + histos.fill(HIST("ptGlobal_vs_centr_vs_occup_NoCollStd"), nPV, occupancy, track.pt()); + histos.fill(HIST("ptPV_vs_centr_vs_occup_NoCollStd"), nPV, occupancy, track.pt()); + } + + if (nPV >= 10 && nPV < 200) { + if (flagWhichDeltaTimeWin == 1 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_lowOccupInTPC"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_lowOccupInTPC"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_lowOccupInTPC"), track.pt()); + } + if (flagWhichDeltaTimeWin == 2 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInRecentPast"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInRecentPast"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInRecentPast"), track.pt()); + } + if (flagWhichDeltaTimeWin == 3 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInCloseFuture"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInCloseFuture"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInCloseFuture"), track.pt()); + } + if (flagWhichDeltaTimeWin == 4 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInDistantFuture"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInDistantFuture"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInDistantFuture"), track.pt()); + } + if (flagWhichDeltaTimeWin == 5) { + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hEta_highOccupInNeighbourEvents"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPhi_highOccupInNeighbourEvents"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_10_200/hPt_highOccupInNeighbourEvents"), track.pt()); + } + } else if (nPV >= 2000) { + if (flagWhichDeltaTimeWin == 1 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hEta_lowOccupInTPC"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPhi_lowOccupInTPC"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPt_lowOccupInTPC"), track.pt()); + } + if (flagWhichDeltaTimeWin == 2 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hEta_highOccupInRecentPast"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInRecentPast"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPt_highOccupInRecentPast"), track.pt()); + } + if (flagWhichDeltaTimeWin == 3 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hEta_highOccupInCloseFuture"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInCloseFuture"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPt_highOccupInCloseFuture"), track.pt()); + } + if (flagWhichDeltaTimeWin == 4 && flagNoCollNearby) { + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hEta_highOccupInDistantFuture"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInDistantFuture"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPt_highOccupInDistantFuture"), track.pt()); + } + if (flagWhichDeltaTimeWin == 5) { + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hEta_highOccupInNeighbourEvents"), track.eta()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPhi_highOccupInNeighbourEvents"), track.phi()); + histos.fill(HIST("track_distr_nITStrThisEv_above_2000/hPt_highOccupInNeighbourEvents"), track.pt()); + } + } + } // end of if (occupancy >= 0) + } + } // end of spec track loop to fill track histograms + + // occupancy vs centrality auto t0cCentr = col.centFT0C(); - histos.fill(HIST("hCentrVsOccupancy"), t0cCentr, occupancy); + if (occupancy >= 0) { + histos.fill(HIST("hCentrVsOccupancy"), t0cCentr, occupancy); + if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) + histos.fill(HIST("hCentrVsOccupancyNoCollStd"), t0cCentr, occupancy); + } if (!confAddTracksVsFwdHistos) { continue; @@ -679,40 +964,29 @@ struct DetectorOccupancyQaTask { histos.fill(HIST("nTracksGlobal_vs_V0A_noOccupSel"), multV0A, nGlobalTracks); histos.fill(HIST("nTracksGlobal_vs_nPV_noOccupSel"), nPV, nGlobalTracks); - if (occupancy >= 0) + if (occupancy >= 0) { histos.fill(HIST("nTracksGlobal_vs_nPV_vs_occup_pure"), nPV, nGlobalTracks, occupancy); + histos.fill(HIST("nTracksGlobal_vs_V0A_vs_occup_pure"), multV0A, nGlobalTracks, occupancy); + histos.fill(HIST("nTracksGlobal_vs_FT0C_vs_occup_pure"), multT0C, nGlobalTracks, occupancy); - if (col.selection_bit(o2::aod::evsel::kNoHighOccupancyAgressive)) { - histos.fill(HIST("nTracksPV_vs_V0A_kNoHighOccupancyAgressive"), multV0A, nPV); - histos.fill(HIST("nTracksGlobal_vs_V0A_kNoHighOccupancyAgressive"), multV0A, nGlobalTracks); - histos.fill(HIST("nTracksGlobal_vs_nPV_kNoHighOccupancyAgressive"), nPV, nGlobalTracks); - } - if (col.selection_bit(o2::aod::evsel::kNoHighOccupancyStrict)) { - histos.fill(HIST("nTracksPV_vs_V0A_kNoHighOccupancyStrict"), multV0A, nPV); - histos.fill(HIST("nTracksGlobal_vs_V0A_kNoHighOccupancyStrict"), multV0A, nGlobalTracks); - histos.fill(HIST("nTracksGlobal_vs_nPV_kNoHighOccupancyStrict"), nPV, nGlobalTracks); - } - if (col.selection_bit(o2::aod::evsel::kNoHighOccupancyMedium)) { - histos.fill(HIST("nTracksPV_vs_V0A_kNoHighOccupancyMedium"), multV0A, nPV); - histos.fill(HIST("nTracksGlobal_vs_V0A_kNoHighOccupancyMedium"), multV0A, nGlobalTracks); - histos.fill(HIST("nTracksGlobal_vs_nPV_kNoHighOccupancyMedium"), nPV, nGlobalTracks); - } - if (col.selection_bit(o2::aod::evsel::kNoHighOccupancyRelaxed)) { - histos.fill(HIST("nTracksPV_vs_V0A_kNoHighOccupancyRelaxed"), multV0A, nPV); - histos.fill(HIST("nTracksGlobal_vs_V0A_kNoHighOccupancyRelaxed"), multV0A, nGlobalTracks); - histos.fill(HIST("nTracksGlobal_vs_nPV_kNoHighOccupancyRelaxed"), nPV, nGlobalTracks); - } - if (col.selection_bit(o2::aod::evsel::kNoHighOccupancyGentle)) { - histos.fill(HIST("nTracksPV_vs_V0A_kNoHighOccupancyGentle"), multV0A, nPV); - histos.fill(HIST("nTracksGlobal_vs_V0A_kNoHighOccupancyGentle"), multV0A, nGlobalTracks); - histos.fill(HIST("nTracksGlobal_vs_nPV_kNoHighOccupancyGentle"), nPV, nGlobalTracks); + histos.fill(HIST("nPV_vs_V0A_vs_occup_pure"), multV0A, nPV, occupancy); + histos.fill(HIST("nPV_vs_FT0C_vs_occup_pure"), multT0C, nPV, occupancy); } + if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { histos.fill(HIST("nTracksPV_vs_V0A_kNoCollInTimeRangeStandard"), multV0A, nPV); histos.fill(HIST("nTracksGlobal_vs_V0A_kNoCollInTimeRangeStandard"), multV0A, nGlobalTracks); histos.fill(HIST("nTracksGlobal_vs_nPV_kNoCollInTimeRangeStandard"), nPV, nGlobalTracks); if (occupancy >= 0) histos.fill(HIST("nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard"), nPV, nGlobalTracks, occupancy); + if (occupancy >= 0 && col.selection_bit(kNoSameBunchPileup) && col.selection_bit(kIsGoodZvtxFT0vsPV)) { + histos.fill(HIST("nTracksGlobal_vs_nPV_vs_occup_kNoCollInTimeRangeStandard_extraCuts"), nPV, nGlobalTracks, occupancy); + histos.fill(HIST("nTracksGlobal_vs_V0A_vs_occup_kNoCollInTimeRangeStandard_extraCuts"), multV0A, nGlobalTracks, occupancy); + histos.fill(HIST("nTracksGlobal_vs_FT0C_vs_occup_kNoCollInTimeRangeStandard_extraCuts"), multT0C, nGlobalTracks, occupancy); + + histos.fill(HIST("nPV_vs_V0A_vs_occup_kNoCollInTimeRangeStandard_extraCuts"), multV0A, nPV, occupancy); + histos.fill(HIST("nPV_vs_FT0C_vs_occup_kNoCollInTimeRangeStandard_extraCuts"), multT0C, nPV, occupancy); + } } if (col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { histos.fill(HIST("nTracksPV_vs_V0A_kNoCollInTimeRangeNarrow"), multV0A, nPV); @@ -739,6 +1013,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/matchingQa.cxx b/DPG/Tasks/AOTEvent/matchingQa.cxx new file mode 100644 index 00000000000..b59b8faba0c --- /dev/null +++ b/DPG/Tasks/AOTEvent/matchingQa.cxx @@ -0,0 +1,818 @@ +// 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 "Framework/HistogramRegistry.h" +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsFT0/Digit.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "MetadataHelper.h" + +using namespace o2; +using namespace o2::framework; + +using BCsRun3 = soa::Join; +using FullTracksIU = soa::Join; +using FullTracksIUwithLabels = soa::Join; +float bcNS = o2::constants::lhc::LHCBunchSpacingNS; +int32_t nBCsPerOrbit = o2::constants::lhc::LHCMaxBunches; + +MetadataHelper metadataInfo; // Metadata helper + +struct MatchingQaTask { + Service ccdb; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + Preslice perCollision = aod::track::collisionId; + Configurable customOrbitOffset{"customOrbitOffset", 0, "customOrbitOffset for MC"}; + Configurable isLowFlux{"isLowFlux", 0, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"}; + Configurable useTimeDiff{"useTimeDiff", 1, "use time difference for selection"}; + Configurable useVtxDiff{"useVtxDiff", 1, "use vertex difference for selection"}; + Configurable removeTOFmatches{"removeTOFmatches", 1, "remove TVX bcs matched to collisions with TOF tracks"}; + Configurable removeHighPtmatches{"removeHighPtmatches", 1, "remove TVX bcs matched to collisions with high-pt ITS-TPC tracks"}; + Configurable removeColsWithAmbiguousTOF{"removeColsWithAmbiguousTOF", 0, "remove collisions with ambiguous TOF signals"}; + Configurable removeNoncollidingBCs{"removeNoncollidingBCs", 1, "Remove TVX from non-colliding bcs"}; + Configurable useITSROFconstraint{"useITSROFconstraint", 1, "use ITS ROF constraints for ITS-TPC vertices"}; + Configurable additionalDeltaBC{"additionalDeltaBC", 0, "Additional BC margin added to deltaBC for ITS-TPC vertices"}; + Configurable deltaBCforTOFcollisions{"deltaBCforTOFcollisions", 1, "bc margin for TOF-matched collisions"}; + Configurable minimumDeltaBC{"minimumDeltaBC", -1, "minimum delta BC for ITS-TPC vertices"}; + Configurable deltaBCforHighPtTracks{"deltaBCforHighPtTracks", 10, "delta BC for high-pt ITS-TPC tracks"}; + + std::bitset bcPatternB; // bc pattern of colliding bunches + int lastRun = -1; + int64_t bcSOR = -1; // global bc of the start of the first orbit + int32_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564 + int32_t offsetITSROF = 64; + int32_t nBCsPerITSROF = 198; + std::vector vFoundBCindex; + std::vector vNumITStracks; + std::vector vNumTOFtracks; + std::vector vNumTRDtracks; + std::vector vNumTPCtracks; + std::vector vNumTPCtracksHighPt; + + bool isGoodBC(int64_t globalBC, bool fillHistos = 0) + { + // kNoTimeFrameBorder + int64_t bcInTF = (globalBC - bcSOR) % nBCsPerTF; + if (fillHistos) + histos.fill(HIST("hBcInTFall"), bcInTF); + if (bcInTF < 300 || bcInTF > nBCsPerTF - 4000) + return 0; + if (fillHistos) + histos.fill(HIST("hBcInTFcut"), bcInTF); + // kNoITSROFrameBorder + uint16_t bcInITSROF = (globalBC + nBCsPerOrbit - offsetITSROF) % nBCsPerITSROF; + if (fillHistos) + histos.fill(HIST("hBcInITSROFall"), bcInITSROF); + if (bcInITSROF < 10 || bcInITSROF > nBCsPerITSROF - 20) + return 0; + if (fillHistos) + histos.fill(HIST("hBcInITSROFcut"), bcInITSROF); + return 1; + } + + void init(InitContext&) + { + if (metadataInfo.isFullyDefined()) { + if (!metadataInfo.isMC()) { + doprocessMC.value = false; + } + } + + const AxisSpec axisNcontrib{isLowFlux ? 200 : 8000, 0., isLowFlux ? 200. : 8000., "n contributors"}; + const AxisSpec axisColTimeRes{1500, 0., 1500., "collision time resolution (ns)"}; + const AxisSpec axisFraction{1000, 0., 1., ""}; + const AxisSpec axisBcDiff{800, -400., 400., "bc diff"}; + const AxisSpec axisBcs{nBCsPerOrbit, 0., static_cast(nBCsPerOrbit), "bc"}; + const AxisSpec axisMultT0C{200, 0., isLowFlux ? 2000. : 60000., "Rec. mult. T0C"}; + const AxisSpec axisZvtxDiff{200, -20., 20., "Zvtx difference, cm"}; + const AxisSpec axisTime{600, -25., 35., "Time, ns"}; + const AxisSpec axisPt{100, 0., 10., "p_{T}, GeV"}; + + histos.add("hTimeT0AHighMultT0C", "", kTH1F, {axisTime}); + histos.add("hTimeT0CHighMultT0C", "", kTH1F, {axisTime}); + histos.add("hTimeV0AHighMultT0C", "", kTH1F, {axisTime}); + histos.add("hTimeFDAHighMultT0C", "", kTH1F, {axisTime}); + histos.add("hTimeFDCHighMultT0C", "", kTH1F, {axisTime}); + + histos.add("hRecMultT0C", "", kTH1D, {axisMultT0C}); + + histos.add("hRecMultT0CvsNcontrib", "", kTH2D, {axisMultT0C, axisNcontrib}); + histos.add("hRecMultT0CvsNcontribTPC", "", kTH2D, {axisMultT0C, axisNcontrib}); + histos.add("hRecMultT0CvsNcontribTOF", "", kTH2D, {axisMultT0C, axisNcontrib}); + histos.add("hRecMultT0CvsNcontribTRD", "", kTH2D, {axisMultT0C, axisNcontrib}); + histos.add("hRecMultT0CvsNcontribTPCHighPt", "", kTH2D, {axisMultT0C, axisNcontrib}); + + histos.add("hBCsITS", "", kTH1F, {axisBcs}); + + histos.add("hNcontribCandidatesHighPt", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribCountsHighPt", "", kTH1F, {axisNcontrib}); + + histos.add("hNcontribCandidates", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribCounts", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribSigma", "", kTH2F, {axisNcontrib, axisColTimeRes}); + + histos.add("hNcontribAll", "", kTH1F, {axisNcontrib}); + + histos.add("hNcontribCol", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColTOF", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColTRD", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColTPC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColITS", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColTPCHighPt", "", kTH1F, {axisNcontrib}); + + histos.add("hNcontribAcc", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccTOF", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccTRD", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccTPC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccITS", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAccTPCHighPt", "", kTH1F, {axisNcontrib}); + + histos.add("hTrackBcDiffVsPt", "", kTH2F, {axisPt, axisBcDiff}); + histos.add("hTrackBcResVsPt", "", kTH2F, {axisPt, axisBcDiff}); + + histos.add("hColBcDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("hColBcDiffVsNcontribTOF", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("hColBcDiffVsNcontribTRD", "", kTH2F, {axisNcontrib, axisBcDiff}); + histos.add("hColBcDiffVsNcontribTPC", "", kTH2F, {axisNcontrib, axisBcDiff}); + + histos.add("hZvtxDiffVsNcontrib", "", kTH2F, {axisNcontrib, axisZvtxDiff}); + histos.add("hZvtxDiffVsNcontribTOF", "", kTH2F, {axisNcontrib, axisZvtxDiff}); + histos.add("hZvtxDiffVsNcontribTPC", "", kTH2F, {axisNcontrib, axisZvtxDiff}); + histos.add("hZvtxDiffVsNcontribTRD", "", kTH2F, {axisNcontrib, axisZvtxDiff}); + + histos.add("hNcontribUnambiguous", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribUnambiguousTOF", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribUnambiguousTRD", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribUnambiguousTPC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribUnambiguousITS", "", kTH1F, {axisNcontrib}); + + histos.add("hNcontribMis", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribMisTOF", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribMisTRD", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribMisTPC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribMisITS", "", kTH1F, {axisNcontrib}); + + histos.add("hNcontribColMostlyOk", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkTOF", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkTPC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkTRD", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkITS", "", kTH1F, {axisNcontrib}); + + histos.add("hNcontribColMostlyOkMis", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkMisTOF", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkMisTPC", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkMisTRD", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribColMostlyOkMisITS", "", kTH1F, {axisNcontrib}); + + histos.add("hNcontribAllContribAll", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAllContribWrong", "", kTH1F, {axisNcontrib}); + histos.add("hNcontribAllFractionWrong", "", kTH2F, {axisNcontrib, axisFraction}); + histos.add("hNcontribTvxMostlyOk", "", kTH1F, {axisNcontrib}); + } + + 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; + } + + void process(aod::Collisions const& cols, FullTracksIU const& tracks, BCsRun3 const& bcs, aod::FT0s const& ft0s, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*FDDs*/) + { + int run = bcs.iteratorAt(0).runNumber(); + if (run != lastRun) { + lastRun = run; + auto runDuration = ccdb->getRunDuration(run, true); + int64_t tsSOR = runDuration.first; + auto grplhcif = ccdb->getForTimeStamp("GLO/Config/GRPLHCIF", tsSOR); + bcPatternB = grplhcif->getBunchFilling().getBCPattern(); + + auto ctpx = ccdb->getForTimeStamp>("CTP/Calib/OrbitReset", tsSOR); + int64_t tsOrbitReset = (*ctpx)[0]; + uint32_t nOrbitsPerTF = run < 534133 ? 128 : 32; + int64_t orbitSOR = (tsSOR * 1000 - tsOrbitReset) / o2::constants::lhc::LHCOrbitMUS; + orbitSOR = orbitSOR / nOrbitsPerTF * nOrbitsPerTF; + bcSOR = orbitSOR * nBCsPerOrbit + customOrbitOffset * nBCsPerOrbit; + nBCsPerTF = nOrbitsPerTF * nBCsPerOrbit; + nBCsPerITSROF = (run >= 543437 && run <= 545367) ? 594 : 198; + const AxisSpec axisBcDiff{800, -400., 400., "bc diff"}; + const AxisSpec axisBcsInTF{nBCsPerTF, 0., static_cast(nBCsPerTF), "bc"}; + const AxisSpec axisBcsInITSROF{nBCsPerITSROF, 0., static_cast(nBCsPerITSROF), "bc"}; + histos.add("hBcInTFall", "", kTH1F, {axisBcsInTF}); + histos.add("hBcInTFcut", "", kTH1F, {axisBcsInTF}); + histos.add("hBcInITSROFall", "", kTH1F, {axisBcsInITSROF}); + histos.add("hBcInITSROFcut", "", kTH1F, {axisBcsInITSROF}); + + histos.add("hBcInTFITS", "", kTH1F, {axisBcsInTF}); + histos.add("hBcInTFTPC", "", kTH1F, {axisBcsInTF}); + + histos.add("hBcInITSROFITS", "", kTH1F, {axisBcsInITSROF}); + histos.add("hBcInITSROFTPC", "", kTH1F, {axisBcsInITSROF}); + + histos.add("hBcInITSROFTPCDiff", "", kTH2F, {axisBcsInITSROF, axisBcDiff}); + } + + int nCols = cols.size(); + vFoundBCindex.resize(nCols); + vNumITStracks.resize(nCols); + vNumTOFtracks.resize(nCols); + vNumTRDtracks.resize(nCols); + vNumTPCtracks.resize(nCols); + vNumTPCtracksHighPt.resize(nCols); + std::fill(vFoundBCindex.begin(), vFoundBCindex.end(), -1); + std::fill(vNumITStracks.begin(), vNumITStracks.end(), 0); + std::fill(vNumTOFtracks.begin(), vNumTOFtracks.end(), 0); + std::fill(vNumTRDtracks.begin(), vNumTRDtracks.end(), 0); + std::fill(vNumTPCtracks.begin(), vNumTPCtracks.end(), 0); + std::fill(vNumTPCtracksHighPt.begin(), vNumTPCtracksHighPt.end(), 0); + + std::vector> vTPCtracksPts(cols.size()); + std::vector> vTOFtracksTimes(cols.size()); + std::vector> vTPCtracksTimes(cols.size()); + std::vector> vITStracksTimes(cols.size()); + std::vector> vTPCtracksTimeRes(cols.size()); + + std::vector vTOFtracksSumWeightedTimes(cols.size(), 0); + std::vector vTRDtracksSumWeightedTimes(cols.size(), 0); + std::vector vTPCtracksSumWeightedTimes(cols.size(), 0); + std::vector vITStracksSumWeightedTimes(cols.size(), 0); + std::vector vTOFtracksSumWeights(cols.size(), 0); + std::vector vTRDtracksSumWeights(cols.size(), 0); + std::vector vTPCtracksSumWeights(cols.size(), 0); + std::vector vITStracksSumWeights(cols.size(), 0); + std::vector vMinTimeTOFtracks(cols.size(), 10000); + std::vector vMaxTimeTOFtracks(cols.size(), -10000); + std::vector vWeightedSigma(cols.size(), 0); + std::map mapGlobalBcWithT0B; + std::map mapGlobalBcWithTVX; + std::map mapGlobalBcVtxZ; + std::map mapGlobalBcMultT0C; + std::map mapGlobalBcVtxZ2; + + int nBCs = bcs.size(); + std::vector vGlobalBCs(nBCs, 0); + + for (auto& bc : bcs) { + vGlobalBCs[bc.globalIndex()] = bc.globalBC(); + } + + for (auto& ft0 : ft0s) { + auto bc = ft0.bc_as(); + int64_t globalBC = bc.globalBC(); + // remove noise from non-colliding bcs + if (removeNoncollidingBCs && bcPatternB[globalBC % o2::constants::lhc::LHCMaxBunches] == 0) + continue; + if (ft0.triggerMask() & BIT(o2::ft0::Triggers::bitVertex)) { + mapGlobalBcWithTVX[globalBC] = bc.globalIndex(); + mapGlobalBcVtxZ[globalBC] = ft0.posZ(); + mapGlobalBcVtxZ2[globalBC] = ft0.posZ(); + mapGlobalBcMultT0C[globalBC] = ft0.sumAmpC(); + } + if (fabs(ft0.timeA()) < 1 && fabs(ft0.timeC()) < 1) { + mapGlobalBcWithT0B[globalBC] = bc.globalIndex(); + } + } + + for (auto& track : tracks) { + // DataFormats/Detectors/GlobalTracking/include/DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h + // Time for different track types: + // ITS-TPC-TRD-TOF: time from TOF +/- 10 ns + // ITS-TPC-TRD: time from TRD +/- 5 ns + // ITS-TPC: time from ITS-TPC matching + + // ITS and colId requirements are redundant for contributors + int32_t colId = track.collisionId(); + + if (!track.isPVContributor() || colId < 0 || !track.hasITS()) + continue; + + float trackPt = track.pt(); + float trackTime = track.trackTime(); + float trackTimeRes = track.trackTimeRes(); + float w = 1. / (trackTimeRes * trackTimeRes); + if (track.hasTOF()) { + vTOFtracksTimes[colId].push_back(trackTime); + vNumTOFtracks[colId]++; + vTOFtracksSumWeightedTimes[colId] += trackTime * w; + vTOFtracksSumWeights[colId] += w; + if (vMinTimeTOFtracks[colId] > trackTime) + vMinTimeTOFtracks[colId] = trackTime; + if (vMaxTimeTOFtracks[colId] < trackTime) + vMaxTimeTOFtracks[colId] = trackTime; + } else if (track.hasTRD()) { + vNumTRDtracks[colId]++; + vTRDtracksSumWeightedTimes[colId] += trackTime * w; + vTRDtracksSumWeights[colId] += w; + } else if (track.hasTPC()) { + vTPCtracksPts[colId].push_back(trackPt); + vTPCtracksTimes[colId].push_back(trackTime); + vTPCtracksTimeRes[colId].push_back(trackTimeRes); + vNumTPCtracks[colId]++; + if (trackPt > 1) + vNumTPCtracksHighPt[colId]++; + vTPCtracksSumWeightedTimes[colId] += trackTime * w; + vTPCtracksSumWeights[colId] += w; + } else { + vITStracksTimes[colId].push_back(trackTime); + vNumITStracks[colId]++; + vITStracksSumWeightedTimes[colId] += trackTime * w; + vITStracksSumWeights[colId] += w; + } + } + + for (auto& col : cols) { + int32_t colId = col.globalIndex(); + + if (vNumTOFtracks[colId] == 0) + continue; + auto bc = col.bc_as(); + int64_t globalBC = bc.globalBC(); + + // todo: bypass ambiguous collisions with TOF tracks pointing to different bcs + // float weightedTime = vTOFtracksSumWeightedTimes[colId] / vTOFtracksSumWeights[colId]; + + // TOF track time median calculation using std::nth_element + auto& vTOFtracks = vTOFtracksTimes[colId]; + int median = vTOFtracks.size() / 2; + std::nth_element(vTOFtracks.begin(), vTOFtracks.begin() + median, vTOFtracks.end()); + float medianTime = vTOFtracks[median]; + + // int64_t tofGlobalBC = globalBC + TMath::Nint(weightedTime / bcNS); + int64_t tofGlobalBC = globalBC + TMath::Nint(medianTime / bcNS); + + int32_t foundBC = findClosest(tofGlobalBC, mapGlobalBcWithTVX); + int64_t foundGlobalBC = bcs.iteratorAt(foundBC).globalBC(); + // todo: check what to do if foundBC is too far from tofGlobalBC + if (fabs(foundGlobalBC - tofGlobalBC) > deltaBCforTOFcollisions) { + foundBC = -1; + int32_t nContrib = col.numContrib(); + if (nContrib > 100) { + int32_t foundBCwithT0B = findClosest(tofGlobalBC, mapGlobalBcWithT0B); + int64_t foundGlobalBCwithT0B = bcs.iteratorAt(foundBCwithT0B).globalBC(); + + LOGP(info, "Total number of TOF tracks: {}", vTOFtracks.size()); + LOGP(info, "Median time: {}", medianTime); + LOGP(info, "globalBC: {}", globalBC % 3564); + LOGP(info, "TOF global BC: {}", tofGlobalBC % 3564); + LOGP(info, "Found global BC: {}", foundGlobalBC % 3564); + LOGP(info, "Found global BC with T0B: {}", foundGlobalBCwithT0B % 3564); + sort(vTOFtracks.begin(), vTOFtracks.end()); + for (float t : vTOFtracks) { + LOGP(info, " {}", t); + } + } + } + + vFoundBCindex[colId] = foundBC; + if (removeTOFmatches && foundBC >= 0) { + mapGlobalBcVtxZ.erase(foundGlobalBC); + } + } + + // second loop to match collisions with high-pt ITS-TPC tracks + for (auto& col : cols) { + int32_t colId = col.globalIndex(); + if (vNumTOFtracks[colId] > 0) + continue; + if (vNumTPCtracksHighPt[colId] == 0) + continue; + + auto bc = col.bc_as(); + int64_t globalBC = bc.globalBC(); + float sumTime = 0; + int nTracks = 0; + for (uint32_t i = 0; i < vTPCtracksTimes[colId].size(); ++i) { + if (vTPCtracksPts[colId][i] < 1.0) + continue; + sumTime += vTPCtracksTimes[colId][i]; + nTracks++; + } + if (nTracks == 0) { + LOGP(info, "Warning: nTracks = 0"); + continue; + } + + int64_t deltaBC = deltaBCforHighPtTracks; + int64_t tpcGlobalBC = globalBC + TMath::Nint(sumTime / nTracks / bcNS); + int64_t minBC = tpcGlobalBC - deltaBC; + int64_t maxBC = tpcGlobalBC + deltaBC; + int32_t nContrib = col.numContrib(); + float zVtxCol = col.posZ(); + float zVtxSigma = 2.7 * pow(nContrib, -0.466) + 0.024; + zVtxSigma += 1.0; // additional uncertainty due to imperfectections of FT0 time calibration + + // todo: check upper bound + auto itMin = mapGlobalBcVtxZ.lower_bound(minBC); + auto itMax = mapGlobalBcVtxZ.upper_bound(maxBC); + + float bestChi2 = 1e+10; + int64_t globalBcBest = 0; + + int nCandidates = 0; + for (std::map::iterator it = itMin; it != itMax; ++it) { + float zVtxFT0 = it->second; + float zVtxDiff = zVtxFT0 - zVtxCol; + float bcDiff = tpcGlobalBC - globalBC; + float chi2 = 0; + chi2 += useVtxDiff ? pow(zVtxDiff / zVtxSigma, 2) : 0.; + chi2 += useTimeDiff ? pow(bcDiff / (deltaBCforHighPtTracks / 3.), 2) : 0.; + + if (chi2 < bestChi2) { + bestChi2 = chi2; + globalBcBest = it->first; + } + nCandidates++; + } + histos.fill(HIST("hNcontribCandidatesHighPt"), nContrib, nCandidates); + histos.fill(HIST("hNcontribCountsHighPt"), nContrib); + + if (globalBcBest != 0) + vFoundBCindex[colId] = mapGlobalBcWithTVX[globalBcBest]; + + if (removeHighPtmatches && vFoundBCindex[colId] >= 0) + mapGlobalBcVtxZ.erase(globalBC); + } // second loop + + // third loop to match collisions with poor time resolution + for (auto& col : cols) { + int32_t colId = col.globalIndex(); + if (vNumTOFtracks[colId] > 0) + continue; + if (vNumTPCtracks[colId] == 0) + continue; + if (vFoundBCindex[colId] >= 0) // found in the previous step + continue; + + auto bc = col.bc_as(); + int64_t globalBC = bc.globalBC(); + + float weightedTime = vTPCtracksSumWeightedTimes[colId] / vTPCtracksSumWeights[colId]; + float weightedSigma = sqrt(1. / vTPCtracksSumWeights[colId]); + + int64_t minROF = 0; + int64_t maxROF = 0; + if (useITSROFconstraint) { + float medianTime = 0; + auto vTPCtracks = vTPCtracksTimes[colId]; + int median = vTPCtracks.size() / 2; + std::nth_element(vTPCtracks.begin(), vTPCtracks.begin() + median, vTPCtracks.end()); + medianTime = vTPCtracks[median]; + + int64_t itsGlobalBC = globalBC + TMath::Nint(medianTime / bcNS); + minROF = (itsGlobalBC - offsetITSROF) / nBCsPerITSROF * nBCsPerITSROF + offsetITSROF; + maxROF = minROF + nBCsPerITSROF; + LOGP(debug, "{} {}", minROF, maxROF); + float sumTime = 0; + float sumW = 0; + for (uint32_t i = 0; i < vTPCtracksTimes[colId].size(); ++i) { + float trackTime = vTPCtracksTimes[colId][i]; + int64_t trackGlobalBC = globalBC + TMath::Nint(trackTime / bcNS); + LOGP(debug, " {}", trackGlobalBC); + if (trackGlobalBC < minROF || trackGlobalBC > maxROF) + continue; + float r = vTPCtracksTimeRes[colId][i]; + float w = 1. / (r * r); + sumTime += trackTime * w; + sumW += w; + } + weightedTime = sumTime / sumW; + weightedSigma = sqrt(1. / sumW); + } + + int64_t deltaBC = std::ceil(weightedSigma / bcNS * 3); + int64_t tpcGlobalBC = globalBC + TMath::Nint(weightedTime / bcNS); + + LOGP(debug, "{} {}", tpcGlobalBC, deltaBC); + + deltaBC += additionalDeltaBC; + + if (minimumDeltaBC >= 0) { + deltaBC = deltaBC < minimumDeltaBC ? minimumDeltaBC : deltaBC; + } + + int64_t minBC = tpcGlobalBC - deltaBC; + int64_t maxBC = tpcGlobalBC + deltaBC; + + if (useITSROFconstraint) { + minBC = minBC < minROF ? minROF : minBC; + maxBC = maxBC > maxROF ? maxROF : maxBC; + if (minBC > maxBC) { + LOGP(debug, "{} {} {} {}", minBC, maxBC, minROF, maxROF); + continue; + } + } + + int32_t nContrib = col.numContrib(); + float zVtxCol = col.posZ(); + float zVtxSigma = 2.7 * pow(nContrib, -0.466) + 0.024; + zVtxSigma += 1.0; // additional uncertainty due to imperfectections of FT0 time calibration + + // QA + vWeightedSigma[colId] = weightedSigma; + + // todo: check upper bound + auto itMin = mapGlobalBcVtxZ.lower_bound(minBC); + auto itMax = mapGlobalBcVtxZ.upper_bound(maxBC); + + float bestChi2 = 1e+10; + int64_t globalBcBest = 0; + + int nCandidates = 0; + for (std::map::iterator it = itMin; it != itMax; ++it) { + float zVtxFT0 = it->second; + float zVtxDiff = zVtxFT0 - zVtxCol; + float timeDiff = bcNS * (tpcGlobalBC - globalBC); + float chi2 = 0; + chi2 += useVtxDiff ? pow(zVtxDiff / zVtxSigma, 2) : 0.; + chi2 += useTimeDiff ? pow(timeDiff / weightedSigma, 2) : 0.; + + if (chi2 < bestChi2) { + bestChi2 = chi2; + globalBcBest = it->first; + } + nCandidates++; + } + if (nCandidates > 100) + LOGP(info, "{} {}", minBC, maxBC); + + histos.fill(HIST("hNcontribCandidates"), nContrib, nCandidates); + histos.fill(HIST("hNcontribCounts"), nContrib); + + if (globalBcBest != 0) + vFoundBCindex[colId] = mapGlobalBcWithTVX[globalBcBest]; + + } // third loop + + // QA + for (auto& ft0 : ft0s) { + auto bc = ft0.bc_as(); + int64_t globalBC = bc.globalBC(); + // remove noise from non-colliding bcs + if (removeNoncollidingBCs && bcPatternB[globalBC % o2::constants::lhc::LHCMaxBunches] == 0) + continue; + if (!(ft0.triggerMask() & BIT(o2::ft0::Triggers::bitVertex))) + continue; + float multT0C = ft0.sumAmpC(); + histos.fill(HIST("hRecMultT0C"), ft0.sumAmpC()); + if (multT0C < 1800) + continue; + histos.fill(HIST("hTimeT0AHighMultT0C"), ft0.timeA()); + histos.fill(HIST("hTimeT0CHighMultT0C"), ft0.timeC()); + if (bc.has_fv0a()) { + auto fv0 = bc.fv0a(); + histos.fill(HIST("hTimeV0AHighMultT0C"), fv0.time()); + } + if (bc.has_fdd()) { + auto fdd = bc.fdd(); + histos.fill(HIST("hTimeFDAHighMultT0C"), fdd.timeA()); + histos.fill(HIST("hTimeFDCHighMultT0C"), fdd.timeC()); + } + } + + for (auto& col : cols) { + int64_t globalBC = col.bc_as().globalBC(); + if (!isGoodBC(globalBC, 1)) + continue; + + int32_t colId = col.globalIndex(); + int32_t nContrib = col.numContrib(); + // float timeRes = col.collisionTimeRes(); + int32_t foundBC = vFoundBCindex[colId]; + bool isGoodTOF = vMaxTimeTOFtracks[colId] - vMinTimeTOFtracks[colId] < 50; + bool isFoundTVX = foundBC >= 0; + + float zVtxDiff = 1e+10; + float multT0C = 0; + int64_t foundGlobalBC = 0; + + if (foundBC >= 0 && foundBC < bcs.size()) { + auto bc = bcs.iteratorAt(foundBC); + foundGlobalBC = bc.globalBC(); + // LOGP(info,"{}",bc.has_ft0()); + if (bc.has_ft0()) { + zVtxDiff = bc.ft0().posZ() - col.posZ(); + multT0C = bc.ft0().sumAmpC(); + } + } + + histos.fill(HIST("hNcontribAll"), nContrib); + if (removeColsWithAmbiguousTOF && !isGoodTOF) { + continue; + } + + histos.fill(HIST("hNcontribCol"), nContrib); + if (isFoundTVX) { + histos.fill(HIST("hNcontribAcc"), nContrib); + histos.fill(HIST("hRecMultT0CvsNcontrib"), multT0C, nContrib); + histos.fill(HIST("hZvtxDiffVsNcontrib"), nContrib, zVtxDiff); + } + + // search for nearest ft0a&ft0c entry + int32_t indexClosestTVX = findClosest(globalBC, mapGlobalBcWithTVX); + int bcDiff = static_cast(globalBC - vGlobalBCs[indexClosestTVX]); + histos.fill(HIST("hColBcDiffVsNcontrib"), nContrib, bcDiff); + + if (vNumTOFtracks[colId] > 0) { + histos.fill(HIST("hNcontribColTOF"), nContrib); + if (isFoundTVX) { + histos.fill(HIST("hNcontribAccTOF"), nContrib); + histos.fill(HIST("hRecMultT0CvsNcontribTOF"), multT0C, nContrib); + histos.fill(HIST("hZvtxDiffVsNcontribTOF"), nContrib, zVtxDiff); + } + histos.fill(HIST("hColBcDiffVsNcontribTOF"), nContrib, bcDiff); + + for (uint32_t i = 0; i < vTPCtracksTimes[colId].size(); i++) { + float pt = vTPCtracksPts[colId][i]; + auto t = vTPCtracksTimes[colId][i]; + int foundBCinITSROF = (foundGlobalBC + nBCsPerOrbit - offsetITSROF) % nBCsPerITSROF; + int64_t tpcTrackGlobalBC = globalBC + TMath::Nint(t / bcNS); + int64_t deltaBC = tpcTrackGlobalBC - foundGlobalBC; + histos.fill(HIST("hBcInITSROFTPCDiff"), foundBCinITSROF, deltaBC); + histos.fill(HIST("hTrackBcDiffVsPt"), pt, deltaBC); + histos.fill(HIST("hTrackBcResVsPt"), pt, vTPCtracksTimeRes[colId][i] / bcNS); + } + } else if (vNumTPCtracksHighPt[colId] > 0) { + histos.fill(HIST("hNcontribColTPCHighPt"), nContrib); + if (isFoundTVX) { + histos.fill(HIST("hNcontribAccTPCHighPt"), nContrib); + histos.fill(HIST("hRecMultT0CvsNcontribTPCHighPt"), multT0C, nContrib); + } + } else if (vNumTPCtracks[colId] > 0) { + histos.fill(HIST("hNcontribSigma"), nContrib, vWeightedSigma[colId]); + histos.fill(HIST("hNcontribColTPC"), nContrib); + histos.fill(HIST("hColBcDiffVsNcontribTPC"), nContrib, bcDiff); + if (nContrib > 180) { + histos.fill(HIST("hBcInTFTPC"), (globalBC - bcSOR) % nBCsPerTF); + histos.fill(HIST("hBcInITSROFTPC"), (globalBC + nBCsPerOrbit - offsetITSROF) % nBCsPerITSROF); + } + if (isFoundTVX) { + histos.fill(HIST("hNcontribAccTPC"), nContrib); + histos.fill(HIST("hRecMultT0CvsNcontribTPC"), multT0C, nContrib); + histos.fill(HIST("hZvtxDiffVsNcontribTPC"), nContrib, zVtxDiff); + } + } else if (vNumTRDtracks[colId] > 0) { + histos.fill(HIST("hNcontribColTRD"), nContrib); + if (isFoundTVX) { + histos.fill(HIST("hNcontribAccTRD"), nContrib); + histos.fill(HIST("hRecMultT0CvsNcontribTRD"), multT0C, nContrib); + histos.fill(HIST("hZvtxDiffVsNcontribTRD"), nContrib, zVtxDiff); + } + histos.fill(HIST("hColBcDiffVsNcontribTRD"), nContrib, bcDiff); + } else if (vNumITStracks[colId] > 0) { + histos.fill(HIST("hNcontribColITS"), nContrib); + if (nContrib > 180) { + histos.fill(HIST("hBcInTFITS"), (globalBC - bcSOR) % nBCsPerTF); + histos.fill(HIST("hBcInITSROFITS"), (globalBC + nBCsPerOrbit - offsetITSROF) % nBCsPerITSROF); + } + + if (isFoundTVX) + histos.fill(HIST("hNcontribAccITS"), nContrib); + } + } + } + + void processMC( + aod::McCollisions const& mcCols, + soa::Join const& cols, + FullTracksIUwithLabels const& tracks, + BCsRun3 const& /*bcs*/, + aod::FT0s const& /*ft0s*/, + aod::McParticles const& mcParts) + { + + std::vector vLabel(cols.size(), -1); + std::vector vIsAmbiguousLabel(cols.size(), 0); + std::vector vNumWrongContributors(cols.size(), 0); + + for (auto& track : tracks) { + if (!track.isPVContributor()) + continue; + int32_t colId = track.collisionId(); + auto col = cols.iteratorAt(colId); + int32_t mcColIdFromCollision = col.mcCollisionId(); + if (mcColIdFromCollision < 0) + continue; + int mcId = track.mcParticleId(); + if (mcId < 0 || mcId >= mcParts.size()) + continue; + auto mcPart = mcParts.iteratorAt(mcId); + int32_t mcColId = mcPart.mcCollisionId(); + if (mcColId < 0) + continue; + if (mcColIdFromCollision != mcColId) + vNumWrongContributors[colId]++; + + if (vLabel[colId] != -1 && vLabel[colId] != mcColId) { + vIsAmbiguousLabel[colId] = 1; + } + vLabel[colId] = mcColId; + } + + for (auto& col : cols) { + int64_t globalBC = col.bc_as().globalBC(); + if (!isGoodBC(globalBC)) + continue; + + int32_t colId = col.globalIndex(); + int32_t nContrib = col.numContrib(); + + histos.fill(HIST("hNcontribAllContribAll"), nContrib, nContrib); + histos.fill(HIST("hNcontribAllContribWrong"), nContrib, vNumWrongContributors[colId]); + histos.fill(HIST("hNcontribAllFractionWrong"), nContrib, static_cast(vNumWrongContributors[colId]) / nContrib); + + if (static_cast(vNumWrongContributors[colId]) / nContrib > 0.1) + continue; + + histos.fill(HIST("hNcontribColMostlyOk"), nContrib); + if (vNumTOFtracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkTOF"), nContrib); + } else if (vNumTPCtracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkTPC"), nContrib); + } else if (vNumTRDtracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkTRD"), nContrib); + } else if (vNumITStracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkITS"), nContrib); + } + + int32_t foundBC = vFoundBCindex[colId]; + int32_t mcColId = vLabel[colId]; + auto mcCol = mcCols.iteratorAt(mcColId); + auto mcBC = mcCol.bc_as(); + // int64_t mcGlobalBC = mcBC.globalBC(); + bool isMcTVX = mcBC.has_ft0() ? mcBC.ft0().triggerMask() & BIT(o2::ft0::Triggers::bitVertex) : 0; + if (isMcTVX) + histos.fill(HIST("hNcontribTvxMostlyOk"), nContrib); + + if (foundBC >= 0 && foundBC != mcBC.globalIndex()) { + // Analyse mismatches + histos.fill(HIST("hNcontribColMostlyOkMis"), nContrib); + if (vNumTOFtracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkMisTOF"), nContrib); + } else if (vNumTPCtracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkMisTPC"), nContrib); + } else if (vNumTRDtracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkMisTRD"), nContrib); + } else if (vNumITStracks[colId] > 0) { + histos.fill(HIST("hNcontribColMostlyOkMisITS"), nContrib); + } + } + + if (vIsAmbiguousLabel[colId]) + continue; + + histos.fill(HIST("hNcontribUnambiguous"), nContrib); + if (vNumTOFtracks[colId] > 0) { + histos.fill(HIST("hNcontribUnambiguousTOF"), nContrib); + } else if (vNumTPCtracks[colId] > 0) { + histos.fill(HIST("hNcontribUnambiguousTPC"), nContrib); + } else if (vNumTRDtracks[colId] > 0) { + histos.fill(HIST("hNcontribUnambiguousTRD"), nContrib); + } else if (vNumITStracks[colId] > 0) { + histos.fill(HIST("hNcontribUnambiguousITS"), nContrib); + } + + if (foundBC >= 0 && foundBC != mcBC.globalIndex()) { + // Analyse mismatches + histos.fill(HIST("hNcontribMis"), nContrib); + if (vNumTOFtracks[colId] > 0) { + histos.fill(HIST("hNcontribMisTOF"), nContrib); + } else if (vNumTPCtracks[colId] > 0) { + histos.fill(HIST("hNcontribMisTPC"), nContrib); + } else if (vNumTRDtracks[colId] > 0) { + histos.fill(HIST("hNcontribMisTRD"), nContrib); + } else if (vNumITStracks[colId] > 0) { + histos.fill(HIST("hNcontribMisITS"), nContrib); + } + } + } + } + + PROCESS_SWITCH(MatchingQaTask, processMC, "", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + // Parse the metadata + metadataInfo.initMetadata(cfgc); + + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/DPG/Tasks/AOTEvent/rofOccupancyQa.cxx b/DPG/Tasks/AOTEvent/rofOccupancyQa.cxx new file mode 100644 index 00000000000..9e82e498585 --- /dev/null +++ b/DPG/Tasks/AOTEvent/rofOccupancyQa.cxx @@ -0,0 +1,1357 @@ +// 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/ConfigParamSpec.h" +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/CCDB/EventSelectionParams.h" +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/LHCConstants.h" +#include "Framework/HistogramRegistry.h" +// #include "DataFormatsParameters/GRPLHCIFData.h" +#include "ITSMFTBase/DPLAlpideParam.h" +#include "DataFormatsParameters/AggregatedRunInfo.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::aod::evsel; + +using BCsWithBcSelsRun3 = soa::Join; +using FullTracksIU = soa::Join; +const double bcNS = o2::constants::lhc::LHCBunchSpacingNS; + +struct RofOccupancyQaTask { + // 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"}; + Configurable confTimeRangeVetoOnCollStandard{"TimeRangeVetoOnCollStandard", 10.0, "Exclusion of a collision if there are other collisions nearby, +/- us"}; + Configurable confTimeRangeVetoOnCollNarrow{"TimeRangeVetoOnCollNarrow", 2.0, "Exclusion of a collision if there are other collisions nearby, +/- us"}; + Configurable confNtracksCutVetoOnCollInTimeRange{"NtracksCutVetoOnCollInTimeRange", 800, "Max allowed N tracks (PV contributors) for each nearby collision in +/- time range"}; + Configurable confEpsilonDistanceForVzDependentVetoTPC{"EpsilonDistanceForVzDependentVetoTPC", 2.5, "Epsilon for vZ-dependent veto on drifting TPC tracks from nearby collisions, cm"}; + // Configurable confNtracksCutVetoOnCollInROF{"NtracksCutVetoOnCollInROF", 500, "Max allowed N tracks (PV contributors) for each nearby collision inside this ITS ROF"}; + Configurable confFT0CamplCutVetoOnCollInROF{"FT0CamplPerCollCutVetoOnCollInROF", 5000, "Max allowed FT0C amplitude for each nearby collision inside this ITS ROF"}; + Configurable confEpsilonVzDiffVetoInROF{"EpsilonVzDiffVetoInROF", 0.3, "Minumum distance to nearby collisions along z inside this ITS ROF, cm"}; + Configurable confUseWeightsForOccupancyVariable{"UseWeightsForOccupancyEstimator", 1, "Use or not the delta-time weights for the occupancy estimator"}; + + Configurable confFactorForHistRange{"kFactorForHistRange", 1.0, "To change axes b/n pp and Pb-Pb"}; + + 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 + + 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 + + void init(InitContext&) + { + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + 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}}); + histos.add("hOccupancyByTrInROF", "", kTH1D, {{250, 0., 25000 * k}}); + histos.add("hOccupancyByFT0C_vs_ByTracks", "", kTH2D, {{500, 0., 25000 * k}, {500, 0., 2.5e5 * k}}); + histos.add("hOccupancyByFT0C_vs_ByTracks_vZ_TF_ROF_border_cuts", "", kTH2D, {{500, 0., 25000 * k}, {500, 0., 2.5e5 * k}}); + histos.add("hOccupancyByFT0C_vs_ByTracks_afterNarrowDeltaTimeCut", "", kTH2D, {{500, 0., 25000 * k}, {500, 0., 2.5e5 * k}}); + histos.add("hOccupancyByFT0C_vs_ByTracks_afterStrictDeltaTimeCut", "", kTH2D, {{500, 0., 25000 * k}, {500, 0., 2.5e5 * k}}); + histos.add("hOccupancyByFT0C_vs_ByTracks_afterStandardDeltaTimeCut", "", kTH2D, {{500, 0., 25000 * k}, {500, 0., 2.5e5 * k}}); + histos.add("hOccupancyByFT0C_vs_ByTracks_afterVzDependentDeltaTimeCut", "", kTH2D, {{500, 0., 25000 * k}, {500, 0., 2.5e5 * k}}); + + histos.add("hOccupancyByTracks_CROSSCHECK", "", kTH1D, {{250, 0., 25000 * k}}); + histos.add("hOccupancyByFT0C_CROSSCHECK", "", kTH1D, {{250, 0., 2.5e5 * k}}); + + // this ev nITStr vs FT0C + 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/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("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_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/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/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("hThisEvITStr_vs_vZcut", "", kTH2D, {{200, 0., 10.}, {200, 0., 8000 * k}}); + histos.add("hThisEvITSTPCtr_vs_vZcut", "", kTH2D, {{200, 0., 10.}, {200, 0., 5000 * k}}); + + 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.}}); + histos.add("hDeltaVzGivenCollAbove100NearbyBelow100", "", kTH1D, {{1600, -40, 40.}}); + histos.add("hDeltaVzGivenCollBelow100NearbyAbove100", "", kTH1D, {{1600, -40, 40.}}); + histos.add("hDeltaVzAfterAllCuts", "", kTH1D, {{1600, -40, 40.}}); + + // + histos.add("hDeltaVzVsDeltaTime1", "", kTH2D, {{400, -25, 25}, {100, -20, 20}}); + histos.add("hDeltaVzVsDeltaTime2", "", kTH2D, {{400, -25, 25}, {100, -20, 20}}); + histos.add("hDeltaVzVsDeltaTime3", "", kTH2D, {{400, -25, 25}, {100, -20, 20}}); + histos.add("hDeltaVzVsDeltaTime4", "", kTH2D, {{400, -25, 25}, {100, -20, 20}}); + + histos.add("hEtaVz02", "", kTH1D, {{500, -2.5, 2.5}}); + histos.add("hEtaVzPlus10", "", kTH1D, {{500, -2.5, 2.5}}); + 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}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterStrictDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterStrictDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterStrictDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterStrictDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterStandardDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterStandardDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterStandardDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterStandardDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterVzDependentDeltaTimeCut/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterVzDependentDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("afterVzDependentDeltaTimeCut/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("afterVzDependentDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStrict/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStrict/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStrict/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStrict/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStandard/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStandard/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStandard/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofStandard/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTPCTr_vs_occupancyByTracks", "", kTH2D, {{250, 0., 25000 * k}, {250, 0., 8000}}); + histos.add("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + histos.add("NarrowDeltaCut_StdTimeAndRofCuts/hThisEvITSTPCTr_vs_occupancyByFT0C", "", kTH2D, {{250, 0., 2.5e5 * k}, {250, 0., 8000}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF", "", kTH2D, {{250, 0., 12000 * k}, {250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyInROF", "", kTH2D, {{250, 0., 12000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF", "", kTH2D, {{250, 0., 12000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyInROF", "", kTH2D, {{250, 0., 12000 * k}, {250, 0., 8000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_HasNeighbours", "", kTH2D, {{250, 0., 12000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_HasNeighbours", "", kTH2D, {{250, 0., 12000 * k}, {250, 0., 8000 * k}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInROF_HasNeighbours", "", kTH2D, {{250, 0., 12000 * k}, {250, 0., 8000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyFT0CInROF", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 8000 * k}}); + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTPCTr_vs_occupancyFT0CInROF", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyFT0CInROF", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTPCTr_vs_occupancyFT0CInROF", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 8000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 8000 * k}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 8000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 100000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 100000 * k}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 100000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInROF_2coll", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvFT0C_vs_occupancyFT0CInROF_2coll", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 100000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvFT0C_vs_occupancyFT0CInROF_2coll", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 100000 * k}}); + histos.add("kNoCollInRofWithCloseVz/hThisEvFT0C_vs_occupancyFT0CInROF_2coll", "", kTH2D, {{250, 0., 100000 * k}, {250, 0., 100000 * k}}); + + histos.add("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInAnotherEarlierROF_1collPerROF", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + histos.add("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInAnotherEarlierROF_1collPerROF", "", kTH2D, {{250, 0., 8000 * k}, {250, 0., 8000 * k}}); + // histos.add("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInAnotherEarlierROF_1collPerROF", "", kTH2D, {{250, 0., 8000*k}, {250, 0., 8000*k}}); + + 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}}); + + 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., 20000 * 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}}); + + 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, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeNarrow", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeStrict", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeStandard", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeRangeVzDependent", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInRofStrict", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInRofStandard", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStandard", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStrict", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + histos.add("nPV_vs_occupancyByTracks/NoCollInTimeAndRofStrict_vZ_5cm", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 25000 * k}}); + + histos.add("nPV_vs_occupancyByFT0C/sel8", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeNarrow", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeStrict", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeStandard", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeRangeVzDependent", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInRofStrict", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInRofStandard", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStandard", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStrict", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + histos.add("nPV_vs_occupancyByFT0C/NoCollInTimeAndRofStrict_vZ_5cm", "", kTH2D, {{250, 0., 8000 * k}, {100, 0., 2.5e5 * k}}); + } + + 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(ColEvSels const& cols, FullTracksIU const&, BCsWithBcSelsRun3 const& bcs, aod::FT0s const&) + { + int run = bcs.iteratorAt(0).runNumber(); + // extract bc pattern from CCDB for data or anchored MC only + if (run != lastRun && run >= 500000) { + lastRun = run; + auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run); + // first bc of the first orbit + bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches; + // duration of TF in bcs + nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches; + + // extract ITS ROF parameters + 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); + } + + 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 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 + std::vector vIsVertexITSTPC(cols.size(), 0); // at least one of vertex contributors is ITS-TPC track + 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 vFoundBCindex(cols.size(), -1); // indices of found bcs + std::vector vFoundGlobalBC(cols.size(), 0); // global BCs for collisions + + 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); + + 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 over collisions - collecting info + for (auto& col : cols) { + int32_t colIndex = col.globalIndex(); + // 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.*/); + + int bcInTF = col.bcInTF(); //(bc.globalBC() - bcSOR) % nBCsPerTF; + vIsFullInfoForOccupancy[colIndex] = ((bcInTF - 300) * bcNS > -timeWinOccupancyCalcMinNS) && ((nBCsPerTF - 4000 - bcInTF) * bcNS > timeWinOccupancyCalcMaxNS) ? true : false; + + // 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()); + + for (auto& track : colPvTracks) { + 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.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()) { + vIsVertexTOFmatched[colIndex] = 1; + } + } + + 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]); + } + } + + // 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]); + } + 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]); + } + + 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]); + } + + 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]); + } + } + + // 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]); + } + + 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 + std::vector> vCollsInTimeWin; + std::vector> vCollsInSameITSROF; + std::vector> vTimeDeltaForColls; // delta time wrt a given collision + for (auto& col : cols) { + int32_t colIndex = col.globalIndex(); + int64_t foundGlobalBC = vFoundGlobalBC[colIndex]; + + // int bcInTF = (foundGlobalBC - bcSOR) % nBCsPerTF; + // int bcInITSROF = (foundGlobalBC + 3564 - rofOffset) % rofLength; + int64_t TFid = (foundGlobalBC - bcSOR) / nBCsPerTF; + int64_t rofId = (foundGlobalBC + 3564 - rofOffset) / rofLength; + // int rofIdInTF = (bcInTF - rofOffset) / rofLength; + + // ### in-ROF occupancy + std::vector vAssocToSameROF; + // find all collisions in the same ROF before a given collision + int32_t 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; + // int thisRofIdInTF = (thisBC - rofOffset) / rofLength; + int64_t thisRofId = (thisBC + 3564 - rofOffset) / rofLength; + + // check if we are within the same ROF + if (thisRofId != rofId) + break; + vAssocToSameROF.push_back(minColIndex); + minColIndex--; + } + // find all collisions in the same ROF after the current one + int32_t maxColIndex = colIndex + 1; + while (maxColIndex < cols.size()) { + int64_t thisBC = vFoundGlobalBC[maxColIndex]; + 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); + maxColIndex++; + } + vCollsInSameITSROF.push_back(vAssocToSameROF); + + // ### occupancy in time windows + std::vector vAssocToThisCol; + std::vector vCollsTimeDeltaWrtGivenColl; + // protection against the TF borders + if (!vIsFullInfoForOccupancy[colIndex]) { + vCollsInTimeWin.push_back(vAssocToThisCol); + vTimeDeltaForColls.push_back(vCollsTimeDeltaWrtGivenColl); + continue; + } + // find all collisions in time window before the current one + 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; + float dt = (thisBC - foundGlobalBC) * bcNS; // ns + // check if we are within the chosen time range + if (dt < timeWinOccupancyCalcMinNS) + break; + vAssocToThisCol.push_back(minColIndex); + vCollsTimeDeltaWrtGivenColl.push_back(dt); + minColIndex--; + } + // find all collisions in time window after the current one + maxColIndex = colIndex + 1; + while (maxColIndex < cols.size()) { + int64_t thisBC = vFoundGlobalBC[maxColIndex]; + int64_t thisTFid = (thisBC - bcSOR) / nBCsPerTF; + if (thisTFid != TFid) + break; + float dt = (thisBC - foundGlobalBC) * bcNS; // ns + if (dt > timeWinOccupancyCalcMaxNS) + break; + vAssocToThisCol.push_back(maxColIndex); + vCollsTimeDeltaWrtGivenColl.push_back(dt); + maxColIndex++; + } + vCollsInTimeWin.push_back(vAssocToThisCol); + vTimeDeltaForColls.push_back(vCollsTimeDeltaWrtGivenColl); + } + + // perform the occupancy calculation per ITS ROF and also in the pre-defined time window + std::vector vNumTracksITS567inFullTimeWin(cols.size(), 0); // counter of tracks in full time window for occupancy studies (excluding given event) + std::vector vSumAmpFT0CinFullTimeWin(cols.size(), 0); // sum of FT0C of tracks in full time window for occupancy studies (excluding given event) + std::vector vNumTracksITS567inROF(cols.size(), 0); // counter of tracks in given ROF (excluding given event) + std::vector vSumAmpFT0CinROF(cols.size(), 0); // counter of tracks in given ROF (excluding given event) + std::vector vNumCollinROF(cols.size(), 0); // counter of tracks in given ROF (excluding given event) + std::vector vNumCollinROFinVz10(cols.size(), 0); // counter of tracks in given ROF (excluding given event) + std::vector vInROFcollIndex(cols.size(), 0); // counter of tracks in given ROF (excluding given event) + std::vector vROFidThisColl(cols.size(), 0); // counter of tracks in given ROF (excluding given event) + + std::vector vNoCollInTimeRangeStrict(cols.size(), 0); // no collisions in a specified time range + std::vector vNoCollInTimeRangeNarrow(cols.size(), 0); // no collisions in a specified time range (narrow) + std::vector vNoHighMultCollInTimeRange(cols.size(), 0); // no high-mult collisions in a specified time range + std::vector vNoCollInVzDependentTimeRange(cols.size(), 0); // no collisions in a vZ-dependent time range + + 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> vArrNoCollInSameRofWithCloseVz; //(cols.size(), 0); // to veto events with nearby collisions with close vZ + + for (auto& col : cols) { + int32_t colIndex = col.globalIndex(); + float vZ = col.posZ(); + + // QA: + if (vAmpFT0CperColl[colIndex] > 5000) { + histos.fill(HIST("hThisEvITStr_vs_vZ"), vZ, vTracksITS567perColl[colIndex]); + histos.fill(HIST("hThisEvITSTPCtr_vs_vZ"), vZ, vTracksITSTPCperColl[colIndex]); + } + + // ### in-ROF occupancy + // int64_t rofId = (vFoundGlobalBC[colIndex] + 3564 - rofOffset) / rofLength; + // 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]); + // 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); + + std::vector vAssocToSameROF = vCollsInSameITSROF[colIndex]; + int nITS567tracksForRofVetoStrict = 0; // to veto events with other collisions in the same ITS ROF + float nSumAmplFT0CforRofVetoStrict = 0; // to veto events with other collisions in the same ITS ROF + // int nITS567tracksForRofVetoStandard = 0; // to veto events with other collisions in the same ITS ROF, with per-collision multiplicity above threshold + 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 + int nArrITS567tracksForRofVetoOnCloseVz[200] = {}; // to veto events with nearby collisions with close vZ + vNumCollinROF[colIndex] = 1; + vInROFcollIndex[colIndex] = 0; + vROFidThisColl[colIndex] = rofIdInTF; + + if (fabs(vZ) < 10) + vNumCollinROFinVz10[colIndex]++; + for (uint32_t iCol = 0; iCol < vAssocToSameROF.size(); iCol++) { + int thisColIndex = vAssocToSameROF[iCol]; + // int64_t thisRofId = (vFoundGlobalBC[thisColIndex] + 3564 - rofOffset) / rofLength; + // int thisBcInTF = (vFoundGlobalBC[thisColIndex] - bcSOR) % nBCsPerTF; + int thisBcInITSROF = (vFoundGlobalBC[thisColIndex] + 3564 - rofOffset) % rofLength; + // int thisRofIdInTF = (vFoundGlobalBC[thisColIndex] + 3564 - rofOffset) / rofLength; + // auto bcAssoc = bcs.iteratorAt(vFoundBCindex[thisColIndex]); + // LOGP(info, ">> assoc: bc={} bcInTF={} bcInITSROF={} rofId={} noROFborder={}", vFoundGlobalBC[thisColIndex], thisBcInTF, thisBcInITSROF, thisRofId, bcAssoc.selection_bit(kNoITSROFrameBorder)); + // LOGP(info, ">> assoc: bcInTF={} bcInITSROF={} rofIdInTF={} noROFborder={} vZ={} mult={}", thisBcInTF, thisBcInITSROF, thisRofIdInTF, bcAssoc.selection_bit(kNoITSROFrameBorder), vCollVz[thisColIndex], vTracksITS567perColl[thisColIndex]); + + // if (fabs(vTracksITS567perColl[thisColIndex]) > confNtracksCutVetoOnCollInROF) + 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 (vTracksITS567perColl[thisColIndex] > confNtracksCutVetoOnCollInROF) + // nITS567tracksForRofVetoStandard += vTracksITS567perColl[thisColIndex]; + + if (vAmpFT0CperColl[thisColIndex] > confFT0CamplCutVetoOnCollInROF) + nCollsInRofWithFT0CAboveVetoStandard++; + + if (fabs(vCollVz[thisColIndex] - vZ) < confEpsilonVzDiffVetoInROF) + nITS567tracksForRofVetoOnCloseVz += vTracksITS567perColl[thisColIndex]; + for (int i = 0; i < 200; i++) { + // if (fabs(vCollVz[thisColIndex] - vZ) < 0.05 * i && vTracksITS567perColl[thisColIndex] > 50) + // if (vTracksITS567perColl[colIndex]>100 && vTracksITS567perColl[colIndex]<1000 && + if (vAmpFT0CperColl[colIndex] > 4000 && vAmpFT0CperColl[colIndex] < 15000 && + (vCollVz[thisColIndex] - vZ) > 0.05 * i && fabs(vCollVz[thisColIndex] - vZ) < (0.1 + 0.05) * i && vTracksITS567perColl[thisColIndex] > 20) // 0.05 * (i + 1)) + // fabs(vCollVz[thisColIndex] - vZ) < 0.05 * i && vTracksITS567perColl[thisColIndex] > 30) // 0.05 * (i + 1)) + nArrITS567tracksForRofVetoOnCloseVz[i]++; + } + + if (fabs(vZ) < 10) { + histos.fill(HIST("hDeltaVz"), vCollVz[thisColIndex] - vZ); + if (vTracksITS567perColl[colIndex] >= 100 && vTracksITS567perColl[thisColIndex] < 100) + histos.fill(HIST("hDeltaVzGivenCollAbove100NearbyBelow100"), vCollVz[thisColIndex] - vZ); + if (vTracksITS567perColl[colIndex] <= 100 && vTracksITS567perColl[thisColIndex] > 100) + histos.fill(HIST("hDeltaVzGivenCollBelow100NearbyAbove100"), vCollVz[thisColIndex] - vZ); + if (vTracksITS567perColl[colIndex] > 20 && vTracksITS567perColl[thisColIndex] > 20) + 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) + vSumAmpFT0CinROF[colIndex] = nSumAmplFT0CforRofVetoStrict; // occupancy in ROF (excluding a given collision) + + // in-ROF occupancy flags + vNoCollInSameRofStrict[colIndex] = (nITS567tracksForRofVetoStrict == 0); + // vNoCollInSameRofStandard[colIndex] = (nITS567tracksForRofVetoStandard == 0); + vNoCollInSameRofStandard[colIndex] = (nCollsInRofWithFT0CAboveVetoStandard == 0); + vNoCollInSameRofWithCloseVz[colIndex] = (nITS567tracksForRofVetoOnCloseVz == 0); + + std::vector vVzCutThisColl; + + // ### occupancy in time windows + // protection against TF borders + if (!vIsFullInfoForOccupancy[colIndex]) { // occupancy in undefined (too close to TF borders) + vNumTracksITS567inFullTimeWin[colIndex] = -1; + vSumAmpFT0CinFullTimeWin[colIndex] = -1; + // vNumTracksITS567inROF[colIndex] = -1; + vArrNoCollInSameRofWithCloseVz.push_back(vVzCutThisColl); + continue; + } + std::vector vAssocToThisCol = vCollsInTimeWin[colIndex]; + std::vector vCollsTimeDeltaWrtGivenColl = vTimeDeltaForColls[colIndex]; + int nITS567tracksInFullTimeWindow = 0; + int sumAmpFT0CInFullTimeWindow = 0; + int nITS567tracksForVetoNarrow = 0; // to veto events with nearby collisions (narrower range) + int nITS567tracksForVetoStrict = 0; // to veto events with nearby collisions + int nITS567tracksForVetoStandard = 0; // to veto events with per-collision multiplicity above threshold + int nITS567tracksForVetoVzDependent = 0; // to veto events with nearby collisions, vZ-dependent time cut + 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 + wOccup = 0; + if (dt >= -40 && dt < -5) // collisions in the past + wOccup = 1. / 1225 * (dt + 40) * (dt + 40); + else if (dt >= -5 && dt < 15) // collisions near a given one + wOccup = 1; + // else if (dt >= 15 && dt < 100) // collisions from the future + // wOccup = -1. / 85 * dt + 20. / 17; + else if (dt >= 15 && dt < 40) // collisions from the future + wOccup = -0.4 / 25 * dt + 1.24; + 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.fill(HIST("hOccupancyWeights"), dt, wOccup); + } + nITS567tracksInFullTimeWindow += wOccup * vTracksITS567perColl[thisColIndex]; + sumAmpFT0CInFullTimeWindow += wOccup * vAmpFT0CperColl[thisColIndex]; + + // counting tracks from other collisions in fixed time windows + if (fabs(dt) < confTimeRangeVetoOnCollNarrow) + nITS567tracksForVetoNarrow += vTracksITS567perColl[thisColIndex]; + if (fabs(dt) < confTimeRangeVetoOnCollStandard) + nITS567tracksForVetoStrict += vTracksITS567perColl[thisColIndex]; + + // if (fabs(dt) < confTimeRangeVetoOnCollStandard + 0.5) { // add 0.5 us safety margin + // standard cut on other collisions vs delta-times + const float driftV = 2.5; // drift velocity in cm/us, TPC drift_length / drift_time = 250 cm / 100 us + if (fabs(dt) < 2.0) { // us, complete veto on other collisions + nITS567tracksForVetoStandard += vTracksITS567perColl[thisColIndex]; + } else if (dt > -4.0 && dt <= -2.0) { // us, strict veto to suppress fake ITS-TPC matches more + if (vTracksITS567perColl[thisColIndex] > confNtracksCutVetoOnCollInTimeRange / 5) + nITS567tracksForVetoStandard += vTracksITS567perColl[thisColIndex]; + } else if (fabs(dt) < 10 + fabs(vZ) / driftV) { // loose veto, 8 us corresponds to maximum possible |vZ|, which is ~20 cm + // counting number of other collisions with mult above threshold + if (vTracksITS567perColl[thisColIndex] > confNtracksCutVetoOnCollInTimeRange) + nITS567tracksForVetoStandard += vTracksITS567perColl[thisColIndex]; + } + // vZ-dependent time cut to avoid collinear tracks from other collisions (experimental) + if (fabs(dt) < 10 + fabs(vZ) / driftV) { + if (dt < 0) { + // check distance between given vZ and (moving in two directions) vZ of drifting tracks from past collisions + if ((fabs(vCollVz[thisColIndex] - fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC) || + (fabs(vCollVz[thisColIndex] + fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC)) + nITS567tracksForVetoVzDependent += vTracksITS567perColl[thisColIndex]; + + // FOR QA: + if (fabs(vCollVz[thisColIndex] - fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC) + histos.fill(HIST("hDeltaVzVsDeltaTime1"), vCollVz[thisColIndex] - fabs(dt) * driftV - vZ, dt); + if (fabs(vCollVz[thisColIndex] + fabs(dt) * driftV - vZ) < confEpsilonDistanceForVzDependentVetoTPC) + 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 + if ((fabs(vZ - dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC) || + (fabs(vZ + dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC)) + nITS567tracksForVetoVzDependent += vTracksITS567perColl[thisColIndex]; + + // FOR QA: + if (fabs(vZ - dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC) + histos.fill(HIST("hDeltaVzVsDeltaTime3"), vZ - dt * driftV - vCollVz[thisColIndex], dt); + if (fabs(vZ + dt * driftV - vCollVz[thisColIndex]) < confEpsilonDistanceForVzDependentVetoTPC) + histos.fill(HIST("hDeltaVzVsDeltaTime4"), vZ + dt * driftV - vCollVz[thisColIndex], dt); + } + } + } + vNumTracksITS567inFullTimeWin[colIndex] = nITS567tracksInFullTimeWindow; // occupancy by ITS tracks (without a current collision) + vSumAmpFT0CinFullTimeWin[colIndex] = sumAmpFT0CInFullTimeWindow; // occupancy by FT0C (without a current collision) + // occupancy flags based on nearby collisions + vNoCollInTimeRangeNarrow[colIndex] = (nITS567tracksForVetoNarrow == 0); + vNoCollInTimeRangeStrict[colIndex] = (nITS567tracksForVetoStrict == 0); + vNoHighMultCollInTimeRange[colIndex] = (nITS567tracksForVetoStandard == 0); + vNoCollInVzDependentTimeRange[colIndex] = (nITS567tracksForVetoVzDependent == 0); + + for (int i = 0; i < 200; i++) + vVzCutThisColl.push_back(nArrITS567tracksForRofVetoOnCloseVz[i] == 0); + vArrNoCollInSameRofWithCloseVz.push_back(vVzCutThisColl); + } + + for (auto& col : cols) { + int32_t colIndex = col.globalIndex(); + 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.fill(HIST("hColCounterAcc"),Form("%d", bc.runNumber()), 1); + if (vInROFcollIndex[colIndex] == 0) + 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 (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 (occTracks >= 0) + histos.fill(HIST("hOccupancyByTracks_CROSSCHECK"), occTracks); + if (occFT0C >= 0) + histos.fill(HIST("hOccupancyByFT0C_CROSSCHECK"), occFT0C); + + if (vNumTracksITS567inFullTimeWin[colIndex] >= 0) { + histos.fill(HIST("hOccupancyByTracks"), vNumTracksITS567inFullTimeWin[colIndex]); + histos.fill(HIST("hOccupancyByFT0C"), vSumAmpFT0CinFullTimeWin[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()) < 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.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.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.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.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.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.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + if (vNumTracksITS567inROF[colIndex] > 0) + histos.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"), vNumTracksITS567inROF[colIndex], 1.0 * vTracksITS567perColl[colIndex] / vNumTracksITS567inROF[colIndex]); + + } else { + 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.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.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.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + if (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.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.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.fill(HIST("vZ_TF_ROF_border_cuts/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex], 1.0 * vTracksITS567perColl[colIndex - 1] / vTracksITS567perColl[colIndex]); + } + } + } + } + } + + if (vNoCollInTimeRangeNarrow[colIndex]) + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterNarrowDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + if (vNoCollInTimeRangeStrict[colIndex]) + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterStrictDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + if (vNoHighMultCollInTimeRange[colIndex]) + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterStandardDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + if (vNoCollInVzDependentTimeRange[colIndex]) + histos.fill(HIST("hOccupancyByFT0C_vs_ByTracks_afterVzDependentDeltaTimeCut"), vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]); + + // same-event 2D correlations: + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/vZ_TF_ROF_border_cuts"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + + if (vNoCollInTimeRangeNarrow[colIndex]) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterNarrowDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (vNoCollInTimeRangeStrict[colIndex]) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterStrictDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (vNoHighMultCollInTimeRange[colIndex]) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterStandardDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (vNoCollInVzDependentTimeRange[colIndex]) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/afterVzDependentDeltaTimeCut"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + + if (vNoCollInSameRofStrict[colIndex]) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofStrict"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (vNoCollInSameRofStandard[colIndex]) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofStandard"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + if (vNoCollInSameRofWithCloseVz[colIndex]) + histos.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/kNoCollInRofWithCloseVz"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + + // CROSS CHECK WITH SEL BITS: + 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.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.fill(HIST("hThisEvITSTr_vs_ThisEvFT0C/NarrowDeltaCut_StdTimeAndRofCuts"), vAmpFT0CperColl[colIndex], vTracksITS567perColl[colIndex]); + + if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) { + 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.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/vZ_TF_ROF_border_cuts"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + + if (vNoCollInTimeRangeNarrow[colIndex]) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterNarrowDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + if (vNoCollInTimeRangeStrict[colIndex]) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterStrictDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + if (vNoHighMultCollInTimeRange[colIndex]) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterStandardDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + if (vNoCollInVzDependentTimeRange[colIndex]) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/afterVzDependentDeltaTimeCut"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + + if (vNoCollInSameRofStrict[colIndex]) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofStrict"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + if (vNoCollInSameRofStandard[colIndex]) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofStandard"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + if (vNoCollInSameRofWithCloseVz[colIndex]) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/kNoCollInRofWithCloseVz"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + + if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + + if (vNoCollInTimeRangeNarrow[colIndex] && vNoHighMultCollInTimeRange[colIndex] && vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) { + histos.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/NarrowDeltaCut_StdTimeAndRofCuts"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + if (vNumTracksITS567inFullTimeWin[colIndex] < 2000) + 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.fill(HIST("hThisEvITSTPCTr_vs_ThisEvITStr/occupBelow2000_StrictDeltaTimeCutAndRofCuts"), vTracksITS567perColl[colIndex], vTracksITSTPCperColl[colIndex]); + } + + // vZ bins to tune vZthresh cut + if (vNoCollInTimeRangeNarrow[colIndex]) { + + for (int i = 0; i < 200; i++) { + if (fabs(col.posZ()) < 8 && !vArrNoCollInSameRofWithCloseVz[colIndex][i]) { + 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]); + } + } + } + + // ### this event vs Occupancy 2D histos + // if (vAmpFT0CperColl[colIndex] > 5000 && vAmpFT0CperColl[colIndex] < 10000) { + // if (vAmpFT0CperColl[colIndex] > 500) { + if (vAmpFT0CperColl[colIndex] > 0) { // 100) { + + if (vNoCollInTimeRangeNarrow[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.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.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); + + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + } + + if (vNumCollinROF[colIndex] == 2 && vNumCollinROFinVz10[colIndex] == 2 && vInROFcollIndex[colIndex] == 1) { + 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.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + if (vNumTracksITS567inROF[colIndex] > 0) + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins_RatioV2toV1"), vNumTracksITS567inROF[colIndex], 1.0 * vTracksITS567perColl[colIndex] / vNumTracksITS567inROF[colIndex]); + } else { + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInROF_2coll_XaxisWins"), vTracksITS567perColl[colIndex], vNumTracksITS567inROF[colIndex]); + if (vTracksITS567perColl[colIndex] > 0) + 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.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.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF"), vTracksITS567perColl[colIndex - 1], vTracksITS567perColl[colIndex]); + + if (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.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins_RatioV2toV1"), vTracksITS567perColl[colIndex - 1], 1.0 * vTracksITS567perColl[colIndex] / vTracksITS567perColl[colIndex - 1]); + } else { + histos.fill(HIST("afterNarrowDeltaTimeCut/hThisEvITSTr_vs_occupancyInPreviousROF_1collPerROF_XaxisWins"), vTracksITS567perColl[colIndex], vTracksITS567perColl[colIndex - 1]); + if (vTracksITS567perColl[colIndex] > 0) + 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.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.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.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.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.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.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.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyInROF_HasNeighbours"), vNumTracksITS567inROF[colIndex], vTracksITS567perColl[colIndex]); + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvITSTr_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vTracksITS567perColl[colIndex]); + + histos.fill(HIST("kNoCollInRofWithCloseVz/hThisEvFT0C_vs_occupancyFT0CInROF_HasNeighbours"), vSumAmpFT0CinROF[colIndex], vAmpFT0CperColl[colIndex]); + } + + if (vNumCollinROF[colIndex] == 2 && vNumCollinROFinVz10[colIndex] == 2 && vInROFcollIndex[colIndex] == 1) { + 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.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]); + } + } + } + } + } + } + + PROCESS_SWITCH(RofOccupancyQaTask, processRun3, "Process Run3 ROF occupancy QA", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& 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 9848784bbda..78aeb2be252 100644 --- a/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx +++ b/DPG/Tasks/AOTTrack/PID/HMPID/qaHMPID.cxx @@ -28,8 +28,6 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -54,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); @@ -147,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/qaPIDTOFEvTime.cxx b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx index a6e501f88ed..e5ca7df21cc 100644 --- a/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx +++ b/DPG/Tasks/AOTTrack/PID/TOF/qaPIDTOFEvTime.cxx @@ -455,13 +455,12 @@ struct tofPidCollisionTimeQa { continue; } const auto& collisionMC = collision.mcCollision_as(); - const int64_t bcMCtime = static_cast((collisionMC.t() + 2.f) / o2::constants::lhc::LHCBunchSpacingNS); - const float eventtimeMC = (collisionMC.t() - bcMCtime * o2::constants::lhc::LHCBunchSpacingNS) * 1000.f; + const float eventtimeMC = collisionMC.t() * 1000.f; if (trk.has_mcParticle()) { const auto& particle = trk.mcParticle(); const auto& mcCollTimeMinusFormationTime = particle.vt() - collisionMC.t(); - const auto& mcTOFvalue = trk.tofSignal() - eventtimeMC - trk.tofExpTime(2); + const auto& mcTOFvalue = trk.tofSignal() - eventtimeMC - trk.tofExpTimePi(); LOG(debug) << "Track " << particle.vt() << " vs " << eventtimeMC; switch (particle.pdgCode()) { case 211: diff --git a/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCMC.cxx b/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCMC.cxx index e99f6a9116c..993c2f7b24c 100644 --- a/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCMC.cxx +++ b/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCMC.cxx @@ -303,6 +303,7 @@ struct pidTpcQaMc { histos.add(hnsigmaMCmat[mcID * Np + massID].data(), Form("True Secondary %s from material", pT[mcID]), HistType::kTH2F, {ptAxis, nSigmaAxis}); if constexpr (mcID == massID) { + histos.add(hsignalMC[mcID].data(), Form("%s", pT[mcID]), HistType::kTH2F, {pAxis, signalAxis}); histos.add(hsignalMCprm[mcID].data(), Form("Primary %s", pT[mcID]), HistType::kTH2F, {pAxis, signalAxis}); histos.add(hsignalMCstr[mcID].data(), Form("Secondary %s from decay", pT[mcID]), HistType::kTH2F, {pAxis, signalAxis}); histos.add(hsignalMCmat[mcID].data(), Form("Secondary %s from material", pT[mcID]), HistType::kTH2F, {pAxis, signalAxis}); diff --git a/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx b/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx index bbae2f60cd5..bc80df4b71a 100644 --- a/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx +++ b/DPG/Tasks/AOTTrack/PID/TPC/qaPIDTPCSignal.cxx @@ -281,7 +281,7 @@ struct tpcPidQaSignal { void processNoEvSel(soa::Filtered const& tracks, aod::Collisions const& collisions) { histos.fill(HIST("event/evsel"), 1, collisions.size()); - LOG(info) << "Processing " << collisions.size() << " collisions with " << tracks.size() << " tracks"; + LOG(debug) << "Processing " << collisions.size() << " collisions with " << tracks.size() << " tracks"; processTracks(tracks); } PROCESS_SWITCH(tpcPidQaSignal, processNoEvSel, "Process without event selection", true); @@ -290,7 +290,7 @@ struct tpcPidQaSignal { void processMoreTrkSel(soa::Filtered> const& tracks, aod::Collisions const& collisions) { histos.fill(HIST("event/evsel"), 1, collisions.size()); - LOG(info) << "Processing " << collisions.size() << " collisions with " << tracks.size() << " tracks"; + LOG(debug) << "Processing " << collisions.size() << " collisions with " << tracks.size() << " tracks"; processTracks(tracks); } PROCESS_SWITCH(tpcPidQaSignal, processMoreTrkSel, "Process without event selection", false); diff --git a/DPG/Tasks/AOTTrack/qaDcaMC.cxx b/DPG/Tasks/AOTTrack/qaDcaMC.cxx index a71bbff8dcd..4054c59b33a 100644 --- a/DPG/Tasks/AOTTrack/qaDcaMC.cxx +++ b/DPG/Tasks/AOTTrack/qaDcaMC.cxx @@ -110,7 +110,8 @@ struct QaDcaMc { 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 dcaBins{"dcaBins", {2000, -1.f, 1.f}, "DCA binning"}; + ConfigurableAxis dcaBinsxy{"dcaBinsxy", {500, -1.f, 1.f}, "DCAxy binning"}; + ConfigurableAxis dcaBinsz{"dcaBinsz", {100, -0.1f, 0.1f}, "DCAz binning"}; Configurable doPVContributorCut{"doPVContributorCut", false, "Select tracks used for primary vertex recostruction (isPVContributor)"}; // Histograms @@ -149,8 +150,8 @@ struct QaDcaMc { const AxisSpec axisEta{etaBins, "#it{#eta}"}; const AxisSpec axisY{yBins, "#it{y}"}; const AxisSpec axisPhi{phiBins, "#it{#varphi} (rad)"}; - const AxisSpec axisDCAxy{dcaBins, "DCA_{xy} (cm)"}; - const AxisSpec axisDCAz{dcaBins, "DCA_{z} (cm)"}; + const AxisSpec axisDCAxy{dcaBinsxy, "DCA_{xy} (cm)"}; + const AxisSpec axisDCAz{dcaBinsz, "DCA_{z} (cm)"}; const char* partName = particleName(pdgSign, id); LOG(info) << "Preparing histograms for particle: " << partName << " pdgSign " << pdgSign; diff --git a/DPG/Tasks/AOTTrack/qaFakeHits.cxx b/DPG/Tasks/AOTTrack/qaFakeHits.cxx index ee913462785..1da3a6a6674 100644 --- a/DPG/Tasks/AOTTrack/qaFakeHits.cxx +++ b/DPG/Tasks/AOTTrack/qaFakeHits.cxx @@ -114,7 +114,6 @@ struct QaFakeHits { const int histogramIndex = id + pdgSign * nSpecies; const TString tagPt = Form("%s ", partName); - hPtAll[histogramIndex] = histos.add(Form("MC/pdg%i/pt/all", PDGs[histogramIndex]), "All tracks " + tagPt, kTH1D, {axisPt}); hPtITS[histogramIndex] = histos.add(Form("MC/pdg%i/pt/mismatched/its", PDGs[histogramIndex]), "ITS mismatch " + tagPt, kTH1D, {axisPt}); hPtTPC[histogramIndex] = histos.add(Form("MC/pdg%i/pt/mismatched/tpc", PDGs[histogramIndex]), "TPC mismatch " + tagPt, kTH1D, {axisPt}); diff --git a/DPG/Tasks/AOTTrack/qaImpPar.cxx b/DPG/Tasks/AOTTrack/qaImpPar.cxx index 452e6448d70..fd5737ebbe8 100644 --- a/DPG/Tasks/AOTTrack/qaImpPar.cxx +++ b/DPG/Tasks/AOTTrack/qaImpPar.cxx @@ -65,12 +65,16 @@ struct QaImpactPar { ConfigurableAxis binningPhi{"binningPhi", {24, 0.f, TMath::TwoPi()}, "Phi binning"}; ConfigurableAxis binningPDG{"binningPDG", {5, -1.5f, 3.5f}, "PDG species binning (-1: not matched, 0: unknown, 1: pi, 2: K, 3: p)"}; ConfigurableAxis binningCharge{"binningCharge", {2, -2.f, 2.f}, "charge binning (-1: negative; +1: positive)"}; + ConfigurableAxis binningIuPosX{"binningIuPosX", {100, -10.f, 10.f}, "Track IU x position"}; + ConfigurableAxis binningIuPosY{"binningIuPosY", {100, -10.f, 10.f}, "Track IU y position"}; + ConfigurableAxis binningIuPosZ{"binningIuPosZ", {100, -10.f, 10.f}, "Track IU z position"}; ConfigurableAxis binsNumPvContrib{"binsNumPvContrib", {200, 0, 200}, "Number of original PV contributors"}; Configurable keepOnlyPhysPrimary{"keepOnlyPhysPrimary", false, "Consider only phys. primary particles (MC)"}; Configurable keepOnlyPvContrib{"keepOnlyPvContrib", false, "Consider only PV contributor tracks"}; // Configurable numberContributorsMin{"numberContributorsMin", 0, "Minimum number of contributors for the primary vertex"}; Configurable useTriggerkINT7{"useTriggerkINT7", false, "Use kINT7 trigger"}; Configurable usesel8{"usesel8", true, "Use or not the sel8() (T0A & T0C) event selection"}; + Configurable addTrackIUinfo{"addTrackIUinfo", false, "Add track parameters at inner most update"}; Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; Configurable zVtxMax{"zVtxMax", 10.f, "Maximum value for |z_vtx|"}; // Configurable keepOnlyGlobalTracks{"keepOnlyGlobalTracks", 1, "Keep only global tracks or not"}; @@ -108,6 +112,7 @@ struct QaImpactPar { Configurable keepAllTracksPVrefit{"keepAllTracksPVrefit", false, "Keep all tracks for PV refit (for debug)"}; Configurable use_customITSHitMap{"use_customITSHitMap", false, "Use custom ITS hitmap selection"}; Configurable customITShitmap{"customITShitmap", 0, "Custom ITS hitmap (consider the binary representation)"}; + Configurable customITShitmap_exclude{"customITShitmap_exclude", 0, "Custom ITS hitmap of layers to be excluded (consider the binary representation)"}; Configurable n_customMinITShits{"n_customMinITShits", 0, "Minimum number of layers crossed by a track among those in \"customITShitmap\""}; Configurable custom_forceITSTPCmatching{"custom_forceITSTPCmatching", false, "Consider or not only ITS-TPC macthed tracks when using custom ITS hitmap"}; @@ -125,15 +130,16 @@ 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; /// Histogram registry (from o2::framework) HistogramRegistry histograms{"HistogramsImpParQA"}; - bool isPIDPionApplied = ((nSigmaTPCPionMin > -10.001 && nSigmaTPCPionMax < 10.001) || (nSigmaTOFPionMin > -10.001 && nSigmaTOFPionMax < 10.001)); - bool isPIDKaonApplied = ((nSigmaTPCKaonMin > -10.001 && nSigmaTPCKaonMax < 10.001) || (nSigmaTOFKaonMin > -10.001 && nSigmaTOFKaonMax < 10.001)); - bool isPIDProtonApplied = ((nSigmaTPCProtonMin > -10.001 && nSigmaTPCProtonMax < 10.001) || (nSigmaTOFProtonMin > -10.001 && nSigmaTOFProtonMax < 10.001)); + bool isPIDPionApplied; + bool isPIDKaonApplied; + bool isPIDProtonApplied; // Needed for PV refitting Service ccdb; @@ -151,14 +157,16 @@ struct QaImpactPar { using trackFullTable = o2::soa::Join; + using trackTableIU = o2::soa::Join; void processData(o2::soa::Filtered::iterator& collision, const trackTable& tracksUnfiltered, const o2::soa::Filtered& tracks, + const trackTableIU& tracksIU, o2::aod::BCsWithTimestamps const&) { /// here call the template processReco function auto bc = collision.bc_as(); - processReco(collision, tracksUnfiltered, tracks, 0, bc); + processReco(collision, tracksUnfiltered, tracks, tracksIU, 0, bc); } PROCESS_SWITCH(QaImpactPar, processData, "process data", true); @@ -168,13 +176,14 @@ struct QaImpactPar { void processMC(o2::soa::Filtered::iterator& collision, trackTable const& tracksUnfiltered, o2::soa::Filtered const& tracks, + const trackTableIU& tracksIU, const o2::aod::McParticles& mcParticles, const o2::aod::McCollisions&, o2::aod::BCsWithTimestamps const&) { /// here call the template processReco function auto bc = collision.bc_as(); - processReco(collision, tracksUnfiltered, tracks, mcParticles, bc); + processReco(collision, tracksUnfiltered, tracks, tracksIU, mcParticles, bc); } PROCESS_SWITCH(QaImpactPar, processMC, "process MC", false); @@ -232,7 +241,7 @@ struct QaImpactPar { // } mRunNumber = -1; - /// Custom cut selection objects + /// Custom cut selection objects - ITS layers that must be present std::set set_customITShitmap; // = {}; if (use_customITSHitMap) { for (int index_ITSlayer = 0; index_ITSlayer < 7; index_ITSlayer++) { @@ -251,11 +260,33 @@ struct QaImpactPar { selector_ITShitmap.SetRequireHitsInITSLayers(n_customMinITShits, set_customITShitmap); } + /// Custom cut selection objects - ITS layers that must be absent + std::set set_customITShitmap_exclude; // = {}; + if (use_customITSHitMap) { + for (int index_ITSlayer = 0; index_ITSlayer < 7; index_ITSlayer++) { + if ((customITShitmap_exclude & (1 << index_ITSlayer)) > 0) { + set_customITShitmap_exclude.insert(static_cast(index_ITSlayer)); + } + } + LOG(info) << "### customITShitmap_exclude: " << customITShitmap_exclude; + LOG(info) << "### set_customITShitmap_exclude.size(): " << set_customITShitmap_exclude.size(); + LOG(info) << "### ITS layers to be excluded: "; + for (std::set::iterator it = set_customITShitmap_exclude.begin(); it != set_customITShitmap_exclude.end(); it++) { + LOG(info) << "Layer " << static_cast(*it) << " "; + } + LOG(info) << "############"; + + selector_ITShitmap.SetRequireNoHitsInITSLayers(set_customITShitmap_exclude); + } // tracks const AxisSpec trackPtAxis{binningPt, "#it{p}_{T} (GeV/#it{c})"}; + const AxisSpec trackPaxis{binningPt, "#it{p} (GeV/#it{c})"}; const AxisSpec trackEtaAxis{binningEta, "#it{#eta}"}; const AxisSpec trackPhiAxis{binningPhi, "#varphi"}; + const AxisSpec trackIUposXaxis{binningIuPosX, "x (cm)"}; + const AxisSpec trackIUposYaxis{binningIuPosY, "y (cm)"}; + const AxisSpec trackIUposZaxis{binningIuPosZ, "z (cm)"}; const AxisSpec trackImpParRPhiAxis{binningImpPar, "#it{d}_{r#it{#varphi}} (#mum)"}; const AxisSpec trackImpParZAxis{binningImpPar, "#it{d}_{z} (#mum)"}; const AxisSpec trackImpParRPhiPullsAxis{binningPulls, "#it{d}_{r#it{#varphi}} / #sigma(#it{d}_{r#it{#varphi}})"}; @@ -281,6 +312,10 @@ struct QaImpactPar { histograms.get(HIST("Reco/refitRun3"))->GetXaxis()->SetBinLabel(5, "hasTPC && hasITS"); histograms.add("Reco/h4ImpPar", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); histograms.add("Reco/h4ImpParZ", "", kTHnSparseD, {trackPtAxis, trackImpParZAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); + if (addTrackIUinfo) { + histograms.add("Reco/h4ImpParIU", "", kTHnSparseD, {trackPaxis, trackImpParRPhiAxis, trackIUposXaxis, trackIUposYaxis, trackIUposZaxis}); + histograms.add("Reco/h4ImpParZIU", "", kTHnSparseD, {trackPaxis, trackImpParZAxis, trackIUposXaxis, trackIUposYaxis, trackIUposZaxis}); + } // if(fEnablePulls && !doPVrefit) { // LOGF(fatal, ">>> dca errors not stored after track propagation at the moment. Use fEnablePulls only if doPVrefit!"); // } @@ -288,14 +323,17 @@ struct QaImpactPar { histograms.add("Reco/h4ImpParPulls", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiPullsAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); histograms.add("Reco/h4ImpParZPulls", "", kTHnSparseD, {trackPtAxis, trackImpParZPullsAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); } + isPIDPionApplied = ((nSigmaTPCPionMin > -10.001 && nSigmaTPCPionMax < 10.001) || (nSigmaTOFPionMin > -10.001 && nSigmaTOFPionMax < 10.001)); if (isPIDPionApplied) { histograms.add("Reco/h4ImpPar_Pion", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); histograms.add("Reco/h4ImpParZ_Pion", "", kTHnSparseD, {trackPtAxis, trackImpParZAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); } + isPIDKaonApplied = ((nSigmaTPCKaonMin > -10.001 && nSigmaTPCKaonMax < 10.001) || (nSigmaTOFKaonMin > -10.001 && nSigmaTOFKaonMax < 10.001)); if (isPIDKaonApplied) { histograms.add("Reco/h4ImpPar_Kaon", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); histograms.add("Reco/h4ImpParZ_Kaon", "", kTHnSparseD, {trackPtAxis, trackImpParZAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); } + isPIDProtonApplied = ((nSigmaTPCProtonMin > -10.001 && nSigmaTPCProtonMax < 10.001) || (nSigmaTOFProtonMin > -10.001 && nSigmaTOFProtonMax < 10.001)); if (isPIDProtonApplied) { histograms.add("Reco/h4ImpPar_Proton", "", kTHnSparseD, {trackPtAxis, trackImpParRPhiAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); histograms.add("Reco/h4ImpParZ_Proton", "", kTHnSparseD, {trackPtAxis, trackImpParZAxis, trackEtaAxis, trackPhiAxis, trackPDGAxis, trackChargeAxis, axisVertexNumContrib, trackIsPvContrib}); @@ -320,7 +358,7 @@ struct QaImpactPar { /// core template process function template void processReco(const C& collision, const trackTable& unfilteredTracks, const T& tracks, - const T_MC& /*mcParticles*/, + const trackTableIU& tracksIU, const T_MC& /*mcParticles*/, o2::aod::BCsWithTimestamps::iterator const& bc) { constexpr float toMicrometers = 10000.f; // Conversion from [cm] to [mum] @@ -441,6 +479,7 @@ struct QaImpactPar { /// loop over tracks float pt = -999.f; + float p = -999.f; float impParRPhi = -999.f; float impParZ = -999.f; float impParRPhiSigma = 999.f; @@ -451,6 +490,10 @@ struct QaImpactPar { float tofNSigmaPion = -999.f; float tofNSigmaKaon = -999.f; float tofNSigmaProton = -999.f; + float trackIuPosX = -999.f; + float trackIuPosY = -999.f; + float trackIuPosZ = -999.f; + std::array posXYZ = {-999.f, -999.f, -999.f}; int ntr = tracks.size(); int cnt = 0; for (const auto& track : tracks) { @@ -534,6 +577,7 @@ struct QaImpactPar { } pt = track.pt(); + p = track.p(); tpcNSigmaPion = track.tpcNSigmaPi(); tpcNSigmaKaon = track.tpcNSigmaKa(); tpcNSigmaProton = track.tpcNSigmaPr(); @@ -638,9 +682,26 @@ struct QaImpactPar { } } + /// retrive track position at inner most update + if (addTrackIUinfo) { + for (const auto& trackIU : tracksIU) { + if (trackIU.globalIndex() == track.globalIndex()) { + o2::track::TrackParCov trackIuParCov = getTrackParCov(trackIU); + trackIuParCov.getXYZGlo(posXYZ); + trackIuPosX = posXYZ[0]; + trackIuPosY = posXYZ[1]; + trackIuPosZ = posXYZ[2]; + } + } + } + /// all tracks histograms.fill(HIST("Reco/h4ImpPar"), pt, impParRPhi, track.eta(), track.phi(), pdgIndex, track.sign(), collision.numContrib(), track.isPVContributor()); histograms.fill(HIST("Reco/h4ImpParZ"), pt, impParZ, track.eta(), track.phi(), pdgIndex, track.sign(), collision.numContrib(), track.isPVContributor()); + if (addTrackIUinfo) { + histograms.fill(HIST("Reco/h4ImpParIU"), p, impParRPhi, trackIuPosX, trackIuPosY, trackIuPosZ); + histograms.fill(HIST("Reco/h4ImpParZIU"), p, impParZ, trackIuPosX, trackIuPosY, trackIuPosZ); + } if (fEnablePulls) { histograms.fill(HIST("Reco/h4ImpParPulls"), pt, impParRPhi / impParRPhiSigma, track.eta(), track.phi(), pdgIndex, track.sign(), collision.numContrib(), track.isPVContributor()); histograms.fill(HIST("Reco/h4ImpParZPulls"), pt, impParZ / impParZSigma, track.eta(), track.phi(), pdgIndex, track.sign(), collision.numContrib(), track.isPVContributor()); diff --git a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx index 6dd7f5ab79b..031315055f0 100644 --- a/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx +++ b/DPG/Tasks/TPC/tpcSkimsTableCreator.cxx @@ -61,6 +61,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()) || @@ -87,7 +90,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, @@ -129,11 +132,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) { @@ -181,37 +187,37 @@ 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])) { + 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); } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisElectrons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Electron])) { + 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); } } // 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])) { + 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); } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { + 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); } } // 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])) { + if (downsampleTsalisCharged(posTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { fillSkimmedV0Table(v0, posTrack, collision, posTrack.tpcNSigmaPr(), posTrack.tofNSigmaPr(), posTrack.tpcExpSignalPr(posTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr); } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisPions, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Pion])) { + 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); } } // 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])) { + 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); } - if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton])) { + if (downsampleTsalisCharged(negTrack.pt(), downsamplingTsalisProtons, sqrtSNN, o2::track::pid_constants::sMasses[o2::track::PID::Proton], maxPt4dwnsmplTsalisProtons)) { fillSkimmedV0Table(v0, negTrack, collision, negTrack.tpcNSigmaPr(), negTrack.tofNSigmaPr(), negTrack.tpcExpSignalPr(negTrack.tpcSignal()), o2::track::PID::Proton, runnumber, dwnSmplFactor_Pr); } } @@ -319,7 +325,7 @@ struct TreeWriterTPCTOF { const double bg = p / mass; const int multTPC = collision.multTPC(); - 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, 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..1ee50ada907 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/PWGJE/jetFilter.cxx b/EventFiltering/PWGJE/jetFilter.cxx index 60e67d39073..54c24ee627d 100644 --- a/EventFiltering/PWGJE/jetFilter.cxx +++ b/EventFiltering/PWGJE/jetFilter.cxx @@ -286,13 +286,13 @@ struct jetFilter { tags(keepEvent[kJetChLowPt], keepEvent[kJetChHighPt], keepEvent[kTrackLowPt], keepEvent[kTrackHighPt]); } - void processWithoutRho(soa::Join::iterator const& collision, o2::aod::ChargedJets const& jets, soa::Filtered const& tracks) + void processWithoutRho(soa::Join::iterator const& collision, o2::aod::ChargedJets const& jets, soa::Filtered const& tracks) { doTriggering(collision, jets, tracks); } PROCESS_SWITCH(jetFilter, processWithoutRho, "Do charged jet triggering without background estimation for filling histograms", true); - void processWithRho(soa::Join::iterator const& collision, o2::aod::ChargedJets const& jets, soa::Filtered const& tracks) + void processWithRho(soa::Join::iterator const& collision, o2::aod::ChargedJets const& jets, soa::Filtered const& tracks) { doTriggering(collision, jets, tracks); } diff --git a/EventFiltering/PWGJE/jetHFFilter.cxx b/EventFiltering/PWGJE/jetHFFilter.cxx index ab6539372b8..6657e785751 100644 --- a/EventFiltering/PWGJE/jetHFFilter.cxx +++ b/EventFiltering/PWGJE/jetHFFilter.cxx @@ -75,7 +75,7 @@ struct JetHFFilterTask { registry.add("h_collisions", "Collision ;entries", {HistType::kTH1F, {{5, 0.0, 5.0}}}); } - void processJets(soa::Join::iterator const& /*collision*/, soa::Join const& d0Jets, CandidatesD0Data const& /*d0Candidates*/, soa::Join const& lcJets, CandidatesLcData const& /*lcCandidates*/, JetTracks const& /*tracks*/) + void processJets(soa::Join::iterator const& /*collision*/, soa::Join const& d0Jets, aod::CandidatesD0Data const& /*d0Candidates*/, soa::Join const& lcJets, aod::CandidatesLcData const& /*lcCandidates*/, aod::JetTracks const& /*tracks*/) { registry.fill(HIST("h_collisions"), 0.5); bool keepEvent[kAllObjects]{false}; diff --git a/EventFiltering/PWGUD/diffractionFilter.cxx b/EventFiltering/PWGUD/diffractionFilter.cxx index 4ea29ab18a0..c5adfcf90c5 100644 --- a/EventFiltering/PWGUD/diffractionFilter.cxx +++ b/EventFiltering/PWGUD/diffractionFilter.cxx @@ -132,11 +132,16 @@ struct DGFilterRun3 { // using MFs = aod::MFTTracks; using FWs = aod::FwdTracks; + // filter for global tracks + Filter globalTrackFilter = requireGlobalTrackInFilter(); + using globalTracks = soa::Filtered; + void process(CC const& collision, BCs const& bcs, TCs& tracks, // MFs& mfttracks, FWs& fwdtracks, + globalTracks& goodTracks, aod::Zdcs& /*zdcs*/, aod::FT0s& /*ft0s*/, aod::FV0As& /*fv0as*/, @@ -162,6 +167,7 @@ struct DGFilterRun3 { // apply DG selection auto isDGEvent = dgSelector.IsSelected(diffCuts, collision, bcRange, tracks, fwdtracks); + LOGF(debug, "isDGEvent %d", isDGEvent); // update after cut histogram registry.fill(HIST("stat/aftercuts"), isDGEvent + 2); @@ -226,8 +232,9 @@ struct DGFilterRun3 { // collisions registry.fill(HIST("collisions/tracksAll"), tracks.size()); registry.fill(HIST("collisions/PVTracksAll"), collision.numContrib()); - Partition goodTracks = requireGlobalTrackInFilter(); - goodTracks.bindTable(tracks); + // Partition goodTracks = requireGlobalTrackInFilter(); + // goodTracks.bindTable(tracks); + // LOGF(info, "# good tracks %d", goodTracks.size()); registry.get(HIST("collisions/globalTracksAll"))->Fill(goodTracks.size()); auto netCharge = udhelpers::netCharge(tracks); registry.fill(HIST("collisions/netChargeAll"), collision.numContrib(), netCharge); diff --git a/EventFiltering/Zorro.cxx b/EventFiltering/Zorro.cxx index 027861009d3..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) { @@ -102,18 +164,14 @@ std::vector Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber mBCtolerance = bcRange; std::map metadata; metadata["runNumber"] = std::to_string(runNumber); - mScalers = mCCDB->getSpecific(mBaseCCDBPath + "FilterCounters", timestamp, metadata); - mSelections = mCCDB->getSpecific(mBaseCCDBPath + "SelectionCounters", timestamp, metadata); - mInspectedTVX = mCCDB->getSpecific(mBaseCCDBPath + "InspectedTVX", timestamp, metadata); - mZorroHelpers = mCCDB->getSpecific>(mBaseCCDBPath + "ZorroHelpers", timestamp, metadata); - std::sort(mZorroHelpers->begin(), mZorroHelpers->end(), [](const auto& a, const auto& b) { return std::min(a.bcAOD, a.bcEvSel) < std::min(b.bcAOD, b.bcEvSel); }); - mBCranges.clear(); - mAccountedBCranges.clear(); - for (auto helper : *mZorroHelpers) { - mBCranges.emplace_back(InteractionRecord::long2IR(std::min(helper.bcAOD, helper.bcEvSel)), InteractionRecord::long2IR(std::max(helper.bcAOD, helper.bcEvSel))); - } - mAccountedBCranges.resize(mBCranges.size(), false); - + mRunDuration = mCCDB->getRunDuration(runNumber, true); + int64_t runTs = (mRunDuration.first / 2 + mRunDuration.second / 2); + auto ctp = ccdb->getForTimeStamp>("CTP/Calib/OrbitReset", runTs); + mOrbitResetTimestamp = (*ctp)[0]; + mScalers = mCCDB->getSpecific(mBaseCCDBPath + "FilterCounters", runTs, metadata); + mSelections = mCCDB->getSpecific(mBaseCCDBPath + "SelectionCounters", runTs, metadata); + mInspectedTVX = mCCDB->getSpecific(mBaseCCDBPath + "InspectedTVX", runTs, metadata); + setupHelpers(timestamp); mLastBCglobalId = 0; mLastSelectedIdx = 0; mTOIs.clear(); @@ -148,6 +206,10 @@ std::vector Zorro::initCCDB(o2::ccdb::BasicCCDBManager* ccdb, int runNumber std::bitset<128> Zorro::fetch(uint64_t bcGlobalId, uint64_t tolerance) { mLastResult.reset(); + if (bcGlobalId < mBCranges.front().getMin().toLong() - tolerance || bcGlobalId > mBCranges.back().getMax().toLong() + tolerance) { + setupHelpers((mOrbitResetTimestamp + int64_t(bcGlobalId * o2::constants::lhc::LHCBunchSpacingNS * 1e-3)) / 1000); + } + o2::dataformats::IRFrame bcFrame{InteractionRecord::long2IR(bcGlobalId) - tolerance, InteractionRecord::long2IR(bcGlobalId) + tolerance}; if (bcGlobalId < mLastBCglobalId) { /// Handle the possible discontinuity in the BC processed by the analyses mLastSelectedIdx = 0; @@ -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; } } @@ -221,3 +286,18 @@ bool Zorro::isNotSelectedByAny(uint64_t bcGlobalId, uint64_t tolerance) fetch(bcGlobalId, tolerance); return mLastResult.none(); } + +void Zorro::setupHelpers(int64_t timestamp) +{ + if (mCCDB->isCachedObjectValid(mBaseCCDBPath + "ZorroHelpers", timestamp)) { + return; + } + mZorroHelpers = mCCDB->getSpecific>(mBaseCCDBPath + "ZorroHelpers", timestamp, {{"runNumber", std::to_string(mRunNumber)}}); + std::sort(mZorroHelpers->begin(), mZorroHelpers->end(), [](const auto& a, const auto& b) { return std::min(a.bcAOD, a.bcEvSel) < std::min(b.bcAOD, b.bcEvSel); }); + mBCranges.clear(); + mAccountedBCranges.clear(); + for (auto helper : *mZorroHelpers) { + mBCranges.emplace_back(InteractionRecord::long2IR(std::min(helper.bcAOD, helper.bcEvSel)), InteractionRecord::long2IR(std::max(helper.bcAOD, helper.bcEvSel))); + } + mAccountedBCranges.resize(mBCranges.size(), false); +} diff --git a/EventFiltering/Zorro.h b/EventFiltering/Zorro.h index 5043eec232c..c818e45ce48 100644 --- a/EventFiltering/Zorro.h +++ b/EventFiltering/Zorro.h @@ -17,9 +17,11 @@ #include #include #include +#include #include #include "TH1D.h" +#include "TH2D.h" #include "CommonDataFormat/IRFrame.h" #include "Framework/HistogramRegistry.h" #include "ZorroHelper.h" @@ -39,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; } @@ -59,10 +62,14 @@ class Zorro ZorroSummary* getZorroSummary() { return &mZorroSummary; } private: + void setupHelpers(int64_t timestamp); + ZorroSummary mZorroSummary{"ZorroSummary", "ZorroSummary"}; - std::string mBaseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/"; + std::string mBaseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/Chunked/"; int mRunNumber = 0; + std::pair mRunDuration; + int64_t mOrbitResetTimestamp = 0; TH1* mAnalysedTriggers; /// Accounting for all triggers in the current run TH1* mAnalysedTriggersOfInterest; /// Accounting for triggers of interest in the current run diff --git a/EventFiltering/cefpTask.cxx b/EventFiltering/cefpTask.cxx index 92d0ed8f6bc..6b998a1d37f 100644 --- a/EventFiltering/cefpTask.cxx +++ b/EventFiltering/cefpTask.cxx @@ -200,12 +200,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 { @@ -272,11 +271,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)}; 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 3dea4c56318..f71212238c3 100644 --- a/EventFiltering/macros/checkBCrangesSkimming.C +++ b/EventFiltering/macros/checkBCrangesSkimming.C @@ -10,13 +10,14 @@ // or submit itself to any jurisdiction. // O2 includes -#include -#include -#include #include #include -#include #include +#include +#include +#include +#include +#include #include "CommonDataFormat/InteractionRecord.h" #include "CommonDataFormat/IRFrame.h" @@ -24,9 +25,7 @@ using o2::InteractionRecord; using o2::dataformats::IRFrame; // Set the bit of trigger which need to be checked -const ULong64_t Trigger0BIT = BIT(61); -const ULong64_t Trigger1BIT = 0; -const ULong64_t bcDiffTolerance = 100; +const ULong64_t bcDiffTolerance = 0; const char outputFileName[15] = "output.root"; struct bcTuple { @@ -40,12 +39,13 @@ struct bcTuple { }; struct selectedFrames : public IRFrame { + selectedFrames(ULong64_t bcAO2D, ULong64_t bcEvSel, const IRFrame& frame) : IRFrame(frame), bcAO2D(bcAO2D), bcEvSel(bcEvSel), triMask{0, 0}, selMask{0, 0} {} selectedFrames(ULong64_t bcAO2D, ULong64_t bcEvSel, ULong64_t triMask[2], ULong64_t selMask[2], const IRFrame& frame) : IRFrame(frame), bcAO2D(bcAO2D), bcEvSel(bcEvSel), triMask{triMask[0], triMask[1]}, selMask{selMask[0], selMask[1]} {} 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) @@ -58,20 +58,32 @@ int DoBCSubraction(ULong64_t bc1, ULong64_t bc2) } } +int DoBCSubraction(selectedFrames bc1, selectedFrames bc2) +{ + if (bc1.getMin() > bc2.getMax()) { + return DoBCSubraction(bc1.getMin().toLong(), bc2.getMax().toLong()); + } else if (bc1.getMax() < bc2.getMin()) { + return DoBCSubraction(bc1.getMax().toLong(), bc2.getMin().toLong()); + } else { + return 0; + } +} + bool isClose(selectedFrames a, selectedFrames b, ULong64_t bcDiffTolerance) { - if (a.getMin() > b.getMax() + bcDiffTolerance || a.getMax() < b.getMin() - bcDiffTolerance) + if (a.getMin() > b.getMax() + bcDiffTolerance || a.getMax() + bcDiffTolerance < b.getMin()) return false; else return true; } -std::vector getSelectedFrames(TFile& file, ULong64_t trigger0Bit, ULong64_t trigger1Bit) +std::vector> getFrames(std::unique_ptr& file, int trgIDStart, int N) { - std::vector selectedFrames; ULong64_t bcAO2D{0ull}, bcEvSel{0ull}, triMask[2]{0ull}, selMask[2]{0ull}; - for (auto key : *file.GetListOfKeys()) { - auto dir = dynamic_cast(file.Get(key->GetName())); + std::vector> frames; + frames.resize(N); + for (auto key : *file->GetListOfKeys()) { + auto dir = dynamic_cast(file->Get(key->GetName())); if (!dir) { continue; } @@ -96,69 +108,237 @@ std::vector getSelectedFrames(TFile& file, ULong64_t trigger0Bit if (!selMask[0] && !selMask[1]) { continue; } - if (selMask[0] & trigger0Bit || selMask[1] & trigger1Bit) { - InteractionRecord irstart, irend; - irstart.setFromLong(std::min(bcAO2D, bcEvSel)); - irend.setFromLong(std::max(bcAO2D, bcEvSel)); - IRFrame frame(irstart, irend); - selectedFrames.push_back({bcAO2D, bcEvSel, triMask, selMask, frame}); + for (int trgID = trgIDStart; trgID < trgIDStart + N; trgID++) { + ULong64_t trigger0Bit = 0, trigger1Bit = 0; + if (trgID < 64) { + trigger0Bit = BIT(trgID); + } else { + trigger1Bit = BIT(trgID - 64); + } + if (selMask[0] & trigger0Bit || selMask[1] & trigger1Bit) { + InteractionRecord irstart, irend; + irstart.setFromLong(std::min(bcAO2D, bcEvSel)); + irend.setFromLong(std::max(bcAO2D, bcEvSel)); + IRFrame frame(irstart, irend); + int index = trgID - trgIDStart; + frames[index].push_back({bcAO2D, bcEvSel, triMask, selMask, frame}); + } } } } - return selectedFrames; + + return frames; +} + +std::vector getSelectedFrames(std::unique_ptr& file, int trgID) +{ + auto frames = getFrames(file, trgID, 1); + return frames[0]; } +// 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 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); } } -// Calulate the ratio of duplicate triggers -void checkDuplicateTriggerAndBCs(std::string AnaFileName = "AnalysisResults.root", std::string originalFileName = "bcRanges_fullrun.root", std::string skimmedFileName = "bcRanges_fullrun_skimmed.root") +// Get RunNumber +std::string getRunNumber(std::string fileName) { - - // Get RunNumber std::string runNumber = ""; std::regex re("/5[0-9]*"); std::smatch match; - if (std::regex_search(originalFileName, match, re)) { + if (std::regex_search(fileName, match, re)) { // Remove the leading '/' runNumber = match.str().substr(1); } + return runNumber; +} - // Checks for BC difference between original and skimming data, and the ratio of triggers which have BCdiff==0 - TH1D hPairedNumCounterTotal("hPairedNumCounterTotal", "hPairedNumCounterTotal", 10, -0.5, 9.5); - TH1D hBCDiffAO2DTotal("hBCDiffAO2DTotal", "hBCDiffAO2DTotal", 201, -100.5, 100.5); - TH1D hBCDiffEvSelTotal("hBCDiffEvSelTotal", "hBCDiffEvSelTotal", 201, -100.5, 100.5); +// Detailed checks for specific trigger, not enabled by default +void checkBCForSelectedTrg(std::vector& originalFrames, std::vector& skimmedFrames, string runNumber, string triggerLabel) +{ + + TH1D hTriggerCounter("hTriggerCounter", (runNumber + " " + triggerLabel + ";;Total number of trigger").data(), 2, -0.5, 1.5); + hTriggerCounter.GetXaxis()->SetBinLabel(1, "Original"); + hTriggerCounter.GetXaxis()->SetBinLabel(2, "Skimmed"); + TH1D hBCDiffAO2D("hBCDiffAO2D", (runNumber + " " + triggerLabel + ";;#DeltaBC_{AO2D} between paired singles").data(), 201, -100.5, 100.5); + TH1D hBCDiffEvSel("hBCDiffEvSel", (runNumber + " " + triggerLabel + ";;#DeltaBC_{EvSel} between paired singles").data(), 201, -100.5, 100.5); + + TH1D hBCOriginal("hBCOriginal", (runNumber + " " + triggerLabel + " Original;;Trigger counts").data(), 4, -0.5, 3.5); + hBCOriginal.GetXaxis()->SetBinLabel(1, "Total"); + hBCOriginal.GetXaxis()->SetBinLabel(2, "Same AO2D BC"); + hBCOriginal.GetXaxis()->SetBinLabel(3, "Same EvSel BC"); + hBCOriginal.GetXaxis()->SetBinLabel(4, "Same Both BC"); + TH1D hBCSkimmed("hBCSkimmed", (runNumber + " " + triggerLabel + " Skimmed;;Trigger counts").data(), 4, -0.5, 3.5); + hBCSkimmed.GetXaxis()->SetBinLabel(1, "Total"); + hBCSkimmed.GetXaxis()->SetBinLabel(2, "Same AO2D BC"); + hBCSkimmed.GetXaxis()->SetBinLabel(3, "Same EvSel BC"); + hBCSkimmed.GetXaxis()->SetBinLabel(4, "Same Both BC"); + + 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 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! ------------------------------------------------------- + auto p1 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcAO2D == frame.bcAO2D; }); + if (p1 != bcSet.end()) { + hBCOriginal.Fill(1); + } + auto p2 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcEvSel == frame.bcEvSel; }); + if (p2 != bcSet.end()) { + hBCOriginal.Fill(2); + } + bcTuple currentBC(frame.bcAO2D, frame.bcEvSel); + auto p3 = std::find(bcSet.begin(), bcSet.end(), currentBC); + if (p3 == bcSet.end()) { + bcSet.push_back(currentBC); + } else { + hBCOriginal.Fill(3); + } + //------------------------------------------------------------------------------------- + + if (frame.GetNInNearbyBC() != 1) { + continue; // Only check singles + } + std::vector skimmedbcs; + int n = 0; + bool shouldUpdate = true; + for (int j = firstTrg; j < skimmedFrames.size(); j++) { + auto& skimmedFrame = skimmedFrames[j]; + if (skimmedFrame.getMin() > frame.getMax()) { + break; + } + 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 (shouldUpdate) { + firstTrg = j; + } + } + } + if (n == 0) { + // std::cout << "Trigger not found!!!" << std::endl; + } else if (n == 1) { + hBCDiffAO2D.Fill(DoBCSubraction(frame.bcAO2D, skimmedbcs[0].bcAO2D)); + hBCDiffEvSel.Fill(DoBCSubraction(frame.bcEvSel, skimmedbcs[0].bcEvSel)); + } + hMatchedNumCounter.Fill(n); + } + + //------------------------------ Check if there are triggers which have same BC, time-consuming! ------------------------------------------------------- + bcSet.clear(); + for (auto& skimmedFrame : skimmedFrames) { + hTriggerCounter.Fill(1); + hBCSkimmed.Fill(0); + auto p1 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcAO2D == skimmedFrame.bcAO2D; }); + if (p1 != bcSet.end()) { + hBCSkimmed.Fill(1); + } + auto p2 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcEvSel == skimmedFrame.bcEvSel; }); + if (p2 != bcSet.end()) { + hBCSkimmed.Fill(2); + } + bcTuple currentBC(skimmedFrame.bcAO2D, skimmedFrame.bcEvSel); + auto p3 = std::find(bcSet.begin(), bcSet.end(), currentBC); + if (p3 == bcSet.end()) { + bcSet.push_back(currentBC); + } else { + hBCSkimmed.Fill(3); + } + } + //------------------------------------------------------------------------------------- + + TFile fout(outputFileName, "UPDATE"); + fout.cd(); + TDirectory* dir1 = fout.GetDirectory(runNumber.data()); + if (!dir1) { + dir1 = fout.mkdir(runNumber.data()); + } + dir1->cd(); + TDirectory* dir2 = dir1->GetDirectory(triggerLabel.data()); + if (!dir2) { + dir2 = dir1->mkdir(triggerLabel.data()); + } + dir2->cd(); + + hTriggerCounter.Write(); + hBCOriginal.Write(); + hBCSkimmed.Write(); + hBCDiffAO2D.Write(); + hBCDiffEvSel.Write(); + hMatchedNumCounter.Write(); + fout.Close(); +} + +// Detailed checks for specific trigger +void checkBCForSelectedTrg(std::string AnaFileName = "AnalysisResults.root", std::string originalFileName = "bcRanges_fullrun.root", std::string skimmedFileName = "bcRanges_fullrun_skimmed.root", int triggerID = 1, bool useAlien = true) +{ + + string runNumber = getRunNumber(originalFileName); + if (useAlien) { + TGrid::Connect("alien://"); + AnaFileName = "alien://" + AnaFileName; + originalFileName = "alien://" + originalFileName; + skimmedFileName = "alien://" + skimmedFileName; + } // Readin labels - TFile AnaFile(AnaFileName.c_str(), "READ"); - TH1* hist0 = dynamic_cast(AnaFile.Get("central-event-filter-task/scalers/mFiltered;1")); + std::unique_ptr AnaFile{TFile::Open(AnaFileName.c_str(), "READ")}; + TH1* hist0 = dynamic_cast(AnaFile->Get("central-event-filter-task/scalers/mFiltered;1")); std::vector labels; std::vector binNum; for (int i = 1; i <= hist0->GetNbinsX(); i++) { @@ -168,395 +348,333 @@ void checkDuplicateTriggerAndBCs(std::string AnaFileName = "AnalysisResults.root binNum.push_back(i); } } - AnaFile.Close(); + AnaFile->Close(); + std::string triggerLabel = labels[triggerID]; - TFile originalFile(originalFileName.c_str(), "READ"); - TFile skimmedFile(skimmedFileName.c_str(), "READ"); - std::vector sel_labels; - std::vector numOriginal, numSkimmed, numOriginalSingle, numSkimmedSingle, numOriginalDouble, numSkimmedDouble, numOriginalMultiple, numSkimmedMultiple; - std::vector numpair, numpairedBCAO2D, numpairedBCEvSel, maxDeltaBCAO2D, maxDeltaBCEvSel; - for (int i = 0; i < labels.size(); i++) { - // std::cout << "i:" << i << std::endl; - ULong64_t trigger0Bit = 0, trigger1Bit = 0; - int triggerBit = binNum[i] - 2; - if (triggerBit < 64) { - trigger0Bit = BIT(triggerBit); - } else { - trigger1Bit = BIT(triggerBit - 64); + std::unique_ptr originalFile{TFile::Open(originalFileName.c_str(), "READ")}; + std::unique_ptr skimmedFile{TFile::Open(skimmedFileName.c_str(), "READ")}; + auto originalFrames = getSelectedFrames(originalFile, triggerID); + auto skimmedFrames = getSelectedFrames(skimmedFile, triggerID); + originalFile->Close(); + skimmedFile->Close(); + + checkBCForSelectedTrg(originalFrames, skimmedFrames, runNumber, triggerLabel); +} + +// 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) +{ + + string runNumber = getRunNumber(originalFileName); + if (useAlien) { + TGrid::Connect("alien://"); + AnaFileName = "alien://" + AnaFileName; + originalFileName = "alien://" + originalFileName; + skimmedFileName = "alien://" + skimmedFileName; + } + + // Readin labels + std::unique_ptr AnaFile{TFile::Open(AnaFileName.c_str(), "READ")}; + TH1* hist0 = dynamic_cast(AnaFile->Get("central-event-filter-task/scalers/mFiltered;1")); + std::vector labels; + std::vector binNum; + for (int i = 1; i <= hist0->GetNbinsX(); i++) { + std::string label = hist0->GetXaxis()->GetBinLabel(i); + if (label != "Total number of events" && label != "Filtered events") { + labels.push_back(label); + binNum.push_back(i); + // std::cout << i - 2 << ": " << label << std::endl; } + } + AnaFile->Close(); + + // Due to potential selection on triggers, histograms should be created later + // for example: skip triggers which have no enrties + std::vector sel_labels; + std::vector numOriginal, numSkimmed, numOriginalSingle, numSkimmedSingle, numOriginalDouble, numSkimmedDouble, numOriginalMultiple, numSkimmedMultiple, numCloseSkimmed; + std::vector numpair, numpairedBCAO2D, numpairedBCEvSel; + std::vector avgDeltaBCAO2D, avgDeltaBCEvSel, avgDeltaBC, rmsDeltaBCAO2D, rmsDeltaBCEvSel, rmsDeltaBC; + std::vector avgNumPairedTrigger, rmsNumPairedTrigger; + + std::unique_ptr originalFile{TFile::Open(originalFileName.c_str(), "READ")}; + std::unique_ptr skimmedFile{TFile::Open(skimmedFileName.c_str(), "READ")}; + std::vector> originalAllFrames = getFrames(originalFile, 0, labels.size()); + std::vector> skimmedAllFrames = getFrames(skimmedFile, 0, labels.size()); + for (int trgID = 0; trgID < labels.size(); trgID++) { // Caculate singles, doubles, and multiples + int noriginal{0}, nskimmed{0}, noriginalsingle{0}, nskimmedsingle{0}, noriginaldouble{0}, nskimmeddouble{0}, noriginalmultiple{0}, nskimmedmultiple{0}; + // Caculate mean and rms of diff BC + TH1D hDiffBCAO2DCount("hDiffBCAO2DCount", "hDiffBCAO2DCount", 21, -10.5, 10.5); + TH1D hDiffBCEvSelCount("hDiffBCEvSelCount", "hDiffBCEvSelCount", 21, -10.5, 10.5); + TH1D hDiffBCCount("hDiffBCCount", "hDiffBCCount", 21, -10.5, 10.5); + TH1D hNumPairedTriggerCount("hNumPairedTriggerCount", "hNumPairedTriggerCount", 10, -0.5, 9.5); // For Original dataset - std::vector bcSet; - std::vector bcFullSet; - int noriginal{0}, nskimmed{0}, noriginalsingle{0}, nskimmedsingle{0}, noriginaldouble{0}, nskimmeddouble{0}, noriginalmultiple{0}, nskimmedmultiple{0}, maxdiffBCAO2D{0}, maxdiffBCEvSel{0}; - auto originalFrames = getSelectedFrames(originalFile, trigger0Bit, trigger1Bit); - checkNearbyBCs(originalFrames, bcDiffTolerance); + auto& originalFrames = originalAllFrames[trgID]; + 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++; } } // For skimmed dataset - auto skimmedFrames = getSelectedFrames(skimmedFile, trigger0Bit, trigger1Bit); - checkNearbyBCs(skimmedFrames, bcDiffTolerance); + auto& skimmedFrames = skimmedAllFrames[trgID]; + 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++; } } - sel_labels.push_back(labels[i]); - numOriginal.push_back(noriginal); - numOriginalSingle.push_back(noriginalsingle); - numOriginalDouble.push_back(noriginaldouble); - numOriginalMultiple.push_back(noriginalmultiple); - numSkimmed.push_back(nskimmed); - numSkimmedSingle.push_back(nskimmedsingle); - numSkimmedDouble.push_back(nskimmeddouble); - numSkimmedMultiple.push_back(nskimmedmultiple); - // Check BC differences - int npair{0}, npairedBCAO2D{0}, npairedBCEvSel{0}, maxdeltaBCAO2D{0}, maxdeltaBCEvSel{0}; - int firstID = 0; - for (auto frame : originalFrames) { - if (frame.selMask[0] & trigger0Bit || frame.selMask[1] & trigger1Bit) { - // std::cout << "------------------------------------------------" << std::endl; - if (frame.GetNum() != 1) { + int npair{0}, npairedBCAO2D{0}, npairedBCEvSel{0}, ncloseskimmed{0}, maxdeltaBCAO2D{0}, maxdeltaBCEvSel{0}; + 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 shouldUpdate = true; + for (int j = firstTrg; j < skimmedFrames.size(); j++) { + auto& skimmedFrame = skimmedFrames[j]; + if (skimmedFrame.getMin() > frame.getMax()) { + break; + } + if (skimmedFrame.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]; - if (skimmedFrame.getMin() > frame.getMax()) { - break; - } - if (skimmedFrame.GetNum() != 1) { - continue; // Only check singles - } - if (isClose(frame, skimmedFrame, bcDiffTolerance)) { - isFirst = false; - bool found = frame.selMask[0] & skimmedFrame.selMask[0] || frame.selMask[1] & skimmedFrame.selMask[1]; - // found = found && (frame.bcAO2D == skimmedFrame.bcAO2D || frame.bcEvSel == skimmedFrame.bcEvSel); - if (found) { - skimmedbcs.push_back({skimmedFrame.bcAO2D, skimmedFrame.bcEvSel}); - n++; + 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; } - } else { - if (isFirst) { - firstID = i; + 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)); + IRFrame frame(irstart, irend); + skimmedbcs.push_back({skimmedFrame.bcAO2D, skimmedFrame.bcEvSel, frame}); + n++; } - } - if (n == 1) { - npair++; - int bcdiffAO2D = DoBCSubraction(frame.bcAO2D, skimmedbcs[0].bcAO2D); - int bcdiffEvSel = DoBCSubraction(frame.bcEvSel, skimmedbcs[0].bcEvSel); - hBCDiffAO2DTotal.Fill(bcdiffAO2D); - hBCDiffEvSelTotal.Fill(bcdiffEvSel); - maxdiffBCAO2D = std::max(std::abs(maxdiffBCAO2D), bcdiffAO2D); - maxdiffBCEvSel = std::max(std::abs(maxdiffBCEvSel), bcdiffEvSel); - if (frame.bcAO2D == skimmedbcs[0].bcAO2D) { - npairedBCAO2D++; - } - if (frame.bcEvSel == skimmedbcs[0].bcEvSel) { - npairedBCEvSel++; + } else { + if (shouldUpdate) { + firstTrg = j; } } - hPairedNumCounterTotal.Fill(n); } + if (n == 1) { + npair++; + int bcdiffAO2D = DoBCSubraction(frame.bcAO2D, skimmedbcs[0].bcAO2D); + int bcdiffEvSel = DoBCSubraction(frame.bcEvSel, skimmedbcs[0].bcEvSel); + hDiffBCAO2DCount.Fill(std::abs(bcdiffAO2D)); + hDiffBCEvSelCount.Fill(std::abs(bcdiffEvSel)); + hDiffBCCount.Fill(std::abs(DoBCSubraction(frame, skimmedbcs[0]))); + if (frame.bcAO2D == skimmedbcs[0].bcAO2D) { + npairedBCAO2D++; + } + if (frame.bcEvSel == skimmedbcs[0].bcEvSel) { + npairedBCEvSel++; + } + } + ncloseskimmed += n; + hNumPairedTriggerCount.Fill(n); + } + + // if (static_cast(ncloseskimmed) / noriginal > 0.95 || noriginal == 0) + if (noriginal == 0) { + // continue; } + sel_labels.push_back(labels[trgID]); + numOriginal.push_back(noriginal); + numOriginalSingle.push_back(noriginalsingle); + numOriginalDouble.push_back(noriginaldouble); + numOriginalMultiple.push_back(noriginalmultiple); + numSkimmed.push_back(nskimmed); + numSkimmedSingle.push_back(nskimmedsingle); + numSkimmedDouble.push_back(nskimmeddouble); + numSkimmedMultiple.push_back(nskimmedmultiple); + numpair.push_back(npair); numpairedBCAO2D.push_back(npairedBCAO2D); numpairedBCEvSel.push_back(npairedBCEvSel); - maxDeltaBCAO2D.push_back(maxdiffBCAO2D); - maxDeltaBCEvSel.push_back(maxdiffBCEvSel); + numCloseSkimmed.push_back(ncloseskimmed); + avgDeltaBCAO2D.push_back(hDiffBCAO2DCount.GetMean()); + avgDeltaBCEvSel.push_back(hDiffBCEvSelCount.GetMean()); + avgDeltaBC.push_back(hDiffBCCount.GetMean()); + rmsDeltaBCAO2D.push_back(hDiffBCAO2DCount.GetRMS()); + rmsDeltaBCEvSel.push_back(hDiffBCEvSelCount.GetRMS()); + rmsDeltaBC.push_back(hDiffBCCount.GetRMS()); + avgNumPairedTrigger.push_back(hNumPairedTriggerCount.GetMean()); + rmsNumPairedTrigger.push_back(hNumPairedTriggerCount.GetRMS()); } - originalFile.Close(); - skimmedFile.Close(); - - TH1D hOriginalTotal("hOriginalTotal", (runNumber + " AO2D Original;;Number of events").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hOriginalSingles("hOriginalSingles", (runNumber + " Original;;Number of Singles").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hOriginalSinglesRatio("hOriginalSinglesRatio", (runNumber + " Original;;Singles / Total").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hOriginalDoubles("hOriginalDoubles", (runNumber + " Original;;Number of Doubles").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hOriginalDoublesRatio("hOriginalDoublesRatio", (runNumber + " Original;;Doubles / Total").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hOriginalMultiples("hOriginalMultiples", (runNumber + " Original;;Number of Multiples").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hOriginalMultiplesRatio("hOriginalMultiplesRatio", (runNumber + " Original;;Multiples / Total").data(), sel_labels.size(), 0, sel_labels.size()); - - TH1D hSkimmedTotal("hSkimmedTotal", (runNumber + " AO2D Skimmed;;Number of events").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hSkimmedSingles("hSkimmedSingles", (runNumber + " Skimmed;;Number of Singles").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hSkimmedSinglesRatio("hSkimmedSinglesRatio", (runNumber + " Skimmed;;Singles / Total").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hSkimmedDoubles("hSkimmedDoubles", (runNumber + " Skimmed;;Number of Doubles").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hSkimmedDoublesRatio("hSkimmedDoublesRatio", (runNumber + " Skimmed;;Doubles / Total").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 hSkimmedMultiplesRatio("hSkimmedMultiplesRatio", (runNumber + " Skimmed;;Multiples / Total").data(), sel_labels.size(), 0, sel_labels.size()); - - TH1D hPairedBCAO2DRatio("hPairedBCAO2DRatio", (runNumber + " One-to-One Pairs;; Pairs with same BCAO2D / Total").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hPairedBCEvSelRatio("hPairedBCEvSelRatio", (runNumber + " One-to-One Pairs;; Pairs with same BCEvSel / Total").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hMaxDiffBCAO2D("hMaxDiffBCAO2D", (runNumber + " One-to-One Pairs;;|#DeltaBCAO2D|_{max}").data(), sel_labels.size(), 0, sel_labels.size()); - TH1D hMaxDiffBCEvSel("hMaxDiffBCEvSel", (runNumber + " One-to-One Pairs;;|#DeltaBCEvSel|_{max}").data(), sel_labels.size(), 0, sel_labels.size()); + originalFile->Close(); + skimmedFile->Close(); + + TH1D hOriginalTotal("hOriginalTotal", (runNumber + " Original;;Number of events").data(), sel_labels.size(), 0, sel_labels.size()); + TH1D hOriginalSingles("hOriginalSingles", (runNumber + " Original;;Number of singles").data(), sel_labels.size(), 0, sel_labels.size()); + TH1D hOriginalDoubles("hOriginalDoubles", (runNumber + " Original;;Number of doubles").data(), sel_labels.size(), 0, sel_labels.size()); + TH1D hOriginalMultiples("hOriginalMultiples", (runNumber + " Original;;Number of multiples").data(), sel_labels.size(), 0, sel_labels.size()); + + TH1D hSkimmedTotal("hSkimmedTotal", (runNumber + " Skimmed;;Number of events").data(), sel_labels.size(), 0, sel_labels.size()); + TH1D hSkimmedSingles("hSkimmedSingles", (runNumber + " Skimmed;;Number of singles").data(), sel_labels.size(), 0, sel_labels.size()); + 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 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 hOriginalTotal.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hOriginalSingles.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); + hOriginalDoubles.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hOriginalMultiples.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hOriginalSinglesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hOriginalDoublesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hOriginalMultiplesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hOriginalTotal.SetBinContent(i + 1, numOriginal[i]); + hOriginalTotal.SetBinError(i + 1, std::sqrt(numOriginal[i])); hOriginalSingles.SetBinContent(i + 1, numOriginalSingle[i]); + hOriginalSingles.SetBinError(i + 1, std::sqrt(numOriginalSingle[i])); hOriginalDoubles.SetBinContent(i + 1, numOriginalDouble[i]); + hOriginalDoubles.SetBinError(i + 1, std::sqrt(numOriginalDouble[i])); hOriginalMultiples.SetBinContent(i + 1, numOriginalMultiple[i]); - if (numOriginal[i] > 0) { - hOriginalSinglesRatio.SetBinContent(i + 1, static_cast(numOriginalSingle[i]) / numOriginal[i]); - hOriginalDoublesRatio.SetBinContent(i + 1, static_cast(numOriginalSingle[i]) / numOriginal[i]); - hOriginalMultiplesRatio.SetBinContent(i + 1, static_cast(numOriginalMultiple[i]) / numOriginal[i]); - } else { - hOriginalSinglesRatio.SetBinContent(i + 1, 0); - hOriginalDoublesRatio.SetBinContent(i + 1, 0); - hOriginalMultiplesRatio.SetBinContent(i + 1, 0); - } + hOriginalMultiples.SetBinError(i + 1, std::sqrt(numOriginalMultiple[i])); + // Skimmed data hSkimmedTotal.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hSkimmedSingles.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); + hSkimmedDoubles.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hSkimmedMultiples.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hSkimmedSinglesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hSkimmedDoublesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hSkimmedMultiplesRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); hSkimmedTotal.SetBinContent(i + 1, numSkimmed[i]); + hSkimmedTotal.SetBinError(i + 1, std::sqrt(numSkimmed[i])); hSkimmedSingles.SetBinContent(i + 1, numSkimmedSingle[i]); + hSkimmedSingles.SetBinError(i + 1, std::sqrt(numSkimmedSingle[i])); hSkimmedDoubles.SetBinContent(i + 1, numSkimmedDouble[i]); + hSkimmedDoubles.SetBinError(i + 1, std::sqrt(numSkimmedDouble[i])); hSkimmedMultiples.SetBinContent(i + 1, numSkimmedMultiple[i]); - if (numSkimmed[i] > 0) { - hSkimmedSinglesRatio.SetBinContent(i + 1, static_cast(numSkimmedSingle[i]) / numSkimmed[i]); - hSkimmedDoublesRatio.SetBinContent(i + 1, static_cast(numSkimmedDouble[i]) / numSkimmed[i]); - hSkimmedMultiplesRatio.SetBinContent(i + 1, static_cast(numSkimmedMultiple[i]) / numSkimmed[i]); - } else { - hSkimmedSinglesRatio.SetBinContent(i + 1, 0); - hSkimmedDoublesRatio.SetBinContent(i + 1, 0); - hSkimmedMultiplesRatio.SetBinContent(i + 1, 0); - } + hSkimmedMultiples.SetBinError(i + 1, std::sqrt(numSkimmedMultiple[i])); + + // 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()); + hNumMatchesInSkimmed.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hPairedBCAO2DRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hPairedBCEvSelRatio.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); if (numpair[i] > 0) { - hPairedBCAO2DRatio.SetBinContent(i + 1, static_cast(numpairedBCAO2D[i]) / numpair[i]); - hPairedBCEvSelRatio.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]); } - - hMaxDiffBCAO2D.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hMaxDiffBCEvSel.GetXaxis()->SetBinLabel(i + 1, sel_labels[i].c_str()); - hMaxDiffBCAO2D.SetBinContent(i + 1, maxDeltaBCAO2D[i]); - hMaxDiffBCEvSel.SetBinContent(i + 1, maxDeltaBCEvSel[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]); + 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 (not the real efficiency since the downscalings are removed in skimmed for this QA) + TH1D *hOriginalSinglesRatio, *hOriginalDoublesRatio, *hOriginalMultiplesRatio; + TH1D *hSkimmedSinglesRatio, *hSkimmedDoublesRatio, *hSkimmedMultiplesRatio; + + hTriggerEff = reinterpret_cast(hSkimmedTotal.Clone("hTriggerEff")); + hTriggerEff->SetTitle((runNumber + " skimmed efficiency;; Skimmed / Original").data()); + hTriggerEff->Divide(&hOriginalTotal); + hTriggerMatchesRatio.Divide(&hOriginalSingles); + hTriggerSingleMatchesRatio.Divide(&hOriginalSingles); + hOriginalSinglesRatio = reinterpret_cast(hOriginalSingles.Clone("hOriginalSinglesRatio")); + hOriginalSinglesRatio->SetTitle((runNumber + " Original;;Singles / Total").data()); + hOriginalSinglesRatio->Divide(&hOriginalTotal); + hOriginalDoublesRatio = reinterpret_cast(hOriginalDoubles.Clone("hOriginalDoublesRatio")); + hOriginalDoublesRatio->SetTitle((runNumber + " Original;;Doubles / Total").data()); + hOriginalDoublesRatio->Divide(&hOriginalTotal); + hOriginalMultiplesRatio = reinterpret_cast(hOriginalMultiples.Clone("hOriginalMultiplesRatio")); + hOriginalMultiplesRatio->SetTitle((runNumber + " Original;;Multiples / Total").data()); + hOriginalMultiplesRatio->Divide(&hOriginalTotal); + + hSkimmedSinglesRatio = reinterpret_cast(hSkimmedSingles.Clone("hSkimmedSinglesRatio")); + hSkimmedSinglesRatio->SetTitle((runNumber + " Skimmed;;Singles / Total").data()); + hSkimmedSinglesRatio->Divide(&hSkimmedTotal); + hSkimmedDoublesRatio = reinterpret_cast(hSkimmedDoubles.Clone("hSkimmedDoublesRatio")); + hSkimmedDoublesRatio->SetTitle((runNumber + " Skimmed;;Doubles / Total").data()); + hSkimmedDoublesRatio->Divide(&hSkimmedTotal); + hSkimmedMultiplesRatio = reinterpret_cast(hSkimmedMultiples.Clone("hSkimmedMultiplesRatio")); + hSkimmedMultiplesRatio->SetTitle((runNumber + " Skimmed;;Multiples / Total").data()); + hSkimmedMultiplesRatio->Divide(&hSkimmedTotal); + TFile fout(outputFileName, "UPDATE"); fout.cd(); + TDirectory* dir = fout.mkdir(runNumber.data()); + dir->cd(); + hTriggerEff->Write(); + hTriggerMatchesRatio.Write(); + hTriggerSingleMatchesRatio.Write(); + hDiffBCAO2D.Write(); + hDiffBCEvSel.Write(); + hNumMatchesInSkimmed.Write(); + if (bcDiffTolerance > 0) { + hDiffBC.Write(); + } + TDirectory* dirextra = dir->mkdir("ExtraQA"); + dirextra->cd(); hOriginalTotal.Write(); hOriginalSingles.Write(); hOriginalDoubles.Write(); hOriginalMultiples.Write(); - hOriginalSinglesRatio.Write(); - hOriginalDoublesRatio.Write(); - hOriginalMultiplesRatio.Write(); + hOriginalSinglesRatio->Write(); + hOriginalDoublesRatio->Write(); + hOriginalMultiplesRatio->Write(); hSkimmedTotal.Write(); hSkimmedSingles.Write(); hSkimmedDoubles.Write(); hSkimmedMultiples.Write(); - hSkimmedSinglesRatio.Write(); - hSkimmedDoublesRatio.Write(); - hSkimmedMultiplesRatio.Write(); - hPairedNumCounterTotal.Write(); - hBCDiffAO2DTotal.Write(); - hBCDiffEvSelTotal.Write(); - hPairedBCAO2DRatio.Write(); - hPairedBCEvSelRatio.Write(); - hMaxDiffBCAO2D.Write(); - hMaxDiffBCEvSel.Write(); + hSkimmedSinglesRatio->Write(); + hSkimmedDoublesRatio->Write(); + hSkimmedMultiplesRatio->Write(); + hMatchesSameBCAO2DRatio.Write(); + hMatchesSameBCEvSelRatio.Write(); fout.Close(); -} - -// Detailed checks for specific trigger -void checkBCrangesSkimming(std::string originalFileName = "bcRanges_fullrun.root", std::string skimmedFileName = "bcRanges_fullrun_skimmed.root") -{ - //---------------------------------For specific trigger---------------------------------- - TH1D hTriggerCounter("hTriggerCounter", "hTriggerCounter", 3, 0.5, 3.5); - hTriggerCounter.GetXaxis()->SetBinLabel(1, "Original"); - hTriggerCounter.GetXaxis()->SetBinLabel(2, "Skimmed"); - TH1D hNumCounter("hNumCounter", "hNumCounter", 10, -0.5, 9.5); - TH1D hSinglePairCheck("hSinglePairCheck", "hSinglePairCheck", 4, 0.5, 4.5); - hSinglePairCheck.GetXaxis()->SetBinLabel(1, "Total"); - hSinglePairCheck.GetXaxis()->SetBinLabel(2, "Same AO2D BC"); - hSinglePairCheck.GetXaxis()->SetBinLabel(3, "Same EvSel BC"); - hSinglePairCheck.GetXaxis()->SetBinLabel(4, "Same Both BC"); - TH1D hMultiPairCheck("hMultiPairCheck", "hMultiPairCheck", 5, 0.5, 5.5); - hMultiPairCheck.GetXaxis()->SetBinLabel(1, "Total"); - hMultiPairCheck.GetXaxis()->SetBinLabel(2, "Total Pair"); - hMultiPairCheck.GetXaxis()->SetBinLabel(3, "Same AO2D BC"); - hMultiPairCheck.GetXaxis()->SetBinLabel(4, "Same EvSel BC"); - hMultiPairCheck.GetXaxis()->SetBinLabel(5, "Same Both BC"); - TH1D hBCDiffAO2D("hBCDiffAO2D", "hBCDiffAO2D", 2001, -1000.5, 1000.5); - TH1D hBCDiffEvSel("hBCDiffEvSel", "hBCDiffEvSel", 2001, -1000.5, 1000.5); - - TH1D hBCOriginal("hBCOriginal", "hBCOriginal", 4, 0.5, 4.5); - hBCOriginal.GetXaxis()->SetBinLabel(1, "Total"); - hBCOriginal.GetXaxis()->SetBinLabel(2, "Same AO2D BC"); - hBCOriginal.GetXaxis()->SetBinLabel(3, "Same EvSel BC"); - hBCOriginal.GetXaxis()->SetBinLabel(4, "Same Both BC"); - TH1D hBCSkimmed("hBCSkimmed", "hBCSkimmed", 4, 0.5, 4.5); - hBCSkimmed.GetXaxis()->SetBinLabel(1, "Total"); - hBCSkimmed.GetXaxis()->SetBinLabel(2, "Same AO2D BC"); - hBCSkimmed.GetXaxis()->SetBinLabel(3, "Same EvSel BC"); - hBCSkimmed.GetXaxis()->SetBinLabel(4, "Same Both BC"); - - auto t1 = std::chrono::steady_clock::now(); - TFile originalFile(originalFileName.c_str(), "READ"); - TFile skimmedFile(skimmedFileName.c_str(), "READ"); - auto originalFrames = getSelectedFrames(originalFile, Trigger0BIT, Trigger1BIT); - auto skimmedFrames = getSelectedFrames(skimmedFile, Trigger0BIT, Trigger1BIT); - originalFile.Close(); - skimmedFile.Close(); - auto t2 = std::chrono::steady_clock::now(); - int d1 = std::chrono::duration_cast(t2 - t1).count(); - std::cout << "Readin Time: " << d1 << std::endl; - - auto t3 = std::chrono::steady_clock::now(); - checkNearbyBCs(originalFrames, bcDiffTolerance); - checkNearbyBCs(skimmedFrames, bcDiffTolerance); - auto t4 = std::chrono::steady_clock::now(); - int d2 = std::chrono::duration_cast(t4 - t3).count(); - std::cout << "Sort Time: " << d2 << std::endl; - - auto t5 = std::chrono::steady_clock::now(); - std::vector bcSet; - for (auto frame : originalFrames) { - if (frame.selMask[0] & Trigger0BIT || frame.selMask[1] & Trigger1BIT) { - hTriggerCounter.Fill(1); - hBCOriginal.Fill(1); - auto p1 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcAO2D == frame.bcAO2D; }); - if (p1 != bcSet.end()) { - hBCOriginal.Fill(2); - } - auto p2 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcEvSel == frame.bcEvSel; }); - if (p2 != bcSet.end()) { - hBCOriginal.Fill(3); - } - bcTuple currentBC(frame.bcAO2D, frame.bcEvSel); - auto p3 = std::find(bcSet.begin(), bcSet.end(), currentBC); - if (p3 == bcSet.end()) { - bcSet.push_back(currentBC); - } else { - hBCOriginal.Fill(4); - } - // std::cout << "------------------------------------------------" << std::endl; - if (frame.GetNum() != 1) { - continue; // Only check singles - } - std::vector skimmedbcs; - int n = 0; - for (auto& skimmedFrame : skimmedFrames) { - if (skimmedFrame.getMin() > frame.getMax()) { - break; - } - if (skimmedFrame.GetNum() != 1) { - continue; // Only check singles - } - if (isClose(frame, skimmedFrame, bcDiffTolerance)) { - bool found = frame.selMask[0] & skimmedFrame.selMask[0] || frame.selMask[1] & skimmedFrame.selMask[1]; - // found = found && (frame.bcAO2D == skimmedFrame.bcAO2D || frame.bcEvSel == skimmedFrame.bcEvSel); - if (found) { - skimmedbcs.push_back({skimmedFrame.bcAO2D, skimmedFrame.bcEvSel}); - n++; - } - } - } - if (n == 0) { - // std::cout << "Trigger not found!!!" << std::endl; - } else if (n == 1) { - hSinglePairCheck.Fill(1); - hBCDiffAO2D.Fill(DoBCSubraction(frame.bcAO2D, skimmedbcs[0].bcAO2D)); - hBCDiffEvSel.Fill(DoBCSubraction(frame.bcEvSel, skimmedbcs[0].bcEvSel)); - if (frame.bcAO2D == skimmedbcs[0].bcAO2D) { - hSinglePairCheck.Fill(2); - } - if (frame.bcEvSel == skimmedbcs[0].bcEvSel) { - hSinglePairCheck.Fill(3); - if (frame.bcAO2D == skimmedbcs[0].bcAO2D) { - hSinglePairCheck.Fill(4); - } - } - } else { - // std::cout << "Unexpected trigger!!! n=" << n << std::endl; - hMultiPairCheck.Fill(1); - for (auto skimmedbc : skimmedbcs) { - hMultiPairCheck.Fill(2); - if (frame.bcAO2D == skimmedbc.bcAO2D) { - hMultiPairCheck.Fill(3); - } - if (frame.bcEvSel == skimmedbc.bcEvSel) { - hMultiPairCheck.Fill(4); - if (frame.bcAO2D == skimmedbc.bcAO2D) { - hMultiPairCheck.Fill(5); - } - } - } - } - hNumCounter.Fill(n); - } - } - auto t6 = std::chrono::steady_clock::now(); - int d3 = std::chrono::duration_cast(t6 - t5).count(); - std::cout << "Search Time: " << d3 << std::endl; - bcSet.clear(); - for (auto& skimmedFrame : skimmedFrames) { - if (skimmedFrame.selMask[0] & Trigger0BIT || skimmedFrame.selMask[1] & Trigger1BIT) { - hTriggerCounter.Fill(2); - hBCSkimmed.Fill(1); - auto p1 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcAO2D == skimmedFrame.bcAO2D; }); - if (p1 != bcSet.end()) { - hBCSkimmed.Fill(2); - } - auto p2 = std::find_if(bcSet.begin(), bcSet.end(), [&](const auto& val) { return val.bcEvSel == skimmedFrame.bcEvSel; }); - if (p2 != bcSet.end()) { - hBCSkimmed.Fill(3); - } - bcTuple currentBC(skimmedFrame.bcAO2D, skimmedFrame.bcEvSel); - auto p3 = std::find(bcSet.begin(), bcSet.end(), currentBC); - if (p3 == bcSet.end()) { - bcSet.push_back(currentBC); - } else { - hBCSkimmed.Fill(4); - } - } + // 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]); + //} } - - TFile fout(outputFileName, "RECREATE"); - fout.cd(); - hTriggerCounter.Write(); - hBCOriginal.Write(); - hBCSkimmed.Write(); - hNumCounter.Write(); - hSinglePairCheck.Write(); - hBCDiffAO2D.Write(); - hBCDiffEvSel.Write(); - hMultiPairCheck.Write(); - fout.Close(); } diff --git a/EventFiltering/macros/uploadOTSobjects.C b/EventFiltering/macros/uploadOTSobjects.C index 132f1b618da..77b6ac97f34 100644 --- a/EventFiltering/macros/uploadOTSobjects.C +++ b/EventFiltering/macros/uploadOTSobjects.C @@ -16,6 +16,7 @@ #include #include #include +#include #include "TFile.h" #include "TGrid.h" @@ -26,16 +27,23 @@ #include "CCDB/BasicCCDBManager.h" #include "EventFiltering/ZorroHelper.h" +#include "CommonConstants/LHCConstants.h" -void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien) +constexpr uint32_t chunkSize = 1000000; + +void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien, bool chunkedProcessing) { const std::string kBaseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/"; std::string baseCCDBpath = passName.empty() ? kBaseCCDBPath : kBaseCCDBPath + passName + "/"; + if (chunkedProcessing) { + baseCCDBpath += "Chunked/"; + } if (useAlien) { TGrid::Connect("alien://"); } o2::ccdb::CcdbApi api; api.init("http://alice-ccdb.cern.ch"); + auto& ccdb = o2::ccdb::BasicCCDBManager::instance(); std::ifstream file(inputList.data()); std::string path; @@ -47,9 +55,11 @@ void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien const int runNumber = std::stoi(runString); metadata["runNumber"] = runString; std::pair duration = o2::ccdb::BasicCCDBManager::getRunDuration(api, runNumber); - duration.first -= 10000; // subtract 3 minutes from the run start - duration.second += 180000; // add 3 minutes to the run duration + duration.first -= 60000; // subtract 1 minutes from the run start + duration.second += 60000; // add 1 minutes to the run duration std::cout << ">>> Begin - end timestamps for the upload: " << duration.first << " - " << duration.second << std::endl; + auto ctp = ccdb.getForTimeStamp>("CTP/Calib/OrbitReset", duration.first / 2 + duration.second / 2); + auto orbitResetTimestamp = (*ctp)[0]; path = useAlien ? "alien://" + path : path; std::unique_ptr scalersFile{TFile::Open((path + "/AnalysisResults_fullrun.root").data(), "READ")}; TH1* scalers = static_cast(scalersFile->Get("central-event-filter-task/scalers/mScalers")); @@ -85,13 +95,48 @@ void uploadOTSobjects(std::string inputList, std::string passName, bool useAlien } } } - api.storeAsTFileAny(&zorroHelpers, baseCCDBpath + "ZorroHelpers", metadata, duration.first, duration.second); + std::sort(zorroHelpers.begin(), zorroHelpers.end(), [](const ZorroHelper& a, const ZorroHelper& b) { + return a.bcAOD < b.bcAOD; + }); + if (!chunkedProcessing) { + api.storeAsTFileAny(&zorroHelpers, baseCCDBpath + "ZorroHelpers", metadata, duration.first, duration.second); + std::cout << std::endl; + } else { + uint32_t helperIndex{0}; + auto startTS = duration.first; + int64_t endTS = 0; + while (helperIndex < zorroHelpers.size()) { + std::vector chunk; + uint32_t endIndex = helperIndex + chunkSize; + while (true) { + if (endIndex >= zorroHelpers.size() - 2) { + endTS = duration.second; + chunk.insert(chunk.begin(), zorroHelpers.begin() + helperIndex, zorroHelpers.end()); + break; + } + auto bcEnd{zorroHelpers[endIndex].bcAOD > zorroHelpers[endIndex].bcEvSel ? zorroHelpers[endIndex].bcAOD : zorroHelpers[endIndex].bcEvSel}; + const auto& nextHelper = zorroHelpers[endIndex + 1]; + auto bcNext{nextHelper.bcAOD < nextHelper.bcEvSel ? nextHelper.bcAOD : nextHelper.bcEvSel}; + if (bcNext - bcEnd > 2001 / o2::constants::lhc::LHCBunchSpacingMUS) { /// ensure a gap of 2ms between chunks + chunk.insert(chunk.begin(), zorroHelpers.begin() + helperIndex, zorroHelpers.begin() + endIndex + 1); + endTS = (orbitResetTimestamp + int64_t(bcEnd * o2::constants::lhc::LHCBunchSpacingNS * 1e-3)) / 1000 + 1; + break; + } + bcEnd = nextHelper.bcAOD > nextHelper.bcEvSel ? nextHelper.bcAOD : nextHelper.bcEvSel; + endIndex++; + } + std::cout << ">>> Chunk " << helperIndex << " - " << helperIndex + chunk.size() << " : " << startTS << " - " << endTS << " \t" << (endTS - startTS) * 1.e-3 << std::endl; + api.storeAsTFileAny(&chunk, baseCCDBpath + "ZorroHelpers", metadata, startTS, endTS); + startTS = endTS + 1; + helperIndex += chunk.size(); + } + } } } -void uploadOTSobjects(std::string periodName) +void uploadOTSobjects(std::string periodName, bool chunkedProcessing) { int year = 2000 + std::stoi(periodName.substr(3, 2)); gSystem->Exec(Form("alien_find /alice/data/%i/%s/ ctf_skim_full/AnalysisResults_fullrun.root | sed 's:/AnalysisResults_fullrun\\.root::' > list_%s.txt", year, periodName.data(), periodName.data())); - uploadOTSobjects(Form("list_%s.txt", periodName.data()), "", true); + uploadOTSobjects(Form("list_%s.txt", periodName.data()), "", true, chunkedProcessing); } 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..ab9708cbaae 100644 --- a/PWGCF/DataModel/FemtoDerived.h +++ b/PWGCF/DataModel/FemtoDerived.h @@ -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 @@ -346,11 +350,15 @@ DECLARE_SOA_TABLE(FDExtParticles, "AOD", "FDEXTPARTICLE", 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, @@ -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/FactorialMomentsTask.cxx b/PWGCF/EbyEFluctuations/Tasks/FactorialMomentsTask.cxx index f235859360a..c76556ec26f 100644 --- a/PWGCF/EbyEFluctuations/Tasks/FactorialMomentsTask.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/FactorialMomentsTask.cxx @@ -16,6 +16,7 @@ #include #include #include +#include "TRandom.h" // O2 includes #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" @@ -33,11 +34,11 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; struct FactorialMoments { - Configurable confEta{"centralEta", 0.8, "eta limit for tracks"}; + Configurable confEta{"centralEta", 0.9, "eta limit for tracks"}; Configurable confNumPt{"numPt", 1, "number of pT bins"}; Configurable confPtMin{"ptMin", 0.2f, "lower pT cut"}; Configurable confDCAxy{"dcaXY", 2.4f, "DCA xy cut"}; - Configurable confDCAz{"dcaZ", 3.2f, "DCA z cut"}; + Configurable confDCAz{"dcaZ", 2.0f, "DCA z cut"}; Configurable confMinTPCCls{"minTPCCls", 70.0f, "minimum number of TPC clusters"}; Configurable> confCentCut{"centLimits", {0, 5}, "centrality min and max"}; Configurable> confVertex{"vertexXYZ", {0.3f, 0.4f, 10.0f}, "vertex cuts"}; @@ -77,9 +78,11 @@ struct FactorialMoments { {"mChi2TPC", "chi2 TPC", {HistType::kTH1F, {{100, 0, 10}}}}, {"mChi2ITS", "chi2 ITS", {HistType::kTH1F, {{100, 0, 10}}}}, {"mChi2TRD", "chi2 TRD", {HistType::kTH1F, {{100, 0, 100}}}}, - {"mDCAxy", "DCA xy", {HistType::kTH1F, {{100, -0.8, 0.8}}}}, - {"mDCAx", "DCA z", {HistType::kTH1F, {{100, -2.0, 2.0}}}}, - {"mDCAxyPt", "DCA xy vs #pt;#pt;DCAxy", {HistType::kTH2F, {{100, 0, 20}, {100, -0.5, 0.5}}}}, + {"mDCAxy", "DCA xy", {HistType::kTH1F, {{500, -0.8, 0.8}}}}, + {"mDCAx", "DCA z", {HistType::kTH1F, {{500, -2.0, 2.0}}}}, + {"mDCAxyPt", "DCA xy vs #pt;#pt;DCAxy", {HistType::kTH2F, {{100, 0, 20}, {500, -0.5, 0.5}}}}, + {"mDCAxyPtbcut", "DCA xy vs #pt;#pt;DCAxycut", {HistType::kTH2F, {{100, 0, 20}, {500, -0.5, 0.5}}}}, + {"mDCAzPtbcut", "DCA z vs #pt;#pt;DCAzcut", {HistType::kTH2F, {{100, 0, 20}, {100, -2.0, 2.0}}}}, {"mDCAzPt", "DCA z vs #pt;#pt;DCAz", {HistType::kTH2F, {{100, 0, 20}, {100, -2.0, 2.0}}}}, {"mNSharedClsTPC", "shared clusters in TPC", {HistType::kTH1F, {{100, 0, 10}}}}, {"mCrossedRowsTPC", "crossedrows in TPC", {HistType::kTH1F, {{100, 0, 200}}}}, @@ -137,9 +140,16 @@ struct FactorialMoments { { for (auto iPt = 0; iPt < confNumPt; ++iPt) { if (track.pt() > confPtBins.value[2 * iPt] && track.pt() < confPtBins.value[2 * iPt + 1]) { + float iphi = track.phi(); + iphi = gRandom->Gaus(iphi, TMath::TwoPi()); + if (iphi < 0) { + iphi += TMath::TwoPi(); + } else if (iphi > TMath::TwoPi()) { + iphi -= TMath::TwoPi(); + } mHistArrQA[iPt * 4]->Fill(track.eta()); mHistArrQA[iPt * 4 + 1]->Fill(track.pt()); - mHistArrQA[iPt * 4 + 2]->Fill(track.phi()); + mHistArrQA[iPt * 4 + 2]->Fill(iphi); countTracks[iPt]++; for (auto iM = 0; iM < nBins; ++iM) { mHistArrReset[iPt * nBins + iM]->Fill(track.eta(), track.phi()); @@ -182,8 +192,9 @@ struct FactorialMoments { mBinConFinal[iPt * 6 + iOrder]->Fill(iM, binConEvent[iPt][iM]); } } // end of loop over M bins - } // end of loop over pT bins + } // end of loop over pT bins } + using TracksFMs = soa::Filtered>; void processRun3(soa::Filtered>::iterator const& coll, TracksFMs const& tracks) { @@ -217,41 +228,32 @@ struct FactorialMoments { fqEvent = {{{{{0, 0, 0, 0, 0, 0}}}}}; binConEvent = {{{0, 0, 0, 0, 0}}}; for (auto const& track : tracks) { - if (includeGlobalTracks && (!track.isGlobalTrack())) { - continue; - } - if (includeTPCTracks && (!track.hasTPC())) { - continue; - } - if (includeITSTracks && (!track.hasITS())) { - continue; + if (track.hasTPC()) { + histos.fill(HIST("mCollID"), track.collisionId()); + histos.fill(HIST("mEta"), track.eta()); + histos.fill(HIST("mPt"), track.pt()); + histos.fill(HIST("mPhi"), track.phi()); + histos.fill(HIST("mNFindableClsTPC"), track.tpcNClsFindable()); + histos.fill(HIST("mNClsTPC"), track.tpcNClsFound()); + histos.fill(HIST("mNClsITS"), track.itsNCls()); + histos.fill(HIST("mChi2TPC"), track.tpcChi2NCl()); + histos.fill(HIST("mChi2ITS"), track.itsChi2NCl()); + histos.fill(HIST("mChi2TRD"), track.trdChi2()); + histos.fill(HIST("mDCAxy"), track.dcaXY()); + histos.fill(HIST("mDCAx"), track.dcaZ()); + histos.fill(HIST("mDCAxyPt"), track.pt(), track.dcaXY()); + histos.fill(HIST("mDCAzPt"), track.pt(), track.dcaZ()); + histos.fill(HIST("mNSharedClsTPC"), track.tpcNClsShared()); + histos.fill(HIST("mCrossedRowsTPC"), track.tpcNClsCrossedRows()); + histos.fill(HIST("mNFinClsminusCRows"), track.tpcNClsFindableMinusCrossedRows()); + histos.fill(HIST("mNFractionShClsTPC"), track.tpcFractionSharedCls()); + histos.fill(HIST("mSharedClsvsPt"), track.pt(), track.tpcNClsShared()); + histos.fill(HIST("mSharedClsProbvsPt"), track.pt(), track.tpcFractionSharedCls() / track.tpcNClsCrossedRows()); + checkpT(track); } - if ((track.pt() < confPtMin) || (track.tpcNClsFindable() < confMinTPCCls)) { - continue; - } - histos.fill(HIST("mCollID"), track.collisionId()); - histos.fill(HIST("mEta"), track.eta()); - histos.fill(HIST("mPt"), track.pt()); - histos.fill(HIST("mPhi"), track.phi()); - histos.fill(HIST("mNFindableClsTPC"), track.tpcNClsFindable()); - histos.fill(HIST("mNClsTPC"), track.tpcNClsFound()); - histos.fill(HIST("mNClsITS"), track.itsNCls()); - histos.fill(HIST("mChi2TPC"), track.tpcChi2NCl()); - histos.fill(HIST("mChi2ITS"), track.itsChi2NCl()); - histos.fill(HIST("mChi2TRD"), track.trdChi2()); - histos.fill(HIST("mDCAxy"), track.dcaXY()); - histos.fill(HIST("mDCAx"), track.dcaZ()); - histos.fill(HIST("mDCAxyPt"), track.pt(), track.dcaXY()); - histos.fill(HIST("mDCAzPt"), track.pt(), track.dcaZ()); - histos.fill(HIST("mNSharedClsTPC"), track.tpcNClsShared()); - histos.fill(HIST("mCrossedRowsTPC"), track.tpcNClsCrossedRows()); - histos.fill(HIST("mNFinClsminusCRows"), track.tpcNClsFindableMinusCrossedRows()); - histos.fill(HIST("mNFractionShClsTPC"), track.tpcFractionSharedCls()); - histos.fill(HIST("mSharedClsvsPt"), track.pt(), track.tpcNClsShared()); - histos.fill(HIST("mSharedClsProbvsPt"), track.pt(), track.tpcFractionSharedCls() / track.tpcNClsCrossedRows()); - checkpT(track); } for (auto iPt = 0; iPt < confNumPt; ++iPt) { + // if (countTracks[iPt] > 0) if (countTracks[iPt] > 0) { mHistArrQA[iPt * 4 + 3]->Fill(countTracks[iPt]); } diff --git a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx index b61c8de928d..5d0ed29cc60 100644 --- a/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/MeanPtFlucIdentified.cxx @@ -29,33 +29,30 @@ #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/Centrality.h" +#include "Common/Core/RecoDecay.h" -#include "TDatabasePDG.h" -#include "TLorentzVector.h" +#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; using namespace std; -double massPi = TDatabasePDG::Instance()->GetParticle(211)->Mass(); -double massKa = TDatabasePDG::Instance()->GetParticle(321)->Mass(); -double massPr = TDatabasePDG::Instance()->GetParticle(2212)->Mass(); - struct meanPtFlucId { Configurable nPtBins{"nPtBins", 300, ""}; Configurable nPartBins{"nPartBins", 250, ""}; Configurable nCentBins{"nCentBins", 101, ""}; Configurable nEtaBins{"nEtaBins", 100, ""}; - Configurable nTpNBins{"nTpNBins", 200, ""}; - Configurable nTpDBins{"nTpDBins", 100, ""}; - Configurable cfgCutPtMax{"cfgCutPtMax", 2.0, "maximum pT"}; + 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)"}; @@ -63,25 +60,41 @@ struct meanPtFlucId { 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 cfgCutPiP1{"cfgCutPiP1", 0.65, "pion p cut-1"}; - Configurable cfgCutPiP2{"cfgCutPiP2", 0.75, "pion p cut-2"}; - Configurable cfgCutKaP1{"cfgCutKaP1", 0.50, "kaon p cut-1"}; - Configurable cfgCutKaP2{"cfgCutKaP2", 0.60, "kaon p cut-2"}; - Configurable cfgCutKaP3{"cfgCutKaP3", 1.60, "kaon p cut-3"}; - Configurable cfgCutPrP1{"cfgCutPrP1", 0.90, "proton p cut-1"}; - Configurable cfgCutPrP2{"cfgCutPrP2", 1.00, "proton p cut-2"}; - Configurable cfgSelPi{"cfgSelPi", true, "PID selection cut for Pions"}; - Configurable cfgSelKa{"cfgSelKa", true, "PID selection cut for Kaons"}; - Configurable cfgSelPr{"cfgSelPr", true, "PID selection cut for Protons"}; - Configurable cfgSelPiInnerParam{"cfgSelPiInnerParam", false, "PID selection cut for Pions by using Momentum at inner wall of the TPC"}; - Configurable cfgSelKaInnerParam{"cfgSelKaInnerParam", false, "PID selection cut for Kaons by using Momentum at inner wall of the TPC"}; - Configurable cfgSelPrInnerParam{"cfgSelPrInnerParam", false, "PID selection cut for Protons by using Momentum at inner wall of the TPC"}; + 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"}; // made change fore Gen + 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", {100, 0., 100.}, "nth moments 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 ", kTH1D, {axisMeanPt}); @@ -320,18 +345,23 @@ struct meanPtFlucId { { 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; } @@ -352,63 +382,116 @@ struct meanPtFlucId { if (track.sign() == 0) return false; - if (std::abs(track.dcaZ()) > cfgCutDcaZ) + if (std::fabs(track.dcaZ()) > cfgCutDcaZ) return false; - if (std::abs(track.dcaXY()) > cfgCutDcaXY) + if (std::fabs(track.dcaXY()) > cfgCutDcaXY) return false; return true; } - // Cuts to rejects the tracks + // Cuts to reject the tracks template bool rejectTracks(T const& track) { - if (track.tpcNSigmaEl() > -3. && track.tpcNSigmaEl() < 5. && std::abs(track.tpcNSigmaPi()) > 3 && std::abs(track.tpcNSigmaKa()) > 3 && std::abs(track.tpcNSigmaPr()) > 3) { + 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; } - // PID selection tpc (!tof) or (tof + tpc) - // PID selction cuts for Pions template - bool selPions(T const& track, double innerParam) + bool selElectrons(T const& track) { - if (track.pt() >= cfgCutPiPtMin && ((!track.hasTOF() && std::abs(track.tpcNSigmaEl()) > cfgCutNSigTpcEl && - ((std::abs(track.tpcNSigmaPi()) < cfgCutNSig3 && innerParam <= cfgCutPiP1) || (std::abs(track.tpcNSigmaPi()) < cfgCutNSig2 && innerParam > cfgCutPiP1 && innerParam <= cfgCutPiP2))) || - (track.hasTOF() && std::abs(track.tpcNSigmaPi()) < cfgCutNSig3 && std::abs(track.tofNSigmaEl()) > cfgCutNSigTofEl && (std::abs(track.tofNSigmaPi()) < cfgCutNSig3)))) { - if (abs(track.rapidity(massPi)) < cfgCutRap) + 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 Kaons + // PID selction cuts for Low momentum Kaons template - bool selKaons(T const& track, double innerParam) + bool selLowKa(T const& track, double p) { - if (track.pt() >= cfgCutKaPtMin && (((!track.hasTOF()) && std::abs(track.tpcNSigmaEl()) > cfgCutNSigTpcEl && - ((std::abs(track.tpcNSigmaKa()) < cfgCutNSig3 && innerParam <= cfgCutKaP1) || (std::abs(track.tpcNSigmaKa()) < cfgCutNSig2 && innerParam > cfgCutKaP1 && innerParam <= cfgCutKaP2))) || - (track.hasTOF() && std::abs(track.tpcNSigmaKa()) < cfgCutNSig3 && std::abs(track.tofNSigmaEl()) > cfgCutNSigTofEl && - ((std::abs(track.tofNSigmaKa()) < cfgCutNSig3 && track.p() <= cfgCutKaP3) || (std::abs(track.tofNSigmaKa()) < cfgCutNSig2 && track.p() > cfgCutKaP3))))) { - if (abs(track.rapidity(massKa)) < cfgCutRap) + 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 Protons + // PID selction cuts for Low momentum Protons template - bool selProtons(T const& track, double innerParam) + bool selLowPr(T const& track, double p) { - if (track.pt() >= cfgCutPrPtMin && (((!track.hasTOF()) && std::abs(track.tpcNSigmaEl()) > cfgCutNSigTpcEl && - ((std::abs(track.tpcNSigmaPr()) < cfgCutNSig3 && innerParam <= cfgCutPrP1) || (std::abs(track.tpcNSigmaPr()) < cfgCutNSig2 && innerParam > cfgCutPrP1 && innerParam <= cfgCutPrP2))) || - (track.hasTOF() && std::abs(track.tpcNSigmaPr()) < cfgCutNSig3 && std::abs(track.tofNSigmaEl()) > cfgCutNSigTofEl && std::abs(track.tofNSigmaPr()) < cfgCutNSig3))) { - if (abs(track.rapidity(massPr)) < cfgCutRap) + 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; @@ -418,18 +501,22 @@ struct meanPtFlucId { template void FillBeforeQAHistos(T const& col, U const& tracks) { - for (auto& myTrack : tracks) { - hist.fill(HIST("QA/before/h_Eta"), myTrack.eta()); - hist.fill(HIST("QA/before/h_Pt"), myTrack.pt()); - hist.fill(HIST("QA/before/h2_PvsPinner"), myTrack.p(), myTrack.tpcInnerParam()); - hist.fill(HIST("QA/before/h2_Pt_Eta"), myTrack.eta(), myTrack.pt()); - hist.fill(HIST("QA/before/h_TPCChi2perCluster"), myTrack.tpcChi2NCl()); - hist.fill(HIST("QA/before/h_ITSChi2perCluster"), myTrack.itsChi2NCl()); - hist.fill(HIST("QA/before/h_crossedTPC"), myTrack.tpcNClsCrossedRows()); - hist.fill(HIST("QA/before/h_DcaXY"), myTrack.dcaXY()); - hist.fill(HIST("QA/before/h_DcaZ"), myTrack.dcaZ()); - hist.fill(HIST("QA/before/h2_DcaXY"), myTrack.pt(), myTrack.dcaXY()); - hist.fill(HIST("QA/before/h2_DcaZ"), myTrack.pt(), myTrack.dcaZ()); + 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); @@ -473,6 +560,7 @@ struct meanPtFlucId { 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()); @@ -484,6 +572,9 @@ struct meanPtFlucId { 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: @@ -519,19 +610,21 @@ struct meanPtFlucId { hist.fill(HIST("QA/Kaon/innerParam/before/h2_TpcTofNsigma"), track.tpcNSigmaKa(), track.tofNSigmaKa()); } - // Fill Proton QA hist: + // 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_Pt"), 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()); @@ -558,13 +651,28 @@ struct meanPtFlucId { 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) + 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; + Q1 += pt; + Q2 += pt * pt; + Q3 += pt * pt * pt; + Q4 += pt * pt * pt * pt; } template @@ -628,6 +736,26 @@ struct meanPtFlucId { 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; @@ -639,16 +767,16 @@ struct meanPtFlucId { double nSigmaTOFPi = track.tofNSigmaPi(); double nSigmaTOFKa = track.tofNSigmaKa(); double nSigmaTOFPr = track.tofNSigmaPr(); - double rapPi = track.rapidity(massPi); - double rapKa = track.rapidity(massKa); - double rapPr = track.rapidity(massPr); + double rapPi = track.rapidity(MassPiPlus); + double rapKa = track.rapidity(MassKPlus); + double rapPr = track.rapidity(MassProton); double innerParam = track.tpcInnerParam(); if constexpr (DataFlag) { - if (std::abs(track.eta()) < 0.8) { + if (std::fabs(track.eta()) < 0.8) { Nch++; pt_ch = track.pt(); - moments(pt_ch, &Q1_ch, &Q2_ch, &Q3_ch, &Q4_ch); + moments(pt_ch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); FillChargedQAHistos(track); } @@ -658,70 +786,166 @@ struct meanPtFlucId { return; } - // For Pions: - if (selPions(track, innerParam) == cfgSelPi) { - N_Pi++; - pt_Pi = track.pt(); - moments(pt_Pi, &Q1_Pi, &Q2_Pi, &Q3_Pi, &Q4_Pi); - FillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi); + if (cfgInvMass == true && invMassGamma < cfgGammaCut) { + continue; } - // For Kaons: - if (selKaons(track, innerParam) == cfgSelKa) { - N_Ka++; - pt_Ka = track.pt(); - moments(pt_Ka, &Q1_Ka, &Q2_Ka, &Q3_Ka, &Q4_Ka); - FillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa); + 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); + } } - // For Protons: - if (selProtons(track, innerParam) == cfgSelPr) { - N_Pr++; - pt_Pr = track.pt(); - moments(pt_Pr, &Q1_Pr, &Q2_Pr, &Q3_Pr, &Q4_Pr); - FillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr); + 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::abs(track.eta()) < 0.8) { + if (std::fabs(track.eta()) < 0.8) { Nch++; pt_ch = track.pt(); - moments(pt_ch, &Q1_ch, &Q2_ch, &Q3_ch, &Q4_ch); + moments(pt_ch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); FillChargedQAHistos(track); } FillBeforePIDQAHistos(track); - if (rejectTracks(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 (selPions(track, innerParam) == cfgSelPi) { - hist.fill(HIST("QA/Reco/Pion/h_allPt"), track.pt()); - if (std::abs(track.mcParticle().pdgCode()) == 211) { - N_Pi++; - pt_Pi = track.pt(); - moments(pt_Pi, &Q1_Pi, &Q2_Pi, &Q3_Pi, &Q4_Pi); - FillIdParticleQAHistos(track, rapPi, nSigmaTPCPi, nSigmaTOFPi); + 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 (selKaons(track, innerParam) == cfgSelKa) { - hist.fill(HIST("QA/Reco/Kaon/h_allPt"), track.pt()); - if (std::abs(track.mcParticle().pdgCode()) == 321) { - N_Ka++; - pt_Ka = track.pt(); - moments(pt_Ka, &Q1_Ka, &Q2_Ka, &Q3_Ka, &Q4_Ka); - FillIdParticleQAHistos(track, rapKa, nSigmaTPCKa, nSigmaTOFKa); + 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 (selProtons(track, innerParam) == cfgSelPr) { - hist.fill(HIST("QA/Reco/Proton/h_allPt"), track.pt()); - if (std::abs(track.mcParticle().pdgCode()) == 2212) { - N_Pr++; - pt_Pr = track.pt(); - moments(pt_Pr, &Q1_Pr, &Q2_Pr, &Q3_Pr, &Q4_Pr); - FillIdParticleQAHistos(track, rapPr, nSigmaTPCPr, nSigmaTOFPr); + 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); + } } } } @@ -751,7 +975,7 @@ struct meanPtFlucId { FillHistos(col, tracks); } } - PROCESS_SWITCH(meanPtFlucId, process_Run3, "Process for Run3", false); + 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&) { @@ -766,18 +990,18 @@ struct meanPtFlucId { FillHistos(col, tracks); } } - PROCESS_SWITCH(meanPtFlucId, process_MCRecoRun3, "process MC Reconstructed Run-3", true); + 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 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; + 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 (abs(mccol.posZ()) > cfgCutPosZ) + if (std::abs(mccol.posZ()) > cfgCutPosZ) return; for (auto& mcParticle : McParticles) { @@ -785,39 +1009,55 @@ struct meanPtFlucId { continue; auto charge = 0.; - auto* p = pdg->GetParticle(mcParticle.pdgCode()); - if (p != nullptr) { - charge = p->Charge(); + int PID = mcParticle.pdgCode(); + auto* pd = pdg->GetParticle(PID); + if (pd != nullptr) { + charge = pd->Charge(); } - if (std::abs(charge) < 1e-3) { - continue; // reject neutral particles in counters + if (std::fabs(charge) < 1e-3) { + continue; } - if (mcParticle.pt() > cfgCutPtMin && mcParticle.pt() < cfgCutPtMax && abs(mcParticle.y()) < cfgCutRap) { + 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); + moments(pt_ch, Q1_ch, Q2_ch, Q3_ch, Q4_ch); hist.fill(HIST("Gen/Charged/h_Pt"), mcParticle.pt()); - if (std::abs(mcParticle.pdgCode()) == 211 && mcParticle.pt() >= cfgCutPiPtMin) { - N_Pi++; - pt_Pi = mcParticle.pt(); - moments(pt_Pi, &Q1_Pi, &Q2_Pi, &Q3_Pi, &Q4_Pi); - hist.fill(HIST("Gen/Pion/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(mcParticle.pdgCode()) == 321 && mcParticle.pt() >= cfgCutKaPtMin) { - N_Ka++; - pt_Ka = mcParticle.pt(); - moments(pt_Ka, &Q1_Ka, &Q2_Ka, &Q3_Ka, &Q4_Ka); - hist.fill(HIST("Gen/Kaon/h_Pt"), mcParticle.pt()); + 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(mcParticle.pdgCode()) == 2212 && mcParticle.pt() >= cfgCutPrPtMin) { - N_Pr++; - pt_Pr = mcParticle.pt(); - moments(pt_Pr, &Q1_Pr, &Q2_Pr, &Q3_Pr, &Q4_Pr); - hist.fill(HIST("Gen/Proton/h_Pt"), mcParticle.pt()); + 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); + } + } } } } @@ -825,16 +1065,19 @@ struct meanPtFlucId { N_FT0C = mccol.multMCFT0C(); hist.fill(HIST("Gen/Counts"), 2); hist.fill(HIST("Gen/vtxZ"), mccol.posZ()); - hist.fill(HIST("Gen/NTPC"), NTPC); - hist.fill(HIST("Gen/NFT0C"), N_FT0C); - hist.fill(HIST("Gen/h2_NTPC_NFT0C"), N_FT0C, NTPC); + 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", true); + PROCESS_SWITCH(meanPtFlucId, process_MCGen, "process MC Generated", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/Femto3D/Core/femto3dPairTask.h b/PWGCF/Femto3D/Core/femto3dPairTask.h index e531c25ac5a..a3b74c36cd0 100755 --- a/PWGCF/Femto3D/Core/femto3dPairTask.h +++ b/PWGCF/Femto3D/Core/femto3dPairTask.h @@ -215,7 +215,8 @@ class FemtoPair float GetKstar() const; TVector3 GetQLCMS() const; float GetKt() const; - float GetMt() const; // test + float GetMt() const; // test + float GetGammaOut() const; // test private: TrackType _first = NULL; @@ -346,6 +347,34 @@ float FemtoPair::GetMt() const return 0.5 * fourmomentasum.Mt(); } + +template +float FemtoPair::GetGammaOut() const +{ + if (_first == NULL || _second == NULL) + return -1000; + if (_magfield1 * _magfield2 == 0) + return -1000; + if (_PDG1 * _PDG2 == 0) + return -1000; + + // double Qinv = 2.0 * GetKstar(); + // TVector3 QLCMS = GetQLCMS(); + // double Qout_PRF = sqrt(Qinv * Qinv - QLCMS.Y() * QLCMS.Y() - QLCMS.Z() * QLCMS.Z()); + // return std::fabs(QLCMS.X() / Qout_PRF); + + TLorentzVector first4momentum; + first4momentum.SetPtEtaPhiM(_first->pt(), _first->eta(), _first->phi(), particle_mass(_PDG1)); + TLorentzVector second4momentum; + second4momentum.SetPtEtaPhiM(_second->pt(), _second->eta(), _second->phi(), particle_mass(_PDG2)); + + TLorentzVector fourmomentasum = first4momentum + second4momentum; + + fourmomentasum.Boost(0.0, 0.0, (-1) * fourmomentasum.BoostVector().Z()); // boost to LCMS + fourmomentasum.RotateZ((-1) * fourmomentasum.Phi()); // rotate so the X axis is along pair's kT + + return fourmomentasum.Gamma(); +} } // namespace o2::aod::singletrackselector #endif // PWGCF_FEMTO3D_CORE_FEMTO3DPAIRTASK_H_ diff --git a/PWGCF/Femto3D/DataModel/singletrackselector.h b/PWGCF/Femto3D/DataModel/singletrackselector.h index 5c78911a3e1..afb4fc3f615 100644 --- a/PWGCF/Femto3D/DataModel/singletrackselector.h +++ b/PWGCF/Femto3D/DataModel/singletrackselector.h @@ -55,6 +55,32 @@ inline o2::framework::expressions::Node unPack(const T& b) return binningType::bin_width * b + binningType::binned_center; } +template +inline typename binningType::binned_t packSymmetric(const float& valueToBin) +{ + if (valueToBin <= binningType::binned_min) { + return (binningType::underflowBin); + } else if (valueToBin >= binningType::binned_max) { + return (binningType::overflowBin); + } else if (valueToBin >= 0) { + return (static_cast((valueToBin * binningType::inv_bin_width) + 0.5f)); + } else { + return (static_cast((valueToBin * binningType::inv_bin_width) - 0.5f)); + } +} + +template +inline float unPackSymmetric(const typename binningType::binned_t& b) +{ + return binningType::bin_width * static_cast(b); +} + +template +inline o2::framework::expressions::Node unPackSymmetric(const T& b) +{ + return binningType::bin_width * static_cast(b); +} + namespace binning { @@ -70,6 +96,7 @@ struct binningParent { static constexpr float binned_max = lim.second; static constexpr float binned_center = 0.5 * (binned_min + binned_max); static constexpr float bin_width = (binned_max - binned_min) / nbins; + static constexpr float inv_bin_width = 1. / bin_width; static_assert(binned_min < binned_max, "Invalid binning range"); static void print() { @@ -78,10 +105,15 @@ struct binningParent { } }; -using nsigma = binningParent(-10.f, 10.f)>; +using nsigma_v0 = binningParent(-10.f, 10.f)>; +using nsigma_v1 = binningParent(-6.35f, 6.35f)>; // Width 0.05 symmetric around 0 +using nsigma = nsigma_v1; + using dca_v0 = binningParent(-1.f, 1.f)>; using dca_v1 = binningParent(-1.f, 1.f), int16_t>; -using dca = dca_v1; +using dca_v2 = binningParent(-3.2767f, 3.2767f), int16_t>; // Width 0.0001 symmetric around 0 +using dca = dca_v2; + using chi2 = binningParent(0.f, 10.f)>; using rowsOverFindable = binningParent(0.f, 3.f)>; @@ -157,20 +189,33 @@ DECLARE_SOA_COLUMN(StoredDcaXY, storedDcaXY, binning::dca_v0::binned_t); DECLARE_SOA_COLUMN(StoredDcaZ, storedDcaZ, binning::dca_v0::binned_t); // impact parameter of the track with 8 bits (v0) DECLARE_SOA_COLUMN(StoredDcaXY_v1, storedDcaXY_v1, binning::dca_v1::binned_t); // impact parameter of the track with 16 bits (v1) DECLARE_SOA_COLUMN(StoredDcaZ_v1, storedDcaZ_v1, binning::dca_v1::binned_t); // impact parameter of the track with 16 bits (v1) +DECLARE_SOA_COLUMN(StoredDcaXY_v2, storedDcaXY_v2, binning::dca_v2::binned_t); // impact parameter of the track with 16 bits (v2, larger range) +DECLARE_SOA_COLUMN(StoredDcaZ_v2, storedDcaZ_v2, binning::dca_v2::binned_t); // impact parameter of the track with 16 bits (v2, larger range) DECLARE_SOA_COLUMN(StoredTPCChi2NCl, storedTpcChi2NCl, binning::chi2::binned_t); // TPC chi2 DECLARE_SOA_COLUMN(StoredITSChi2NCl, storedItsChi2NCl, binning::chi2::binned_t); // ITS chi2 DECLARE_SOA_COLUMN(StoredTPCCrossedRowsOverFindableCls, storedTpcCrossedRowsOverFindableCls, binning::rowsOverFindable::binned_t); // Ratio of found over findable clusters -DECLARE_SOA_COLUMN(StoredTOFNSigmaPi, storedTofNSigmaPi, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTPCNSigmaPi, storedTpcNSigmaPi, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTOFNSigmaKa, storedTofNSigmaKa, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTPCNSigmaKa, storedTpcNSigmaKa, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTOFNSigmaPr, storedTofNSigmaPr, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTPCNSigmaPr, storedTpcNSigmaPr, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTOFNSigmaDe, storedTofNSigmaDe, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTPCNSigmaDe, storedTpcNSigmaDe, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTOFNSigmaHe, storedTofNSigmaHe, binning::nsigma::binned_t); -DECLARE_SOA_COLUMN(StoredTPCNSigmaHe, storedTpcNSigmaHe, binning::nsigma::binned_t); +DECLARE_SOA_COLUMN(StoredTOFNSigmaPi, storedTofNSigmaPi, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTPCNSigmaPi, storedTpcNSigmaPi, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTOFNSigmaKa, storedTofNSigmaKa, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTPCNSigmaKa, storedTpcNSigmaKa, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTOFNSigmaPr, storedTofNSigmaPr, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTPCNSigmaPr, storedTpcNSigmaPr, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTOFNSigmaDe, storedTofNSigmaDe, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTPCNSigmaDe, storedTpcNSigmaDe, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTOFNSigmaHe, storedTofNSigmaHe, binning::nsigma::binned_t); // (v0) +DECLARE_SOA_COLUMN(StoredTPCNSigmaHe, storedTpcNSigmaHe, binning::nsigma::binned_t); // (v0) + +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_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); }); @@ -194,6 +239,12 @@ DECLARE_SOA_DYNAMIC_COLUMN(DcaXY_v1, dcaXY, [](binning::dca_v1::binned_t dca_binned) -> float { return singletrackselector::unPack(dca_binned); }); DECLARE_SOA_DYNAMIC_COLUMN(DcaZ_v1, dcaZ, [](binning::dca_v1::binned_t dca_binned) -> float { return singletrackselector::unPack(dca_binned); }); + +DECLARE_SOA_DYNAMIC_COLUMN(DcaXY_v2, dcaXY, + [](binning::dca_v2::binned_t dca_binned) -> float { return singletrackselector::unPackSymmetric(dca_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(DcaZ_v2, dcaZ, + [](binning::dca_v2::binned_t dca_binned) -> float { return singletrackselector::unPackSymmetric(dca_binned); }); + DECLARE_SOA_DYNAMIC_COLUMN(TPCChi2NCl, tpcChi2NCl, [](binning::chi2::binned_t chi2_binned) -> float { return singletrackselector::unPack(chi2_binned); }); DECLARE_SOA_DYNAMIC_COLUMN(ITSChi2NCl, itsChi2NCl, @@ -205,32 +256,56 @@ DECLARE_SOA_DYNAMIC_COLUMN(TPCCrossedRowsOverFindableCls, tpcCrossedRowsOverFind DECLARE_SOA_DYNAMIC_COLUMN(TPCFractionSharedCls, tpcFractionSharedCls, //! Fraction of shared TPC clusters [](uint8_t tpcNClsShared, int16_t tpcNClsFound) -> float { return (float)tpcNClsShared / (float)tpcNClsFound; }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPi, tofNSigmaPi, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi, tpcNSigmaPi, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaKa, tofNSigmaKa, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaKa, tpcNSigmaKa, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); - -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPr, tofNSigmaPr, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPr, tpcNSigmaPr, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaDe, tofNSigmaDe, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaDe, tpcNSigmaDe, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaHe, tofNSigmaHe, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); -DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaHe, tpcNSigmaHe, - [](binning::nsigma::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPi_v0, tofNSigmaPi, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi_v0, tpcNSigmaPi, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaKa_v0, tofNSigmaKa, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaKa_v0, tpcNSigmaKa, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPr_v0, tofNSigmaPr, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPr_v0, tpcNSigmaPr, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaDe_v0, tofNSigmaDe, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaDe_v0, tpcNSigmaDe, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaHe_v0, tofNSigmaHe, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaHe_v0, tpcNSigmaHe, + [](binning::nsigma_v0::binned_t nsigma_binned) -> float { return singletrackselector::unPack(nsigma_binned); }); + +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPi_v1, tofNSigmaPi, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPi_v1, tpcNSigmaPi, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaKa_v1, tofNSigmaKa, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaKa_v1, tpcNSigmaKa, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaPr_v1, tofNSigmaPr, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaPr_v1, tpcNSigmaPr, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaDe_v1, tofNSigmaDe, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaDe_v1, tpcNSigmaDe, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TOFNSigmaHe_v1, tofNSigmaHe, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaHe_v1, tpcNSigmaHe, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); DECLARE_SOA_COLUMN(TPCInnerParam, tpcInnerParam, float); // Momentum at inner wall of the TPC DECLARE_SOA_COLUMN(TPCSignal, tpcSignal, float); // dE/dx TPC DECLARE_SOA_COLUMN(Beta, beta, float); // TOF beta +DECLARE_SOA_COLUMN(StoredTPCNSigmaEl, storedTpcNSigmaEl, binning::nsigma::binned_t); +DECLARE_SOA_DYNAMIC_COLUMN(TPCNSigmaEl, tpcNSigmaEl, + [](binning::nsigma_v1::binned_t nsigma_binned) -> float { return singletrackselector::unPackSymmetric(nsigma_binned); }); + DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed under the mass assumption given as input [](float p, float eta, float mass) -> float { const auto pz = p * std::tanh(eta); @@ -240,118 +315,178 @@ 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, - singletrackselector::TPCNSigmaPi, - singletrackselector::TOFNSigmaKa, - singletrackselector::TPCNSigmaKa, - singletrackselector::TOFNSigmaPr, - singletrackselector::TPCNSigmaPr, - singletrackselector::TOFNSigmaDe, - singletrackselector::TPCNSigmaDe, - - 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, - singletrackselector::TPCNSigmaPi, - singletrackselector::TOFNSigmaKa, - singletrackselector::TPCNSigmaKa, - singletrackselector::TOFNSigmaPr, - singletrackselector::TPCNSigmaPr, - singletrackselector::TOFNSigmaDe, - singletrackselector::TPCNSigmaDe, - singletrackselector::TOFNSigmaHe, - singletrackselector::TPCNSigmaHe, - - singletrackselector::Rapidity, - singletrackselector::Energy, - singletrackselector::Pt, - singletrackselector::Px, - singletrackselector::Py, - singletrackselector::Pz, - singletrackselector::PhiStar); - -using SingleTrackSels = SingleTrackSels_v1; +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; DECLARE_SOA_TABLE(SingleTrkExtras, "AOD", "SINGLETRKEXTRA", singletrackselector::TPCInnerParam, singletrackselector::TPCSignal, singletrackselector::Beta); +DECLARE_SOA_TABLE(SinglePIDEls, "AOD", "SINGLEPIDEL", + singletrackselector::StoredTPCNSigmaEl, + singletrackselector::TPCNSigmaEl); + namespace singletrackselector { DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); diff --git a/PWGCF/Femto3D/TableProducer/CMakeLists.txt b/PWGCF/Femto3D/TableProducer/CMakeLists.txt index aba3d3c728f..a31ce326c9f 100644 --- a/PWGCF/Femto3D/TableProducer/CMakeLists.txt +++ b/PWGCF/Femto3D/TableProducer/CMakeLists.txt @@ -9,14 +9,11 @@ # 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(single-track-selector SOURCES singleTrackSelector.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB - COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(single-track-selector-converter - SOURCES singleTrackSelectorConverter.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(single-track-selector-extra diff --git a/PWGCF/Femto3D/TableProducer/Converters/CMakeLists.txt b/PWGCF/Femto3D/TableProducer/Converters/CMakeLists.txt new file mode 100644 index 00000000000..9014f8fbe4e --- /dev/null +++ b/PWGCF/Femto3D/TableProducer/Converters/CMakeLists.txt @@ -0,0 +1,21 @@ +# 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(single-track-selector-converter + SOURCES singleTrackSelectorConverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(single-track-selector-converter-v1 + SOURCES singleTrackSelectorConverterV1.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGCF/Femto3D/TableProducer/singleTrackSelectorConverter.cxx b/PWGCF/Femto3D/TableProducer/Converters/singleTrackSelectorConverter.cxx similarity index 98% rename from PWGCF/Femto3D/TableProducer/singleTrackSelectorConverter.cxx rename to PWGCF/Femto3D/TableProducer/Converters/singleTrackSelectorConverter.cxx index 2fe7126ff95..4a44e331e9b 100644 --- a/PWGCF/Femto3D/TableProducer/singleTrackSelectorConverter.cxx +++ b/PWGCF/Femto3D/TableProducer/Converters/singleTrackSelectorConverter.cxx @@ -26,7 +26,7 @@ using namespace o2::aod; //::singletrackselector; // the namespace defined in .h struct singleTrackSelectorConverter { - Produces tableRow; + Produces tableRow; void init(InitContext&) {} diff --git a/PWGCF/Femto3D/TableProducer/Converters/singleTrackSelectorConverterV1.cxx b/PWGCF/Femto3D/TableProducer/Converters/singleTrackSelectorConverterV1.cxx new file mode 100644 index 00000000000..584760ce74a --- /dev/null +++ b/PWGCF/Femto3D/TableProducer/Converters/singleTrackSelectorConverterV1.cxx @@ -0,0 +1,68 @@ +// 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 Converter for the different versions of the singletrackselector tables +/// \author Sofia Tomassini, Gleb Romanenko, Nicolò Jacazio +/// \since 03 May 2024 + +#include +#include "PWGCF/Femto3D/DataModel/singletrackselector.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::track; +using namespace o2::aod; +//::singletrackselector; // the namespace defined in .h + +struct singleTrackSelectorConverter { + Produces tableRow; + + void init(InitContext&) {} + + void process(o2::aod::SingleTrackSels_v1 const& tracks) + { + tableRow.reserve(tracks.size()); + for (auto const& track : tracks) { + tableRow(track.singleCollSelId(), + track.p(), + track.eta(), + track.phi(), + track.sign(), + track.tpcNClsFound(), + track.tpcNClsShared(), + track.itsClsMap(), + track.itsClusterSizes(), + singletrackselector::packSymmetric(track.dcaXY()), + singletrackselector::packSymmetric(track.dcaZ()), + singletrackselector::packInTable(track.tpcChi2NCl()), + singletrackselector::packInTable(track.itsChi2NCl()), + singletrackselector::packInTable(track.tpcCrossedRowsOverFindableCls()), + singletrackselector::packSymmetric(track.tofNSigmaPi()), + singletrackselector::packSymmetric(track.tpcNSigmaPi()), + singletrackselector::packSymmetric(track.tofNSigmaKa()), + singletrackselector::packSymmetric(track.tpcNSigmaKa()), + singletrackselector::packSymmetric(track.tofNSigmaPr()), + singletrackselector::packSymmetric(track.tpcNSigmaPr()), + singletrackselector::packSymmetric(track.tofNSigmaDe()), + singletrackselector::packSymmetric(track.tpcNSigmaDe()), + singletrackselector::packSymmetric(track.tofNSigmaHe()), + singletrackselector::packSymmetric(track.tpcNSigmaHe())); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx b/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx index 5b108aef576..0bec4d3cf40 100644 --- a/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx +++ b/PWGCF/Femto3D/TableProducer/singleTrackSelector.cxx @@ -18,6 +18,9 @@ #include +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + #include "PWGCF/Femto3D/DataModel/singletrackselector.h" #include "Framework/AnalysisTask.h" @@ -44,9 +47,14 @@ using namespace o2::aod; struct singleTrackSelector { Service ccdb; + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + 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 applySkimming{"applySkimming", false, "Skimmed dataset processing"}; + Configurable cfgSkimming{"cfgSkimming", "fPD", "Configurable for skimming"}; 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"}; @@ -89,6 +97,7 @@ struct singleTrackSelector { Produces tableRowCollExtra; Produces tableRow; Produces tableRowExtra; + Produces tableRowPIDEl; Produces tableRowMC; Filter eventFilter = (applyEvSel.node() == 0) || @@ -110,7 +119,7 @@ struct singleTrackSelector { std::vector particlesToKeep; std::vector particlesToReject; - HistogramRegistry registry{"registry"}; + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; SliceCache cache; void init(InitContext&) @@ -119,11 +128,20 @@ struct singleTrackSelector { particlesToKeep = _particlesToKeep; particlesToReject = _particlesToReject; + if (applySkimming) { + zorroSummary.setObject(zorro.getZorroSummary()); + } ccdb->setURL(ccdburl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + if (applySkimming) { + registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{2, 0.f, 2.f}}}); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "All"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "Skimmed"); + } + if (enable_gen_info) { registry.add("hNEvents_MCGen", "hNEvents_MCGen", {HistType::kTH1F, {{1, 0.f, 1.f}}}); registry.add("hGen_EtaPhiPt_Proton", "Gen (anti)protons in true collisions", {HistType::kTH3F, {{100, -1., 1., "#eta"}, {157, 0., 2 * TMath::Pi(), "#phi"}, {100, -5.f, 5.f, "p_{T} GeV/c"}}}); @@ -142,6 +160,11 @@ struct singleTrackSelector { } d_bz = 0.f; + if (applySkimming) { + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfgSkimming.value); + zorro.populateHistRegistry(registry, bc.runNumber()); + } + auto run3grp_timestamp = bc.timestamp(); o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); o2::parameters::GRPMagField* grpmag = 0x0; @@ -204,27 +227,28 @@ struct singleTrackSelector { track.tpcNClsShared(), track.itsClusterMap(), track.itsClusterSizes(), - - singletrackselector::packInTable(track.dcaXY()), - singletrackselector::packInTable(track.dcaZ()), + singletrackselector::packSymmetric(track.dcaXY()), + singletrackselector::packSymmetric(track.dcaZ()), singletrackselector::packInTable(track.tpcChi2NCl()), singletrackselector::packInTable(track.itsChi2NCl()), singletrackselector::packInTable(track.tpcCrossedRowsOverFindableCls()), - singletrackselector::packInTable(track.tofNSigmaPi()), - singletrackselector::packInTable(track.tpcNSigmaPi()), - singletrackselector::packInTable(track.tofNSigmaKa()), - singletrackselector::packInTable(track.tpcNSigmaKa()), - singletrackselector::packInTable(track.tofNSigmaPr()), - singletrackselector::packInTable(track.tpcNSigmaPr()), - singletrackselector::packInTable(track.tofNSigmaDe()), - singletrackselector::packInTable(track.tpcNSigmaDe()), - singletrackselector::packInTable(track.tofNSigmaHe()), - singletrackselector::packInTable(track.tpcNSigmaHe())); + singletrackselector::packSymmetric(track.tofNSigmaPi()), + singletrackselector::packSymmetric(track.tpcNSigmaPi()), + singletrackselector::packSymmetric(track.tofNSigmaKa()), + singletrackselector::packSymmetric(track.tpcNSigmaKa()), + singletrackselector::packSymmetric(track.tofNSigmaPr()), + singletrackselector::packSymmetric(track.tpcNSigmaPr()), + singletrackselector::packSymmetric(track.tofNSigmaDe()), + singletrackselector::packSymmetric(track.tpcNSigmaDe()), + singletrackselector::packSymmetric(track.tofNSigmaHe()), + singletrackselector::packSymmetric(track.tpcNSigmaHe())); tableRowExtra(track.tpcInnerParam(), track.tpcSignal(), track.beta()); + tableRowPIDEl(singletrackselector::packSymmetric(track.tpcNSigmaEl())); + if constexpr (isMC) { int origin = -1; if (track.mcParticle().isPhysicalPrimary()) { @@ -289,6 +313,16 @@ struct singleTrackSelector { { auto bc = collision.bc_as(); initCCDB(bc); + + if (applySkimming) { + registry.fill(HIST("hNEvents"), 0.5); + bool zorroSelected = zorro.isSelected(bc.globalBC()); + if (!zorroSelected) { + return; + } + registry.fill(HIST("hNEvents"), 1.5); + } + double hadronicRate = 0.; if (fetchRate) { hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // fetch IR diff --git a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx index e39a9449040..045dc9ad2d8 100644 --- a/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx +++ b/PWGCF/Femto3D/Tasks/femto3dPairTask.cxx @@ -97,6 +97,7 @@ struct FemtoCorrelations { ConfigurableAxis CFkStarBinning{"CFkStarBinning", {500, 0.005, 5.005}, "k* binning of the CF (Nbins, lowlimit, uplimit)"}; Configurable _fill3dCF{"fill3dCF", false, "flag for filling 3D LCMS histos: true -- fill; false -- not"}; + Configurable _fill3dAddHistos{"fill3dAddHistos", 1, "flag for filling additional 3D histos: 0 -- nothing; 1 -- Q_LCMS vs. k*; 2 -- Q_LCMS vs. Gamma_out (currently testing)"}; Configurable _fillDetaDphi{"fillDetaDphi", -1, "flag for filling dEta(dPhi*) histos: '-1' -- don't fill; '0' -- fill before the cut; '1' -- fill after the cut; '2' -- fill before & after the cut"}; ConfigurableAxis CF3DqLCMSBinning{"CF3DqLCMSBinning", {60, -0.3, 0.3}, "q_out/side/long binning of the CF 3D in LCMS (Nbins, lowlimit, uplimit)"}; // the next configarable is responsible for skipping (pseudo)randomly chosen ($value -1) pairs of events in the mixing process @@ -147,7 +148,7 @@ struct FemtoCorrelations { std::vector>> SEhistos_3D; std::vector>> MEhistos_3D; - std::vector>> qLCMSvskStar; + std::vector>> Add3dHistos; std::vector>> DoubleTrack_SE_histos_BC; // BC -- before cutting std::vector>> DoubleTrack_ME_histos_BC; // BC -- before cutting @@ -204,19 +205,26 @@ struct FemtoCorrelations { if (_fill3dCF) { std::vector> SEperMult_3D; std::vector> MEperMult_3D; - std::vector> qLCMSvskStarperMult; + std::vector> Add3dHistosperMult; for (unsigned int j = 0; j < _kTbins.value.size() - 1; j++) { auto hSE_3D = registry.add(Form("Cent%i/SE_3D_cent%i_kT%i", i, i, j), Form("SE_3D_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); auto hME_3D = registry.add(Form("Cent%i/ME_3D_cent%i_kT%i", i, i, j), Form("ME_3D_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); - auto hqLCMSvskStar = registry.add(Form("Cent%i/qLCMSvskStar_cent%i_kT%i", i, i, j), Form("qLCMSvskStar_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); SEperMult_3D.push_back(std::move(hSE_3D)); MEperMult_3D.push_back(std::move(hME_3D)); - qLCMSvskStarperMult.push_back(std::move(hqLCMSvskStar)); + + if (_fill3dAddHistos == 1) { + auto hAdd3dHistos = registry.add(Form("Cent%i/qLCMSvskStar_cent%i_kT%i", i, i, j), Form("qLCMSvskStar_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); + Add3dHistosperMult.push_back(std::move(hAdd3dHistos)); + } else if (_fill3dAddHistos == 2) { + auto hAdd3dHistos = registry.add(Form("Cent%i/qLCMSvsGout_cent%i_kT%i", i, i, j), Form("qLCMSvsGout_cent%i_kT%i", i, j), kTH3F, {{CF3DqLCMSBinning, "q_out (GeV/c)"}, {CF3DqLCMSBinning, "q_side (GeV/c)"}, {CF3DqLCMSBinning, "q_long (GeV/c)"}}); + Add3dHistosperMult.push_back(std::move(hAdd3dHistos)); + } } SEhistos_3D.push_back(std::move(SEperMult_3D)); MEhistos_3D.push_back(std::move(MEperMult_3D)); - qLCMSvskStar.push_back(std::move(qLCMSvskStarperMult)); + if (_fill3dAddHistos != 0) + Add3dHistos.push_back(std::move(Add3dHistosperMult)); } if (_fillDetaDphi > -1) { @@ -366,7 +374,10 @@ struct FemtoCorrelations { std::mt19937 mt(std::chrono::steady_clock::now().time_since_epoch().count()); TVector3 qLCMS = std::pow(-1, (mt() % 2)) * Pair->GetQLCMS(); // introducing randomness to the pair order ([first, second]); important only for 3D because if there are any sudden order/correlation in the tables, it could couse unwanted asymmetries in the final 3d rel. momentum distributions; irrelevant in 1D case because the absolute value of the rel.momentum is taken MEhistos_3D[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z()); - qLCMSvskStar[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z(), Pair->GetKstar()); + if (_fill3dAddHistos == 1) + Add3dHistos[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z(), Pair->GetKstar()); + else if (_fill3dAddHistos == 2) + Add3dHistos[multBin][kTbin]->Fill(qLCMS.X(), qLCMS.Y(), qLCMS.Z(), Pair->GetGammaOut()); } } Pair->ResetPair(); diff --git a/PWGCF/Femto3D/Tools/checkPacking.cxx b/PWGCF/Femto3D/Tools/checkPacking.cxx index baa4322e553..51d26443200 100644 --- a/PWGCF/Femto3D/Tools/checkPacking.cxx +++ b/PWGCF/Femto3D/Tools/checkPacking.cxx @@ -24,22 +24,45 @@ using namespace o2; template -bool process(std::string outputName, int nevents = 100000) +bool process(const TString outputName, const int nevents = 100000) { class Container { public: Container() {} - void operator()(const float toPack) { mPacked = aod::singletrackselector::packInTable(toPack); } + void operator()(const float toPack) { mPacked = aod::singletrackselector::packSymmetric(toPack); } + void test(const float toPack) + { + auto bin = aod::singletrackselector::packSymmetric(toPack); + LOG(info) << toPack << " goes to " << aod::singletrackselector::unPackSymmetric(bin) << " bin " << static_cast(bin); + } T::binned_t mPacked = 0; - float unpack() { return aod::singletrackselector::unPack(mPacked); } + float unpack() { return aod::singletrackselector::unPackSymmetric(mPacked); } } container; - const float min = T::binned_min - 2; - const float max = T::binned_max + 2; + T::print(); + const float min = T::binned_min; + const float max = T::binned_max; + container.test(0); + container.test(0 + T::bin_width); + container.test(0 - T::bin_width); + container.test(0 - T::bin_width * 0.5); + const int nbins = (max - min) / T::bin_width; + std::vector xbins; + for (int i = 0; i <= nbins; i++) { + const float x = min + i * T::bin_width; + const auto ix = aod::singletrackselector::packSymmetric(x); + const float u = aod::singletrackselector::unPackSymmetric(ix); + LOG(info) << "Bin " << i << "/" << xbins.size() << " " << x << " => " << static_cast(ix) << " " << u; + if (i > 1) { + if (ix == aod::singletrackselector::packSymmetric(xbins.back())) { + continue; + } + } + xbins.push_back(u); + } LOG(info) << "Min = " << min << " Max = " << max; - TH1F* hgaus = new TH1F("hgaus", "", (max - min) / T::bin_width, - min, max); + TH1F* hgaus = new TH1F("hgaus", "", nbins, min + T::bin_width * 0.5, max + 0.5 * T::bin_width); hgaus->Print(); LOG(info) << "Bin width = " << T::bin_width << " vs histo " << hgaus->GetXaxis()->GetBinWidth(1); hgaus->SetLineColor(2); @@ -56,31 +79,47 @@ bool process(std::string outputName, int nevents = 100000) huniformPacked->SetLineStyle(2); for (int i = 0; i < nevents; i++) { - float nsigma = gRandom->Gaus(0, 1); - hgaus->Fill(nsigma); - aod::pidutils::packInTable(nsigma, container); + float randomValue = gRandom->Gaus(0, 1); + hgaus->Fill(randomValue); + container(randomValue); hgausPacked->Fill(container.unpack()); - nsigma = gRandom->Uniform(-10, 10); - huniform->Fill(nsigma); - aod::pidutils::packInTable(nsigma, container); + randomValue = gRandom->Uniform(-10, 10); + huniform->Fill(randomValue); + container(randomValue); huniformPacked->Fill(container.unpack()); } TCanvas* can = new TCanvas("can"); hgaus->Draw(); hgausPacked->Draw("same"); - outputName = "/tmp/" + outputName + ".pdf"; - can->SaveAs(Form("%s[", outputName.c_str())); - can->SaveAs(outputName.c_str()); + TString imgoutputName = "/tmp/" + outputName + ".pdf"; + can->SaveAs("/tmp/" + outputName + "_Gaus.root"); + can->SaveAs(Form("%s[", imgoutputName.Data())); + can->SaveAs(imgoutputName.Data()); huniform->Draw(); huniformPacked->Draw("same"); - can->SaveAs(outputName.c_str()); - can->SaveAs(Form("%s]", outputName.c_str())); + can->SaveAs(imgoutputName.Data()); + can->SaveAs(Form("%s]", imgoutputName.Data())); const bool gausOk = (hgaus->GetBinContent(hgaus->FindBin(0)) == hgausPacked->GetBinContent(hgausPacked->FindBin(0))); + if (!gausOk) { + LOG(info) << "Gaus packing/unpacking failed"; + } + const bool gausMeanOk = (hgaus->GetMean() == hgausPacked->GetMean()); + if (!gausMeanOk) { + LOG(info) << "Gaus packing/unpacking mean failed"; + } + const bool uniformOk = (huniform->GetBinContent(huniform->FindBin(0)) == huniformPacked->GetBinContent(huniformPacked->FindBin(0))); - return gausOk && uniformOk; + if (!uniformOk) { + LOG(info) << "Uniform packing/unpacking failed"; + } + const bool uniformMeanOk = (huniform->GetMean() == huniformPacked->GetMean()); + if (!uniformMeanOk) { + LOG(info) << "Uniform packing/unpacking mean failed"; + } + return gausOk && uniformOk && gausMeanOk && uniformMeanOk; } int main(int /*argc*/, char* /*argv*/[]) @@ -93,4 +132,11 @@ int main(int /*argc*/, char* /*argv*/[]) LOG(fatal) << "Packing and unpacking of PID signals (nsigmas) in the Femto PID response is incorrect."; } + LOG(info) << "Checking the packing and unpacking of PID signals (dca) in the Femto DCA."; + if (process("Dca", 100000)) { + LOG(info) << "Packing and unpacking of DCA signals (dca) in the Femto is correct."; + } else { + LOG(fatal) << "Packing and unpacking of DCA signals (dca) in the Femto is incorrect."; + } + } // main 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/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/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..fa215542a6c 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx @@ -56,8 +56,10 @@ 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 @@ -363,16 +365,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(), @@ -647,8 +654,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 +710,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 } } } 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..aecca490b80 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); @@ -548,7 +552,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/FemtoUniverseEventHisto.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h index ebd95d31a00..b49c2480710 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h @@ -35,11 +35,11 @@ class FemtoUniverseEventHisto void init(HistogramRegistry* registry) { mHistogramRegistry = registry; - mHistogramRegistry->add("Event/zvtxhist", "; vtx_{z} (cm); Entries", kTH1F, {{300, -12.5, 12.5}}); - mHistogramRegistry->add("Event/MultV0M", "; vMultV0M; Entries", kTH1F, {{16384, 0, 32768}}); - mHistogramRegistry->add("Event/MultNTr", "; vMultNTr; Entries", kTH1F, {{200, 0, 200}}); - mHistogramRegistry->add("Event/MultNTrVSMultV0M", "; vMultNTr; MultV0M", kTH2F, {{4000, 0, 4000}, {32768, 0, 32768}}); - mHistogramRegistry->add("Event/zvtxhist_MultNTr", "; zvtxhist; MultNTr", kTH2F, {{300, -12.5, 12.5}, {200, 0, 200}}); + mHistogramRegistry->add("Event/zvtxhist", "; vtx_{z} (cm); Entries", kTH1F, {{250, -12.5, 12.5}}); + mHistogramRegistry->add("Event/MultV0M", "; vMultV0M; Entries", kTH1F, {{1500, 0, 30000}}); + mHistogramRegistry->add("Event/MultNTr", "; vMultNTr; Entries", kTH1F, {{20, 0, 200}}); + mHistogramRegistry->add("Event/MultNTrVSMultV0M", "; vMultNTr; MultV0M", kTH2F, {{200, 0, 4000}, {1500, 0, 30000}}); + mHistogramRegistry->add("Event/zvtxhist_MultNTr", "; zvtxhist; MultNTr", kTH2F, {{250, -12.5, 12.5}, {20, 0, 200}}); } /// Some basic QA of the event diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h index 95c0165b26d..74f5554bde3 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h @@ -65,6 +65,37 @@ 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 ROOT::Math::PtEtaPhiMVector trackDiff = 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 @@ -166,55 +197,56 @@ class FemtoUniverseMath const double tPz = trackSum.pz(); const double tE = trackSum.E(); - double tPt = (tPx * tPx + tPy * tPy); - double tMt = (tE * tE - tPz * tPz); - double tM = sqrt(tMt - tPt); - tMt = sqrt(tMt); - tPt = sqrt(tPt); - - double fDKOutLCMS, fDKSideLCMS, fDKLongLCMS; - double fDKOut, fDKSide, fDKLong, fDE; - double px1LCMS, py1LCMS, pz1LCMS; - double px2LCMS, py2LCMS, pz2LCMS; - double kstar; + const double tPtSq = (tPx * tPx + tPy * tPy); + const double tMtSq = (tE * tE - tPz * tPz); + const double tM = sqrt(tMtSq - tPtSq); + const double tMt = sqrt(tMtSq); + const double tPt = sqrt(tPtSq); // Boost to LCMS const double beta = tPz / tE; const double gamma = tE / tMt; - fDKOut = (part1.px() * tPx + part1.py() * tPy) / tPt; - fDKSide = (-part1.px() * tPy + part1.py() * tPx) / tPt; - fDKLong = gamma * (part1.pz() - beta * E1); - fDE = gamma * (E1 - beta * part1.pz()); + const double fDKOut = (part1.px() * tPx + part1.py() * tPy) / tPt; + const double fDKSide = (-part1.px() * tPy + part1.py() * tPx) / tPt; + const double fDKLong = gamma * (part1.pz() - beta * E1); + const double fDE = gamma * (E1 - beta * part1.pz()); - px1LCMS = fDKOut; - py1LCMS = fDKSide; - pz1LCMS = fDKLong; - // pE1LCMS = fDE; + const double px1LCMS = fDKOut; + const double py1LCMS = fDKSide; + const double pz1LCMS = fDKLong; + const double pE1LCMS = fDE; - px2LCMS = (part2.px() * tPx + part2.py() * tPy) / tPt; - py2LCMS = (part2.py() * tPx - part2.px() * tPy) / tPt; - pz2LCMS = gamma * (part2.pz() - beta * E2); - // pE2LCMS = gamma * (E2 - beta * part2.pz()); + const double px2LCMS = (part2.px() * tPx + part2.py() * tPy) / tPt; + const double py2LCMS = (part2.py() * tPx - part2.px() * tPy) / tPt; + const double pz2LCMS = gamma * (part2.pz() - beta * E2); + const double pE2LCMS = gamma * (E2 - beta * part2.pz()); - fDKOutLCMS = px1LCMS - px2LCMS; - fDKSideLCMS = py1LCMS - py2LCMS; - fDKLongLCMS = pz1LCMS - pz2LCMS; + const double fDKOutLCMS = px1LCMS - px2LCMS; + const double fDKSideLCMS = py1LCMS - py2LCMS; + const double fDKLongLCMS = pz1LCMS - pz2LCMS; // Boost to PRF const double betaOut = tPt / tMt; const double gammaOut = tMt / tM; - fDKOut = gammaOut * (fDKOut - betaOut * fDE); - kstar = sqrt(fDKOut * fDKOut + fDKSide * fDKSide + fDKLong * fDKLong); + const double fDKOutPRF = gammaOut * (fDKOutLCMS - betaOut * (pE1LCMS - pE2LCMS)); + const double fDKSidePRF = fDKSideLCMS; + const double fDKLongPRF = fDKLongLCMS; + const double fKOut = gammaOut * (fDKOut - betaOut * fDE); + + const double qlcms = sqrt(fDKOutLCMS * fDKOutLCMS + fDKSideLCMS * fDKSideLCMS + fDKLongLCMS * fDKLongLCMS); + const double qinv = sqrt(fDKOutPRF * fDKOutPRF + fDKSidePRF * fDKSidePRF + fDKLongPRF * fDKLongPRF); + const double kstar = sqrt(fKOut * fKOut + fDKSide * fDKSide + fDKLong * fDKLong); if (isiden) { - vect.push_back(2.0 * (kstar)); + vect.push_back(qinv); vect.push_back(fDKOutLCMS); vect.push_back(fDKSideLCMS); vect.push_back(fDKLongLCMS); + vect.push_back(qlcms); } else { vect.push_back(kstar); vect.push_back(fDKOut); 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..f2465196a6f 100644 --- a/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h +++ b/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h @@ -126,6 +126,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 +205,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 +301,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/femtoUniverseProducerMCTruthTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx index f80d7dafcd6..117b5c57624 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx @@ -170,6 +170,8 @@ struct femtoUniverseProducerMCTruthTask { for (uint32_t pdg : tmpPDGCodes) { if (pdgCode == 333) { pass = true; + } else if (pdgCode == 421) { + pass = true; } else if (static_cast(pdg) == static_cast(pdgCode)) { if (particle.isPhysicalPrimary()) pass = true; diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 0bd9b95b771..30cc8d97278 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -15,9 +15,12 @@ /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch /// \author Malgorzata Janik, WUT Warsaw, majanik@cern.ch +#include #include // FIXME +#include +#include +#include -#include #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -102,6 +105,7 @@ struct femtoUniverseProducerTask { Produces outputDebugParts; Produces outputPartsMCLabels; Produces outputDebugPartsMC; + Produces outputCascParts; Configurable ConfIsDebug{"ConfIsDebug", true, "Enable Debug tables"}; // Choose if filtering or skimming version is run @@ -123,7 +127,7 @@ 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 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"}; @@ -131,7 +135,11 @@ struct femtoUniverseProducerTask { Configurable ConfCentFT0Max{"ConfCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"}; Configurable ConfEvIsGoodZvtxFT0vsPV{"ConfEvIsGoodZvtxFT0vsPV", true, "Require kIsGoodZvtxFT0vsPV selection on Events."}; Configurable ConfEvNoSameBunchPileup{"ConfEvNoSameBunchPileup", true, "Require kNoSameBunchPileup selection on Events."}; + Configurable ConfIsUsePileUp{"ConfIsUsePileUp", true, "Required for choosing whether to run the pile-up cuts"}; Configurable ConfEvIsVertexITSTPC{"ConfEvIsVertexITSTPC", true, "Require kIsVertexITSTPC selection on Events"}; + Configurable ConfTPCOccupancyMin{"ConfTPCOccupancyMin", 0, "Minimum value for TPC Occupancy selection"}; + Configurable ConfTPCOccupancyMax{"ConfTPCOccupancyMax", 500, "Maximum value for TPC Occupancy selection"}; + Filter CustomCollCentFilter = (aod::cent::centFT0C > ConfCentFT0Min) && (aod::cent::centFT0C < ConfCentFT0Max); @@ -262,6 +270,8 @@ struct femtoUniverseProducerTask { Configurable ConfLooseTOFNSigmaValue{"ConfLooseTOFNSigmaValue", 10, "Value for the loose TOF N Sigma for Kaon PID."}; Configurable ConfInvMassLowLimitPhi{"ConfInvMassLowLimitPhi", 1.011, "Lower limit of the Phi invariant mass"}; // change that to do invariant mass cut Configurable ConfInvMassUpLimitPhi{"ConfInvMassUpLimitPhi", 1.027, "Upper limit of the Phi invariant mass"}; + Configurable ConfPtLowLimitPhi{"ConfPtLowLimitPhi", 0.8, "Lower limit of the Phi pT."}; + Configurable ConfPtHighLimitPhi{"ConfPtHighLimitPhi", 4.0, "Higher limit of the Phi pT."}; Configurable ConfNsigmaRejectPion{"ConfNsigmaRejectPion", 3.0, "Reject if particle could be a Pion combined nsigma value."}; Configurable ConfNsigmaRejectProton{"ConfNsigmaRejectProton", 3.0, "Reject if particle could be a Proton combined nsigma value."}; } ConfPhiSelection; @@ -321,31 +331,31 @@ struct femtoUniverseProducerTask { { if (mom < 0.3) { // 0.0-0.3 - if (TMath::Abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue) { + if (TMath::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) { + if (TMath::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) { + if (TMath::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)) { + if ((TMath::Abs(nsigmaTOFK) < 3.0) && (TMath::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)) { + if ((TMath::Abs(nsigmaTOFK) < 2.0) && (TMath::Abs(nsigmaTPCK) < ConfPhiSelection.ConfLooseTPCNSigmaValue.value)) { return true; } else { return false; @@ -376,7 +386,7 @@ struct femtoUniverseProducerTask { return false; } } else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF) - if ((TMath::Abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((TMath::Abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue.value) && (TMath::Abs(nsigmaTPCK) < 3.0)) { { return true; } @@ -384,7 +394,7 @@ struct femtoUniverseProducerTask { return false; } } else if (mom > 1.5) { // 1.5 - - if ((TMath::Abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue) && (TMath::Abs(nsigmaTPCK) < 3.0)) { + if ((TMath::Abs(nsigmaTOFK) < ConfPhiSelection.ConfLooseTOFNSigmaValue.value) && (TMath::Abs(nsigmaTPCK) < 3.0)) { return true; } else { return false; @@ -397,16 +407,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) { + if (TMath::Abs(nsigmaTPCPi) < ConfPhiSelection.ConfNsigmaRejectPion.value) { return true; - } else if (TMath::Abs(nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton) { + } else if (TMath::Abs(nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton.value) { return true; } } if (mom > 0.5) { - if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPhiSelection.ConfNsigmaRejectPion) { + if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfPhiSelection.ConfNsigmaRejectPion.value) { return true; - } else if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton) { + } else if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfPhiSelection.ConfNsigmaRejectProton.value) { return true; } else { return false; @@ -765,22 +775,23 @@ struct femtoUniverseProducerTask { // in case of trigger run - store such collisions but don't store any // particle candidates for such collisions if (!colCuts.isSelected(col)) { - if (ConfIsTrigger) { - 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); - } - } return; } - colCuts.fillQA(col); - if (ConfDoSpher) { - 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); } template @@ -820,14 +831,6 @@ struct femtoUniverseProducerTask { // in case of trigger run - store such collisions but don't store any // particle candidates for such collisions if (!colCuts.isSelected(col)) { - if (ConfIsTrigger) { - if (ConfDoSpher) { - outputCollision(vtxZ, cent, multNtr, colCuts.computeSphericity(col, tracks), mMagField); - } else { - outputCollision(vtxZ, cent, multNtr, 2, mMagField); - } - } - return; } @@ -850,28 +853,23 @@ struct femtoUniverseProducerTask { 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)) { - if (ConfIsTrigger) { - if (ConfDoSpher) { - outputCollision(vtxZ, cent, multNtr, colCuts.computeSphericity(col, tracks), mMagField); - } else { - outputCollision(vtxZ, cent, multNtr, 2, mMagField); - } - } ////// - 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); - } else { - outputCollision(vtxZ, cent, multNtr, 2, mMagField); + if ((col.selection_bit(aod::evsel::kNoSameBunchPileup)) && (col.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) && (occupancy > ConfTPCOccupancyMin && occupancy <= ConfTPCOccupancyMax)) { + if (ConfDoSpher) { + outputCollision(vtxZ, cent, multNtr, colCuts.computeSphericity(col, tracks), mMagField); + } else { + outputCollision(vtxZ, cent, multNtr, 2, mMagField); + } } } @@ -900,13 +898,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); @@ -1033,18 +1041,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); // } @@ -1054,18 +1072,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); // } @@ -1076,31 +1104,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, + casc.mXi(), + 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 @@ -1239,7 +1287,7 @@ struct femtoUniverseProducerTask { continue; } // implementing PID cuts for phi children - if (ConfPhiSelection.ConfLooseTPCNSigma) { + if (ConfPhiSelection.ConfLooseTPCNSigma.value) { if (!(IsKaonNSigmaTPCLoose(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon)))) { continue; } @@ -1247,7 +1295,7 @@ struct femtoUniverseProducerTask { continue; } } - if (ConfPhiSelection.ConfLooseTOFNSigma) { + if (ConfPhiSelection.ConfLooseTOFNSigma.value) { if (!(IsKaonNSigmaTOFLoose(p1.pt(), trackCuts.getNsigmaTPC(p1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(p1, o2::track::PID::Kaon)))) { continue; } @@ -1291,7 +1339,7 @@ struct femtoUniverseProducerTask { } float phiPt = sumVec.Pt(); - if ((phiPt < 0.14) || (phiPt > 10.0)) { + if ((phiPt < ConfPhiSelection.ConfPtLowLimitPhi.value) || (phiPt > ConfPhiSelection.ConfPtHighLimitPhi.value)) { continue; } @@ -1303,7 +1351,7 @@ struct femtoUniverseProducerTask { } float phiM = sumVec.M(); - if (((phiM < ConfPhiSelection.ConfInvMassLowLimitPhi) || (phiM > ConfPhiSelection.ConfInvMassUpLimitPhi))) { + if (((phiM < ConfPhiSelection.ConfInvMassLowLimitPhi.value) || (phiM > ConfPhiSelection.ConfInvMassUpLimitPhi.value))) { continue; } @@ -1388,7 +1436,7 @@ 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; 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..3e07257147f 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackCascadeExtended.cxx @@ -37,7 +37,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)"}; @@ -80,17 +80,27 @@ 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}}); posChildHistos.init(&qaRegistry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false, 0, true); negChildHistos.init(&qaRegistry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false, 0, true); @@ -103,8 +113,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 +150,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); diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackD0.cxx index bd59782fc0a..c224194e604 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" @@ -56,9 +57,7 @@ static constexpr int nPart = 2; static constexpr int nCuts = 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[nPart][nCuts]{{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] @@ -483,9 +482,9 @@ struct femtoUniversePairTaskTrackD0 { } // filling QA plots for D0 mesons' negative daughters (pi-) if (daughD0D0bar.mLambda() == -1 && daughD0D0bar.mAntiLambda() == 1) { - qaRegistry.fill(HIST("D0_pos_daugh/pt"), daughD0D0bar.pt()); - qaRegistry.fill(HIST("D0_pos_daugh/eta"), daughD0D0bar.eta()); - qaRegistry.fill(HIST("D0_pos_daugh/phi"), daughD0D0bar.phi()); + qaRegistry.fill(HIST("D0_neg_daugh/pt"), daughD0D0bar.pt()); + qaRegistry.fill(HIST("D0_neg_daugh/eta"), daughD0D0bar.eta()); + qaRegistry.fill(HIST("D0_neg_daugh/phi"), daughD0D0bar.phi()); } // filling QA plots for D0bar mesons' positive daughters (pi+) if (daughD0D0bar.mLambda() == 1 && daughD0D0bar.mAntiLambda() == -1) { @@ -556,7 +555,7 @@ struct femtoUniversePairTaskTrackD0 { } } } // It is the end of the for loop over D0bar mesons - } // It is the end of the for loop over all candidates + } // It is the end of the for loop over all candidates } PROCESS_SWITCH(femtoUniversePairTaskTrackD0, processSideBand, "Enable processing side-band methode", false); @@ -578,6 +577,7 @@ struct femtoUniversePairTaskTrackD0 { for (auto& d0candidate : groupPartsD0) { trackHistoPartD0D0bar.fillQA(d0candidate); } + float tpcNSigmaPr, tofNSigmaPr, tpcNSigmaPi, tofNSigmaPi, tpcNSigmaKa, tofNSigmaKa; if (!ConfTrack.ConfIsSame) { diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx index 56dc219c883..b5b1aeb6296 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx @@ -68,54 +68,66 @@ struct femtoUniversePairTaskTrackPhi { using FemtoRecoParticles = soa::Join; Preslice perColMC = aod::femtouniverseparticle::fdCollisionId; - 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 ConfCPRInvMassCutMin{"ConfCPRInvMassCutMin", 1.014, "Invariant mass (low) cut for Close Pair Rejection"}; - Configurable ConfCPRInvMassCutMax{"ConfCPRInvMassCutMax", 1.026, "Invariant mass (high) cut for Close Pair Rejection"}; - Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; + // Efficiency + 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"}; + } ConfEff; + + struct : o2::framework::ConfigurableGroup { + Configurable ConfCPRIsEnabled{"ConfCPRIsEnabled", 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 ConfCPRInvMassCutMin{"ConfCPRInvMassCutMin", 1.014, "Invariant mass (low) cut for Close Pair Rejection"}; + Configurable ConfCPRInvMassCutMax{"ConfCPRInvMassCutMax", 1.026, "Invariant mass (high) cut for Close Pair Rejection"}; + Configurable ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"}; + } ConfCPR; /// 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 ConfNsigmaRejectKaon{"ConfNsigmaRejectKaon", 3.0, "Reject if particle could be a Kaon combined nsigma value."}; - Configurable ConfNsigmaRejectPion{"ConfNsigmaRejectPion", 3.0, "Reject if particle could be a Pion combined nsigma value."}; - Configurable ConfNsigmaRejectProton{"ConfNsigmaRejectProton", 3.0, "Reject if particle could be a Proton combined nsigma value."}; - 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 ConfPIDProtonNsigmaCombined{"ConfPIDProtonNsigmaCombined", 3.0, "TPC and TOF Proton Sigma (combined) for momentum > 0.5"}; + Configurable ConfPIDProtonNsigmaTPC{"ConfPIDProtonNsigmaTPC", 3.0, "TPC Proton Sigma for momentum < 0.5"}; + Configurable ConfPIDKaonNsigmaReject{"ConfPIDKaonNsigmaReject", 3.0, "Reject if particle could be a Kaon combined nsigma value."}; + Configurable ConfPIDPionNsigmaReject{"ConfPIDPionNsigmaReject", 3.0, "Reject if particle could be a Pion combined nsigma value."}; + Configurable ConfPIDProtonNsigmaReject{"ConfPIDProtonNsigmaReject", 3.0, "Reject if particle could be a Proton combined nsigma value."}; + Configurable ConfPIDPionNsigmaCombined{"ConfPIDPionNsigmaCombined", 3.0, "TPC and TOF Pion Sigma (combined) for momentum > 0.5"}; + Configurable ConfPIDPionNsigmaTPC{"ConfPIDPionNsigmaTPC", 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 ConfIsMC{"ConfIsMC", false, "Enable additional Histograms 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 ConfBinsPhi{"ConfBinsPhi", 29, "Number of phi bins in deta dphi"}; + Configurable ConfBinsEta{"ConfBinsEta", 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 ConfTrackIsSame{"ConfTrackIsSame", false, "Pairs of the same particle"}; + Configurable ConfTrackPDGCode{"ConfTrackPDGCode", 2212, "Particle 2 - PDG code"}; + Configurable ConfTrackPID{"ConfTrackPID", 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 ConfIsTrackRejected{"ConfIsTrackRejected", true, "Enable PID rejection for the track other species than the identified one."}; + Configurable ConfTrackIsIdentified{"ConfTrackIsIdentified", true, "Enable PID for the track"}; + Configurable ConfTrackIsRejected{"ConfTrackIsRejected", true, "Enable PID rejection for the track other species than the identified one."}; + Configurable ConfTrackPtLowLimit{"ConfTrackPtLowLimit", 0.5, "Lower limit of the Phi pT."}; + Configurable ConfTrackPtHighLimit{"ConfTrackPtHighLimit", 2.5, "Higher limit of the Phi pT."}; } ConfTrack; /// Particle 2 --- PHI struct : o2::framework::ConfigurableGroup { - Configurable ConfPDGCodePhi{"ConfPDGCodePhi", 333, "Phi meson - PDG code"}; - Configurable ConfPIDPhi{"ConfPIDPhi", 2, "Phi meson - Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector>int>> + Configurable ConfPhiPDGCode{"ConfPhiPDGCode", 333, "Phi meson - PDG code"}; + Configurable ConfPhiPID{"ConfPhiPID", 2, "Phi meson - Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector>int>> } ConfPhi; /// Partitions for particle 1 - Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == ConfTrack.ConfTrackSign); - Partition> partsTrackMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)); + Partition partsTrack = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == ConfTrack.ConfTrackSign.value) && (aod::femtouniverseparticle::pt > ConfTrack.ConfTrackPtLowLimit.value) && (aod::femtouniverseparticle::pt < ConfTrack.ConfTrackPtHighLimit.value); + Partition> partsTrackMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == ConfTrack.ConfTrackSign.value) && (aod::femtouniverseparticle::pt > ConfTrack.ConfTrackPtLowLimit.value) && (aod::femtouniverseparticle::pt < ConfTrack.ConfTrackPtHighLimit.value); /// Partitions for particle 2 Partition partsPhi = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kPhi)); @@ -143,25 +155,21 @@ struct femtoUniversePairTaskTrackPhi { 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 ConfBinsTempFitVar{"ConfDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis ConfBinsTempFitVarInvMass{"ConfDTempFitVarInvMassBins", {6000, 0.9, 4.0}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; + ConfigurableAxis ConfBinsTempFitVarpT{"ConfBinsTempFitVarpT", {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 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 ConfBinsMult{"ConfBinsMult", {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 ConfBinsVtx{"ConfBinsVtx", {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 ConfBins3DmT{"ConfBins3DmT", {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 ConfBins3Dmult{"ConfBins3Dmult", {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 ConfkstarBins{"ConfkstarBins", {1500, 0., 6.}, "binning kstar"}; - ConfigurableAxis ConfkTBins{"ConfkTBins", {150, 0., 9.}, "binning kT"}; - ConfigurableAxis ConfmTBins{"ConfmTBins", {225, 0., 7.5}, "binning mT"}; + ColumnBinningPolicy colBinning{{ConfBinsVtx, ConfBinsMult}, true}; - // Efficiency - Configurable ConfLocalEfficiencyProton{"ConfLocalEfficiencyProton", "", "Local path to proton efficiency th2d file"}; - Configurable ConfLocalEfficiencyPhi{"ConfLocalEfficiencyPhi", "", "Local path to Phi efficiency th2d file"}; + ConfigurableAxis ConfBinskstar{"ConfBinskstar", {1500, 0., 6.}, "binning kstar"}; + ConfigurableAxis ConfBinskT{"ConfBinskT", {150, 0., 9.}, "binning kT"}; + ConfigurableAxis ConfBinsmT{"ConfBinsmT", {225, 0., 7.5}, "binning mT"}; FemtoUniverseAngularContainer sameEventAngularCont; FemtoUniverseAngularContainer mixedEventAngularCont; @@ -178,20 +186,20 @@ struct femtoUniversePairTaskTrackPhi { HistogramRegistry registryPhiMinvBackground{"registryPhiMinvBackground", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; Service ccdb; - TH2D* protoneff; - TH2D* phieff; + TH2F* protoneff; + TH2F* phieff; // 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 { if (mom < 0.5) { - if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaTPCProton) { + if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfPIDProtonNsigmaTPC.value) { return true; } else { return false; } } else if (mom > 0.4) { - if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.ConfNsigmaCombinedProton) { + if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.ConfPIDProtonNsigmaCombined.value) { return true; } else { return false; @@ -206,9 +214,9 @@ struct femtoUniversePairTaskTrackPhi { return true; } if (mom > 0.5) { - if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) { + if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfPIDPionNsigmaReject.value) { return true; - } else if (TMath::Hypot(nsigmaTOFK, nsigmaTPCK) < ConfBothTracks.ConfNsigmaRejectKaon) { + } else if (TMath::Hypot(nsigmaTOFK, nsigmaTPCK) < ConfBothTracks.ConfPIDKaonNsigmaReject.value) { return true; } else { return false; @@ -260,16 +268,16 @@ struct femtoUniversePairTaskTrackPhi { bool IsKaonRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi) { if (mom < 0.5) { - if (TMath::Abs(nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) { + if (TMath::Abs(nsigmaTPCPi) < ConfBothTracks.ConfPIDPionNsigmaReject.value) { return true; - } else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) { + } else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfPIDProtonNsigmaReject.value) { return true; } } if (mom > 0.5) { - if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaRejectPion) { + if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfPIDPionNsigmaReject.value) { return true; - } else if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) { + } else if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.ConfPIDProtonNsigmaReject.value) { return true; } else { return false; @@ -283,13 +291,13 @@ struct femtoUniversePairTaskTrackPhi { { if (true) { if (mom < 0.5) { - if (TMath::Abs(nsigmaTPCPi) < ConfBothTracks.ConfNsigmaTPCPion) { + if (TMath::Abs(nsigmaTPCPi) < ConfBothTracks.ConfPIDPionNsigmaTPC.value) { return true; } else { return false; } } else if (mom > 0.5) { - if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfNsigmaCombinedPion) { + if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < ConfBothTracks.ConfPIDPionNsigmaCombined.value) { return true; } else { return false; @@ -302,16 +310,16 @@ struct femtoUniversePairTaskTrackPhi { bool IsPionRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCK, float nsigmaTOFK) { if (mom < 0.5) { - if (TMath::Abs(nsigmaTPCK) < ConfBothTracks.ConfNsigmaRejectKaon) { + if (TMath::Abs(nsigmaTPCK) < ConfBothTracks.ConfPIDKaonNsigmaReject.value) { return true; - } else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) { + } else if (TMath::Abs(nsigmaTPCPr) < ConfBothTracks.ConfPIDProtonNsigmaReject.value) { return true; } } if (mom > 0.5) { - if (TMath::Hypot(nsigmaTOFK, nsigmaTPCK) < ConfBothTracks.ConfNsigmaRejectKaon) { + if (TMath::Hypot(nsigmaTOFK, nsigmaTPCK) < ConfBothTracks.ConfPIDKaonNsigmaReject.value) { return true; - } else if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.ConfNsigmaRejectProton) { + } else if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < ConfBothTracks.ConfPIDProtonNsigmaReject.value) { return true; } else { return false; @@ -323,7 +331,7 @@ struct femtoUniversePairTaskTrackPhi { bool IsParticleNSigmaAccepted(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) { - switch (ConfTrack.ConfPDGCodeTrack) { + switch (ConfTrack.ConfTrackPDGCode) { case 2212: // Proton case -2212: // anty Proton return IsProtonNSigma(mom, nsigmaTPCPr, nsigmaTOFPr); @@ -343,7 +351,7 @@ struct femtoUniversePairTaskTrackPhi { bool IsParticleNSigmaRejected(float mom, float nsigmaTPCPr, float nsigmaTOFPr, float nsigmaTPCPi, float nsigmaTOFPi, float nsigmaTPCK, float nsigmaTOFK) { - switch (ConfTrack.ConfPDGCodeTrack) { + switch (ConfTrack.ConfTrackPDGCode) { case 2212: // Proton case -2212: // anty Proton return IsProtonRejected(mom, nsigmaTPCPi, nsigmaTOFPi, nsigmaTPCK, nsigmaTOFK); @@ -406,23 +414,23 @@ struct femtoUniversePairTaskTrackPhi { registryMCreco.add("MCrecoPpos", "MC reco proton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); registryMCreco.add("MCrecoPneg", "MC reco antiproton;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}}); - trackHistoPartPhi.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarInvMassBins, ConfBothTracks.ConfIsMC, ConfPhi.ConfPDGCodePhi); - if (!ConfTrack.ConfIsSame) { - trackHistoPartTrack.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarBins, ConfBothTracks.ConfIsMC, ConfTrack.ConfPDGCodeTrack); + trackHistoPartPhi.init(&qaRegistry, ConfBinsTempFitVarpT, ConfBinsTempFitVarInvMass, ConfBothTracks.ConfIsMC, ConfPhi.ConfPhiPDGCode); + if (!ConfTrack.ConfTrackIsSame) { + trackHistoPartTrack.init(&qaRegistry, ConfBinsTempFitVarpT, ConfBinsTempFitVar, ConfBothTracks.ConfIsMC, ConfTrack.ConfTrackPDGCode); } MixQaRegistry.add("MixingQA/hSECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); MixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}}); - 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); + sameEventAngularCont.init(&resultRegistry, ConfBinskstar, ConfBinsMult, ConfBinskT, ConfBinsmT, ConfBins3Dmult, ConfBins3DmT, ConfBothTracks.ConfBinsEta, ConfBothTracks.ConfBinsPhi, ConfBothTracks.ConfIsMC, ConfBothTracks.ConfUse3D); + mixedEventAngularCont.init(&resultRegistry, ConfBinskstar, ConfBinsMult, ConfBinskT, ConfBinsmT, ConfBins3Dmult, ConfBins3DmT, ConfBothTracks.ConfBinsEta, ConfBothTracks.ConfBinsPhi, ConfBothTracks.ConfIsMC, ConfBothTracks.ConfUse3D); - sameEventAngularCont.setPDGCodes(ConfPhi.ConfPDGCodePhi, ConfTrack.ConfPDGCodeTrack); - mixedEventAngularCont.setPDGCodes(ConfPhi.ConfPDGCodePhi, ConfTrack.ConfPDGCodeTrack); + sameEventAngularCont.setPDGCodes(ConfPhi.ConfPhiPDGCode, ConfTrack.ConfTrackPDGCode); + mixedEventAngularCont.setPDGCodes(ConfPhi.ConfPhiPDGCode, ConfTrack.ConfTrackPDGCode); pairCleaner.init(&qaRegistry); - if (ConfIsCPR.value) { - pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value, ConfCPRInvMassCutMin.value, ConfCPRInvMassCutMax.value); + if (ConfCPR.ConfCPRIsEnabled.value) { + pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPR.ConfCPRdeltaPhiCutMin.value, ConfCPR.ConfCPRdeltaPhiCutMax.value, ConfCPR.ConfCPRdeltaEtaCutMin.value, ConfCPR.ConfCPRdeltaEtaCutMax.value, ConfCPR.ConfCPRChosenRadii.value, ConfCPR.ConfCPRPlotPerRadii.value, ConfCPR.ConfCPRInvMassCutMin.value, ConfCPR.ConfCPRInvMassCutMax.value); } /// Initializing CCDB @@ -433,21 +441,21 @@ struct femtoUniversePairTaskTrackPhi { long now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); ccdb->setCreatedNotAfter(now); - if (!ConfLocalEfficiencyProton.value.empty()) { - protoneff = ccdb->getForTimeStamp(ConfLocalEfficiencyProton.value.c_str(), -1); + if (!ConfEff.ConfEfficiencyTrackPath.value.empty()) { + protoneff = ccdb->getForTimeStamp(ConfEff.ConfEfficiencyTrackPath.value.c_str(), ConfEff.ConfEfficiencyTrackTimestamp.value); if (!protoneff || protoneff->IsZombie()) { - LOGF(fatal, "Could not load efficiency protoneff histogram from %s", ConfLocalEfficiencyProton.value.c_str()); + LOGF(fatal, "Could not load efficiency protoneff histogram from %s", ConfEff.ConfEfficiencyTrackPath.value.c_str()); } } - if (!ConfLocalEfficiencyPhi.value.empty()) { - phieff = ccdb->getForTimeStamp(ConfLocalEfficiencyPhi.value.c_str(), -1); + if (!ConfEff.ConfEfficiencyPhiPath.value.empty()) { + phieff = ccdb->getForTimeStamp(ConfEff.ConfEfficiencyPhiPath.value.c_str(), ConfEff.ConfEfficiencyPhiTimestamp.value); if (!phieff || phieff->IsZombie()) { - LOGF(fatal, "Could not load efficiency phieff histogram from %s", ConfLocalEfficiencyPhi.value.c_str()); + LOGF(fatal, "Could not load efficiency phieff histogram from %s", ConfEff.ConfEfficiencyPhiPath.value.c_str()); } } - vPIDPhiCandidate = ConfPhi.ConfPIDPhi.value; - vPIDTrack = ConfTrack.ConfPIDTrack.value; + vPIDPhiCandidate = ConfPhi.ConfPhiPID.value; + vPIDTrack = ConfTrack.ConfTrackPID.value; kNsigma = ConfBothTracks.ConfTrkPIDnSigmaMax.value; } @@ -503,7 +511,7 @@ struct femtoUniversePairTaskTrackPhi { } } float tpcNSigmaPr, tofNSigmaPr, tpcNSigmaPi, tofNSigmaPi, tpcNSigmaKa, tofNSigmaKa; - if (!ConfTrack.ConfIsSame) { + if (!ConfTrack.ConfTrackIsSame) { for (auto& track : groupPartsTrack) { tpcNSigmaPi = trackCuts.getNsigmaTPC(track, o2::track::PID::Pion); tofNSigmaPi = trackCuts.getNsigmaTOF(track, o2::track::PID::Pion); @@ -512,13 +520,13 @@ struct femtoUniversePairTaskTrackPhi { tpcNSigmaPr = trackCuts.getNsigmaTPC(track, o2::track::PID::Proton); tofNSigmaPr = trackCuts.getNsigmaTOF(track, o2::track::PID::Proton); - if (ConfTrack.ConfIsTrackIdentified) { + if (ConfTrack.ConfTrackIsIdentified) { if (!IsParticleNSigmaAccepted(track.p(), tpcNSigmaPr, tofNSigmaPr, tpcNSigmaPi, tofNSigmaPi, tpcNSigmaKa, tofNSigmaKa)) { continue; } } - if (ConfTrack.ConfIsTrackRejected) { + if (ConfTrack.ConfTrackIsRejected) { if (IsParticleNSigmaRejected(track.p(), tpcNSigmaPr, tofNSigmaPr, tpcNSigmaPi, tofNSigmaPi, tpcNSigmaKa, tofNSigmaKa)) { continue; } @@ -536,20 +544,20 @@ struct femtoUniversePairTaskTrackPhi { } /// Now build the combinations for (auto& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) { - if (ConfTrack.ConfIsTrackIdentified) { + if (ConfTrack.ConfTrackIsIdentified) { if (!IsParticleNSigmaAccepted(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; } } - if (ConfTrack.ConfIsTrackRejected) { + if (ConfTrack.ConfTrackIsRejected) { if (IsParticleNSigmaRejected(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 (ConfCPR.ConfCPRIsEnabled.value) { if (pairCloseRejection.isClosePair(track, phicandidate, parts, magFieldTesla, femtoUniverseContainer::EventType::same)) { continue; } @@ -649,19 +657,19 @@ struct femtoUniversePairTaskTrackPhi { { for (auto& [track, phicandidate] : combinations(CombinationsFullIndexPolicy(groupPartsTrack, groupPartsPhi))) { - if (ConfTrack.ConfIsTrackIdentified) { + if (ConfTrack.ConfTrackIsIdentified) { if (!IsParticleNSigmaAccepted(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; } } - if (ConfTrack.ConfIsTrackRejected) { + if (ConfTrack.ConfTrackIsRejected) { if (IsParticleNSigmaRejected(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; } } - if (ConfIsCPR.value) { + if (ConfCPR.ConfCPRIsEnabled.value) { if (pairCloseRejection.isClosePair(track, phicandidate, parts, magFieldTesla, femtoUniverseContainer::EventType::mixed)) { continue; } diff --git a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx index d5b7c010acc..deb2e4b8d80 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" @@ -134,7 +135,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { Configurable ConfV0MHigh{"ConfV0MHigh", 25000.0, "Upper limit for V0M multiplicity"}; Filter collV0Mfilter = ((o2::aod::femtouniversecollision::multV0M > ConfV0MLow) && (o2::aod::femtouniversecollision::multV0M < ConfV0MHigh)); - // Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable + using FilteredFDCollisions = soa::Filtered; + using FilteredFDCollision = soa::Filtered::iterator; /// Particle part ConfigurableAxis ConfTempFitVarBins{"ConfDTempFitVarBins", {300, -0.15, 0.15}, "binning of the TempFitVar in the pT vs. TempFitVar plot"}; @@ -149,7 +151,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 +215,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 +416,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 +488,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 +566,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 +575,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 +608,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 +651,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 +726,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 +759,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended { doMixedEvent(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3); } } + delete randgen; } PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEvent, "Enable processing mixed events", true); @@ -729,9 +771,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 e2e2104a9fb..0ae10b8c65a 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx @@ -57,7 +57,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { /// Partition for particle 1 Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && - aod::femtouniverseparticle::pt < ConfPtHighPart1 && aod::femtouniverseparticle::pt > ConfPtLowPart1&& nabs(aod::femtouniverseparticle::eta) < ConfEtaMax; + (aod::femtouniverseparticle::pt < ConfPtHighPart1) && (aod::femtouniverseparticle::pt > ConfPtLowPart1) && (nabs(aod::femtouniverseparticle::eta) < ConfEtaMax); /// Histogramming for particle 1 FemtoUniverseParticleHisto trackHistoPartOne; @@ -71,7 +71,7 @@ struct femtoUniversePairTaskTrackTrackMcTruth { /// Partition for particle 2 Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) && - aod::femtouniverseparticle::pt < ConfPtHighPart2 && aod::femtouniverseparticle::pt > ConfPtLowPart2&& nabs(aod::femtouniverseparticle::eta) < ConfEtaMax; + (aod::femtouniverseparticle::pt < ConfPtHighPart2) && (aod::femtouniverseparticle::pt > ConfPtLowPart2) && (nabs(aod::femtouniverseparticle::eta) < ConfEtaMax); /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; @@ -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,30 +169,49 @@ struct femtoUniversePairTaskTrackTrackMcTruth { if (!ConfIsSame) { for (auto& part : groupPartsTwo) { - if (!ConfNoPDGPartTwo && part.pidcut() != ConfPDGCodePartTwo) { + if (!ConfNoPDGPartTwo && part.tempFitVar() != ConfPDGCodePartTwo) { continue; } trackHistoPartTwo.fillQA(part); } } /// Now build the combinations - for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsTwo))) { - // track cleaning - if (!pairCleaner.isCleanPair(p1, p2, parts)) { - continue; - } - if ((!ConfNoPDGPartOne && p2.pidcut() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.pidcut() != ConfPDGCodePartTwo)) { - continue; + if (!ConfIsSame) { + // Build the combinations for pairs of non-identical particles + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { + continue; + } + if (swpart) + sameEventCont.setPair(p1, p2, multCol, ConfUse3D); + else + sameEventCont.setPair(p2, p1, multCol, ConfUse3D); + + swpart = !swpart; } - if (swpart) - sameEventCont.setPair(p1, p2, multCol, ConfUse3D); - else - sameEventCont.setPair(p2, p1, multCol, ConfUse3D); + } else { + // Build the combinations for pairs of identical pairs + for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsTwo))) { + // track cleaning + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + if ((!ConfNoPDGPartOne && p2.tempFitVar() != ConfPDGCodePartOne) || (!ConfNoPDGPartTwo && p1.tempFitVar() != ConfPDGCodePartTwo)) { + continue; + } + if (swpart) + sameEventCont.setPair(p1, p2, multCol, ConfUse3D); + else + sameEventCont.setPair(p2, p1, multCol, ConfUse3D); - swpart = !swpart; + swpart = !swpart; + } } } - /// process function for to call doSameEvent with Data /// \param col subscribe to the collision table (Data) /// \param parts subscribe to the femtoUniverseParticleTable @@ -225,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..f7f9baa6d87 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 { @@ -119,15 +118,15 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 211, "Particle 1 -- PDG code"}; // Configurable ConfCutPartOne{"ConfCutPartOne", 5542474, "Particle 1 -- Selection bit from cutCulator"}; Configurable ConfPIDPartOne{"ConfPIDPartOne", 2, "Particle 1 -- Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector>int>> - Configurable ConfpLowPart1{"ConfpLowPart1", 0.14, "Lower limit for Pt for the first particle"}; + Configurable ConfPtLowPart1{"ConfPtLowPart1", 0.14, "Lower limit for Pt for the first particle"}; Configurable ConfPtHighPart1{"ConfPtHighPart1", 1.5, "Higher limit for Pt for the first particle"}; Configurable ConfChargePart1{"ConfChargePart1", 1, "Particle 1 sign"}; } trackonefilter; /// Partition for particle 1 - Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfpLowPart1; + Partition partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; - Partition> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfpLowPart1; + Partition> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1; /// Histogramming for particle 1 FemtoUniverseParticleHisto trackHistoPartOne; @@ -137,15 +136,15 @@ struct femtoUniversePairTaskTrackTrackMultKtExtended { Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 211, "Particle 2 -- PDG code"}; // Configurable ConfCutPartTwo{"ConfCutPartTwo", 5542474, "Particle 2 -- Selection bit"}; Configurable ConfPIDPartTwo{"ConfPIDPartTwo", 2, "Particle 2 -- Read from cutCulator"}; // we also need the possibility to specify whether the bit is true/false ->std>>vector> - Configurable ConfpLowPart2{"ConfpLowPart2", 0.14, "Lower limit for Pt for the second particle"}; + Configurable ConfPtLowPart2{"ConfPtLowPart2", 0.14, "Lower limit for Pt for the second particle"}; Configurable ConfPtHighPart2{"ConfPtHighPart2", 1.5, "Higher limit for Pt for the second particle"}; Configurable ConfChargePart2{"ConfChargePart2", -1, "Particle 2 sign"}; } tracktwofilter; /// Partition for particle 2 - Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfpLowPart2; + Partition partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; - Partition> partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfpLowPart2; + Partition> partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2; /// Histogramming for particle 2 FemtoUniverseParticleHisto trackHistoPartTwo; @@ -180,7 +179,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"}; @@ -457,7 +456,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); } @@ -612,13 +611,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 +636,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); @@ -742,7 +741,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 +780,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..9ada1b9b973 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" @@ -215,6 +216,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 +503,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 +517,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 +527,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended { default: break; } - delete randgen; } } } @@ -543,6 +543,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 +556,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 +606,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 +649,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 +679,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 b542eff0cbe..3b1dcce4d73 100644 --- a/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx +++ b/PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackV0Extended.cxx @@ -456,6 +456,7 @@ struct femtoUniversePairTaskTrackV0Extended { PROCESS_SWITCH(femtoUniversePairTaskTrackV0Extended, processSameEventV0, "Enable processing same event for V0 - V0", false); + /// This function processes MC same events for Track - V0 void processMCSameEvent(FilteredFDCollision& col, FemtoFullParticles& parts) { const auto& magFieldTesla = col.magField(); @@ -509,6 +510,47 @@ 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) + { + auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache); + const int multCol = ConfUseCent ? col.multV0M() : col.multNtr(); + + eventHisto.fillQA(col); + + /// Histogramming same event + for (auto& part : groupPartsTwo) { + int pdgCode = static_cast(part.pidcut()); + if ((ConfV0Type1 == 0 && pdgCode != 3122) || (ConfV0Type1 == 1 && pdgCode != -3122)) + continue; + trackHistoPartTwo.fillQA(part); + } + + auto pairProcessFunc = [&](auto& p1, auto& p2) -> void { + int pdgCode1 = static_cast(p1.pidcut()); + if ((ConfV0Type1 == 0 && pdgCode1 != 3122) || (ConfV0Type1 == 1 && pdgCode1 != -3122)) + return; + int pdgCode2 = static_cast(p2.pidcut()); + if ((ConfV0Type2 == 0 && pdgCode2 != 3122) || (ConfV0Type2 == 1 && pdgCode2 != -3122)) + return; + sameEventCont.setPair(p1, p2, multCol, ConfUse3D); + }; + /// Now build the combinations + if (ConfV0Type1 == ConfV0Type2) { + /// Now build the combinations for identical V0s + for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsTwo, groupPartsTwo))) { + pairProcessFunc(p1, p2); + } + } else { + /// Now build the combinations for not identical identical V0s + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsTwo, groupPartsTwo))) { + pairProcessFunc(p1, p2); + } + } + } + + PROCESS_SWITCH(femtoUniversePairTaskTrackV0Extended, processMCSameEventV0, "Enable processing same event for MC truth V0 - V0", false); + /// This function processes the mixed event for track - V0 template void doMixedEvent(FilteredFDCollisions& cols, PartType& parts, PartitionType& partitionOne, PartitionType& partitionTwo, [[maybe_unused]] MCParticles mcParts = nullptr) @@ -630,6 +672,7 @@ struct femtoUniversePairTaskTrackV0Extended { } PROCESS_SWITCH(femtoUniversePairTaskTrackV0Extended, processMixedEventV0, "Enable processing mixed events for V0 - V0", false); + /// This function processes MC mixed events for Track - V0 void processMCMixedEvent(FilteredFDCollisions& cols, FemtoFullParticles& parts) { ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; @@ -665,6 +708,31 @@ struct femtoUniversePairTaskTrackV0Extended { 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) + { + ColumnBinningPolicy colBinning{{ConfVtxBins, ConfMultBins}, true}; + + for (auto& [collision1, collision2] : soa::selfCombinations(colBinning, 5, -1, cols, cols)) { + + const int multCol = ConfUseCent ? collision1.multV0M() : collision1.multNtr(); + + auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache); + auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache); + + for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) { + int pdgCode1 = static_cast(p1.pidcut()); + if ((ConfV0Type1 == 0 && pdgCode1 != 3122) || (ConfV0Type1 == 1 && pdgCode1 != -3122)) + continue; + int pdgCode2 = static_cast(p2.pidcut()); + if ((ConfV0Type2 == 0 && pdgCode2 != 3122) || (ConfV0Type2 == 1 && pdgCode2 != -3122)) + continue; + mixedEventCont.setPair(p1, p2, multCol, ConfUse3D); + } + } + } + + PROCESS_SWITCH(femtoUniversePairTaskTrackV0Extended, processMCMixedEventV0, "Enable processing mixed events for MC truth V0 - V0", false); ///--------------------------------------------MC-------------------------------------------------/// /// This function fills MC truth particles from derived MC table 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..667fcde6866 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(flow-zdc-qvectors + 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..82202d86e3d --- /dev/null +++ b/PWGCF/Flow/TableProducer/ZDCQvectors.cxx @@ -0,0 +1,679 @@ +// 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. + +// 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 myCollisions = soa::Join; +using BCsRun3 = soa::Join; + +namespace o2::analysis::qvectortask +{ + +int counter = 0; + +// step0 -> Energy calib +std::shared_ptr ZN_Energy[10] = {{nullptr}}; +std::shared_ptr hQx_vs_Qy[6] = {{nullptr}}; + +// and +std::shared_ptr COORD_correlations[6][4] = {{nullptr}}; +std::vector hZN_mean(10, nullptr); // Get from calibration file + +// step1: 4D large bins +std::vector mean_10perCent_v(4, nullptr); // hQXA, hQYA, hQXC, hQYC + +// step2: Small bins 1D +std::vector mean_1perCent_Run(4, nullptr); // hQXA, hQYA, hQXC, hQYC +std::vector mean_vx_Run(4, nullptr); // hQXA, hQYA, hQXC, hQYC +std::vector mean_vy_Run(4, nullptr); // hQXA, hQYA, hQXC, hQYC +std::vector mean_vz_Run(4, nullptr); // hQXA, hQYA, hQXC, hQYC + +// Define histogrm names here to use same names for creating and later uploading and retrieving data from ccdb +// Energy calibration: +std::vector names_Ecal(10, ""); +std::vector> names(5, std::vector()); //(1x 4d 4x 1d) + +// https://alice-notes.web.cern.ch/system/files/notes/analysis/620/017-May-31-analysis_note-ALICE_analysis_note_v2.pdf +std::vector ZDC_px = {-1.75, 1.75, -1.75, 1.75}; +std::vector ZDC_py = {-1.75, -1.75, 1.75, 1.75}; +double alphaZDC = 0.395; + +// step 0 tm 5 A&C +std::vector>> q(5, 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 = false; + +} // 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 axisVx_big{"axisVx_big", {3, -0.006, -0.006}, "for Pos X of collision"}; + ConfigurableAxis axisVy_big{"axisVy_big", {3, -0.003, 0.003}, "for Pos Y of collision"}; + ConfigurableAxis axisVz_big{"axisVz_big", {3, -10, 10}, "for Pos Z of collision"}; + ConfigurableAxis axisVx{"axisVx", {10, -0.006, 0.006}, "for Pos X of collision"}; + ConfigurableAxis axisVy{"axisVy", {10, -0.003, 0.003}, "for Pos Y of collision"}; + ConfigurableAxis axisVz{"axisVz", {10, -10, 1}, "for vz of collision"}; + ConfigurableAxis axisRun{"axisRun", {1e6, 0, 1e6}, "for runNumber in ThnSparse"}; + + 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, "", "ccdb path for energy calibration histos") + O2_DEFINE_CONFIGURABLE(cfgMeanv, std::string, "", "ccdb path for mean v histos") + Configurable> cfgRec1{"cfgRec1", {"", "", "", "", ""}, "ccdb paths for recentering calibration histos iteration 1"}; + Configurable> cfgRec2{"cfgRec2", {"", "", "", "", ""}, "ccdb paths for recentering calibration histos iteration 2"}; + Configurable> cfgRec3{"cfgRec3", {"", "", "", "", ""}, "ccdb paths for recentering calibration histos iteration 3"}; + Configurable> cfgRec4{"cfgRec4", {"", "", "", "", ""}, "ccdb paths for recentering calibration histos iteration 4"}; + + // 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 coords = {"x", "y", "z"}; + std::vector COORDS = {"X", "Y"}; + + // Tower mean energies vs. centrality used for tower gain equalisation + for (int tower = 0; tower < 10; tower++) { + names_Ecal[tower] = TString::Format("hZN%s_mean_t%i_cent", sides[(tower < 5) ? 0 : 1], tower % 5); + ZN_Energy[tower] = registry.add(Form("Energy/%s", names_Ecal[tower].Data()), Form("%s", names_Ecal[tower].Data()), kTProfile2D, {{1, 0, 1}, axisCent}); + } + + // Qx_vs_Qy for each step for ZNA and ZNC + for (int step = 0; step < 6; step++) { + for (const char* side : sides) { + hQx_vs_Qy[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 char* COORD1 : COORDS) { + for (const char* COORD2 : COORDS) { + // Now we get: & vs. Centrality + COORD_correlations[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 coords is {X,Y} + for (const char* side : sides) { + for (const char* coord : COORDS) { + 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, {axisRun, axisCent10, axisVx_big, axisVy_big, axisVz_big, axisQ}}); + if (step == 1) + names[step - 1].push_back(name); + } + if (step == 2) { + TString name = TString::Format("hQ%s%s_mean_1percent_run", coord, side); + registry.add(Form("step%i/%s", step, name.Data()), Form("hQ%s%s_mean_1percent_run", coord, side), kTProfile2D, {{1, 0., 1.}, 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), kTProfile2D, {{1, 0., 1.}, 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), kTProfile2D, {{1, 0., 1.}, 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), kTProfile2D, {{1, 0., 1.}, axisVz}); + names[step - 1].push_back(name); + } + } // end of COORDS + } // 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.}}}); + } + + 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_1percent_run"))->Fill(Form("%d", runnumber), centrality, q[iteration][step][0], 1); + registry.get(HIST("step2/hQYA_mean_1percent_run"))->Fill(Form("%d", runnumber), centrality, q[iteration][step][1], 1); + registry.get(HIST("step2/hQXC_mean_1percent_run"))->Fill(Form("%d", runnumber), centrality, q[iteration][step][2], 1); + registry.get(HIST("step2/hQYC_mean_1percent_run"))->Fill(Form("%d", runnumber), centrality, q[iteration][step][3], 1); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 2) { + registry.get(HIST("step3/hQXA_mean_vx_run"))->Fill(Form("%d", runnumber), v[0], q[iteration][step][0], 1); + registry.get(HIST("step3/hQYA_mean_vx_run"))->Fill(Form("%d", runnumber), v[0], q[iteration][step][1], 1); + registry.get(HIST("step3/hQXC_mean_vx_run"))->Fill(Form("%d", runnumber), v[0], q[iteration][step][2], 1); + registry.get(HIST("step3/hQYC_mean_vx_run"))->Fill(Form("%d", runnumber), v[0], q[iteration][step][3], 1); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 3) { + registry.get(HIST("step4/hQXA_mean_vy_run"))->Fill(Form("%d", runnumber), v[1], q[iteration][step][0], 1); + registry.get(HIST("step4/hQYA_mean_vy_run"))->Fill(Form("%d", runnumber), v[1], q[iteration][step][1], 1); + registry.get(HIST("step4/hQXC_mean_vy_run"))->Fill(Form("%d", runnumber), v[1], q[iteration][step][2], 1); + registry.get(HIST("step4/hQYC_mean_vy_run"))->Fill(Form("%d", runnumber), v[1], q[iteration][step][3], 1); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 4) { + registry.get(HIST("step5/hQXA_mean_vz_run"))->Fill(Form("%d", runnumber), v[2], q[iteration][step][0], 1); + registry.get(HIST("step5/hQYA_mean_vz_run"))->Fill(Form("%d", runnumber), v[2], q[iteration][step][1], 1); + registry.get(HIST("step5/hQXC_mean_vz_run"))->Fill(Form("%d", runnumber), v[2], q[iteration][step][2], 1); + registry.get(HIST("step5/hQYC_mean_vz_run"))->Fill(Form("%d", runnumber), v[2], q[iteration][step][3], 1); + registry.fill(HIST("hStep"), step, 1); + } + + if (step == 5) { + registry.fill(HIST("step5/hQXA_mean_Cent_V_run"), runnumber, centrality, v[0], v[1], v[2], q[iteration][step][0]); + registry.fill(HIST("step5/hQYA_mean_Cent_V_run"), runnumber, centrality, v[0], v[1], v[2], q[iteration][step][1]); + registry.fill(HIST("step5/hQXC_mean_Cent_V_run"), runnumber, centrality, v[0], v[1], v[2], q[iteration][step][2]); + registry.fill(HIST("step5/hQYC_mean_Cent_V_run"), runnumber, 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 index_rt = index + 1; + + registry.fill(HIST(subdir[index]) + HIST("hZNA_Qx_vs_Qy"), q[iteration][index_rt][0], q[iteration][index_rt][1]); + registry.fill(HIST(subdir[index]) + HIST("hZNC_Qx_vs_Qy"), q[iteration][index_rt][2], q[iteration][index_rt][3]); + + registry.fill(HIST(subdir[index]) + HIST("QA/hQXA_QXC_vs_cent"), centrality, q[iteration][index_rt][0] * q[iteration][index_rt][2]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYA_QYC_vs_cent"), centrality, q[iteration][index_rt][1] * q[iteration][index_rt][3]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYA_QXC_vs_cent"), centrality, q[iteration][index_rt][1] * q[iteration][index_rt][2]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQXA_QYC_vs_cent"), centrality, q[iteration][index_rt][0] * q[iteration][index_rt][3]); + + registry.fill(HIST(subdir[index]) + HIST("QA/hQXA_vs_cent"), centrality, q[iteration][index_rt][0]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYA_vs_cent"), centrality, q[iteration][index_rt][1]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQXC_vs_cent"), centrality, q[iteration][index_rt][2]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYC_vs_cent"), centrality, q[iteration][index_rt][3]); + + registry.fill(HIST(subdir[index]) + HIST("QA/hQXA_vs_vx"), v[0], q[iteration][index_rt][0]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYA_vs_vx"), v[0], q[iteration][index_rt][1]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQXC_vs_vx"), v[0], q[iteration][index_rt][2]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYC_vs_vx"), v[0], q[iteration][index_rt][3]); + + registry.fill(HIST(subdir[index]) + HIST("QA/hQXA_vs_vy"), v[1], q[iteration][index_rt][0]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYA_vs_vy"), v[1], q[iteration][index_rt][1]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQXC_vs_vy"), v[1], q[iteration][index_rt][2]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYC_vs_vy"), v[1], q[iteration][index_rt][3]); + + registry.fill(HIST(subdir[index]) + HIST("QA/hQXA_vs_vz"), v[2], q[iteration][index_rt][0]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYA_vs_vz"), v[2], q[iteration][index_rt][1]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQXC_vs_vz"), v[2], q[iteration][index_rt][2]); + registry.fill(HIST(subdir[index]) + HIST("QA/hQYC_vs_vz"), v[2], q[iteration][index_rt][3]); + }); + } + + 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 (int 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 iteration %i and step %i", iteration, step + 1); + 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 + 1); + } + } + + template + double getCorrection(int iteration, int step, const char* objName) + { + T* hist = nullptr; + double calibConstant; + + hist = reinterpret_cast(cal.calibList[iteration][step]->FindObject(Form("%s", objName))); + if (!hist) { + LOGF(fatal, "%s not available.. Abort..", objName); + } + + if (hist->InheritsFrom("TProfile2D")) { + if (counter < 1) + LOGF(info, "correction is TProfile2D %s for q[%i][%i]", objName, iteration, step); + TProfile2D* h = reinterpret_cast(hist); + int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%i", runnumber)); + int bincentrality = h->GetYaxis()->FindBin(centrality); + calibConstant = h->GetBinContent(binrunnumber, bincentrality); + } else if (hist->InheritsFrom("TProfile")) { + if (counter < 1) + LOGF(info, "correction is TProfile %s for q[%i][%i]", objName, iteration, step); + TProfile* h = reinterpret_cast(hist); + int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%i", runnumber)); + calibConstant = h->GetBinContent(binrunnumber); + } else if (hist->InheritsFrom("THnSparse")) { + if (counter < 1) + LOGF(info, "correction is THnSparse %s for q[%i][%i]", objName, iteration, step); + std::vector sparsePars; + if (counter < 1) + LOGF(info, "correction is THnSparse %s for q[%i][%i]", objName, iteration, step); + THnSparseD* h = reinterpret_cast(hist); + if (step == 0 && iteration > 0) { + sparsePars.push_back(h->GetAxis(0)->FindBin(runnumber)); + 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 (int i = 0; i < sparsePars.size(); i++) { + h->GetAxis(i)->SetRange(sparsePars[i], sparsePars[i]); + } + calibConstant = h->Projection(sparsePars.size())->GetMean(); + + if (h->Projection(sparsePars.size())->GetEntries() < 2) { + LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)"); + calibConstant = 0; + } + } + return calibConstant; + } + + void fillAllRegistries(int iteration, int step) + { + for (int s = 0; s <= step; s++) + fillRegistry(iteration, s); + fillCommonRegistry(iteration); + } + + void process(myCollisions::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.); + + auto cent = collision.centFT0C(); + + if (cent < 0 || cent > 90) { + SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0); + return; + } + + const auto& foundBC = collision.foundBC_as(); + + if (!foundBC.has_zdc()) { + SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 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, names_Ecal); + if (!cal.calibfilesLoaded[0][0]) { + if (counter < 1) { + LOGF(info, " --> No Energy calibration files found.. -> Only Energy calibration will be done. "); + } + } + + 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) + ZN_Energy[tower]->Fill(Form("%d", runnumber), cent, zdcCol.energyCommonZNA(), 1); + if (isZNChit) + ZN_Energy[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) + ZN_Energy[tower]->Fill(Form("%d", runnumber), cent, EZN[tower - 1], 1); + if (isZNChit) + ZN_Energy[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++; + SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0); + return; + } + + if (!cal.calibfilesLoaded[0][0]) { + counter++; + SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 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, names_Ecal[tower].Data()); + } + + // Use the calibration constants but now only loop over towers 1-4 + int calibtower = 0; + std::vector towers_nocom = {1, 2, 3, 4, 6, 7, 8, 9}; + + for (int tower : towers_nocom) { + if (meanEZN[tower] > 0) { + double ecommon = (tower > 4) ? meanEZN[5] : meanEZN[0]; + e[calibtower] = EZN[calibtower] * (0.25 * ecommon) / meanEZN[tower]; + } + calibtower++; + } + + // 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) ? ZDC_px[sector] * energy : -1.0 * ZDC_px[sector] * energy; + yEnZN[side] += ZDC_py[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] + } + } + + for (int iteration = 1; iteration < 5; iteration++) { + std::vector ccdb_dirs; + if (iteration == 1) + ccdb_dirs = cfgRec1.value; + if (iteration == 2) + ccdb_dirs = cfgRec2.value; + if (iteration == 3) + ccdb_dirs = cfgRec3.value; + if (iteration == 4) + ccdb_dirs = cfgRec4.value; + + for (int step = 0; step < 5; step++) { + loadCalibrations(iteration, step, foundBC.timestamp(), (ccdb_dirs)[step], names[step]); + } + } + + 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], true, 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(warning, "Calibation files missing!!! Output created with q-vectors at iteration %i and step %i!!!!", cal.atIteration, cal.atStep + 1); + fillAllRegistries(cal.atIteration, cal.atStep + 1); + 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], true, 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 9e7c62ba359..bb7fd7d4ac4 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 @@ -38,3 +43,8 @@ o2physics_add_dpl_workflow(flow-pbpb-pikp-task SOURCES FlowPbPbpikp.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(flow-gfw-omegaxi + SOURCES flowGFWOmegaXi.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 48868e86934..23442a4ee0b 100644 --- a/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx +++ b/PWGCF/Flow/Tasks/FlowGFWPbPb.cxx @@ -13,11 +13,14 @@ #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 "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" @@ -38,6 +41,8 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::aod::track; +using namespace o2::aod::evsel; #define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable NAME{#NAME, DEFAULT, HELP}; @@ -57,6 +62,20 @@ struct FlowGFWPbPb { 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") + 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(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"}; @@ -70,11 +89,8 @@ struct FlowGFWPbPb { ConfigurableAxis axisT0C{"axisT0C", {70, 0, 70000}, "N_{ch} (T0C)"}; ConfigurableAxis axisT0A{"axisT0A", {200, 0, 200000}, "N_{ch} (T0A)"}; ConfigurableAxis axisNchPV{"axisNchPV", {4000, 0, 4000}, "N_{ch} (PV)"}; - - using Colls = soa::Join; // collisions filter - using aodTracks = soa::Filtered>; // tracks filter - 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); + ConfigurableAxis axisDCAz{"axisDCAz", {200, -2, 2}, "DCA_{z} (cm)"}; + ConfigurableAxis axisDCAxy{"axisDCAxy", {200, -1, 1}, "DCA_{xy} (cm)"}; // Corrections TH1D* mEfficiency = nullptr; @@ -106,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; @@ -129,12 +162,20 @@ struct FlowGFWPbPb { ccdb->setCreatedNotAfter(nolaterthan.value); // Add some output objects to the histogram registry - registry.add("hEventCount", "Number of Events;; Count", {HistType::kTH1D, {{4, 0, 4}}}); - 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 additional event cut"); - registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "after correction loads"); - registry.add("hPhi", "", {HistType::kTH1D, {axisPhi}}); + 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}}); registry.add("hVtxZ", "Vexter Z distribution", {HistType::kTH1D, {axisVertex}}); registry.add("hMult", "Multiplicity distribution", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); @@ -149,10 +190,6 @@ struct FlowGFWPbPb { registry.add("BeforeCut_globalTracks_multV0A", "before cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); registry.add("BeforeCut_multV0A_multT0A", "before cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}}); registry.add("BeforeCut_multT0C_centT0C", "before cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}}); - registry.add("multITSnoTPC_vs_MultITSTPC_Bef", " multiplicity ITS vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); - registry.add("multITSonly_vs_MultITSTPC_Bef", " multiplicity ITS vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); - registry.add("multNTracksITSonly_vs_MultNTracksITSTPC_Bef", " multiplicity ITS vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); - registry.add("multNTracksTPConly_vs_MultNtracksITSTPC_Bef", " multiplicity TPC only vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); // After cuts registry.add("globalTracks_centT0C_Aft", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); @@ -162,10 +199,13 @@ struct FlowGFWPbPb { registry.add("globalTracks_multV0A_Aft", "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); registry.add("multV0A_multT0A_Aft", "after cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}}); registry.add("multT0C_centT0C_Aft", "after cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}}); - registry.add("multITSnoTPC_vs_MultITSTPC_Aft", " multiplicity ITS vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); - registry.add("multITSonly_vs_MultITSTPC_Aft", " multiplicity ITS vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); - registry.add("multNTracksITSonly_vs_MultNTracksITSTPC_Aft", " multiplicity ITS vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); - registry.add("multNTracksTPConly_vs_MultNtracksITSTPC_Aft", " multiplicity TPC only vs multiplicity ITS+TPC", kTH2F, {axisNch, axisNch}); + + // Track types + 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("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}}); @@ -175,6 +215,8 @@ struct FlowGFWPbPb { registry.add("hChi2prTPCcls", "#chi^{2}/cluster for the TPC track segment", {HistType::kTH1D, {{100, 0., 5.}}}); registry.add("hnTPCClu", "Number of found TPC clusters", {HistType::kTH1D, {{100, 40, 180}}}); registry.add("hnTPCCrossedRow", "Number of crossed TPC Rows", {HistType::kTH1D, {{100, 40, 180}}}); + registry.add("hDCAz", "DCAz after cuts", {HistType::kTH1D, {{100, -3, 3}}}); + registry.add("hDCAxy", "DCAxy after cuts; DCAxy (cm); Pt", {HistType::kTH2D, {{50, -1, 1}, {50, 0, 10}}}); // additional Output histograms registry.add("c22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisCentrality}}); @@ -182,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); @@ -195,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; @@ -223,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) { @@ -345,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(); @@ -379,18 +450,20 @@ struct FlowGFWPbPb { auto multNTracksPV = collision.multNTracksPV(); - 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 (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())) @@ -433,9 +506,16 @@ struct FlowGFWPbPb { return true; } + // Apply process filters + 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) && (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; @@ -443,6 +523,7 @@ struct FlowGFWPbPb { if (Ntot < 1) return; + // fill event QA before cuts registry.fill(HIST("BeforeCut_globalTracks_centT0C"), collision.centFT0C(), tracks.size()); registry.fill(HIST("BeforeCut_PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); registry.fill(HIST("BeforeCut_globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size()); @@ -450,47 +531,37 @@ 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); - - Int_t multITSnoTPC = 0, multITSonly = 0, multITSTPC = 0; - - for (auto& track : tracks) { - - if (track.hasITS() && !track.hasTPC()) - multITSnoTPC++; + registry.fill(HIST("hEventCount"), kSEL8); - if (track.hasITS()) - multITSonly++; + const auto centrality = collision.centFT0C(); - if (track.hasITS() && track.hasTPC()) - multITSTPC++; + if (cfgOccupancy) { + int occupancy = collision.trackOccupancyInTimeRange(); + if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh) + return; + registry.fill(HIST("hEventCount"), kOCCUPANCY); } - registry.fill(HIST("multITSnoTPC_vs_MultITSTPC_Bef"), multITSTPC, multITSnoTPC); - registry.fill(HIST("multITSonly_vs_MultITSTPC_Bef"), multITSTPC, multITSonly); - registry.fill(HIST("multNTracksITSonly_vs_MultNTracksITSTPC_Bef"), collision.multNTracksITSTPC(), collision.multNTracksITSOnly()); - registry.fill(HIST("multNTracksTPConly_vs_MultNtracksITSTPC_Bef"), collision.multNTracksITSTPC(), collision.multNTracksTPCOnly()); - - const auto cent = collision.centFT0C(); - - 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"), collision.centFT0C()); - 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 + // fill event QA after cuts registry.fill(HIST("globalTracks_centT0C_Aft"), collision.centFT0C(), tracks.size()); registry.fill(HIST("PVTracks_centT0C_Aft"), collision.centFT0C(), collision.multNTracksPV()); registry.fill(HIST("globalTracks_PVTracks_Aft"), collision.multNTracksPV(), tracks.size()); @@ -499,11 +570,6 @@ struct FlowGFWPbPb { registry.fill(HIST("multV0A_multT0A_Aft"), collision.multFT0A(), collision.multFV0A()); registry.fill(HIST("multT0C_centT0C_Aft"), collision.centFT0C(), collision.multFT0C()); - registry.fill(HIST("multITSnoTPC_vs_MultITSTPC_Aft"), multITSTPC, multITSnoTPC); - registry.fill(HIST("multITSonly_vs_MultITSTPC_Aft"), multITSTPC, multITSonly); - registry.fill(HIST("multNTracksITSonly_vs_MultNTracksITSTPC_Aft"), collision.multAllTracksITSTPC(), collision.multNTracksITSOnly()); - registry.fill(HIST("multNTracksTPConly_vs_MultNtracksITSTPC_Aft"), collision.multAllTracksITSTPC(), collision.multNTracksTPCOnly()); - // track weights float weff = 1, wacc = 1; int Magnetfield = 0; @@ -513,6 +579,10 @@ struct FlowGFWPbPb { Magnetfield = getMagneticField(bc.timestamp()); } + // track loop + int globaltracks_nch{0}; + int itstracks_nch{0}; + for (auto& track : tracks) { if (track.tpcNClsFound() < cfgCutTPCclu) @@ -520,7 +590,7 @@ struct FlowGFWPbPb { 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; @@ -529,40 +599,62 @@ struct FlowGFWPbPb { if (WithinPtRef) { registry.fill(HIST("hPhi"), track.phi()); + registry.fill(HIST("hPhiWeighted"), track.phi(), wacc); registry.fill(HIST("hEta"), track.eta()); registry.fill(HIST("hPtRef"), track.pt()); registry.fill(HIST("hChi2prTPCcls"), track.tpcChi2NCl()); registry.fill(HIST("hnTPCClu"), track.tpcNClsFound()); registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); + registry.fill(HIST("hDCAz"), track.dcaZ()); + registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt()); } - if (WithinPtRef) - fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1); + globaltracks_nch++; + itstracks_nch++; + if (Global == true) { + registry.fill(HIST("Global_Tracks"), collision.centFT0C()); + if (WithinPtRef) + fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 1); + } + + if (track.hasITS() && ITSonly == true) { + registry.fill(HIST("ITSonly"), collision.centFT0C()); + if (WithinPtRef) + fGFW->Fill(track.eta(), 1, track.phi(), wacc * weff, 1); + } } // End of track loop + 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 -}; // End of struct +}; // End of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGCF/Flow/Tasks/FlowRunbyRun.cxx b/PWGCF/Flow/Tasks/FlowRunbyRun.cxx new file mode 100644 index 00000000000..d24350df022 --- /dev/null +++ b/PWGCF/Flow/Tasks/FlowRunbyRun.cxx @@ -0,0 +1,206 @@ +// 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 "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") + Configurable> cfgRunNumbers{"cfgRunNumbers", std::vector{544095, 544098, 544116, 544121, 544122, 544123, 544124}, "Preconfigured run numbers"}; + + 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 + HistogramRegistry registry{"registry"}; + + // define global variables + GFW* fGFW = new GFW(); + std::vector corrconfigs; + 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 + 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); + + // Add output histograms to the registry + RunNumbers = cfgRunNumbers; + for (auto& runNumber : RunNumbers) { + CreateOutputObjectsForRun(runNumber); + } + + 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); + 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 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)); + } + + 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(); + 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); + } + } + + // Filling TProfile + for (uint i = 0; i < kCount_TProfileNames; ++i) { + FillProfile(corrconfigs[i], ProfilesList[runNumber][i], cent); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/Flow/Tasks/FlowTask.cxx b/PWGCF/Flow/Tasks/FlowTask.cxx index 2b9cd8e1be7..7639b4af2d7 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" @@ -50,26 +54,43 @@ struct FlowTask { 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(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(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(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi") + 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") + O2_DEFINE_CONFIGURABLE(cfgEvSelkIsGoodZvtxFT0vsPV, bool, true, "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") + 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(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") + O2_DEFINE_CONFIGURABLE(cfgEvSelOccupancy, bool, true, "Occupancy cut") 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(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"}; @@ -87,7 +108,7 @@ struct FlowTask { ConfigurableAxis axisDCAxy{"axisDCAxy", {200, -1, 1}, "DCA_{xy} (cm)"}; Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; - Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls); + 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); // Corrections TH1D* mEfficiency = nullptr; @@ -130,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; @@ -152,26 +175,28 @@ 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}}); registry.add("hMult", "Multiplicity distribution", {HistType::kTH1D, {{3000, 0.5, 3000.5}}}); registry.add("hCent", "Centrality distribution", {HistType::kTH1D, {{90, 0, 90}}}); - registry.add("BeforeCut_globalTracks_centT0C", "before cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); - registry.add("BeforeCut_PVTracks_centT0C", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}}); - registry.add("BeforeCut_globalTracks_PVTracks", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}}); - registry.add("BeforeCut_globalTracks_multT0A", "before cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); - registry.add("BeforeCut_globalTracks_multV0A", "before cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); - registry.add("BeforeCut_multV0A_multT0A", "before cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}}); - registry.add("BeforeCut_multT0C_centT0C", "before cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}}); - registry.add("globalTracks_centT0C", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); - registry.add("PVTracks_centT0C", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}}); - registry.add("globalTracks_PVTracks", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}}); - registry.add("globalTracks_multT0A", "after cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); - registry.add("globalTracks_multV0A", "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); - registry.add("multV0A_multT0A", "after cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}}); - registry.add("multT0C_centT0C", "after cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}}); + if (!cfgUseSmallMemory) { + registry.add("BeforeCut_globalTracks_centT0C", "before cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); + registry.add("BeforeCut_PVTracks_centT0C", "before cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}}); + registry.add("BeforeCut_globalTracks_PVTracks", "before cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}}); + registry.add("BeforeCut_globalTracks_multT0A", "before cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); + registry.add("BeforeCut_globalTracks_multV0A", "before cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); + registry.add("BeforeCut_multV0A_multT0A", "before cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}}); + registry.add("BeforeCut_multT0C_centT0C", "before cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}}); + registry.add("globalTracks_centT0C", "after cut;Centrality T0C;mulplicity global tracks", {HistType::kTH2D, {axisCentForQA, axisNch}}); + registry.add("PVTracks_centT0C", "after cut;Centrality T0C;mulplicity PV tracks", {HistType::kTH2D, {axisCentForQA, axisNchPV}}); + registry.add("globalTracks_PVTracks", "after cut;mulplicity PV tracks;mulplicity global tracks", {HistType::kTH2D, {axisNchPV, axisNch}}); + registry.add("globalTracks_multT0A", "after cut;mulplicity T0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); + registry.add("globalTracks_multV0A", "after cut;mulplicity V0A;mulplicity global tracks", {HistType::kTH2D, {axisT0A, axisNch}}); + registry.add("multV0A_multT0A", "after cut;mulplicity T0A;mulplicity V0A", {HistType::kTH2D, {axisT0A, axisT0A}}); + registry.add("multT0C_centT0C", "after cut;Centrality T0C;mulplicity T0C", {HistType::kTH2D, {axisCentForQA, axisT0C}}); + } // Track QA registry.add("hPhi", "#phi distribution", {HistType::kTH1D, {axisPhi}}); registry.add("hPhiWeighted", "corrected #phi distribution", {HistType::kTH1D, {axisPhi}}); @@ -181,30 +206,33 @@ struct FlowTask { registry.add("pt_phi_bef", "before cut;p_{T};#phi_{modn}", {HistType::kTH2D, {axisPt, axisPhiMod}}); registry.add("pt_phi_aft", "after cut;p_{T};#phi_{modn}", {HistType::kTH2D, {axisPt, axisPhiMod}}); registry.add("hChi2prTPCcls", "#chi^{2}/cluster for the TPC track segment", {HistType::kTH1D, {{100, 0., 5.}}}); + registry.add("hChi2prITScls", "#chi^{2}/cluster for the ITS track", {HistType::kTH1D, {{100, 0., 50.}}}); registry.add("hnTPCClu", "Number of found TPC clusters", {HistType::kTH1D, {{100, 40, 180}}}); registry.add("hnTPCCrossedRow", "Number of crossed TPC Rows", {HistType::kTH1D, {{100, 40, 180}}}); registry.add("hDCAz", "DCAz after cuts", {HistType::kTH1D, {{100, -3, 3}}}); registry.add("hDCAxy", "DCAxy after cuts; DCAxy (cm); Pt", {HistType::kTH2D, {{50, -1, 1}, {50, 0, 10}}}); registry.add("hTrackCorrection2d", "Correlation table for number of tracks table; uncorrected track; corrected track", {HistType::kTH2D, {axisNch, axisNch}}); - // additional Output histograms - registry.add("hMeanPt", "", {HistType::kTProfile, {axisIndependent}}); - registry.add("hMeanPtWithinGap08", "", {HistType::kTProfile, {axisIndependent}}); - registry.add("c22_gap08_Weff", "", {HistType::kTProfile, {axisIndependent}}); - registry.add("c22_gap08_trackMeanPt", "", {HistType::kTProfile, {axisIndependent}}); - registry.add("PtVariance_partA_WithinGap08", "", {HistType::kTProfile, {axisIndependent}}); - registry.add("PtVariance_partB_WithinGap08", "", {HistType::kTProfile, {axisIndependent}}); - - // initial array - BootstrapArray.resize(cfgNbootstrap); - for (int i = 0; i < cfgNbootstrap; i++) { - BootstrapArray[i].resize(kCount_ExtraProfile); - } - for (int i = 0; i < cfgNbootstrap; i++) { - BootstrapArray[i][kMeanPt_InGap08] = registry.add(Form("BootstrapContainer_%d/hMeanPtWithinGap08", i), "", {HistType::kTProfile, {axisIndependent}}); - BootstrapArray[i][kC22_Gap08_Weff] = registry.add(Form("BootstrapContainer_%d/c22_gap08_Weff", i), "", {HistType::kTProfile, {axisIndependent}}); - BootstrapArray[i][kC22_Gap08_MeanPt] = registry.add(Form("BootstrapContainer_%d/c22_gap08_trackMeanPt", i), "", {HistType::kTProfile, {axisIndependent}}); - BootstrapArray[i][kPtVarParA_InGap08] = registry.add(Form("BootstrapContainer_%d/PtVariance_partA_WithinGap08", i), "", {HistType::kTProfile, {axisIndependent}}); - BootstrapArray[i][kPtVarParB_InGap08] = registry.add(Form("BootstrapContainer_%d/PtVariance_partB_WithinGap08", i), "", {HistType::kTProfile, {axisIndependent}}); + if (!cfgUseSmallMemory) { + // additional Output histograms + registry.add("hMeanPt", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("hMeanPtWithinGap08", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("c22_gap08_Weff", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("c22_gap08_trackMeanPt", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("PtVariance_partA_WithinGap08", "", {HistType::kTProfile, {axisIndependent}}); + registry.add("PtVariance_partB_WithinGap08", "", {HistType::kTProfile, {axisIndependent}}); + + // initial array + BootstrapArray.resize(cfgNbootstrap); + for (int i = 0; i < cfgNbootstrap; i++) { + BootstrapArray[i].resize(kCount_ExtraProfile); + } + for (int i = 0; i < cfgNbootstrap; i++) { + BootstrapArray[i][kMeanPt_InGap08] = registry.add(Form("BootstrapContainer_%d/hMeanPtWithinGap08", i), "", {HistType::kTProfile, {axisIndependent}}); + BootstrapArray[i][kC22_Gap08_Weff] = registry.add(Form("BootstrapContainer_%d/c22_gap08_Weff", i), "", {HistType::kTProfile, {axisIndependent}}); + BootstrapArray[i][kC22_Gap08_MeanPt] = registry.add(Form("BootstrapContainer_%d/c22_gap08_trackMeanPt", i), "", {HistType::kTProfile, {axisIndependent}}); + BootstrapArray[i][kPtVarParA_InGap08] = registry.add(Form("BootstrapContainer_%d/PtVariance_partA_WithinGap08", i), "", {HistType::kTProfile, {axisIndependent}}); + BootstrapArray[i][kPtVarParB_InGap08] = registry.add(Form("BootstrapContainer_%d/PtVariance_partB_WithinGap08", i), "", {HistType::kTProfile, {axisIndependent}}); + } } o2::framework::AxisSpec axis = axisPt; @@ -231,14 +259,23 @@ struct FlowTask { oba->Add(new TNamed("Ch06Gap22", "Ch06Gap22")); oba->Add(new TNamed("Ch08Gap22", "Ch08Gap22")); oba->Add(new TNamed("Ch10Gap22", "Ch10Gap22")); + for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("Ch10Gap22_pt_%i", i + 1), "Ch10Gap22_pTDiff")); + oba->Add(new TNamed("Ch12Gap22", "Ch12Gap22")); oba->Add(new TNamed("Ch04Gap32", "Ch04Gap32")); oba->Add(new TNamed("Ch06Gap32", "Ch06Gap32")); oba->Add(new TNamed("Ch08Gap32", "Ch08Gap32")); oba->Add(new TNamed("Ch10Gap32", "Ch10Gap32")); + for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("Ch10Gap32_pt_%i", i + 1), "Ch10Gap32_pTDiff")); + oba->Add(new TNamed("Ch12Gap32", "Ch12Gap32")); oba->Add(new TNamed("Ch04Gap42", "Ch04Gap42")); oba->Add(new TNamed("Ch06Gap42", "Ch06Gap42")); oba->Add(new TNamed("Ch08Gap42", "Ch08Gap42")); oba->Add(new TNamed("Ch10Gap42", "Ch10Gap42")); + for (Int_t i = 0; i < fPtAxis->GetNbins(); i++) + oba->Add(new TNamed(Form("Ch10Gap42_pt_%i", i + 1), "Ch10Gap42_pTDiff")); + oba->Add(new TNamed("Ch12Gap42", "Ch12Gap42")); oba->Add(new TNamed("ChFull422", "ChFull422")); oba->Add(new TNamed("Ch04GapA422", "Ch04GapA422")); oba->Add(new TNamed("Ch04GapB422", "Ch04GapB422")); @@ -255,7 +292,7 @@ struct FlowTask { std::vector UserDefineGFWCorr = cfgUserDefineGFWCorr; std::vector UserDefineGFWName = cfgUserDefineGFWName; if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) { - for (int 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())); } } @@ -280,11 +317,15 @@ 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("olN", -0.8, -0.4, 1, 4); + fGFW->AddRegion("olN10", -0.8, -0.5, 1, 4); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {2 -2}", "ChFull22", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {3 -3}", "ChFull32", kFALSE)); @@ -295,16 +336,22 @@ struct FlowTask { corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN06 {2} refP06 {-2}", "Ch06Gap22", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN08 {2} refP08 {-2}", "Ch08Gap22", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {2} refP10 {-2}", "Ch10Gap22", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN12 {2} refP12 {-2}", "Ch12Gap22", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN04 {3} refP04 {-3}", "Ch04Gap32", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN06 {3} refP06 {-3}", "Ch06Gap32", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN08 {3} refP08 {-3}", "Ch08Gap32", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN10 {3} refP10 {-3}", "Ch10Gap32", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN12 {3} refP12 {-3}", "Ch12Gap32", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN04 {4} refP04 {-4}", "Ch04Gap42", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN06 {4} refP06 {-4}", "Ch06Gap42", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN08 {4} refP08 {-4}", "Ch08Gap42", kFALSE)); 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("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)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("full {4 -2 -2}", "ChFull422", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN04 {-2 -2} refP04 {4}", "Ch04GapA422", kFALSE)); corrconfigs.push_back(fGFW->GetCorrelatorConfig("refN04 {4} refP04 {-2 -2}", "Ch04GapB422", kFALSE)); @@ -321,7 +368,7 @@ struct FlowTask { if (!UserDefineGFWCorr.empty() && !UserDefineGFWName.empty()) { LOGF(info, "User adding GFW CorrelatorConfig:"); // attentaion: here we follow the index of cfgUserDefineGFWCorr - for (int 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; @@ -349,10 +396,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 @@ -472,31 +528,21 @@ struct FlowTask { template bool eventSelected(TCollision collision, const int multTrk, const float centrality) { - if (collision.alias_bit(kTVXinTRD)) { + if (cfgTriggerkTVXinTRD && collision.alias_bit(kTVXinTRD)) { // TRD triggered return 0; } - if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - // reject collisions close to Time Frame borders - // https://its.cern.ch/jira/browse/O2-4623 - return 0; - } - 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 0; - } - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + if (cfgEvSelkNoSameBunchPileup && !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; } - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + if (cfgEvSelkIsGoodZvtxFT0vsPV && !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; } - if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + if (cfgEvSelkNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { // no collisions in specified time range return 0; } @@ -509,22 +555,22 @@ struct FlowTask { } auto multNTracksPV = collision.multNTracksPV(); auto occupancy = collision.trackOccupancyInTimeRange(); - - if (abs(vtxz) > cfgCutVertex) - 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; - if (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh) + if (cfgEvSelOccupancy && (occupancy < cfgCutOccupancyLow || occupancy > cfgCutOccupancyHigh)) return 0; + if (cfgEvSelMultCorrelation) { + 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; + } + // V0A T0A 5 sigma cut - if (abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A())) + if (cfgEvSelV0AT0ACut && (fabs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A()))) return 0; return 1; @@ -545,7 +591,20 @@ struct FlowTask { } template - bool trackSelected(TTrack track, const int field) + bool trackSelected(TTrack track) + { + 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 RejectionTPCoverlap(TTrack track, const int field) { double phimodn = track.phi(); if (field < 0) // for negative polarity field @@ -588,16 +647,24 @@ struct FlowTask { return; if (tracks.size() < 1) return; - registry.fill(HIST("BeforeCut_globalTracks_centT0C"), collision.centFT0C(), tracks.size()); - registry.fill(HIST("BeforeCut_PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); - registry.fill(HIST("BeforeCut_globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size()); - registry.fill(HIST("BeforeCut_globalTracks_multT0A"), collision.multFT0A(), tracks.size()); - 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); - // place holder for pile-up rejection + 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()); + registry.fill(HIST("BeforeCut_globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size()); + registry.fill(HIST("BeforeCut_globalTracks_multT0A"), collision.multFT0A(), tracks.size()); + 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()); + } const auto cent = collision.centFT0C(); if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent)) return; @@ -608,7 +675,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; // @@ -621,13 +687,15 @@ struct FlowTask { registry.fill(HIST("hEventCount"), 4.5); // fill event QA - registry.fill(HIST("globalTracks_centT0C"), collision.centFT0C(), tracks.size()); - registry.fill(HIST("PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); - registry.fill(HIST("globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size()); - registry.fill(HIST("globalTracks_multT0A"), collision.multFT0A(), tracks.size()); - registry.fill(HIST("globalTracks_multV0A"), collision.multFV0A(), tracks.size()); - registry.fill(HIST("multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); - registry.fill(HIST("multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); + if (!cfgUseSmallMemory) { + registry.fill(HIST("globalTracks_centT0C"), collision.centFT0C(), tracks.size()); + registry.fill(HIST("PVTracks_centT0C"), collision.centFT0C(), collision.multNTracksPV()); + registry.fill(HIST("globalTracks_PVTracks"), collision.multNTracksPV(), tracks.size()); + registry.fill(HIST("globalTracks_multT0A"), collision.multFT0A(), tracks.size()); + registry.fill(HIST("globalTracks_multV0A"), collision.multFV0A(), tracks.size()); + registry.fill(HIST("multV0A_multT0A"), collision.multFT0A(), collision.multFV0A()); + registry.fill(HIST("multT0C_centT0C"), collision.centFT0C(), collision.multFT0C()); + } // track weights float weff = 1, wacc = 1; @@ -637,7 +705,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()); } @@ -646,17 +714,23 @@ struct FlowTask { independent = static_cast(tracks.size()); for (auto& track : tracks) { - if (track.tpcNClsFound() < cfgCutTPCclu) + if (!trackSelected(track)) continue; - if (cfgUseAdditionalTrackCut && !trackSelected(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 = (cfgCutPtMin < track.pt()) && (track.pt() < cfgCutPtMax); // within RF 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()); @@ -664,6 +738,7 @@ struct FlowTask { registry.fill(HIST("hEta"), track.eta()); registry.fill(HIST("hPtRef"), track.pt()); registry.fill(HIST("hChi2prTPCcls"), track.tpcChi2NCl()); + registry.fill(HIST("hChi2prITScls"), track.itsChi2NCl()); registry.fill(HIST("hnTPCClu"), track.tpcNClsFound()); registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows()); registry.fill(HIST("hDCAz"), track.dcaZ()); @@ -688,40 +763,42 @@ struct FlowTask { } registry.fill(HIST("hTrackCorrection2d"), tracks.size(), NTracksCorrected); - double WeffEvent_diff_WithGap08 = weffEvent_WithinGap08 * weffEvent_WithinGap08 - weffEventSquare_WithinGap08; - // Filling TProfile - // MeanPt - if (weffEvent > 1e-6) - registry.fill(HIST("hMeanPt"), independent, ptSum / weffEvent, weffEvent); - if (weffEvent_WithinGap08 > 1e-6) - registry.fill(HIST("hMeanPtWithinGap08"), independent, ptSum_Gap08 / weffEvent_WithinGap08, weffEvent_WithinGap08); - // v22-Pt - // c22_gap8 * pt_withGap8 - if (weffEvent_WithinGap08 > 1e-6) - FillpTvnProfile(corrconfigs.at(7), ptSum_Gap08, weffEvent_WithinGap08, HIST("c22_gap08_Weff"), HIST("c22_gap08_trackMeanPt"), independent); - // PtVariance - if (WeffEvent_diff_WithGap08 > 1e-6) { - registry.fill(HIST("PtVariance_partA_WithinGap08"), independent, - (ptSum_Gap08 * ptSum_Gap08 - sum_ptSquare_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, - WeffEvent_diff_WithGap08); - registry.fill(HIST("PtVariance_partB_WithinGap08"), independent, - (weffEvent_WithinGap08 * ptSum_Gap08 - sum_pt_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, - WeffEvent_diff_WithGap08); - } - - // Filling Bootstrap Samples - int SampleIndex = static_cast(cfgNbootstrap * l_Random); - if (weffEvent_WithinGap08 > 1e-6) - BootstrapArray[SampleIndex][kMeanPt_InGap08]->Fill(independent, ptSum_Gap08 / weffEvent_WithinGap08, weffEvent_WithinGap08); - if (weffEvent_WithinGap08 > 1e-6) - FillpTvnProfile(corrconfigs.at(7), ptSum_Gap08, weffEvent_WithinGap08, BootstrapArray[SampleIndex][kC22_Gap08_Weff], BootstrapArray[SampleIndex][kC22_Gap08_MeanPt], independent); - if (WeffEvent_diff_WithGap08 > 1e-6) { - BootstrapArray[SampleIndex][kPtVarParA_InGap08]->Fill(independent, - (ptSum_Gap08 * ptSum_Gap08 - sum_ptSquare_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, - WeffEvent_diff_WithGap08); - BootstrapArray[SampleIndex][kPtVarParB_InGap08]->Fill(independent, - (weffEvent_WithinGap08 * ptSum_Gap08 - sum_pt_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, - WeffEvent_diff_WithGap08); + if (!cfgUseSmallMemory) { + double WeffEvent_diff_WithGap08 = weffEvent_WithinGap08 * weffEvent_WithinGap08 - weffEventSquare_WithinGap08; + // Filling TProfile + // MeanPt + if (weffEvent > 1e-6) + registry.fill(HIST("hMeanPt"), independent, ptSum / weffEvent, weffEvent); + if (weffEvent_WithinGap08 > 1e-6) + registry.fill(HIST("hMeanPtWithinGap08"), independent, ptSum_Gap08 / weffEvent_WithinGap08, weffEvent_WithinGap08); + // v22-Pt + // c22_gap8 * pt_withGap8 + if (weffEvent_WithinGap08 > 1e-6) + FillpTvnProfile(corrconfigs.at(7), ptSum_Gap08, weffEvent_WithinGap08, HIST("c22_gap08_Weff"), HIST("c22_gap08_trackMeanPt"), independent); + // PtVariance + if (WeffEvent_diff_WithGap08 > 1e-6) { + registry.fill(HIST("PtVariance_partA_WithinGap08"), independent, + (ptSum_Gap08 * ptSum_Gap08 - sum_ptSquare_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, + WeffEvent_diff_WithGap08); + registry.fill(HIST("PtVariance_partB_WithinGap08"), independent, + (weffEvent_WithinGap08 * ptSum_Gap08 - sum_pt_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, + WeffEvent_diff_WithGap08); + } + + // Filling Bootstrap Samples + int SampleIndex = static_cast(cfgNbootstrap * l_Random); + if (weffEvent_WithinGap08 > 1e-6) + BootstrapArray[SampleIndex][kMeanPt_InGap08]->Fill(independent, ptSum_Gap08 / weffEvent_WithinGap08, weffEvent_WithinGap08); + if (weffEvent_WithinGap08 > 1e-6) + FillpTvnProfile(corrconfigs.at(7), ptSum_Gap08, weffEvent_WithinGap08, BootstrapArray[SampleIndex][kC22_Gap08_Weff], BootstrapArray[SampleIndex][kC22_Gap08_MeanPt], independent); + if (WeffEvent_diff_WithGap08 > 1e-6) { + BootstrapArray[SampleIndex][kPtVarParA_InGap08]->Fill(independent, + (ptSum_Gap08 * ptSum_Gap08 - sum_ptSquare_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, + WeffEvent_diff_WithGap08); + BootstrapArray[SampleIndex][kPtVarParB_InGap08]->Fill(independent, + (weffEvent_WithinGap08 * ptSum_Gap08 - sum_pt_wSquare_WithinGap08) / WeffEvent_diff_WithGap08, + WeffEvent_diff_WithGap08); + } } // Filling Flow Container diff --git a/PWGCF/Flow/Tasks/FlowZDCtask.cxx b/PWGCF/Flow/Tasks/FlowZDCtask.cxx index 641ef3cb1e5..fbb6e068cf6 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; @@ -76,7 +76,6 @@ struct FlowZDCtask { 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"}; - 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); @@ -102,6 +101,13 @@ 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", 100, 0, 50000, 0, 500)}; + OutputObj pZPvsFT0MAmp{TProfile("pZPvsFT0MAmp", "ZP Energy vs FT0M Amplitude", 100, 0, 50000, 0, 500)}; + + OutputObj pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 50000)}; + OutputObj pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 50000)}; + 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 +126,11 @@ 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"}; + const AxisSpec axisEnergy{100, 0, 50000., "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 +158,7 @@ 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}}); // for q vector recentering histos.add("revsimag", "revsimag", kTH2F, {axisREQ, axisIMQ}); @@ -179,6 +186,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, 10000000}}); + histos.add("hFT0AAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 10000000}}); + histos.add("hFT0MAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 10000000}}); + 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 +248,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 +303,47 @@ 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()); + float common_sumZNA = (zdcread.energyCommonZNA()); + float common_sumZPC = (zdcread.energyCommonZPC()); + float common_sumZPA = (zdcread.energyCommonZPA()); + 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); + + 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 +386,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 new file mode 100644 index 00000000000..68d162f7005 --- /dev/null +++ b/PWGCF/Flow/Tasks/flowGFWOmegaXi.cxx @@ -0,0 +1,709 @@ +// 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. + +/// In case of questions please write to: +/// \author Fuchun Cui(fcui@cern.ch) + +#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/PIDResponse.h" +#include "Common/DataModel/Multiplicity.h" +#include "GFWPowerArray.h" +#include "GFW.h" +#include "GFWCumulant.h" +#include "GFWWeights.h" +#include "Common/DataModel/Qvectors.h" +#include "Common/Core/EventPlaneHelper.h" +#include "ReconstructionDataFormats/Track.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/trackUtilities.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "TList.h" +#include +#include +#include +#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 FlowGFWOmegaXi { + + 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, 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(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") + O2_DEFINE_CONFIGURABLE(cfgLambdaMassbins, int, 32, "Number of Lambda mass axis bins for c22") + // 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_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") + O2_DEFINE_CONFIGURABLE(cfgv0_ArmPodocut, float, 0.2f, "Armenteros Podolski cut for K0") + // topological cut for cascade + O2_DEFINE_CONFIGURABLE(cfgcasc_radius, float, 0.5f, "minimum decay radius") + O2_DEFINE_CONFIGURABLE(cfgcasc_casccospa, float, 0.999f, "minimum cosine of pointing angle") + O2_DEFINE_CONFIGURABLE(cfgcasc_v0cospa, float, 0.998f, "minimum cosine of pointing angle") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcav0topv, float, 0.01f, "minimum daughter DCA to PV") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcabachtopv, float, 0.01f, "minimum bachelor DCA to PV") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcacascdau, float, 0.3f, "maximum DCA among cascade daughters") + O2_DEFINE_CONFIGURABLE(cfgcasc_dcav0dau, float, 1.0f, "maximum DCA among V0 daughters") + O2_DEFINE_CONFIGURABLE(cfgcasc_mlambdawindow, float, 0.04f, "Invariant mass window of lambda") + // 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(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(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"}; + ConfigurableAxis cfgaxisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"}; + ConfigurableAxis cfgaxisPt{"axisPtREF", {VARIABLE_WIDTH, 0.20, 0.25, 0.30, 0.35, 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, 3.50, 4.00, 4.50, 5.00, 5.50, 6.00, 10.0}, "pt (GeV)"}; + ConfigurableAxis cfgaxisPtXi{"axisPtXi", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; + ConfigurableAxis cfgaxisPtOmega{"axisPtOmega", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; + ConfigurableAxis cfgaxisPtV0{"axisPtV0", {VARIABLE_WIDTH, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.9, 4.9, 5.9, 9.9}, "pt (GeV)"}; + ConfigurableAxis cfgaxisOmegaminusMassforflow{"axismassOmegaFlow", {16, 1.63f, 1.71f}, "Inv. Mass (GeV)"}; + ConfigurableAxis cfgaxisXiminusMassforflow{"axismassXiFlow", {14, 1.3f, 1.37f}, "Inv. Mass (GeV)"}; + ConfigurableAxis cfgaxisK0sMassforflow{"axismassK0sFlow", {40, 0.4f, 0.6f}, "Inv. Mass (GeV)"}; + ConfigurableAxis cfgaxisLambdaMassforflow{"axismassLambdaFlow", {32, 1.08f, 1.16f}, "Inv. Mass (GeV)"}; + + AxisSpec axisMultiplicity{{0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "Centrality (%)"}; + AxisSpec axisOmegaminusMass = {80, 1.63f, 1.71f, "Inv. Mass (GeV)"}; + AxisSpec axisXiminusMass = {70, 1.3f, 1.37f, "Inv. Mass (GeV)"}; + AxisSpec axisK0sMass = {400, 0.4f, 0.6f, "Inv. Mass (GeV)"}; + AxisSpec axisLambdaMass = {160, 1.08f, 1.16f, "Inv. Mass (GeV)"}; + + 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); + + // Connect to ccdb + Service ccdb; + O2_DEFINE_CONFIGURABLE(cfgnolaterthan, int64_t, std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object") + O2_DEFINE_CONFIGURABLE(cfgurl, std::string, "http://alice-ccdb.cern.ch", "url of the ccdb repository") + + // 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 + std::vector corrconfigs; + std::vector cfgAcceptance = cfgAcceptancePath; + std::vector cfgEfficiency = cfgEfficiencyPath; + + std::vector mEfficiency; + std::vector mAcceptance; + bool correctionsLoaded = false; + + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + TF1* fMultCutLow = nullptr; + TF1* fMultCutHigh = nullptr; + TF1* fT0AV0AMean = nullptr; + TF1* fT0AV0ASigma = nullptr; + + using TracksPID = soa::Join; + using aodTracks = soa::Filtered>; // tracks filter + using aodCollisions = soa::Filtered>; // collisions filter + using DaughterTracks = soa::Join; + + // Declare the pt, mult and phi Axis; + int nPtBins = 0; + TAxis* fPtAxis = nullptr; + + int nXiPtBins = 0; + TAxis* fXiPtAxis = nullptr; + + int nV0PtBins = 0; + TAxis* fV0PtAxis = nullptr; + + int nMultBins = 0; + TAxis* fMultAxis = nullptr; + + int nPhiBins = 60; + TAxis* fPhiAxis = new TAxis(nPhiBins, 0, constants::math::TwoPI); + + TAxis* fOmegaMass = nullptr; + + TAxis* fXiMass = nullptr; + + TAxis* fK0sMass = nullptr; + + TAxis* fLambdaMass = nullptr; + + void init(InitContext const&) // Initialization + { + ccdb->setURL(cfgurl.value); + ccdb->setCaching(true); + ccdb->setCreatedNotAfter(cfgnolaterthan.value); + + // Add some output objects to the histogram registry + registry.add("hPhi", "", {HistType::kTH1D, {cfgaxisPhi}}); + registry.add("hEta", "", {HistType::kTH1D, {cfgaxisEta}}); + registry.add("hVtxZ", "", {HistType::kTH1D, {cfgaxisVertex}}); + 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, {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"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "before topological cut"); + registry.get(HIST("hEventCount"))->GetXaxis()->SetBinLabel(4, "after topological cut"); + registry.get(HIST("hEventCount"))->GetYaxis()->SetBinLabel(1, "K0s"); + registry.get(HIST("hEventCount"))->GetYaxis()->SetBinLabel(2, "Lambda"); + registry.get(HIST("hEventCount"))->GetYaxis()->SetBinLabel(3, "XiMinus"); + registry.get(HIST("hEventCount"))->GetYaxis()->SetBinLabel(4, "Omega"); + + // cumulant of flow + registry.add("c22", ";Centrality (%) ; C_{2}{2} ", {HistType::kTProfile, {axisMultiplicity}}); + registry.add("c24", ";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}}); + registry.add("K0sc22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisK0sMassforflow, axisMultiplicity}}); + registry.add("Lambdac22dpt", ";pt ; C_{2}{2} ", {HistType::kTProfile3D, {cfgaxisPtV0, cfgaxisLambdaMassforflow, axisMultiplicity}}); + registry.add("Xic24dpt", ";pt ; C_{2}{4} ", {HistType::kTProfile3D, {cfgaxisPtXi, cfgaxisXiminusMassforflow, axisMultiplicity}}); + 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}}); + // 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}}); + registry.add("InvMassOmegaMinus", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisOmegaminusMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassXiMinus", "", {HistType::kTHnSparseF, {cfgaxisPtXi, axisXiminusMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassK0s_all", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisK0sMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassLambda_all", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisLambdaMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassK0s", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisK0sMass, cfgaxisEta, axisMultiplicity}}); + registry.add("InvMassLambda", "", {HistType::kTHnSparseF, {cfgaxisPtV0, axisLambdaMass, cfgaxisEta, axisMultiplicity}}); + + // Set the pt, mult and phi Axis; + o2::framework::AxisSpec axisPt = cfgaxisPt; + nPtBins = axisPt.binEdges.size() - 1; + fPtAxis = new TAxis(nPtBins, &(axisPt.binEdges)[0]); + + o2::framework::AxisSpec axisXiPt = cfgaxisPtXi; + nXiPtBins = axisXiPt.binEdges.size() - 1; + fXiPtAxis = new TAxis(nXiPtBins, &(axisXiPt.binEdges)[0]); + + o2::framework::AxisSpec axisV0Pt = cfgaxisPtV0; + nV0PtBins = axisV0Pt.binEdges.size() - 1; + fV0PtAxis = new TAxis(nV0PtBins, &(axisV0Pt.binEdges)[0]); + + o2::framework::AxisSpec axisMult = axisMultiplicity; + nMultBins = axisMult.binEdges.size() - 1; + fMultAxis = new TAxis(nMultBins, &(axisMult.binEdges)[0]); + + fOmegaMass = new TAxis(cfgOmegaMassbins, 1.63, 1.71); + + fXiMass = new TAxis(cfgXiMassbins, 1.3, 1.37); + + fK0sMass = new TAxis(cfgK0sMassbins, 0.4, 0.6); + + 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.4, 1, 1); + fGFW->AddRegion("refP10", 0.4, 0.8, 1, 1); + fGFW->AddRegion("refN10dpt", -0.8, -0.4, nPtBins, 1); + fGFW->AddRegion("refP10dpt", 0.4, 0.8, nPtBins, 1); + fGFW->AddRegion("reffulldpt", -0.8, 0.8, nPtBins, 1); + fGFW->AddRegion("refoldpt", -0.8, 0.8, nPtBins, 1); + int nXiptMassBins = nXiPtBins * cfgXiMassbins; + fGFW->AddRegion("poiXiP", 0.4, 0.8, nXiptMassBins, 2); + fGFW->AddRegion("poiXiN", -0.8, -0.4, nXiptMassBins, 2); + fGFW->AddRegion("poiXifull", -0.8, 0.8, nXiptMassBins, 2); + int nOmegaptMassBins = nXiPtBins * cfgOmegaMassbins; + fGFW->AddRegion("poiOmegaP", 0.4, 0.8, nOmegaptMassBins, 4); + fGFW->AddRegion("poiOmegaN", -0.8, -0.4, nOmegaptMassBins, 4); + fGFW->AddRegion("poiOmegafull", -0.8, 0.8, nOmegaptMassBins, 4); + int nK0sptMassBins = nV0PtBins * cfgK0sMassbins; + fGFW->AddRegion("poiK0sP", 0.4, 0.8, nK0sptMassBins, 8); + fGFW->AddRegion("poiK0sN", -0.8, -0.4, nK0sptMassBins, 8); + fGFW->AddRegion("poiK0sfull", -0.8, 0.8, nK0sptMassBins, 8); + int nLambdaptMassBins = nV0PtBins * cfgLambdaMassbins; + fGFW->AddRegion("poiLambdaP", 0.4, 0.8, nLambdaptMassBins, 16); + fGFW->AddRegion("poiLambdaN", -0.8, -0.4, nLambdaptMassBins, 16); + fGFW->AddRegion("poiLambdafull", -0.8, 0.8, nLambdaptMassBins, 16); + // pushback + corrconfigs.push_back(fGFW->GetCorrelatorConfig("refP10dpt {2} refN10dpt {-2}", "Ref10Gap22dpt", kTRUE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("reffulldpt reffulldpt {2 2 -2 -2}", "Ref10Gap24dpt", 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("refP10 {2} refN10 {-2}", "Ref10Gap22", kFALSE)); + corrconfigs.push_back(fGFW->GetCorrelatorConfig("reffull reffull {2 2 -2 -2}", "Ref10Gap24", kFALSE)); + fGFW->CreateRegions(); // finalize the initialization + + // used for event selection + fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6must ]*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); + fT0AV0AMean = new TF1("fT0AV0AMean", "[0]+[1]*x", 0, 200000); + 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); + } + } + + 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 (TMath::Abs(val) < 1) + registry.fill(tarName, cent, val, dnx); + return; + } + return; + } + + template + 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(); + if (dnx == 0) + return; + val = fGFW->Calculate(corrconf, ptbin, kFALSE).real() / dnx; + if (TMath::Abs(val) < 1) { + registry.fill(tarName, fPtAxis->GetBinCenter(ptbin), cent, val, dnx); + } + return; + } + + template + void FillProfilepTMass(const GFW::CorrConfig& corrconf, const ConstStr& tarName, 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 (TMath::Abs(val) < 1) { + registry.fill(tarName, fpt->GetBinCenter(ptbin), fMass->GetBinCenter(massbin), cent, val, dnx); + } + } + return; + } + + void loadCorrections(uint64_t timestamp) + { + if (correctionsLoaded) + return; + 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 (mEfficiency.size() == 5) + LOGF(info, "Loaded efficiency histogram"); + else + LOGF(fatal, "Could not load efficiency histogram"); + } + correctionsLoaded = true; + } + + template + bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, TrackObject track, float vtxz, int ispecies) + { + float eff = 1.; + 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() == 5) + weight_nua = mAcceptance[ispecies]->GetNUA(track.phi(), track.eta(), vtxz); + else + weight_nua = 1; + return true; + } + // event selection + template + bool eventSelected(TCollision collision, const int multTrk, const float centrality) + { + if (collision.alias_bit(kTVXinTRD)) { + // TRD triggered + return false; + } + 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 (!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 (!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 (!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; + } + 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(); + + 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; + + // V0A T0A 5 sigma cut + if (abs(collision.multFV0A() - fT0AV0AMean->Eval(collision.multFT0A())) > 5 * fT0AV0ASigma->Eval(collision.multFT0A())) + return 0; + + return true; + } + + void process(aodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks, aod::CascDataExt const& Cascades, aod::V0Datas const& V0s, DaughterTracks&) + { + int Ntot = tracks.size(); + int CandNum_all[4] = {0, 0, 0, 0}; + int CandNum[4] = {0, 0, 0, 0}; + for (int i = 0; i < 4; i++) { + registry.fill(HIST("hEventCount"), 0.5, i + 0.5); + } + if (Ntot < 1) + return; + fGFW->Clear(); + const auto cent = collision.centFT0C(); + if (!collision.sel8()) + return; + if (eventSelected(collision, tracks.size(), cent)) + return; + auto bc = collision.bc_as(); + loadCorrections(bc.timestamp()); + float vtxz = collision.posZ(); + registry.fill(HIST("hVtxZ"), vtxz); + registry.fill(HIST("hMult"), Ntot); + registry.fill(HIST("hCent"), collision.centFT0C()); + for (int i = 0; i < 4; i++) { + registry.fill(HIST("hEventCount"), 1.5, i + 0.5); + } + + float weff = 1; + float wacc = 1; + // fill GFW ref flow + for (auto& track : tracks) { + if (!setCurrentParticleWeights(weff, wacc, track, vtxz, 0)) + continue; + registry.fill(HIST("hPhi"), track.phi()); + registry.fill(HIST("hEta"), track.eta()); + registry.fill(HIST("hEtaPhiVtxzREF"), track.phi(), track.eta(), vtxz); + 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 (cfgOutputNUAWeights) + fWeightsREF->Fill(track.phi(), track.eta(), vtxz, track.pt(), cent, 0); + } + // fill GFW of V0 flow + for (auto& v0 : V0s) { + auto v0posdau = v0.posTrack_as(); + 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) { + 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("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; + } + // track quality check + if (v0posdau.tpcNClsFound() < cfgtpcclusters) + continue; + if (v0negdau.tpcNClsFound() < cfgtpcclusters) + continue; + if (v0posdau.itsNCls() < cfgitsclusters) + continue; + if (v0negdau.itsNCls() < cfgitsclusters) + continue; + // topological cut + if (v0.v0radius() < cfgv0_radius) + continue; + if (v0.v0cosPA() < cfgv0_v0cospa) + continue; + if (v0.dcaV0daughters() > cfgv0_dcav0dau) + continue; + if (PDGCode == kK0Short) { + if (TMath::Abs(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.phi(), v0.eta(), vtxz); + 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() - 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.phi(), v0.eta(), vtxz); + 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); + } + } + } + // fill GFW of casc flow + for (auto& casc : Cascades) { + auto bachelor = casc.bachelor_as(); + auto posdau = casc.posTrack_as(); + auto negdau = casc.negTrack_as(); + // check TPC + if (cfgcheckDauTPC && (!posdau.hasTPC() || !negdau.hasTPC() || !bachelor.hasTPC())) { + 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) { + 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) { + registry.fill(HIST("InvMassXiMinus_all"), casc.pt(), casc.mXi(), casc.eta(), cent); + if (!setCurrentParticleWeights(weff, wacc, casc, vtxz, 3)) + continue; + PDGCode = kXiMinus; + CandNum_all[2] = CandNum_all[2] + 1; + } else { + continue; + } + // topological cut + if (casc.cascradius() < cfgcasc_radius) + continue; + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cfgcasc_casccospa) + continue; + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cfgcasc_v0cospa) + continue; + if (casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cfgcasc_dcav0topv) + continue; + if (casc.dcabachtopv() < cfgcasc_dcabachtopv) + continue; + if (casc.dcacascdaughters() > cfgcasc_dcacascdau) + continue; + if (casc.dcaV0daughters() > cfgcasc_dcav0dau) + continue; + if (TMath::Abs(casc.mLambda() - o2::constants::physics::MassLambda0) > cfgcasc_mlambdawindow) + continue; + // track quality check + if (bachelor.tpcNClsFound() < cfgtpcclusters) + continue; + if (posdau.tpcNClsFound() < cfgtpcclusters) + continue; + if (negdau.tpcNClsFound() < cfgtpcclusters) + continue; + if (bachelor.itsNCls() < cfgitsclusters) + continue; + if (posdau.itsNCls() < cfgitsclusters) + continue; + if (negdau.itsNCls() < cfgitsclusters) + continue; + if (PDGCode == kOmegaMinus) { + CandNum[3] = CandNum[3] + 1; + registry.fill(HIST("hEtaPhiVtxzPOIOmega"), casc.phi(), casc.eta(), vtxz); + 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.phi(), casc.eta(), vtxz); + 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) { + registry.fill(HIST("hEventCount"), 2.5, i + 0.5); + } + if (CandNum[i] > 1) { + registry.fill(HIST("hEventCount"), 3.5, i + 0.5); + } + } + // Filling cumulant with ROOT TProfile and loop for all ptBins + FillProfile(corrconfigs.at(14), HIST("c22"), cent); + FillProfile(corrconfigs.at(15), HIST("c24"), cent); + for (int i = 1; i <= nPtBins; i++) { + FillProfilepT(corrconfigs.at(0), HIST("c22dpt"), i, cent); + FillProfilepT(corrconfigs.at(1), HIST("c24dpt"), i, cent); + } + for (int i = 1; i <= nV0PtBins; i++) { + FillProfilepTMass(corrconfigs.at(8), HIST("K0sc22dpt"), i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(9), HIST("K0sc22dpt"), i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(10), HIST("K0sc24dpt"), i, kK0Short, cent); + FillProfilepTMass(corrconfigs.at(11), HIST("Lambdac22dpt"), i, kLambda0, cent); + FillProfilepTMass(corrconfigs.at(12), HIST("Lambdac22dpt"), i, kLambda0, cent); + FillProfilepTMass(corrconfigs.at(13), HIST("Lambdac24dpt"), i, kLambda0, cent); + } + for (int i = 1; i <= nXiPtBins; i++) { + FillProfilepTMass(corrconfigs.at(2), HIST("Xic22dpt"), i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(3), HIST("Xic22dpt"), i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(4), HIST("Xic24dpt"), i, kXiMinus, cent); + FillProfilepTMass(corrconfigs.at(5), HIST("Omegac22dpt"), i, kOmegaMinus, cent); + FillProfilepTMass(corrconfigs.at(6), HIST("Omegac22dpt"), i, kOmegaMinus, cent); + FillProfilepTMass(corrconfigs.at(7), HIST("Omegac24dpt"), i, kOmegaMinus, cent); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx index 6088da403a4..239107ce0ad 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.cxx +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.cxx @@ -21,10 +21,11 @@ FlowPtContainer::FlowPtContainer() : TNamed("name", "name"), fillCounter(0), fEventWeight(kEventWeight::kUnity), fUseCentralMoments(true), + fUseGap(false), sumP(), corrNum(), corrDen(), - cmNum(), + cmVal(), cmDen() {} FlowPtContainer::~FlowPtContainer() { @@ -41,47 +42,28 @@ FlowPtContainer::FlowPtContainer(const char* name) : TNamed(name, name), fillCounter(0), fEventWeight(kEventWeight::kUnity), fUseCentralMoments(true), + fUseGap(false), sumP(), corrNum(), corrDen(), - cmNum(), + cmVal(), cmDen() {} -FlowPtContainer::FlowPtContainer(const char* name, const char* title, int nbinsx, double* xbins, const int& m, const GFWCorrConfigs& configs) : TNamed(name, title), - fCMTermList(0), - fCorrList(0), - fCovList(0), - fCumulantList(0), - fCentralMomentList(0), - mpar(m), - fillCounter(0), - fEventWeight(kEventWeight::kUnity), - fUseCentralMoments(true), - sumP(), - corrNum(), - corrDen(), - cmNum(), - cmDen() -{ - Initialise(nbinsx, xbins, m, configs); -}; -FlowPtContainer::FlowPtContainer(const char* name, const char* title, int nbinsx, double xlow, double xhigh, const int& m, const GFWCorrConfigs& configs) : TNamed(name, title), - fCMTermList(0), - fCorrList(0), - fCovList(0), - fCumulantList(0), - fCentralMomentList(0), - mpar(m), - fillCounter(0), - fEventWeight(kEventWeight::kUnity), - fUseCentralMoments(true), - sumP(), - corrNum(), - corrDen(), - cmNum(), - cmDen() -{ - Initialise(nbinsx, xlow, xhigh, m, configs); -}; +FlowPtContainer::FlowPtContainer(const char* name, const char* title) : TNamed(name, title), + fCMTermList(0), + fCorrList(0), + fCovList(0), + fCumulantList(0), + fCentralMomentList(0), + mpar(0), + fillCounter(0), + fEventWeight(kEventWeight::kUnity), + fUseCentralMoments(true), + fUseGap(false), + sumP(), + corrNum(), + corrDen(), + cmVal(), + cmDen() {} void FlowPtContainer::Initialise(const o2::framework::AxisSpec axis, const int& m, const GFWCorrConfigs& configs, const int& nsub) { if (!mpar) @@ -107,26 +89,50 @@ void FlowPtContainer::Initialise(const o2::framework::AxisSpec axis, const int& fCovList = new TList(); fCovList->SetOwner(kTRUE); for (int m = 0; m < mpar; ++m) { - fCorrList->Add(new BootstrapProfile(Form("mpt%i", m + 1), Form("corr_%ipar", m + 1), nMultiBins, &multiBins[0])); + fCorrList->Add(new BootstrapProfile(Form("mpt%i", m + 1), Form("mpt%i", m + 1), nMultiBins, &multiBins[0])); } for (int m = 0; m < 4; ++m) { for (int i = 0; i <= m; ++i) { fCMTermList->Add(new BootstrapProfile(Form("cm%i_Mpt%i", m + 1, i), Form("cm%i_Mpt%i", m + 1, i), nMultiBins, &multiBins[0])); } } - for (int i = 0; i < configs.GetSize(); ++i) { - for (auto m(1); m <= mpar; ++m) { - if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) - continue; - if (fUseCentralMoments) { - for (auto j = 0; j < m; ++j) { - fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, m - j - 1), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, m - j - 1), nMultiBins, &multiBins[0])); + if (fUseGap) { + for (int i = 0; i < configs.GetSize(); ++i) { + for (auto m(1); m <= mpar; ++m) { + if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) + continue; + if (fUseCentralMoments) { + for (auto j = 0; j <= m; ++j) { + fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nMultiBins, &multiBins[0])); + } + } else { + fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nMultiBins, &multiBins[0])); } - } else { - fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nMultiBins, &multiBins[0])); } } + } else { + if (fUseCentralMoments) { + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt0", "ChFull24pt2_Mpt0", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt1", "ChFull24pt2_Mpt1", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt2", "ChFull24pt2_Mpt2", nMultiBins, &multiBins[0])); + + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt0", "ChFull24pt1_Mpt0", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt1", "ChFull24pt1_Mpt1", nMultiBins, &multiBins[0])); + + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt0", "ChFull22pt2_Mpt0", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt1", "ChFull22pt2_Mpt1", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt2", "ChFull22pt2_Mpt2", nMultiBins, &multiBins[0])); + + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt0", "ChFull22pt1_Mpt0", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt1", "ChFull22pt1_Mpt1", nMultiBins, &multiBins[0])); + } else { + fCovList->Add(new BootstrapProfile("ChFull24pt2", "ChFull24pt2", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull24pt1", "ChFull24pt1", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt2", "ChFull22pt2", nMultiBins, &multiBins[0])); + fCovList->Add(new BootstrapProfile("ChFull22pt1", "ChFull22pt1", nMultiBins, &multiBins[0])); + } } + if (nsub) { for (int i = 0; i < fCorrList->GetEntries(); ++i) dynamic_cast(fCorrList->At(i))->InitializeSubsamples(nsub); @@ -158,18 +164,41 @@ void FlowPtContainer::Initialise(int nbinsx, double* xbins, const int& m, const fCMTermList->Add(new BootstrapProfile(Form("cm%i_Mpt%i", m + 1, i), Form("cm%i_Mpt%i", m + 1, i), nbinsx, xbins)); } } - for (int i = 0; i < configs.GetSize(); ++i) { - for (auto m(1); m <= mpar; ++m) { - if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) - continue; - if (fUseCentralMoments) { - for (auto j = 0; j < m; ++j) { - fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, m - j - 1), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, m - j - 1), nbinsx, xbins)); + if (fUseGap) { + for (int i = 0; i < configs.GetSize(); ++i) { + for (auto m(1); m <= mpar; ++m) { + if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) + continue; + if (fUseCentralMoments) { + for (auto j = 0; j <= m; ++j) { + fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nbinsx, xbins)); + } + } else { + fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xbins)); } - } else { - fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xbins)); } } + } else { + if (fUseCentralMoments) { + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt0", "ChFull24pt2_Mpt0", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt1", "ChFull24pt2_Mpt1", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt2", "ChFull24pt2_Mpt2", nbinsx, xbins)); + + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt0", "ChFull24pt1_Mpt0", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt1", "ChFull24pt1_Mpt1", nbinsx, xbins)); + + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt0", "ChFull22pt2_Mpt0", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt1", "ChFull22pt2_Mpt1", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt2", "ChFull22pt2_Mpt2", nbinsx, xbins)); + + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt0", "ChFull22pt1_Mpt0", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt1", "ChFull22pt1_Mpt1", nbinsx, xbins)); + } else { + fCovList->Add(new BootstrapProfile("ChFull24pt2", "ChFull24pt2", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull24pt1", "ChFull24pt1", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull22pt2", "ChFull22pt2", nbinsx, xbins)); + fCovList->Add(new BootstrapProfile("ChFull22pt1", "ChFull22pt1", nbinsx, xbins)); + } } if (nsub) { for (int i = 0; i < fCorrList->GetEntries(); ++i) @@ -201,18 +230,41 @@ void FlowPtContainer::Initialise(int nbinsx, double xlow, double xhigh, const in fCMTermList->Add(new BootstrapProfile(Form("cm%i_Mpt%i", m + 1, i), Form("cm%i_Mpt%i", m + 1, i), nbinsx, xlow, xhigh)); } } - for (int i = 0; i < configs.GetSize(); ++i) { - for (auto m(1); m <= mpar; ++m) { - if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) - continue; - if (fUseCentralMoments) { - for (auto j = 0; j < m; ++j) { - fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, m - j - 1), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, m - j - 1), nbinsx, xlow, xhigh)); + if (fUseGap) { + for (int i = 0; i < configs.GetSize(); ++i) { + for (auto m(1); m <= mpar; ++m) { + if (!(configs.GetpTCorrMasks()[i] & (1 << (m - 1)))) + continue; + if (fUseCentralMoments) { + for (auto j = 0; j <= m; ++j) { + fCovList->Add(new BootstrapProfile(Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), Form("%spt%i_Mpt%i", configs.GetHeads()[i].c_str(), m, j), nbinsx, xlow, xhigh)); + } + } else { + fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xlow, xhigh)); } - } else { - fCovList->Add(new BootstrapProfile(Form("%spt%i", configs.GetHeads()[i].c_str(), m), Form("%spt%i", configs.GetHeads()[i].c_str(), m), nbinsx, xlow, xhigh)); } } + } else { + if (fUseCentralMoments) { + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt0", "ChFull24pt2_Mpt0", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt1", "ChFull24pt2_Mpt1", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull24pt2_Mpt2", "ChFull24pt2_Mpt2", nbinsx, xlow, xhigh)); + + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt0", "ChFull24pt1_Mpt0", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull24pt1_Mpt1", "ChFull24pt1_Mpt1", nbinsx, xlow, xhigh)); + + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt0", "ChFull22pt2_Mpt0", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt1", "ChFull22pt2_Mpt1", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull22pt2_Mpt2", "ChFull22pt2_Mpt2", nbinsx, xlow, xhigh)); + + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt0", "ChFull22pt1_Mpt0", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull22pt1_Mpt1", "ChFull22pt1_Mpt1", nbinsx, xlow, xhigh)); + } else { + fCovList->Add(new BootstrapProfile("ChFull24pt2", "ChFull24pt2", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull24pt1", "ChFull24pt1", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull22pt2", "ChFull22pt2", nbinsx, xlow, xhigh)); + fCovList->Add(new BootstrapProfile("ChFull22pt1", "ChFull22pt1", nbinsx, xlow, xhigh)); + } } if (nsub) { for (int i = 0; i < fCorrList->GetEntries(); ++i) @@ -261,82 +313,446 @@ void FlowPtContainer::CalculateCorrelations() void FlowPtContainer::FillPtProfiles(const double& centmult, const double& rn) { for (int m = 1; m <= mpar; ++m) { - if (corrDen[m] != 0) + if (corrDen[m] != 0) { dynamic_cast(fCorrList->At(m - 1))->FillProfile(centmult, corrNum[m] / corrDen[m], (fEventWeight == kEventWeight::kUnity) ? 1.0 : corrDen[m], rn); + } } return; } void FlowPtContainer::FillVnPtCorrProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) { - if (!mask) + if (!mask) { return; + } for (auto m(1); m <= mpar; ++m) { - if (!(mask & (1 << (m - 1)))) + if (!(mask & (1 << (m - 1)))) { continue; - if (corrDen[m] != 0) + } + if (corrDen[m] != 0) { dynamic_cast(fCovList->At(fillCounter))->FillProfile(centmult, flowval * corrNum[m] / corrDen[m], (fEventWeight == kUnity) ? 1.0 : flowtuples * corrDen[m], rn); + } ++fillCounter; } return; } void FlowPtContainer::FillVnDeltaPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) { - if (!mask) + if (!mask) { return; + } for (auto m(1); m <= mpar; ++m) { if (!(mask & (1 << (m - 1)))) continue; - for (auto i = 0; i < m; ++i) { - if (cmDen[m - 1] != 0) - dynamic_cast(fCovList->At(fillCounter))->FillProfile(centmult, flowval * cmNum[m * (m - 1) / 2 + (m - i)], (fEventWeight == kUnity) ? 1.0 : flowtuples * cmDen[m - 1], rn); + for (auto i = 0; i <= m; ++i) { + if (cmDen[m] != 0) { + dynamic_cast(fCovList->At(fillCounter))->FillProfile(centmult, flowval * ((i == m) ? cmVal[0] : cmVal[m * (m - 1) / 2 + (m - i)]), (fEventWeight == kUnity) ? 1.0 : flowtuples * cmDen[m], rn); + } ++fillCounter; } } return; } +void FlowPtContainer::FillVnPtCorrStdProfiles(const double& centmult, const double& rn) +{ + double wAABBCC = getStdAABBCC(warr); + if (wAABBCC != 0) + dynamic_cast(fCovList->At(0))->FillProfile(centmult, getStdAABBCC(arr) / wAABBCC, (fEventWeight == kUnity) ? 1.0 : wAABBCC, rn); + double wAABBC = getStdAABBC(warr); + if (wAABBC != 0) + dynamic_cast(fCovList->At(1))->FillProfile(centmult, getStdAABBCC(arr) / wAABBC, (fEventWeight == kUnity) ? 1.0 : wAABBC, rn); + double wABCC = getStdAABBC(warr); + if (wABCC != 0) + dynamic_cast(fCovList->At(2))->FillProfile(centmult, getStdABCC(arr) / wABCC, (fEventWeight == kUnity) ? 1.0 : wABCC, rn); + double wABC = getStdABC(warr); + if (wABC != 0) + dynamic_cast(fCovList->At(3))->FillProfile(centmult, getStdABC(arr) / wABC, (fEventWeight == kUnity) ? 1.0 : wABC, rn); + return; +} +void FlowPtContainer::FillVnDeltaPtStdProfiles(const double& centmult, const double& rn) +{ + double wAABBCC = getStdAABBCC(warr); + if (wAABBCC != 0) + dynamic_cast(fCovList->At(0))->FillProfile(centmult, getStdAABBCC(arr) / wAABBCC, (fEventWeight == kUnity) ? 1.0 : wAABBCC, rn); + double wAABBCD = getStdAABBCD(warr); + if (wAABBCD != 0) + dynamic_cast(fCovList->At(1))->FillProfile(centmult, getStdAABBCD(arr) / wAABBCD, (fEventWeight == kUnity) ? 1.0 : wAABBCD, rn); + double wAABBDD = getStdAABBDD(warr); + if (wAABBDD != 0) + dynamic_cast(fCovList->At(2))->FillProfile(centmult, getStdAABBDD(arr) / wAABBDD, (fEventWeight == kUnity) ? 1.0 : wAABBDD, rn); + + double wAABBC = getStdAABBC(warr); + if (wAABBC != 0) + dynamic_cast(fCovList->At(3))->FillProfile(centmult, getStdAABBC(arr) / wAABBC, (fEventWeight == kUnity) ? 1.0 : wAABBC, rn); + double wAABBD = getStdAABBD(warr); + if (wAABBD != 0) + dynamic_cast(fCovList->At(4))->FillProfile(centmult, getStdAABBD(arr) / wAABBD, (fEventWeight == kUnity) ? 1.0 : wAABBD, rn); + + double wABCC = getStdABCC(warr); + if (wABCC != 0) + dynamic_cast(fCovList->At(5))->FillProfile(centmult, getStdABCC(arr) / wABCC, (fEventWeight == kUnity) ? 1.0 : wABCC, rn); + double wABCD = getStdABCD(warr); + if (wABCD != 0) + dynamic_cast(fCovList->At(6))->FillProfile(centmult, getStdABCD(arr) / wABCD, (fEventWeight == kUnity) ? 1.0 : wABCD, rn); + double wABDD = getStdABDD(warr); + if (wABDD != 0) + dynamic_cast(fCovList->At(7))->FillProfile(centmult, getStdABDD(arr) / wABDD, (fEventWeight == kUnity) ? 1.0 : wABDD, rn); + + double wABC = getStdABC(warr); + if (wABC != 0) + dynamic_cast(fCovList->At(8))->FillProfile(centmult, getStdABC(arr) / wABC, (fEventWeight == kUnity) ? 1.0 : wABC, rn); + double wABD = getStdABD(warr); + if (wABD != 0) + dynamic_cast(fCovList->At(9))->FillProfile(centmult, getStdABD(arr) / wABD, (fEventWeight == kUnity) ? 1.0 : wABD, rn); + return; +} void FlowPtContainer::FillCMProfiles(const double& centmult, const double& rn) { if (sumP[GetVectorIndex(0, 0)] == 0) return; - double tau1 = sumP[GetVectorIndex(2, 0)] / pow(sumP[GetVectorIndex(1, 0)], 2); - double tau2 = sumP[GetVectorIndex(3, 0)] / pow(sumP[GetVectorIndex(1, 0)], 3); - double tau3 = sumP[GetVectorIndex(4, 0)] / pow(sumP[GetVectorIndex(1, 0)], 4); - // double tau4 = sumP[GetVectorIndex(5,0)]/pow(sumP[GetVectorIndex(1,0)],5); + // 0th order correlation + cmDen.push_back(1.); + cmVal.push_back(1.); + cmDen.push_back(sumP[GetVectorIndex(1, 0)]); - cmDen.push_back(1 - tau1); - cmDen.push_back(1 - 3 * tau1 + 2 * tau2); - cmDen.push_back(1 - 6 * tau1 + 3 * tau1 * tau1 + 8 * tau2 - 6 * tau3); - // double weight4 = 1 - 10*tau1 + 15*tau1*tau1 + 20*tau2 - 20*tau1*tau2 - 30*tau3 + 24*tau4; - if (mpar < 1 || cmDen[0] == 0) + cmDen.push_back(sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - sumP[GetVectorIndex(2, 0)]); + cmDen.push_back(sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - 3 * sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 0)] + 2 * sumP[GetVectorIndex(3, 0)]); + cmDen.push_back(sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - 6 * sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] + 8 * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(3, 0)] + 3 * sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(2, 0)] - 6 * sumP[GetVectorIndex(4, 0)]); + if (mpar < 1 || cmDen[1] == 0) return; - cmNum.push_back(sumP[GetVectorIndex(1, 1)] / cmDen[0]); - dynamic_cast(fCMTermList->At(0))->FillProfile(centmult, cmNum[0], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[0], rn); - if (mpar < 2 || sumP[GetVectorIndex(2, 0)] == 0 || cmDen[1] == 0) + cmVal.push_back(sumP[GetVectorIndex(1, 1)] / cmDen[1]); + dynamic_cast(fCMTermList->At(0))->FillProfile(centmult, cmVal[1], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[0], rn); + if (mpar < 2 || sumP[GetVectorIndex(2, 0)] == 0 || cmDen[2] == 0) return; - cmNum.push_back(1 / cmDen[1] * (sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)])); - dynamic_cast(fCMTermList->At(1))->FillProfile(centmult, cmNum[1], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[1], rn); - cmNum.push_back(1 / cmDen[1] * (-2 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 2 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)])); - dynamic_cast(fCMTermList->At(2))->FillProfile(centmult, cmNum[2], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[1], rn); - if (mpar < 3 || sumP[GetVectorIndex(3, 0)] == 0 || cmDen[2] == 0) + cmVal.push_back(1 / cmDen[2] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] - sumP[GetVectorIndex(2, 2)])); + dynamic_cast(fCMTermList->At(1))->FillProfile(centmult, cmVal[2], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[1], rn); + cmVal.push_back(-2 * 1 / cmDen[2] * (sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] - sumP[GetVectorIndex(2, 1)])); + dynamic_cast(fCMTermList->At(2))->FillProfile(centmult, cmVal[3], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[1], rn); + if (mpar < 3 || sumP[GetVectorIndex(3, 0)] == 0 || cmDen[3] == 0) return; - cmNum.push_back(1 / cmDen[2] * (sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 3 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 2 * tau2 * sumP[GetVectorIndex(3, 3)] / sumP[GetVectorIndex(3, 0)])); - dynamic_cast(fCMTermList->At(3))->FillProfile(centmult, cmNum[3], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[2], rn); - cmNum.push_back(1 / cmDen[2] * (-3 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 3 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] + 6 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 6 * tau2 * sumP[GetVectorIndex(3, 2)] / sumP[GetVectorIndex(3, 0)])); - dynamic_cast(fCMTermList->At(4))->FillProfile(centmult, cmNum[4], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[2], rn); - cmNum.push_back(1 / cmDen[2] * (3 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 6 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] - 3 * tau1 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 6 * tau2 * sumP[GetVectorIndex(3, 1)] / sumP[GetVectorIndex(3, 0)])); - dynamic_cast(fCMTermList->At(5))->FillProfile(centmult, cmNum[5], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[2], rn); - if (mpar < 4 || sumP[GetVectorIndex(4, 0)] == 0 || cmDen[3] == 0) + cmVal.push_back(1 / cmDen[3] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] - 3 * sumP[GetVectorIndex(2, 2)] * sumP[GetVectorIndex(1, 1)] + 2 * sumP[GetVectorIndex(3, 3)])); + dynamic_cast(fCMTermList->At(3))->FillProfile(centmult, cmVal[4], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[2], rn); + cmVal.push_back(-3 * 1 / cmDen[3] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 0)] - 2 * sumP[GetVectorIndex(2, 1)] * sumP[GetVectorIndex(1, 1)] + 2 * sumP[GetVectorIndex(3, 2)] - sumP[GetVectorIndex(2, 2)] * sumP[GetVectorIndex(1, 0)])); + dynamic_cast(fCMTermList->At(4))->FillProfile(centmult, cmVal[5], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[2], rn); + cmVal.push_back(3 * 1 / cmDen[3] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - 2 * sumP[GetVectorIndex(2, 1)] * sumP[GetVectorIndex(1, 0)] + 2 * sumP[GetVectorIndex(3, 1)] - sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(2, 0)])); + dynamic_cast(fCMTermList->At(5))->FillProfile(centmult, cmVal[6], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[2], rn); + if (mpar < 4 || sumP[GetVectorIndex(4, 0)] == 0 || cmDen[4] == 0) return; - cmNum.push_back(1 / cmDen[3] * (sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 6 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 3 * tau1 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] + 8 * tau2 * sumP[GetVectorIndex(3, 3)] / sumP[GetVectorIndex(3, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 6 * tau3 * sumP[GetVectorIndex(4, 4)] / sumP[GetVectorIndex(4, 0)])); - dynamic_cast(fCMTermList->At(6))->FillProfile(centmult, cmNum[6], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); - cmNum.push_back(1 / cmDen[3] * (-4 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 12 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 12 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 12 * tau1 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] - 8 * tau2 * sumP[GetVectorIndex(3, 3)] / sumP[GetVectorIndex(3, 0)] - 24 * tau2 * sumP[GetVectorIndex(3, 2)] / sumP[GetVectorIndex(3, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 24 * tau3 * sumP[GetVectorIndex(4, 3)] / sumP[GetVectorIndex(4, 0)])); - dynamic_cast(fCMTermList->At(7))->FillProfile(centmult, cmNum[7], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); - cmNum.push_back(1 / cmDen[3] * (6 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 6 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] - 24 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 6 * tau1 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 6 * tau1 * tau1 * sumP[GetVectorIndex(2, 2)] / sumP[GetVectorIndex(2, 0)] + 12 * tau1 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] + 24 * tau2 * sumP[GetVectorIndex(3, 2)] / sumP[GetVectorIndex(3, 0)] + 24 * tau2 * sumP[GetVectorIndex(3, 1)] / sumP[GetVectorIndex(3, 0)] * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 36 * tau3 * sumP[GetVectorIndex(4, 2)] / sumP[GetVectorIndex(4, 0)])); - dynamic_cast(fCMTermList->At(8))->FillProfile(centmult, cmNum[8], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); - cmNum.push_back(1 / cmDen[3] * (-4 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 12 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] + 12 * tau1 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] - 12 * tau1 * tau1 * sumP[GetVectorIndex(2, 1)] / sumP[GetVectorIndex(2, 0)] - 24 * tau2 * sumP[GetVectorIndex(3, 1)] / sumP[GetVectorIndex(3, 0)] - 8 * tau2 * sumP[GetVectorIndex(1, 1)] / sumP[GetVectorIndex(1, 0)] + 24 * tau3 * sumP[GetVectorIndex(4, 1)] / sumP[GetVectorIndex(4, 0)])); - dynamic_cast(fCMTermList->At(9))->FillProfile(centmult, cmNum[9], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); + cmVal.push_back(1 / cmDen[4] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] - 6 * sumP[GetVectorIndex(2, 2)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] + 3 * sumP[GetVectorIndex(2, 2)] * sumP[GetVectorIndex(2, 2)] + 8 * sumP[GetVectorIndex(3, 3)] * sumP[GetVectorIndex(1, 1)] - 6 * sumP[GetVectorIndex(4, 4)])); + dynamic_cast(fCMTermList->At(6))->FillProfile(centmult, cmVal[7], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); + cmVal.push_back(-4 * 1 / cmDen[4] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 0)] - 3 * sumP[GetVectorIndex(2, 2)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 0)] - 3 * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(2, 1)] + 3 * sumP[GetVectorIndex(2, 2)] * sumP[GetVectorIndex(2, 1)] + 6 * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(3, 2)] - 6 * sumP[GetVectorIndex(4, 3)])); + dynamic_cast(fCMTermList->At(7))->FillProfile(centmult, cmVal[8], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); + cmVal.push_back(6 * 1 / cmDen[4] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - sumP[GetVectorIndex(2, 2)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 1)] + sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(2, 2)] - 4 * sumP[GetVectorIndex(2, 1)] * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 0)] + 4 * sumP[GetVectorIndex(3, 2)] * sumP[GetVectorIndex(1, 0)] + 4 * sumP[GetVectorIndex(3, 1)] * sumP[GetVectorIndex(1, 1)] + 2 * sumP[GetVectorIndex(2, 1)] * sumP[GetVectorIndex(2, 1)] - 6 * sumP[GetVectorIndex(4, 2)])); + dynamic_cast(fCMTermList->At(8))->FillProfile(centmult, cmVal[9], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); + cmVal.push_back(-4 * 1 / cmDen[4] * (sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - 3 * sumP[GetVectorIndex(2, 1)] * sumP[GetVectorIndex(1, 0)] * sumP[GetVectorIndex(1, 0)] - 3 * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(2, 0)] * sumP[GetVectorIndex(1, 0)] + 3 * sumP[GetVectorIndex(2, 1)] * sumP[GetVectorIndex(2, 0)] + 2 * sumP[GetVectorIndex(1, 1)] * sumP[GetVectorIndex(3, 0)] + 6 * sumP[GetVectorIndex(3, 1)] * sumP[GetVectorIndex(1, 0)] - 6 * sumP[GetVectorIndex(4, 1)])); + dynamic_cast(fCMTermList->At(9))->FillProfile(centmult, cmVal[10], (fEventWeight == kEventWeight::kUnity) ? 1.0 : cmDen[3], rn); return; } +void FlowPtContainer::FillArray(FillType a, FillType b, double c, double d) +{ + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + for (int k = 0; k < 3; ++k) { + for (int l = 0; l < 3; ++l) { + if (std::holds_alternative>(a) && std::holds_alternative>(b)) { + arr[i][j][k][l] += pow(std::get<0>(a), i) * pow(std::get<0>(b), j) * pow(c, k) * pow(d, l); + } else if (std::holds_alternative(a) && std::holds_alternative(b)) { + warr[i][j][k][l] += pow(std::get<1>(a), i) * pow(std::get<1>(b), j) * pow(c, k) * pow(d, l); + } else { + LOGF(error, "FillType variant should hold same type for a and b during single function c"); + } + } + } + } + } + return; +} +void FlowPtContainer::ClearArray() +{ + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { + for (int k = 0; k < 3; ++k) { + for (int l = 0; l < 3; ++l) { + arr[i][j][k][l] = {0.0, 0.0}; + warr[i][j][k][l] = 0.0; + } + } + } + } + + return; +} +template +double FlowPtContainer::getStdAABBCC(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex c = inarr[0][0][1][0]; + std::complex aa = inarr[2][0][0][0]; + std::complex bb = inarr[0][2][0][0]; + std::complex cc = inarr[0][0][2][0]; + std::complex ab = inarr[1][1][0][0]; + std::complex ac = inarr[1][0][1][0]; + std::complex bc = inarr[0][1][1][0]; + std::complex aab = inarr[2][1][0][0]; + std::complex aac = inarr[2][0][1][0]; + std::complex abb = inarr[1][2][0][0]; + std::complex acc = inarr[1][0][2][0]; + std::complex abc = inarr[1][1][1][0]; + std::complex bbc = inarr[0][2][1][0]; + std::complex bcc = inarr[0][1][2][0]; + std::complex aabb = inarr[2][2][0][0]; + std::complex aacc = inarr[2][0][2][0]; + std::complex aabc = inarr[2][1][1][0]; + std::complex abbc = inarr[1][2][1][0]; + std::complex abcc = inarr[1][1][2][0]; + std::complex bbcc = inarr[0][2][2][0]; + std::complex aabbc = inarr[2][2][1][0]; + std::complex aabcc = inarr[2][1][2][0]; + std::complex abbcc = inarr[0][0][0][0]; + std::complex aabbcc = inarr[2][2][2][0]; + return (a * a * b * b * c * c - aa * b * b * c * c - a * a * bb * c * c - a * a * b * b * cc - 4. * a * ab * b * c * c - + 4. * a * ac * b * b * c - 4. * a * a * b * bc * c + 4. * aab * b * c * c + 4. * aac * b * b * c + + 4. * a * abb * c * c + 4. * a * acc * b * b + 4. * a * a * bbc * c + 4. * a * a * b * bcc + + 16. * a * abc * b * c + aa * bb * c * c + aa * b * b * cc + a * a * bb * cc + 2. * ab * ab * c * c + + 2. * ac * ac * b * b + 2. * a * a * bc * bc + 4. * aa * b * bc * c + 4. * a * ac * bb * c + + 4. * a * ab * b * cc + 8. * ab * ac * b * c + 8. * a * ab * bc * c + 8. * a * ac * b * bc - 6. * aabb * c * c - + 24. * aabc * b * c - 6. * aacc * b * b - 24. * abbc * a * c - 24. * abcc * a * b - 6. * bbcc * a * a - + 8. * aab * bc * c - 8. * aac * b * bc - 4. * aac * bb * c - 4. * aab * b * cc - 8. * abb * ac * c - + 4. * abb * a * cc - 8. * acc * ab * b - 4. * acc * a * bb - 8. * bbc * a * ac - 4. * bbc * aa * c - + 8. * bcc * a * ab - 4. * bcc * aa * b - 16. * abc * ab * c - 16. * abc * ac * b - 16. * abc * a * bc - + aa * bb * cc - 2. * ab * ab * cc - 2. * ac * ac * bb - 2. * bc * bc * aa - 8. * ab * ac * bc + + 48. * aabbc * c + 48. * aabcc * b + 48. * abbcc * a + 6. * aabb * cc + 6. * aacc * bb + + 6. * bbcc * aa + 24. * aabc * bc + 24. * abbc * ac + 24. * abcc * ab + 8. * aab * bcc + + 8. * aac * bbc + 8. * abb * acc + 16. * abc * abc - 120. * aabbcc) + .real(); +} +template +double FlowPtContainer::getStdAABBCD(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex c = inarr[0][0][1][0]; + std::complex d = inarr[0][0][0][1]; + std::complex aa = inarr[2][0][0][0]; + std::complex bb = inarr[0][2][0][0]; + std::complex ab = inarr[1][1][0][0]; + std::complex ac = inarr[1][0][1][0]; + std::complex ad = inarr[1][0][0][1]; + std::complex bc = inarr[0][1][1][0]; + std::complex bd = inarr[0][1][0][1]; + std::complex cd = inarr[0][0][1][1]; + std::complex aab = inarr[2][1][0][0]; + std::complex aac = inarr[2][0][1][0]; + std::complex aad = inarr[2][0][0][1]; + std::complex abb = inarr[1][2][0][0]; + std::complex abc = inarr[1][1][1][0]; + std::complex abd = inarr[1][1][0][1]; + std::complex acd = inarr[1][0][1][1]; + std::complex bbc = inarr[0][2][1][0]; + std::complex bbd = inarr[0][2][0][1]; + std::complex bcd = inarr[0][1][1][1]; + std::complex aabb = inarr[2][2][0][0]; + std::complex aabc = inarr[2][1][1][0]; + std::complex aabd = inarr[2][1][0][1]; + std::complex aacd = inarr[2][0][1][1]; + std::complex abbc = inarr[1][2][1][0]; + std::complex abbd = inarr[1][2][0][1]; + std::complex abcd = inarr[0][1][1][1]; + std::complex bbcd = inarr[0][2][1][1]; + std::complex aabbc = inarr[2][2][1][0]; + std::complex aabbd = inarr[2][2][0][1]; + std::complex aabcd = inarr[2][1][1][1]; + std::complex abbcd = inarr[1][2][1][1]; + std::complex aabbcd = inarr[2][2][1][1]; + return (-120. * aabbcd + 48. * a * abbcd + 24. * ab * abcd + 16. * abc * abd + 12. * abbd * ac + + 8. * abb * acd + 12. * abbc * ad + 48. * aabcd * b - 24. * a * abcd * b - 8. * abd * ac * b - + 8. * ab * acd * b - 8. * abc * ad * b - 6. * aacd * b * b + 4. * a * acd * b * b + 2. * ac * ad * b * b + + 6. * aacd * bb - 4. * a * acd * bb - 2. * ac * ad * bb + 4. * aad * bbc - 4. * a * ad * bbc - + 6. * a * a * bbcd + 6. * aa * bbcd + 4. * aac * bbd - 4. * a * ac * bbd + 12. * aabd * bc - + 8. * a * abd * bc - 4. * ab * ad * bc - 4. * aad * b * bc + 4. * a * ad * b * bc + 8. * aab * bcd - + 8. * a * ab * bcd + 4. * a * a * b * bcd - 4. * aa * b * bcd + 12. * aabc * bd - 8. * a * abc * bd - + 4. * ab * ac * bd - 4. * aac * b * bd + 4. * a * ac * b * bd + 2. * a * a * bc * bd - 2. * aa * bc * bd + + 24. * aabbd * c - 12. * a * abbd * c - 8. * ab * abd * c - 4. * abb * ad * c - 12. * aabd * b * c + + 8. * a * abd * b * c + 4. * ab * ad * b * c + 2. * aad * b * b * c - 2. * a * ad * b * b * c - + 2. * aad * bb * c + 2. * a * ad * bb * c + 2. * a * a * bbd * c - 2. * aa * bbd * c - 4. * aab * bd * c + + 4. * a * ab * bd * c - 2. * a * a * b * bd * c + 2. * aa * b * bd * c + 6. * aabb * cd - 2. * ab * ab * cd - + 4. * a * abb * cd - 4. * aab * b * cd + 4. * a * ab * b * cd - a * a * b * b * cd + aa * b * b * cd + + a * a * bb * cd - aa * bb * cd + 24. * aabbc * d - 12. * a * abbc * d - 8. * ab * abc * d - + 4. * abb * ac * d - 12. * aabc * b * d + 8. * a * abc * b * d + 4. * ab * ac * b * d + 2. * aac * b * b * d - + 2. * a * ac * b * b * d - 2. * aac * bb * d + 2. * a * ac * bb * d + 2. * a * a * bbc * d - 2. * aa * bbc * d - + 4. * aab * bc * d + 4. * a * ab * bc * d - 2. * a * a * b * bc * d + 2. * aa * b * bc * d - 6. * aabb * c * d + + 2. * ab * ab * c * d + 4. * a * abb * c * d + 4. * aab * b * c * d - 4. * a * ab * b * c * d + + a * a * b * b * c * d - aa * b * b * c * d - a * a * bb * c * d + aa * bb * c * d) + .real(); +} +template +double FlowPtContainer::getStdAABBDD(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex d = inarr[0][0][1][1]; + std::complex aa = inarr[2][0][0][0]; + std::complex bb = inarr[0][2][0][0]; + std::complex dd = inarr[0][0][0][2]; + std::complex ab = inarr[1][1][0][0]; + std::complex ad = inarr[1][0][0][1]; + std::complex bd = inarr[0][1][0][1]; + std::complex aab = inarr[2][1][0][0]; + std::complex aad = inarr[2][0][0][1]; + std::complex abb = inarr[1][2][0][0]; + std::complex add = inarr[1][0][0][2]; + std::complex abd = inarr[1][1][0][1]; + std::complex bbd = inarr[0][2][0][1]; + std::complex bdd = inarr[0][1][0][2]; + std::complex aabb = inarr[2][2][0][0]; + std::complex aadd = inarr[2][0][0][2]; + std::complex aabd = inarr[2][1][0][1]; + std::complex abbd = inarr[1][2][0][1]; + std::complex abdd = inarr[1][1][0][2]; + std::complex bbdd = inarr[0][2][0][2]; + std::complex aabbd = inarr[2][2][0][1]; + std::complex aabdd = inarr[2][1][0][2]; + std::complex abbdd = inarr[0][0][0][2]; + std::complex aabbdd = inarr[2][2][0][2]; + return (-120. * aabbdd + 48. * a * abbdd + 16. * abd * abd + 24. * ab * abdd + 24. * abbd * ad + + 8. * abb * add + 48. * aabdd * b - 24. * a * abdd * b - 16. * abd * ad * b - 8. * ab * add * b - + 6. * aadd * b * b + 2. * ad * ad * b * b + 4. * a * add * b * b + 6. * aadd * bb - 2. * ad * ad * bb - + 4. * a * add * bb + 8. * aad * bbd - 8. * a * ad * bbd - 6. * a * a * bbdd + 6. * aa * bbdd + + 24. * aabd * bd - 16. * a * abd * bd - 8. * ab * ad * bd - 8. * aad * b * bd + 8. * a * ad * b * bd + + 2. * a * a * bd * bd - 2. * aa * bd * bd + 8. * aab * bdd - 8. * a * ab * bdd + 4. * a * a * b * bdd - + 4. * aa * b * bdd + 48. * aabbd * d - 24. * a * abbd * d - 16. * ab * abd * d - 8. * abb * ad * d - + 24. * aabd * b * d + 16. * a * abd * b * d + 8. * ab * ad * b * d + 4. * aad * b * b * d - + 4. * a * ad * b * b * d - 4. * aad * bb * d + 4. * a * ad * bb * d + 4. * a * a * bbd * d - 4. * aa * bbd * d - + 8. * aab * bd * d + 8. * a * ab * bd * d - 4. * a * a * b * bd * d + 4. * aa * b * bd * d - 6. * aabb * d * d + + 2. * ab * ab * d * d + 4. * a * abb * d * d + 4. * aab * b * d * d - 4. * a * ab * b * d * d + + a * a * b * b * d * d - aa * b * b * d * d - a * a * bb * d * d + aa * bb * d * d + 6. * aabb * dd - + 2. * ab * ab * dd - 4. * a * abb * dd - 4. * aab * b * dd + 4. * a * ab * b * dd - a * a * b * b * dd + + aa * b * b * dd + a * a * bb * dd - aa * bb * dd) + .real(); +} +template +double FlowPtContainer::getStdAABBC(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex c = inarr[0][0][1][0]; + std::complex aa = inarr[2][0][0][0]; + std::complex ab = inarr[1][1][0][0]; + std::complex ac = inarr[1][0][1][0]; + std::complex bb = inarr[0][2][0][0]; + std::complex bc = inarr[0][1][1][0]; + std::complex aab = inarr[2][1][0][0]; + std::complex aac = arr[2][0][1][0]; + std::complex abb = inarr[1][2][0][0]; + std::complex abc = inarr[1][1][1][0]; + std::complex bbc = inarr[0][2][1][0]; + std::complex aabb = inarr[2][2][0][0]; + std::complex aabc = inarr[2][1][1][0]; + std::complex abbc = inarr[1][2][1][0]; + std::complex aabbc = inarr[2][2][1][0]; + return (a * a * b * b * c - aa * b * b * c - a * a * bb * c - 4. * ab * a * b * c - 2. * a * ac * b * b - 2. * a * a * bc * b + 2. * ab * ab * c + 4. * ab * ac * b + 4. * ab * bc * a + 8. * abc * a * b + 4. * aab * b * c + 2. * aac * b * b + 4. * abb * a * c + 2. * bbc * a * a + aa * bb * c + 2. * aa * b * bc + 2. * bb * a * ac - 12. * aabc * b - 12. * abbc * a - 6. * aabb * c - 8. * abc * ab - 2. * bbc * aa - 2. * aac * bb - 4. * aab * bc - 4. * abb * ac + 24. * aabbc).real(); +} +template +double FlowPtContainer::getStdAABBD(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex d = inarr[0][0][1][0]; + std::complex aa = inarr[2][0][0][0]; + std::complex ab = inarr[1][1][0][0]; + std::complex ad = inarr[1][0][1][0]; + std::complex bb = inarr[0][2][0][0]; + std::complex bd = inarr[0][1][1][0]; + std::complex aab = inarr[2][1][0][0]; + std::complex aad = arr[2][0][1][0]; + std::complex abb = inarr[1][2][0][0]; + std::complex abd = inarr[1][1][1][0]; + std::complex bbd = inarr[0][2][1][0]; + std::complex aabb = inarr[2][2][0][0]; + std::complex aabd = inarr[2][1][1][0]; + std::complex abbd = inarr[1][2][1][0]; + std::complex aabbd = inarr[2][2][1][0]; + return (a * a * b * b * d - aa * b * b * d - a * a * bb * d - 4. * ab * a * b * d - 2. * a * ad * b * b - 2. * a * a * bd * b + 2. * ab * ab * d + 4. * ab * ad * b + 4. * ab * bd * a + 8. * abd * a * b + 4. * aab * b * d + 2. * aad * b * b + 4. * abb * a * d + 2. * bbd * a * a + aa * bb * d + 2. * aa * b * bd + 2. * bb * a * ad - 12. * aabd * b - 12. * abbd * a - 6. * aabb * d - 8. * abd * ab - 2. * bbd * aa - 2. * aad * bb - 4. * aab * bd - 4. * abb * ad + 24. * aabbd).real(); +} +template +double FlowPtContainer::getStdABCC(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex c = inarr[0][0][1][0]; + std::complex ab = inarr[1][1][0][0]; + std::complex ac = inarr[1][0][1][0]; + std::complex bc = inarr[0][1][1][0]; + std::complex cc = inarr[0][0][2][0]; + std::complex abc = inarr[1][1][1][0]; + std::complex acc = inarr[1][0][2][0]; + std::complex bcc = inarr[0][1][2][0]; + std::complex abcc = inarr[1][1][2][0]; + return (a * b * c * c - a * b * cc - 2. * a * bc * c - 2. * ac * b * c - ab * c * c + 2. * acc * b + 2. * a * bcc + 4. * abc * c + ab * cc + 2. * ac * bc - 6. * abcc).real(); +} +template +double FlowPtContainer::getStdABCD(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex c = inarr[0][0][1][0]; + std::complex d = inarr[0][0][0][1]; + std::complex ab = inarr[1][1][0][0]; + std::complex ac = inarr[1][0][1][0]; + std::complex ad = inarr[1][0][0][1]; + std::complex bc = inarr[0][1][1][0]; + std::complex bd = inarr[0][1][0][1]; + std::complex cd = inarr[0][0][1][1]; + std::complex abc = inarr[1][1][1][0]; + std::complex abd = inarr[1][1][0][1]; + std::complex acd = inarr[1][0][1][1]; + std::complex bcd = inarr[0][1][1][1]; + std::complex abcd = inarr[1][1][0][1]; + return (-6. * abcd + 2. * acd * b + ad * bc + 2. * a * bcd + ac * bd + 2. * abd * c - ad * b * c - + a * bd * c + ab * cd - a * b * cd + 2. * abc * d - ac * b * d - a * bc * d - ab * c * d + + a * b * c * d) + .real(); +} +template +double FlowPtContainer::getStdABDD(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex d = inarr[0][0][0][1]; + std::complex ab = inarr[1][1][0][0]; + std::complex ad = inarr[1][0][0][1]; + std::complex bd = inarr[0][1][0][1]; + std::complex dd = inarr[0][0][0][2]; + std::complex abd = inarr[1][1][0][1]; + std::complex add = inarr[1][0][0][2]; + std::complex bdd = inarr[0][1][0][2]; + std::complex abdd = inarr[1][1][0][2]; + return (a * b * d * d - a * b * dd - 2. * a * bd * d - 2. * ad * b * d - ab * d * d + 2. * add * b + 2. * a * bdd + 4. * abd * d + ab * dd + 2. * ad * bd - 6. * abdd).real(); +} +template +double FlowPtContainer::getStdABC(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex c = inarr[0][0][1][0]; + std::complex ab = inarr[1][1][0][0]; + std::complex ac = inarr[1][0][1][0]; + std::complex bc = inarr[0][1][1][0]; + std::complex abc = inarr[1][1][1][0]; + return (a * b * c - ab * c - ac * b - a * bc + 2. * abc).real(); +} +template +double FlowPtContainer::getStdABD(T& inarr) +{ + std::complex a = inarr[1][0][0][0]; + std::complex b = inarr[0][1][0][0]; + std::complex d = inarr[0][0][0][1]; + std::complex ab = inarr[1][1][0][0]; + std::complex ad = inarr[1][0][0][1]; + std::complex bd = inarr[0][1][0][1]; + std::complex abd = inarr[1][1][0][1]; + return (a * b * d - ab * d - ad * b - a * bd + 2. * abd).real(); +} double FlowPtContainer::OrderedAddition(std::vector vec) { double sum = 0; @@ -380,7 +796,7 @@ void FlowPtContainer::RebinMulti(Int_t nbins, Double_t* binedges) } TH1* FlowPtContainer::getCorrHist(int ind, int m) { - return dynamic_cast(fCorrList->FindObject(Form("corr_%ipar", m)))->getHist(ind); + return dynamic_cast(fCorrList->FindObject(Form("mpt%i", m + 1)))->getHist(ind); } TH1* FlowPtContainer::getCentralMomentHist(int ind, int m) { @@ -389,7 +805,7 @@ TH1* FlowPtContainer::getCentralMomentHist(int ind, int m) if (!fCentralMomentList) return 0; if (ind + 1 < fCentralMomentList->GetEntries()) - return dynamic_cast(fCentralMomentList->FindObject(Form("cm%i_%i", m + 1, ind))); + return dynamic_cast(fCentralMomentList->FindObject(Form("cm%i_%i", m, ind))); return 0; } void FlowPtContainer::CreateCentralMomentList() @@ -444,8 +860,8 @@ void FlowPtContainer::CreateCumulantList() for (int i = -1; i < reinterpret_cast(fCorrList->At(0))->getNSubs(); ++i) { std::vector hTs; for (int j = 0; j < mpar; ++j) { - dynamic_cast(fCorrList->FindObject(Form("corr_%ipar", j + 1)))->SetErrorOption("g"); - hTs.push_back(reinterpret_cast(fCorrList->FindObject(Form("corr_%ipar", j + 1)))->getHist(i)); + dynamic_cast(fCorrList->FindObject(Form("mpt%i", j + 1)))->SetErrorOption("g"); + hTs.push_back(reinterpret_cast(fCorrList->FindObject(Form("mpt%i", j + 1)))->getHist(i)); } CalculateCumulantHists(hTs, i); } diff --git a/PWGCF/GenericFramework/Core/FlowPtContainer.h b/PWGCF/GenericFramework/Core/FlowPtContainer.h index 18cf8ae82ea..5455859cf05 100644 --- a/PWGCF/GenericFramework/Core/FlowPtContainer.h +++ b/PWGCF/GenericFramework/Core/FlowPtContainer.h @@ -14,6 +14,8 @@ #include #include +#include +#include #include "BootstrapProfile.h" #include "TNamed.h" #include "TList.h" @@ -36,21 +38,24 @@ using namespace o2::analysis::genericframework::eventweight; class FlowPtContainer : public TNamed { public: + using FillType = std::variant, double>; FlowPtContainer(); explicit FlowPtContainer(const char* name); ~FlowPtContainer(); - FlowPtContainer(const char* name, const char* title, int nbinsx, double* xbins, const int& m, const GFWCorrConfigs& configs); - FlowPtContainer(const char* name, const char* title, int nbinsx, double xlow, double xhigh, const int& m, const GFWCorrConfigs& configs); + FlowPtContainer(const char* name, const char* title); void Initialise(const o2::framework::AxisSpec axis, const int& m, const GFWCorrConfigs& configs, const int& nsub = 10); void Initialise(int nbinsx, double* xbins, const int& m, const GFWCorrConfigs& configs, const int& nsub = 10); void Initialise(int nbinsx, double xlow, double xhigh, const int& m, const GFWCorrConfigs& configs, const int& nsub = 10); void Fill(const double& w, const double& pt); + void FillArray(FillType a, FillType b, double c, double d); int GetVectorIndex(const int i, const int j) { return j * (mpar + 1) + i; } void CalculateCorrelations(); void CalculateCMTerms(); void FillPtProfiles(const Double_t& lMult, const Double_t& rn); void FillVnPtCorrProfiles(const double& lMult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); void FillVnDeltaPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask); + void FillVnDeltaPtStdProfiles(const double& centmult, const double& rn); + void FillVnPtCorrStdProfiles(const double& centmult, const double& rn); void FillVnPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask) { if (fUseCentralMoments) @@ -58,12 +63,20 @@ class FlowPtContainer : public TNamed else FillVnPtCorrProfiles(centmult, flowval, flowtuples, rn, mask); } + void FillVnPtStdProfiles(const double& centmult, const double& rn) + { + if (fUseCentralMoments) + FillVnDeltaPtStdProfiles(centmult, rn); + else + FillVnPtCorrStdProfiles(centmult, rn); + } void FillCMProfiles(const double& lMult, const double& rn); TList* GetCorrList() { return fCorrList; } TList* GetCMTermList() { return fCMTermList; } TList* GetCovList() { return fCovList; } void SetEventWeight(const unsigned int& lWeight) { fEventWeight = lWeight; } void SetUseCentralMoments(bool newval) { fUseCentralMoments = newval; } + void SetUseGapMethod(bool newval) { fUseGap = newval; } bool usesCentralMoments() { return fUseCentralMoments; } void RebinMulti(Int_t nbins); void RebinMulti(Int_t nbins, double* binedges); @@ -77,11 +90,12 @@ class FlowPtContainer : public TNamed void CalculateCentralMomentHists(std::vector inh, int ind, int m, TH1* hMpt); void CreateCumulantList(); void CalculateCumulantHists(std::vector inh, Int_t ind); + void ClearArray(); void ClearVector() { sumP.clear(); sumP.resize((mpar + 1) * (mpar + 1)); - cmNum.clear(); + cmVal.clear(); cmDen.clear(); fillCounter = 0; }; @@ -96,14 +110,36 @@ class FlowPtContainer : public TNamed int fillCounter; unsigned int fEventWeight; bool fUseCentralMoments; + bool fUseGap; void MergeBSLists(TList* source, TList* target); TH1* raiseHistToPower(TH1* inh, double p); - std::vector sumP; //! - std::vector corrNum; //! - std::vector corrDen; //! - std::vector cmNum; //! - std::vector cmDen; //! - + std::vector sumP; //! + std::vector corrNum; //! + std::vector corrDen; //! + std::vector cmVal; //! + std::vector cmDen; //! + std::complex arr[3][3][3][3]; //! + double warr[3][3][3][3]; //! + template + double getStdAABBCC(T& inarr); + template + double getStdAABBCD(T& inarr); + template + double getStdAABBDD(T& inarr); + template + double getStdAABBC(T& inarr); + template + double getStdAABBD(T& inarr); + template + double getStdABCC(T& inarr); + template + double getStdABCD(T& inarr); + template + double getStdABDD(T& inarr); + template + double getStdABC(T& inarr); + template + double getStdABD(T& inarr); static constexpr float fFactorial[9] = {1., 1., 2., 6., 24., 120., 720., 5040., 40320.}; static constexpr int fSign[9] = {1, -1, 1, -1, 1, -1, 1, -1, 1}; ClassDef(FlowPtContainer, 1); diff --git a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx index 5bc41f81886..d9b969ffbf6 100644 --- a/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx +++ b/PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -84,6 +85,7 @@ struct GenericFramework { O2_DEFINE_CONFIGURABLE(cfgUseAdditionalEventCut, bool, false, "Use additional event cut on mult correlations") O2_DEFINE_CONFIGURABLE(cfgUseAdditionalTrackCut, bool, false, "Use additional track cut on phi") O2_DEFINE_CONFIGURABLE(cfgUseCentralMoments, bool, true, "Use central moments in vn-pt calculations") + O2_DEFINE_CONFIGURABLE(cfgUseGapMethod, bool, false, "Use gap method in vn-pt calculations") 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(cfgDCAxy, float, 0.2, "Cut on DCA in the transverse direction (cm)"); @@ -92,6 +94,7 @@ struct GenericFramework { 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(cfgEtaPtPt, float, 0.4, "eta cut for pt-pt correlations"); O2_DEFINE_CONFIGURABLE(cfgVtxZ, float, 10, "vertex cut (cm)"); O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried"); @@ -241,6 +244,7 @@ struct GenericFramework { } delete oba; fFCpt->SetUseCentralMoments(cfgUseCentralMoments); + fFCpt->SetUseGapMethod(cfgUseGapMethod); fFCpt->Initialise(multAxis, cfgMpar, configs, cfgNbootstrap); // Event selection - Alex if (cfgUseAdditionalEventCut) { @@ -421,6 +425,8 @@ struct GenericFramework { fFCpt->CalculateCorrelations(); fFCpt->FillPtProfiles(centmult, rndm); fFCpt->FillCMProfiles(centmult, rndm); + if (!cfgUseGapMethod) + fFCpt->FillVnPtStdProfiles(centmult, rndm); for (uint l_ind = 0; l_ind < corrconfigs.size(); ++l_ind) { auto dnx = fGFW->Calculate(corrconfigs.at(l_ind), 0, kTRUE).real(); if (dnx == 0) @@ -429,7 +435,8 @@ struct GenericFramework { auto val = fGFW->Calculate(corrconfigs.at(l_ind), 0, kFALSE).real() / dnx; if (TMath::Abs(val) < 1) { (dt == kGen) ? fFC_gen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, dnx, rndm) : fFC->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, dnx, rndm); - fFCpt->FillVnPtProfiles(centmult, val, dnx, rndm, configs.GetpTCorrMasks()[l_ind]); + if (cfgUseGapMethod) + fFCpt->FillVnPtProfiles(centmult, val, dnx, rndm, configs.GetpTCorrMasks()[l_ind]); } continue; } @@ -455,6 +462,7 @@ struct GenericFramework { float vtxz = collision.posZ(); fGFW->Clear(); fFCpt->ClearVector(); + fFCpt->ClearArray(); float l_Random = fRndm->Rndm(); for (auto& track : tracks) { ProcessTrack(track, centrality, vtxz, field); @@ -520,7 +528,14 @@ struct GenericFramework { template inline void FillGFW(TrackObject track, float weff, float wacc) { - fFCpt->Fill(weff, track.pt()); + if (fabs(track.eta()) < cfgEtaPtPt) + fFCpt->Fill(weff, track.pt()); + std::complex q2p = {weff * wacc * cos(2 * track.phi()), weff * wacc * sin(2 * track.phi())}; + std::complex q2n = {weff * wacc * cos(-2 * track.phi()), weff * wacc * sin(-2 * track.phi())}; + if (!cfgUseGapMethod) { + fFCpt->FillArray(q2p, q2n, weff * track.pt(), weff); + fFCpt->FillArray(weff * wacc, weff * wacc, weff, weff); + } bool WithinPtPOI = (ptpoilow < track.pt()) && (track.pt() < ptpoiup); // within POI pT range bool WithinPtRef = (ptreflow < track.pt()) && (track.pt() < ptrefup); // within RF pT range if (WithinPtRef) diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h index 770ed87472f..d2bc6c08c8c 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-Configurables.h @@ -21,7 +21,8 @@ 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 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 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."}; @@ -30,26 +31,27 @@ struct : ConfigurableGroup { 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"}; } 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 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", {"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", "TrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange-1", "TrackOccupancyInTimeRange_vs_MultTPC-1", "TrackOccupancyInTimeRange_vs_Vertex_z-1"}, "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", {"dcaXY_vs_Pt-1"}, "book (1) or do not book (0) this QA 2D particle histogram"}; + Configurable> cfBookQAParticleHistograms2D{"cfBookQAParticleHistograms2D", {"Pt_vs_dcaXY-1"}, "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", {"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", "Occupancy-1"}, "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", {"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", "Occupancy-1", "Trigger-0", "Sel7-1", "Sel8-1", "CentralityEstimator-1", "SelectedEvents-1", "NoSameBunchPileup-1", "IsGoodZvtxFT0vsPV-1", "IsVertexITSTPC-1", "IsVertexTOFmatched-1", "IsVertexTRDmatched-1", "OccupancyEstimator-1"}, "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)"}; @@ -68,16 +70,18 @@ struct : ConfigurableGroup { 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> cfImpactParameter{"cfImpactParameter", {-1, 1000000000}, "Impact parameter range (can be used only for sim): {min, max}, with convention: min <= IP < max"}; + Configurable> cfOccupancy{"cfOccupancy", {-2, 1000000000}, "Range for occupancy (use cfOccupancyEstimator to set specific estimator): {min, max}, with convention: min <= X < max"}; Configurable cfTrigger{"cfTrigger", "some supported trigger", "set here some supported trigger (kINT7, ...) "}; 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 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> 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 cfOccupancyEstimator{"cfOccupancyEstimator", "some supported occupancy estimator", "set here some supported occupancy estimator (TrackOccupancyInTimeRange, FT0COccupancyInTimeRange, ..."}; } cf_ec; // *) Particle histograms: @@ -106,8 +110,8 @@ struct : ConfigurableGroup { 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> cfdcaXY{"cfdcaXY", {-1000., 1000.}, "dcaXY range: {min, max}, with convention: min <= dcaXY < max (yes, DCA can be negative!)"}; + Configurable> cfdcaZ{"cfdcaZ", {-1000., 1000.}, "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"}; @@ -127,6 +131,12 @@ struct : ConfigurableGroup { // *) 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"}; } cf_mupa; // *) Test0: @@ -137,6 +147,7 @@ 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 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" } cf_t0; @@ -171,30 +182,36 @@ 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> cfMultRangeInternalValidation{"cfMultRangeInternalValidation", {1000, 1001}, "{min, max}, with convention: min <= M < max"}; } cf_iv; -// Results histograms: +// *) 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"}; - // Variable-length binning: TBI 20240113 I do it via string + tokenize + Atof(), use arrays eventually as for FixedLength case above. + Configurable> cfFixedLength_occu_bins{"cfFixedLength_occu_bins", {400, 0., 4000.}, "nOccuBins, occuMin, occuMax"}; + + // 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.,100.,250.,1000.", "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"}; - Configurable cfVariableLength_cent_bins{"cfVariableLength_cent_bins", "0.,10.,50.,100.", "variable-length centrality bins"}; + Configurable> cfVariableLength_cent_bins{"cfVariableLength_cent_bins", {0., 10., 50., 100.}, "variable-length centrality bins"}; Configurable cfUseVariableLength_pt_bins{"cfUseVariableLength_pt_bins", false, "use or not variable-length pt bins"}; - Configurable cfVariableLength_pt_bins{"cfVariableLength_pt_bins", "1.0,2.0,5.0", "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", "-0.8,-0.4,0.0,0.4,0.8", "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 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"}; + } 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 2d4d7536cc6..1ea50d6ff64 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-DataMembers.h @@ -42,14 +42,15 @@ struct TaskConfiguration { TString fRunNumber = ""; // over which run number this task is executed Bool_t fRunNumberIsDetermined = kFALSE; // ensures that run number is determined in process() and propagated to already booked objects only once Bool_t fDryRun = kFALSE; // book all histos and run without storing and calculating anything - Bool_t fVerbose = kFALSE; // print additional info during debugging, but not for function calls per particle (see next) + Bool_t fVerbose = kFALSE; // print additional info during debugging, but not for simply utility function or function calls per particle (see next) + Bool_t fVerboseUtility = kFALSE; // print additional info during debugging also for simply utility function, but not for function calls per particle (see next) Bool_t fVerboseForEachParticle = kFALSE; // print additional info during debugging, also for function calls per particle Bool_t fDoAdditionalInsanityChecks = kFALSE; // do additional insanity checks at run time, at the expense of losing a bit of performance // (for instance, check if the run number in the current 'collision' is the same as run number in the first 'collision', etc.) Bool_t fInsanityCheckForEachParticle = kFALSE; // do additional insanity checks at run time for each particle, at the expense of losing a lot of performance. Use only during debugging. Bool_t fUseCCDB = kFALSE; // access personal files from CCDB (kTRUE, this is set as default in Configurables), // or from home dir in AliEn (kFALSE, use with care, as this is discouraged) - Bool_t fProcess[eProcess_N] = {kFALSE}; // Set what to process. See enum eProcess for full description. Set via implicit variables within a PROCESS_SWITCH clause. + Bool_t fProcess[eProcess_N] = {kFALSE}; // set what to process. See enum eProcess for full description. Set via implicit variables within a PROCESS_SWITCH clause. TString fWhichProcess = "ProcessRec"; // dump in this variable which process was used UInt_t fRandomSeed = 0; // argument for TRandom3 constructor. By default it is 0 (seed is guaranteed to be unique in time and space) Bool_t fUseFisherYates = kFALSE; // algorithm used to randomize particle indices, set via configurable @@ -57,6 +58,7 @@ struct TaskConfiguration { Int_t fFixedNumberOfRandomlySelectedTracks = -1; // use a fixed number of randomly selected particles in each event. It is set and applied, if > 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 + Float_t fFloatingPointPrecision = 1.e-6; // two floats are the same if TMath::Abs(f1 - f2) < fFloatingPointPrecision (there is configurable for it) // 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. @@ -65,39 +67,49 @@ struct TaskConfiguration { // *) 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 + 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 } ebye; // "ebye" is a common label for objects in this struct // *) QA: -// Remark: 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 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; //! 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) + 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 20240410 - eCentralityEstimator, // the default centrality estimator, set via configurable. All supported centrality estimatos, for QA, etc, are in enum eCentralityEstimators + 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 + 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, @@ -179,6 +183,7 @@ enum eAsFunctionOf { AFO_CENTRALITY = 2, // vs. default centrality estimator, see how it's calculated in DetermineCentrality(...) AFO_PT = 3, AFO_ETA = 4, + AFO_OCCUPANCY = 5, // vs. default "occupancy" variable which is (at the moment) "TrackOccupancyInTimeRange" (alternative is "FT0COccupancyInTimeRange") eAsFunctionOf_N }; // prefix is needed, to avoid conflict with enum eKinematics @@ -224,16 +229,17 @@ enum eQAEventHistograms2D { 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, + 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) + eCentRun2V0M_vs_NContributors, // Run 2 centrality (do not use in Run 1 converted, because there is no centrality information) + eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange, + eTrackOccupancyInTimeRange_vs_MultTPC, + eTrackOccupancyInTimeRange_vs_Vertex_z, eQAEventHistograms2D_N }; enum eQAParticleHistograms2D { - edcaXY_vs_Pt, + ePt_vs_dcaXY, eQAParticleHistograms2D_N }; @@ -248,4 +254,10 @@ 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 +}; + #endif // PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_ENUMS_H_ diff --git a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h index 50eec12c14c..416640dd9c7 100644 --- a/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h +++ b/PWGCF/MultiparticleCorrelations/Core/MuPa-MemberFunctions.h @@ -20,18 +20,23 @@ 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); @@ -45,39 +50,46 @@ void BookBaseList() // Then, I replace placeholder with run number in DetermineAndPropagateRunNumber(T const& collision) 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(eVerboseForEachParticle, "fVerboseForEachParticle"); - fBasePro->Fill(eVerboseForEachParticle, static_cast(tc.fVerboseForEachParticle)); + fBasePro->Fill(eVerboseForEachParticle, static_cast(tc.fVerboseForEachParticle)); 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->Fill(eInsanityCheckForEachParticle, static_cast(tc.fInsanityCheckForEachParticle)); fBasePro->GetXaxis()->SetBinLabel(eUseCCDB, "fUseCCDB"); - fBasePro->Fill(eUseCCDB, static_cast(tc.fUseCCDB)); + fBasePro->Fill(eUseCCDB, static_cast(tc.fUseCCDB)); 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); fBaseList->Add(fBasePro); + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookBaseList() //============================================================ @@ -85,8 +97,7 @@ void BookBaseList() void DefaultConfiguration() { // Default task configuration. - // a) Default values are hardcoded as Configurables in the file - // MuPa-Configurables.h + // a) Default values are hardcoded as Configurables in the file MuPa-Configurables.h // b) If corresponding fields are available in an external json file at run time, the default values hardcoded here are // overwritten with values set in json file. @@ -117,8 +128,9 @@ void DefaultConfiguration() 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.fDoAdditionalInsanityChecks = cf_tc.cfDoAdditionalInsanityChecks; tc.fUseCCDB = cf_tc.cfUseCCDB; @@ -187,6 +199,7 @@ void DefaultConfiguration() tc.fUseFisherYates = cf_tc.cfUseFisherYates; tc.fFixedNumberOfRandomlySelectedTracks = cf_tc.cfFixedNumberOfRandomlySelectedTracks; tc.fUseStopwatch = cf_tc.cfUseStopwatch; + tc.fFloatingPointPrecision = cf_tc.cfFloatingPointPrecision; // *) Event histograms: eh.fEventHistogramsName[eNumberOfEvents] = "NumberOfEvents"; @@ -203,6 +216,7 @@ void DefaultConfiguration() eh.fEventHistogramsName[eVertex_z] = "Vertex_z"; eh.fEventHistogramsName[eNContributors] = "NContributors"; eh.fEventHistogramsName[eImpactParameter] = "ImpactParameter"; + eh.fEventHistogramsName[eOccupancy] = "Occupancy"; 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)); @@ -229,6 +243,7 @@ void DefaultConfiguration() ec.fEventCutName[eVertex_z] = "Vertex_z"; ec.fEventCutName[eNContributors] = "NContributors"; ec.fEventCutName[eImpactParameter] = "ImpactParameter"; + ec.fEventCutName[eOccupancy] = "Occupancy"; ec.fEventCutName[eTrigger] = "Trigger"; ec.fEventCutName[eSel7] = "Sel7"; ec.fEventCutName[eSel8] = "Sel8"; @@ -239,6 +254,7 @@ void DefaultConfiguration() ec.fEventCutName[eIsVertexITSTPC] = "IsVertexITSTPC"; ec.fEventCutName[eIsVertexTOFmatched] = "IsVertexTOFmatched"; ec.fEventCutName[eIsVertexTRDmatched] = "IsVertexTRDmatched"; + 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()); @@ -316,22 +332,21 @@ void DefaultConfiguration() // *) Multiparticle correlations: mupa.fCalculateCorrelations = cf_mupa.cfCalculateCorrelations; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_INTEGRATED] = cf_mupa.cfCalculateCorrelationsAsFunctionOfIntegrated; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_MULTIPLICITY] = cf_mupa.cfCalculateCorrelationsAsFunctionOfMultiplicity; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_CENTRALITY] = cf_mupa.cfCalculateCorrelationsAsFunctionOfCentrality; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT] = cf_mupa.cfCalculateCorrelationsAsFunctionOfPt; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA] = cf_mupa.cfCalculateCorrelationsAsFunctionOfEta; + mupa.fCalculateCorrelationsAsFunctionOf[AFO_OCCUPANCY] = cf_mupa.cfCalculateCorrelationsAsFunctionOfOccupancy; // *) 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.fCalculateTest0 = cf_t0.cfCalculateTest0; 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.fCalculateTest0AsFunctionOf[AFO_OCCUPANCY] = cf_t0.cfCalculateTest0AsFunctionOfOccupancy; t0.fFileWithLabels = TString(cf_t0.cfFileWithLabels); // *) Particle weights: @@ -440,6 +455,10 @@ void DefaultConfiguration() qa.fCentralityEstimatorName[eCentRun2V0M] = "CentRun2V0M"; qa.fCentralityEstimatorName[eCentRun2SPDTracklets] = "CentRun2SPDTracklets"; + // **) Occupancy estimators: + qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange] = "TrackOccupancyInTimeRange"; + qa.fOccupancyEstimatorName[eFT0COccupancyInTimeRange] = "FT0COccupancyInTimeRange"; + // **) 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()); @@ -447,6 +466,9 @@ void DefaultConfiguration() 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[eTrackOccupancyInTimeRange_vs_MultTPC] = Form("%s_vs_%s", qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange].Data(), eh.fEventHistogramsName[eMultTPC].Data()); + qa.fEventHistogramsName2D[eTrackOccupancyInTimeRange_vs_Vertex_z] = Form("%s_vs_%s", qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange].Data(), eh.fEventHistogramsName[eVertex_z].Data()); // ***) Quick insanity check that all names are set: for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) { @@ -456,7 +478,7 @@ void DefaultConfiguration() } // **) Names of 2D particle histograms: - qa.fParticleHistogramsName2D[edcaXY_vs_Pt] = Form("%s_vs_%s", ph.fParticleHistogramsName[edcaXY].Data(), ph.fParticleHistogramsName[ePt].Data()); + 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: for (Int_t t = 0; t < eQAParticleHistograms2D_N; t++) { @@ -465,6 +487,10 @@ void DefaultConfiguration() } } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void DefaultConfiguration() //============================================================ @@ -476,10 +502,13 @@ Bool_t Alright(TString s) // 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) { @@ -494,14 +523,19 @@ Bool_t Alright(TString s) // 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")) { delete oa; - return kFALSE; + returnValue = kFALSE; } else if (TString(oa->At(1)->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()); } - return kFALSE; // obsolete, but suppresses the warning + + if (tc.fVerboseUtility) { + ExitFunction(__FUNCTION__); + } + + return returnValue; } // Bool_t Alright(const char* name) @@ -518,7 +552,7 @@ void DefaultBooking() // e) QA; if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Event histograms 1D: @@ -560,6 +594,7 @@ void DefaultBooking() 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[eOccupancy] = Alright(lBookEventHistograms[eOccupancy]) && eh.fFillEventHistograms; // b) Event histograms 2D: // TBI 20240515 Ideally, all 2D shall go to QA group, see below @@ -611,7 +646,7 @@ void DefaultBooking() 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? + // *) 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()); @@ -619,6 +654,15 @@ void DefaultBooking() 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 BeginsWith, but then I need to tokenize, etc., etc. This shall be safe enough. + if (!TString(lBookParticleHistograms2D[name]).BeginsWith(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; @@ -653,6 +697,9 @@ void DefaultBooking() 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; + qa.fBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = Alright(lBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_MultTPC] = Alright(lBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_MultTPC]) && qa.fFillQAEventHistograms2D; + qa.fBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_Vertex_z] = Alright(lBookQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_Vertex_z]) && qa.fFillQAEventHistograms2D; // **) QA 2D particle histograms: qa.fFillQAParticleHistograms2D = cf_qa.cfFillQAParticleHistograms2D; @@ -676,10 +723,14 @@ void DefaultBooking() } // I append "&& qa.fFillQAParticleHistograms2D" below, to switch off booking of all 2D particle histograms with one common flag: - qa.fBookQAParticleHistograms2D[edcaXY_vs_Pt] = Alright(lBookQAParticleHistograms2D[edcaXY_vs_Pt]) && qa.fFillQAParticleHistograms2D; + qa.fBookQAParticleHistograms2D[ePt_vs_dcaXY] = Alright(lBookQAParticleHistograms2D[ePt_vs_dcaXY]) && qa.fFillQAParticleHistograms2D; // ... + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void DefaultBooking() //============================================================ @@ -698,7 +749,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: @@ -755,8 +806,12 @@ void DefaultBinning() 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][1] = -1000.; // It's set to -999 if not meaningful + eh.fEventHistogramsBins[eImpactParameter][2] = 1000.; + + eh.fEventHistogramsBins[eOccupancy][0] = 151; + eh.fEventHistogramsBins[eOccupancy][1] = -100.; // It's set to -1 if not meaningful TBI 20241109 check this further + eh.fEventHistogramsBins[eOccupancy][2] = 15000.; // b) Default binning for particle histograms 1D: ph.fParticleHistogramsBins[ePhi][0] = 360; @@ -846,77 +901,161 @@ void DefaultBinning() res.fResultsProFixedLengthBins[AFO_INTEGRATED][0] = 1; res.fResultsProFixedLengthBins[AFO_INTEGRATED][1] = 0.; res.fResultsProFixedLengthBins[AFO_INTEGRATED][2] = 1.; - // *) Fixed-length binning vs. multiplicity: - auto lFixedLength_mult_bins = (vector)cf_res.cfFixedLength_mult_bins; // this is now the local version of that float array from configurable. - if (lFixedLength_mult_bins.size() != 3) { - LOGF(fatal, "in function \033[1;31m%s at line %d => The array cfFixedLength_mult_bins must have 3 entries: {nBins, min, max} \n \033[0m", __FUNCTION__, __LINE__); - } - res.fResultsProFixedLengthBins[AFO_MULTIPLICITY][0] = lFixedLength_mult_bins[0]; - res.fResultsProFixedLengthBins[AFO_MULTIPLICITY][1] = lFixedLength_mult_bins[1]; - res.fResultsProFixedLengthBins[AFO_MULTIPLICITY][2] = lFixedLength_mult_bins[2]; - + this->InitializeFixedLengthBins(AFO_MULTIPLICITY); // *) Fixed-length binning vs. centrality: - auto lFixedLength_cent_bins = (vector)cf_res.cfFixedLength_cent_bins; // this is now the local version of that float array from configurable. - if (lFixedLength_cent_bins.size() != 3) { - LOGF(fatal, "in function \033[1;31m%s at line %d => The array cfFixedLength_cent_bins must have 3 entries: {nBins, min, max} \n \033[0m", __FUNCTION__, __LINE__); - } - res.fResultsProFixedLengthBins[AFO_CENTRALITY][0] = lFixedLength_cent_bins[0]; - res.fResultsProFixedLengthBins[AFO_CENTRALITY][1] = lFixedLength_cent_bins[1]; - res.fResultsProFixedLengthBins[AFO_CENTRALITY][2] = lFixedLength_cent_bins[2]; - + this->InitializeFixedLengthBins(AFO_CENTRALITY); // *) Fixed-length binning vs. pt: - auto lFixedLength_pt_bins = (vector)cf_res.cfFixedLength_pt_bins; // this is now the local version of that float array from configurable. - if (lFixedLength_pt_bins.size() != 3) { - LOGF(fatal, "in function \033[1;31m%s at line %d => The array cfFixedLength_pt_bins must have 3 entries: {nBins, min, max} \n \033[0m", __FUNCTION__, __LINE__); - } - res.fResultsProFixedLengthBins[AFO_PT][0] = lFixedLength_pt_bins[0]; - res.fResultsProFixedLengthBins[AFO_PT][1] = lFixedLength_pt_bins[1]; - res.fResultsProFixedLengthBins[AFO_PT][2] = lFixedLength_pt_bins[2]; - + this->InitializeFixedLengthBins(AFO_PT); // *) Fixed-length binning vs. eta: - auto lFixedLength_eta_bins = (vector)cf_res.cfFixedLength_eta_bins; // this is now the local version of that float array from configurable. - if (lFixedLength_eta_bins.size() != 3) { - LOGF(fatal, "in function \033[1;31m%s at line %d => The array cfFixedLength_eta_bins must have 3 entries: {nBins, min, max} \n \033[0m", __FUNCTION__, __LINE__); - } - res.fResultsProFixedLengthBins[AFO_ETA][0] = lFixedLength_eta_bins[0]; - res.fResultsProFixedLengthBins[AFO_ETA][1] = lFixedLength_eta_bins[1]; - res.fResultsProFixedLengthBins[AFO_ETA][2] = lFixedLength_eta_bins[2]; + this->InitializeFixedLengthBins(AFO_ETA); + // *) Fixed-length binning vs. occupancy: + this->InitializeFixedLengthBins(AFO_OCCUPANCY); // e) Variable-length binning set via MuPa-Configurables.h: // *) Variable-length binning vs. multiplicity: if (cf_res.cfUseVariableLength_mult_bins) { - res.fUseResultsProVariableLengthBins[AFO_MULTIPLICITY] = kTRUE; - res.fResultsProVariableLengthBinsString[AFO_MULTIPLICITY] = cf_res.cfVariableLength_mult_bins; - this->CastStringIntoArray(AFO_MULTIPLICITY); + this->InitializeVariableLengthBins(AFO_MULTIPLICITY); } // *) Variable-length binning vs. centrality: if (cf_res.cfUseVariableLength_cent_bins) { - res.fUseResultsProVariableLengthBins[AFO_CENTRALITY] = kTRUE; - res.fResultsProVariableLengthBinsString[AFO_CENTRALITY] = cf_res.cfVariableLength_cent_bins; - this->CastStringIntoArray(AFO_CENTRALITY); + this->InitializeVariableLengthBins(AFO_CENTRALITY); } // *) Variable-length binning vs. pt: if (cf_res.cfUseVariableLength_pt_bins) { - res.fUseResultsProVariableLengthBins[AFO_PT] = kTRUE; - res.fResultsProVariableLengthBinsString[AFO_PT] = cf_res.cfVariableLength_pt_bins; - this->CastStringIntoArray(AFO_PT); + this->InitializeVariableLengthBins(AFO_PT); } // *) Variable-length binning vs. eta: if (cf_res.cfUseVariableLength_eta_bins) { - res.fUseResultsProVariableLengthBins[AFO_ETA] = kTRUE; - res.fResultsProVariableLengthBinsString[AFO_ETA] = cf_res.cfVariableLength_eta_bins; - this->CastStringIntoArray(AFO_ETA); + this->InitializeVariableLengthBins(AFO_ETA); + } + // *) Variable-length binning vs. occupancy: + if (cf_res.cfUseVariableLength_occu_bins) { + this->InitializeVariableLengthBins(AFO_OCCUPANCY); + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); } } // void DefaultBinning() //============================================================ +void InitializeFixedLengthBins(eAsFunctionOf AFO) +{ + // This is a helper function to suppress code bloat in DefaultBinning(). + // It merely initalizes res.fResultsProFixedLengthBins[...] from corresponding configurables + a few other minor thingies. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // Common local vector for all fixed-length bins: + vector lFixedLength_bins; + + switch (AFO) { + case AFO_MULTIPLICITY: + lFixedLength_bins = cf_res.cfFixedLength_mult_bins.value; + break; + case AFO_CENTRALITY: + lFixedLength_bins = cf_res.cfFixedLength_cent_bins.value; + break; + case AFO_PT: + lFixedLength_bins = cf_res.cfFixedLength_pt_bins.value; + break; + case AFO_ETA: + lFixedLength_bins = cf_res.cfFixedLength_eta_bins.value; + break; + case AFO_OCCUPANCY: + lFixedLength_bins = cf_res.cfFixedLength_occu_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)); + break; + } // switch(AFO) + + // From this point onward, the code is the same for any AFO variable: + if (lFixedLength_bins.size() != 3) { + LOGF(fatal, "in function \033[1;31m%s at line %d => The array cfFixedLength_bins must have have 3 entries: {nBins, min, max} \n \033[0m", __FUNCTION__, __LINE__); + } + res.fResultsProFixedLengthBins[AFO][0] = lFixedLength_bins[0]; + res.fResultsProFixedLengthBins[AFO][1] = lFixedLength_bins[1]; + res.fResultsProFixedLengthBins[AFO][2] = lFixedLength_bins[2]; + + if (tc.fVerbose) { + LOGF(info, "\033[1;32m %s : fixed-length %s bins \033[0m", __FUNCTION__, res.fResultsProXaxisTitle[AFO].Data()); + 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) + +//============================================================ + +void InitializeVariableLengthBins(eAsFunctionOf AFO) +{ + // This is a helper function to suppress code bloat in DefaultBinning(). + // It merely initalizes res.fResultsProVariableLengthBins[...] from corresponding configurables + a few other minor thingies. + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // Common local vector for all variable-length bins: + vector lVariableLength_bins; + + switch (AFO) { + case AFO_MULTIPLICITY: + lVariableLength_bins = cf_res.cfVariableLength_mult_bins.value; + break; + case AFO_CENTRALITY: + lVariableLength_bins = cf_res.cfVariableLength_cent_bins.value; + break; + case AFO_PT: + lVariableLength_bins = cf_res.cfVariableLength_pt_bins.value; + break; + case AFO_ETA: + lVariableLength_bins = cf_res.cfVariableLength_eta_bins.value; + break; + case AFO_OCCUPANCY: + lVariableLength_bins = cf_res.cfVariableLength_occu_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)); + break; + } // switch(AFO) + + // From this point onward, the code is the same for any AFO variable: + res.fUseResultsProVariableLengthBins[AFO] = kTRUE; + if (lVariableLength_bins.size() < 2) { + LOGF(fatal, "in function \033[1;31m%s at line %d => The array cfVariableLength_bins must have at least 2 entries \n \033[0m", __FUNCTION__, __LINE__); + } + res.fResultsProVariableLengthBins[AFO] = new TArrayF(lVariableLength_bins.size(), lVariableLength_bins.data()); + if (tc.fVerbose) { + LOGF(info, "\033[1;32m %s : variable-length %s bins \033[0m", __FUNCTION__, res.fResultsProXaxisTitle[AFO].Data()); + for (Int_t i = 0; i < res.fResultsProVariableLengthBins[AFO]->GetSize(); i++) { + LOGF(info, "\033[1;32m [%d] : %f \033[0m", i, res.fResultsProVariableLengthBins[AFO]->GetAt(i)); + } + } + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void InitializeVariableLengthBins(eAsFunctionOf AFO) + +//============================================================ + void CastStringIntoArray(Int_t AFO) { // Temporary function, to be removed eventually. Here temporarily I am casting e.g. a string "1.0,2.0,5.0" into corresponding TArrayD. - // TBI 20240114 This function is used until I figure out how to pass array directly via configurable. + + // TBI 20241019 This function is not needed any longer, remove eventually. if (tc.fVerbose) { LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); @@ -931,9 +1070,8 @@ void CastStringIntoArray(Int_t AFO) LOGF(fatal, "in function \033[1;31m%s at line %d \n fResultsProVariableLengthBinsString[AFO] = %s\033[0m", __FUNCTION__, __LINE__, res.fResultsProVariableLengthBinsString[AFO].Data()); } Int_t nEntries = oa->GetEntries(); - res.fResultsProVariableLengthBins[AFO] = new TArrayD(nEntries); + 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 @@ -960,7 +1098,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: @@ -998,6 +1136,7 @@ void DefaultCuts() ec.fUseEventCuts[eVertex_z] = Alright(lUseEventCuts[eVertex_z]); ec.fUseEventCuts[eNContributors] = Alright(lUseEventCuts[eNContributors]); ec.fUseEventCuts[eImpactParameter] = Alright(lUseEventCuts[eImpactParameter]); + ec.fUseEventCuts[eOccupancy] = Alright(lUseEventCuts[eOccupancy]); // *) from enum eEventCuts: ec.fUseEventCuts[eTrigger] = Alright(lUseEventCuts[eTrigger]); ec.fUseEventCuts[eSel7] = Alright(lUseEventCuts[eSel7]); @@ -1009,6 +1148,7 @@ void DefaultCuts() ec.fUseEventCuts[eIsVertexITSTPC] = Alright(lUseEventCuts[eIsVertexITSTPC]); ec.fUseEventCuts[eIsVertexTOFmatched] = Alright(lUseEventCuts[eIsVertexTOFmatched]); ec.fUseEventCuts[eIsVertexTRDmatched] = Alright(lUseEventCuts[eIsVertexTRDmatched]); + ec.fUseEventCuts[eOccupancyEstimator] = Alright(lUseEventCuts[eOccupancyEstimator]); // **) event cuts defined via booleans: ec.fUseEventCuts[eSel7] = ec.fUseEventCuts[eSel7] && cf_ec.cfUseSel7; @@ -1076,6 +1216,10 @@ void DefaultCuts() ec.fdEventCuts[eImpactParameter][eMin] = lImpactParameter[eMin]; ec.fdEventCuts[eImpactParameter][eMax] = lImpactParameter[eMax]; + auto lOccupancy = (vector)cf_ec.cfOccupancy; + ec.fdEventCuts[eOccupancy][eMin] = lOccupancy[eMin]; + ec.fdEventCuts[eOccupancy][eMax] = lOccupancy[eMax]; + auto lSelectedEvents = (vector)cf_ec.cfSelectedEvents; ec.fdEventCuts[eSelectedEvents][eMin] = lSelectedEvents[eMin]; ec.fdEventCuts[eSelectedEvents][eMax] = lSelectedEvents[eMax]; @@ -1083,6 +1227,7 @@ void DefaultCuts() // **) event cuts defined via string: ec.fsEventCuts[eCentralityEstimator] = cf_ec.cfCentralityEstimator; ec.fsEventCuts[eTrigger] = cf_ec.cfTrigger; + ec.fsEventCuts[eOccupancyEstimator] = cf_ec.cfOccupancyEstimator; // ---------------------------------------------------------------------- @@ -1207,75 +1352,149 @@ void DefaultCuts() // **) particles cuts defined via string: pc.fsParticleCuts[ePtDependentDCAxyParameterization] = cf_pc.cfPtDependentDCAxyParameterization; + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void DefaultCuts() //============================================================ -void InsanityChecks() +void InsanityChecksBeforeBooking() { - // Do insanity checks on configuration, booking, binning and cuts. + // 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. + // For those additional checks, use InsanityChecksAfterBooking(). // a) Insanity checks on configuration; - // b) Insanity checks on event cuts; - // c) Insanity checks on booking; + // 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 cuts; + // e) Insanity checks on events cuts; // f) Insanity checks on Toy NUA; - // g) Insanity checks on internal validation. + // 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: - // Remark: Here I also classify all cases which couple 2 or more categories: - // *) Cannot calculate multiparticle correlations, in case Q-vectors are not filled: + // **) 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__); } - // *) Cannot calculate Test0, in case Q-vectors are not filled: + // **) 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: if (t0.fCalculateTest0 && !qv.fCalculateQvectors) { LOGF(fatal, "\033[1;31m%s at line %d : Cannot calculate Test0, in case Q-vectors are not filled \033[0m", __FUNCTION__, __LINE__); } - // *) Insanity check on individual flags: Make sure that only one process is set to kTRUE. - // If 2 or more are kTRUE, then corresponding process function is executed over ALL data, then another process(...) function, etc. - // Re-think this if it's possible to run different process(...)'s concurently over the same data. + // **) 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__); + } + + // **) When it comes to DCAxy cut, ensure that either flat or pt-dependent cut is used, but not both: + if (pc.fUseParticleCuts[edcaXY] && pc.fUseParticleCuts[ePtDependentDCAxyParameterization]) { + LOGF(fatal, "\033[1;31m%s at line %d : use either flat or pt-dependent DCAxy cut, but not both \033[0m", __FUNCTION__, __LINE__); + } + + // **) Insanity check on individual flags: Make sure that only one process is set to kTRUE. + // If 2 or more are kTRUE, then corresponding process function is executed over ALL data, then another process(...) function, etc. + // Re-think this if it's possible to run different process(...)'s concurently over the same data. if (static_cast(tc.fProcess[eProcessRec]) + static_cast(tc.fProcess[eProcessRecSim]) + static_cast(tc.fProcess[eProcessSim]) + static_cast(tc.fProcess[eProcessRec_Run2]) + static_cast(tc.fProcess[eProcessRecSim_Run2]) + static_cast(tc.fProcess[eProcessSim_Run2]) + static_cast(tc.fProcess[eProcessRec_Run1]) + static_cast(tc.fProcess[eProcessRecSim_Run1]) + static_cast(tc.fProcess[eProcessSim_Run1]) > 1) { LOGF(info, "\033[1;31m Only one flag can be kTRUE: tc.fProcess[eProcessRec] = %d, tc.fProcess[eProcessRecSim] = %d, tc.fProcess[eProcessSim] = %d, tc.fProcess[eProcessRec_Run2] = %d, tc.fProcess[eProcessRecSim_Run2] = %d, tc.fProcess[eProcessSim_Run2] = %d, tc.fProcess[eProcessRec_Run1] = %d, tc.fProcess[eProcessRecSim_Run1] = %d, tc.fProcess[eProcessSim_Run1] = %d \033[0m", static_cast(tc.fProcess[eProcessRec]), static_cast(tc.fProcess[eProcessRecSim]), static_cast(tc.fProcess[eProcessSim]), static_cast(tc.fProcess[eProcessRec_Run2]), static_cast(tc.fProcess[eProcessRecSim_Run2]), static_cast(tc.fProcess[eProcessSim_Run2]), static_cast(tc.fProcess[eProcessRec_Run1]), static_cast(tc.fProcess[eProcessRecSim_Run1]), static_cast(tc.fProcess[eProcessSim_Run1])); LOGF(fatal, "in function \033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - // *) Insanity checks on event cuts: + // **) 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 + // If I do not want to bail out when max number of events is reached, then in the configurable I have e.g. cfNumberOfEvents{"cfNumberOfEvents", {-1, 1000000000} + // So if the upper limit is set to some number < 1e6, I want to bail out for that number of events. + // TBI 20241011 this is a bit shaky, but nevermind now... + if (!eh.fBookEventHistograms[eNumberOfEvents]) { + LOGF(fatal, "\033[1;31m%s at line %d : Bailout for max number of events cannot be done, unless eh.fBookEventHistograms[eNumberOfEvents] is kTRUE.\033[0m", __FUNCTION__, __LINE__); + } + } + + // **) Check if the trigger makes sense 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) 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()); - // TBI 20240517 I need here programmattic access to "event-selection-task" flags "isMC and "isRunMC" . Then I can directly bail out. + // TBI 20240517 I need here programmatic access to "event-selection-task" flags "isMC and "isRunMC" . Then I can directly bail out. } } - if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim]) { // From documentation: Bypass this check if you analyse MC or continuous Run3 data. + // **) 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__); } } - if (ec.fUseEventCuts[eSel7]) { // from doc: for Run 2 data and MC + // **) 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 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])) { LOGF(fatal, "\033[1;31m%s at line %d : use fSel7 for Run 2 data and MC\033[0m", __FUNCTION__, __LINE__); } } - if (ec.fUseEventCuts[eSel8]) { // from doc: for Run 3 data and MC + // **) 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()); + } + } + + // **) Protection against particle cuts which are available, but not yet validated, or are meaningless, in Run 2 and 1: + 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 (pc.fUseParticleCuts[etrackCutFlagFb1]) { + LOGF(fatal, "\033[1;31m%s at line %d : particle cut etrackCutFlagFb1 is not validated, as of 20240511 it kills all reconstructed tracks \033[0m", __FUNCTION__, __LINE__); + } + if (pc.fUseParticleCuts[etrackCutFlagFb2]) { + LOGF(fatal, "\033[1;31m%s at line %d : particle cut etrackCutFlagFb2 is not validated, as of 20240511 it kills all reconstructed tracks \033[0m", __FUNCTION__, __LINE__); + } + } + + // ... + + // c) Ensure that Run 3 specific cuts and flags are used only in Run 3 (both data and sim): + // **) Ensure that eSel8 is used only in Run 3 (both data and sim): + if (ec.fUseEventCuts[eSel8]) { if (!(tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim])) { LOGF(fatal, "\033[1;31m%s at line %d : use eSel8 only for Run 3 data and MC\033[0m", __FUNCTION__, __LINE__); } @@ -1311,12 +1530,8 @@ void InsanityChecks() } } - if (tc.fFixedNumberOfRandomlySelectedTracks > 0 && !tc.fUseFisherYates) { - LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); - } - + // **) Supported centrality estimators for Run 3 are enlisted here: if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim]) { - // Supported centrality estimators for Run 3 are enlisted here: if (!(ec.fsEventCuts[eCentralityEstimator].EqualTo("centFT0M", TString::kIgnoreCase) || ec.fsEventCuts[eCentralityEstimator].EqualTo("centFV0A", TString::kIgnoreCase) || ec.fsEventCuts[eCentralityEstimator].EqualTo("centNTPV", TString::kIgnoreCase))) { @@ -1324,16 +1539,15 @@ void InsanityChecks() } } - 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]) { - // Supported centrality estimators for Run 3 are enlisted here: - 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()); + // **) 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()); } } - // *) Insanity checks on particle cuts: - // **) Protection against particle cuts which are available, but not yet validated, or are meaningless, in Run 3: + // **) Protection against particle cuts which are available, but not yet validated, or are meaningless, in Run 3: if (tc.fProcess[eProcessRec] || tc.fProcess[eProcessRecSim] || tc.fProcess[eProcessSim]) { if (pc.fUseParticleCuts[eisQualityTrack]) { LOGF(fatal, "\033[1;31m%s at line %d : particle cut isQualityTrack is not validated in Run 3 as of 20240516 => it kills all reconstructed tracks \033[0m", __FUNCTION__, __LINE__); @@ -1343,32 +1557,20 @@ void InsanityChecks() } } - // **) Protection against particle cuts which are available, but not yet validated, or are meaningless, in Run 2 and 1: - 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 (pc.fUseParticleCuts[etrackCutFlagFb1]) { - LOGF(fatal, "\033[1;31m%s at line %d : particle cut etrackCutFlagFb1 is not validated, as of 20240511 it kills all reconstructed tracks \033[0m", __FUNCTION__, __LINE__); - } - if (pc.fUseParticleCuts[etrackCutFlagFb2]) { - LOGF(fatal, "\033[1;31m%s at line %d : particle cut etrackCutFlagFb2 is not validated, as of 20240511 it kills all reconstructed tracks \033[0m", __FUNCTION__, __LINE__); - } - } - - // **) When it comes to DCAxy cut, ensure that either flat or pt-dependent cut is used, but not both: - if (pc.fUseParticleCuts[edcaXY] && pc.fUseParticleCuts[ePtDependentDCAxyParameterization]) { - LOGF(fatal, "\033[1;31m%s at line %d : use either flat or pt-dependent DCAxy cut, but not both \033[0m", __FUNCTION__, __LINE__); - } + // ... - // *) Insanity checks on booking: + // d) Insanity checks on binning: // ... - // *) Insanity checks on binning: + // e) Insanity checks on events cuts: // ... - // *) Insanity checks on cuts: + // f) Insanity checks on Toy NUA: // ... - // *) 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() + // 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) { if (iv.fnEventsInternalValidation <= 0) { LOGF(fatal, "\033[1;31m%s at line %d : iv.fnEventsInternalValidation <= 0 => Set number of events to positive integer\033[0m", __FUNCTION__, __LINE__); @@ -1388,7 +1590,114 @@ void InsanityChecks() } // if (iv.fUseInternalValidation) { -} // void InsanityChecks() + // 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 (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() + +//============================================================ + +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; + // b) Insanity checks on internal validation; + // ... + + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + + // a) Insanity checks on booking: + + // **) 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) //============================================================ @@ -1407,7 +1716,7 @@ void BookAndNestAllLists() // *) Results. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // *) QA: @@ -1488,6 +1797,10 @@ void BookAndNestAllLists() res.fResultsList->SetOwner(kTRUE); fBaseList->Add(res.fResultsList); + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookAndNestAllLists() //============================================================ @@ -1504,11 +1817,21 @@ 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: + /* + [1450742:multiparticle-correlations-a-b]: [13:30:27][STATE] Exiting FairMQ state machine + [1450742:multiparticle-correlations-a-b]: [13:30:27][FATAL] error while setting up workflow in o2-analysis-cf-multiparticle-correlations-ab: shmem: could not create a message of size 1282720912, alignment: 64, free memory: 1358639296 + [1450742:multiparticle-correlations-a-b]: terminate called after throwing an instance of 'o2::framework::RuntimeErrorRef' + [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__); + // a) Book the profile holding flags: - qa.fQAHistogramsPro = new TProfile("fQAHistogramsPro", "flags for QA histograms", 2, 0., 2.); // TBI 20240515 re-think how to organize the binning here + qa.fQAHistogramsPro = new TProfile("fQAHistogramsPro", "flags for QA histograms", 3, 0., 3.); qa.fQAHistogramsPro->SetStats(kFALSE); qa.fQAHistogramsPro->SetLineColor(eColor); qa.fQAHistogramsPro->SetFillColor(eFillColor); @@ -1516,6 +1839,8 @@ void BookQAHistograms() qa.fQAHistogramsPro->Fill(0.5, static_cast(qa.fCheckUnderflowAndOverflow)); qa.fQAHistogramsPro->GetXaxis()->SetBinLabel(2, "fFillQAEventHistograms2D"); qa.fQAHistogramsPro->Fill(1.5, static_cast(qa.fFillQAEventHistograms2D)); + qa.fQAHistogramsPro->GetXaxis()->SetBinLabel(3, "fFillQAParticleHistograms2D"); + qa.fQAHistogramsPro->Fill(2.5, static_cast(qa.fFillQAParticleHistograms2D)); // ... @@ -1539,31 +1864,31 @@ void BookQAHistograms() TString title_y_Event[eQAEventHistograms2D_N] = {""}; // *) "MultTPC_vs_NContributors": - nBins_x_Event[eMultTPC_vs_NContributors] = static_cast(eh.fEventHistogramsBins[eMultTPC][0]) / 10; // TBI 20240504 hardcoded number + 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]) / 10; // TBI 20240504 hardcoded number + 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]) / 10; // TBI 20240504 hardcoded number + 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]) / 100; // TBI 20240504 hardcoded number + 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]) / 10; // TBI 20240504 hardcoded number + 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]) / 10; // TBI 20240504 hardcoded number + 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()); @@ -1598,17 +1923,58 @@ void BookQAHistograms() 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]); + 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]); + min_y_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = eh.fEventHistogramsBins[eOccupancy][1]; + max_y_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = eh.fEventHistogramsBins[eOccupancy][2] * 10; // TBI 20241112 I extend here manually this axis temporarily + title_y_Event[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange] = FancyFormatting(qa.fOccupancyEstimatorName[eFT0COccupancyInTimeRange].Data()); + + // *) "eTrackOccupancyInTimeRange_vs_MultTPC": + nBins_x_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = static_cast(eh.fEventHistogramsBins[eOccupancy][0]); + min_x_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = eh.fEventHistogramsBins[eOccupancy][1]; + max_x_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = eh.fEventHistogramsBins[eOccupancy][2]; + title_x_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = FancyFormatting(qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange].Data()); + nBins_y_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = static_cast(eh.fEventHistogramsBins[eMultTPC][0]); + min_y_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = eh.fEventHistogramsBins[eMultTPC][1]; + max_y_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = eh.fEventHistogramsBins[eMultTPC][2]; + title_y_Event[eTrackOccupancyInTimeRange_vs_MultTPC] = FancyFormatting(eh.fEventHistogramsName[eMultTPC].Data()); + + // *) "eTrackOccupancyInTimeRange_vs_Vertex_z": + nBins_x_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eOccupancy][0]); + min_x_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = eh.fEventHistogramsBins[eOccupancy][1]; + max_x_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = eh.fEventHistogramsBins[eOccupancy][2]; + title_x_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = FancyFormatting(qa.fOccupancyEstimatorName[eTrackOccupancyInTimeRange].Data()); + nBins_y_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = static_cast(eh.fEventHistogramsBins[eVertex_z][0]); + min_y_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][1]; + max_y_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = eh.fEventHistogramsBins[eVertex_z][2]; + title_y_Event[eTrackOccupancyInTimeRange_vs_Vertex_z] = FancyFormatting(eh.fEventHistogramsName[eVertex_z].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 @@ -1618,20 +1984,14 @@ 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.fQAEventHistograms2D[t][rs][ba] = new TH2D( + 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) nBins_x_Event[t], min_x_Event[t], max_x_Event[t], nBins_y_Event[t], min_y_Event[t], max_y_Event[t]); @@ -1643,8 +2003,8 @@ void BookQAHistograms() qa.fQAEventHistograms2D[t][rs][ba]->SetOption("col"); qa.fQAList->Add(qa.fQAEventHistograms2D[t][rs][ba]); } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for(Int_t t=0;t(ph.fParticleHistogramsBins[edcaXY][0]) / 10; // TBI 20240504 hardcoded number - min_x_Particle[edcaXY_vs_Pt] = ph.fParticleHistogramsBins[edcaXY][1]; - max_x_Particle[edcaXY_vs_Pt] = ph.fParticleHistogramsBins[edcaXY][2]; - title_x_Particle[edcaXY_vs_Pt] = FancyFormatting(ph.fParticleHistogramsName[edcaXY].Data()); - nBins_y_Particle[edcaXY_vs_Pt] = static_cast(ph.fParticleHistogramsBins[ePt][0]) / 10; // TBI 20240504 hardcoded number - min_y_Particle[edcaXY_vs_Pt] = ph.fParticleHistogramsBins[ePt][1]; - max_y_Particle[edcaXY_vs_Pt] = ph.fParticleHistogramsBins[ePt][2]; - title_y_Particle[edcaXY_vs_Pt] = FancyFormatting(ph.fParticleHistogramsName[ePt].Data()); + // *) "pt_vs_dcaXY": + nBins_x_Particle[ePt_vs_dcaXY] = static_cast(ph.fParticleHistogramsBins[ePt][0]); // TBI 20240702 add support for rebinning + min_x_Particle[ePt_vs_dcaXY] = ph.fParticleHistogramsBins[ePt][1]; + max_x_Particle[ePt_vs_dcaXY] = ph.fParticleHistogramsBins[ePt][2]; + title_x_Particle[ePt_vs_dcaXY] = FancyFormatting(ph.fParticleHistogramsName[ePt].Data()); + nBins_y_Particle[ePt_vs_dcaXY] = static_cast(ph.fParticleHistogramsBins[edcaXY][0]); // TBI 20240702 add support for rebinning + min_y_Particle[ePt_vs_dcaXY] = ph.fParticleHistogramsBins[edcaXY][1]; + max_y_Particle[ePt_vs_dcaXY] = ph.fParticleHistogramsBins[edcaXY][2]; + title_y_Particle[ePt_vs_dcaXY] = FancyFormatting(ph.fParticleHistogramsName[edcaXY].Data()); // ... @@ -1689,20 +2049,14 @@ 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 TH2D( + 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) nBins_x_Particle[t], min_x_Particle[t], max_x_Particle[t], nBins_y_Particle[t], min_y_Particle[t], max_y_Particle[t]); @@ -1714,8 +2068,12 @@ void BookQAHistograms() qa.fQAParticleHistograms2D[t][rs][ba]->SetOption("col"); qa.fQAList->Add(qa.fQAParticleHistograms2D[t][rs][ba]); } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for(Int_t t=0;tSetStats(kFALSE); eh.fEventHistogramsPro->SetLineColor(eColor); eh.fEventHistogramsPro->SetFillColor(eFillColor); + eh.fEventHistogramsPro->GetXaxis()->SetBinLabel(1, "fFillEventHistograms"); + eh.fEventHistogramsPro->Fill(0.5, static_cast(eh.fFillEventHistograms)); // ... eh.fEventHistogramsList->Add(eh.fEventHistogramsPro); @@ -1754,14 +2114,8 @@ void BookEventHistograms() } 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; } @@ -1773,7 +2127,7 @@ void BookEventHistograms() continue; } - eh.fEventHistograms[t][rs][ba] = new TH1D( + eh.fEventHistograms[t][rs][ba] = new TH1F( 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) static_cast(eh.fEventHistogramsBins[t][0]), @@ -1784,8 +2138,12 @@ void BookEventHistograms() eh.fEventHistograms[t][rs][ba]->SetFillColor(ec.fBeforeAfterColor[ba] - 10); eh.fEventHistogramsList->Add(eh.fEventHistograms[t][rs][ba]); } // for(Int_t ba=0;ba<2;ba++) - } // 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]", srs[rs].Data(), scc[cc].Data()), Form("%s, %s, event cut counter (%s)", "__RUN_NUMBER__", srs_long[rs].Data(), 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); @@ -1861,6 +2214,10 @@ void BookEventCutsHistograms() } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookEventCutsHistograms() //============================================================ @@ -1874,7 +2231,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: @@ -1883,7 +2240,9 @@ void BookParticleHistograms() ph.fParticleHistogramsPro->SetStats(kFALSE); ph.fParticleHistogramsPro->SetLineColor(eColor); ph.fParticleHistogramsPro->SetFillColor(eFillColor); - // ... TBI 20240418 I shall fill something in this config profile... + ph.fParticleHistogramsPro->GetXaxis()->SetBinLabel(1, "fFillParticleHistograms"); + ph.fParticleHistogramsPro->Fill(0.5, static_cast(ph.fFillParticleHistograms)); + // ... ph.fParticleHistogramsList->Add(ph.fParticleHistogramsPro); // b) Book specific particle histograms 1D: @@ -1900,8 +2259,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; } @@ -1912,14 +2270,9 @@ 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()), + ph.fParticleHistograms[t][rs][ba] = new TH1F(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()), static_cast(ph.fParticleHistogramsBins[t][0]), ph.fParticleHistogramsBins[t][1], ph.fParticleHistogramsBins[t][2]); ph.fParticleHistograms[t][rs][ba]->SetLineColor(ec.fBeforeAfterColor[ba]); @@ -1932,8 +2285,8 @@ void BookParticleHistograms() ph.fParticleHistograms[t][rs][ba]->SetOption("hist"); // do not plot marker and error (see BanishmentLoopOverParticles why errors are not reliable) for each bin, only content + filled area. ph.fParticleHistogramsList->Add(ph.fParticleHistograms[t][rs][ba]); } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for(Int_t t=0;t(ph.fParticleHistogramsBins2D[t][eX][0]), ph.fParticleHistogramsBins2D[t][eX][1], ph.fParticleHistogramsBins2D[t][eX][2], // TBI 20240418 this is not safe, eX doesn't have to be phi axis in general, but it's ok for the time being => re-thing and fix later - 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("PhiEta") && res.fUseResultsProVariableLengthBins[AFO_ETA]) { + 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()), - static_cast(ph.fParticleHistogramsBins2D[t][eX][0]), ph.fParticleHistogramsBins2D[t][eX][1], ph.fParticleHistogramsBins2D[t][eX][2], // TBI 20240418 this is not safe, eX doesn't have to be phi axis in general, but it's ok for the time being => re-thing and fix later - 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 + 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-langth binnging: + // 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()), static_cast(ph.fParticleHistogramsBins2D[t][eX][0]), ph.fParticleHistogramsBins2D[t][eX][1], ph.fParticleHistogramsBins2D[t][eX][2], @@ -1996,9 +2351,13 @@ void BookParticleHistograms() ph.fParticleHistograms2D[t][rs][ba]->GetYaxis()->SetTitle(stitleY2D[t].Data()); ph.fParticleHistogramsList->Add(ph.fParticleHistograms2D[t][rs][ba]); } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for(Int_t t=0;t(eParticleCuts_N) + 0.5); + pc.fParticleCutCounterHist[rs][cc] = new TH1I(Form("fParticleCutCounterHist[%s][%s]", srs[rs].Data(), scc[cc].Data()), Form("%s, %s, particle cut counter (%s)", "__RUN_NUMBER__", srs_long[rs].Data(), 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); @@ -2085,6 +2440,10 @@ void BookParticleCutsHistograms() } } // if(pc.fUseParticleCuts[ePtDependentDCAxyParameterization]) { + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookParticleCutsHistograms() //============================================================ @@ -2097,7 +2456,7 @@ void BookQvectorHistograms() // b) ... if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -2117,6 +2476,10 @@ void BookQvectorHistograms() // b) ... + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookQvectorHistograms() //============================================================ @@ -2131,7 +2494,7 @@ 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: @@ -2163,9 +2526,28 @@ 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 (!res.fResultsPro[v]) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } @@ -2177,7 +2559,7 @@ void BookCorrelationsHistograms() mupa.fCorrelationsList->Add(mupa.fCorrelationsPro[k][n][v]); } } // for (Int_t n = 0; n < gMaxHarmonic; n++) // harmonic - } // for (Int_t k = 0; k < 4; k++) // order [2p=0,4p=1,6p=2,8p=3] + } // for (Int_t k = 0; k < 4; k++) // order [2p=0,4p=1,6p=2,8p=3] // d) Few quick insanity checks on booking: if (mupa.fCorrelationsPro[0][0][AFO_INTEGRATED] && !TString(mupa.fCorrelationsPro[0][0][AFO_INTEGRATED]->GetXaxis()->GetTitle()).EqualTo("integrated")) { @@ -2187,6 +2569,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() //============================================================ @@ -2196,11 +2582,11 @@ void BookWeightsHistograms() // Book all objects for particle weights. // a) Book the profile holding flags; - // b) Histograms; + // b) Histograms for integrated weights; // 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: @@ -2213,8 +2599,8 @@ void BookWeightsHistograms() pw.fWeightsFlagsPro->GetXaxis()->SetBinLabel(1, "w_{#varphi}"); pw.fWeightsFlagsPro->GetXaxis()->SetBinLabel(2, "w_{p_{t}}"); pw.fWeightsFlagsPro->GetXaxis()->SetBinLabel(3, "w_{#eta}"); - pw.fWeightsFlagsPro->GetXaxis()->SetBinLabel(4, "w_{#varphi}(p_{t})"); - pw.fWeightsFlagsPro->GetXaxis()->SetBinLabel(5, "w_{#varphi}(#eta)"); + pw.fWeightsFlagsPro->GetXaxis()->SetBinLabel(4, "(w_{#varphi})_{| p_{T}}"); // TBI 20241019 not sure if this is the final notation, keep in sync with void SetDiffWeightsHist(...) + pw.fWeightsFlagsPro->GetXaxis()->SetBinLabel(5, "(w_{#varphi})_{| #eta}"); // TBI 20241019 not sure if this is the final notation, keep in sync with void SetDiffWeightsHist(...) for (Int_t w = 0; w < eWeights_N; w++) // use weights [phi,pt,eta] { @@ -2230,13 +2616,17 @@ void BookWeightsHistograms() } pw.fWeightsList->Add(pw.fWeightsFlagsPro); - // b) Histograms: + // b) Histograms for integrated weights: // As of 20240216, I have abandoned the idea to generate integrated weights internally, weights // are always fetched and cloned from external files, in any case (local, AliEn, CCDB). // Therefore, add histos with weights to this list only after they are cloned from external files. // c) Histograms for differential weights: - // Same comment applies as for c) => add histograms to the list, only after they are cloned from external files. + // 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() @@ -2252,7 +2642,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: @@ -2315,9 +2705,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;} @@ -2329,8 +2717,7 @@ void BookNestedLoopsHistograms() nl.fNestedLoopsPro[k][n][v]->SetTitle(Form("#LT#LTcos[%s(%s)]#GT#GT", 1 == n + 1 ? "" : Form("%d", n + 1), oVariable[k].Data())); nl.fNestedLoopsPro[k][n][v]->SetStats(kFALSE); nl.fNestedLoopsPro[k][n][v]->Sumw2(); - nl.fNestedLoopsPro[k][n][v]->GetXaxis()->SetTitle( - res.fResultsProXaxisTitle[v].Data()); + nl.fNestedLoopsPro[k][n][v]->GetXaxis()->SetTitle(res.fResultsProXaxisTitle[v].Data()); /* if(fUseFixedNumberOfRandomlySelectedTracks && 1==v) // just a warning @@ -2345,8 +2732,8 @@ void BookNestedLoopsHistograms() nl.fNestedLoopsList->Add(nl.fNestedLoopsPro[k][n][v]); } // for(Int_t v=0;v<5;v++) // variable [0=integrated,1=vs. // multiplicity,2=vs. centrality] - } // for (Int_t n = 0; n < gMaxHarmonic; n++) // harmonic - } // for (Int_t k = 0; k < 4; k++) // order [2p=0,4p=1,6p=2,8p=3] + } // for (Int_t n = 0; n < gMaxHarmonic; n++) // harmonic + } // for (Int_t k = 0; k < 4; k++) // order [2p=0,4p=1,6p=2,8p=3] // d) Few quick insanity checks on booking: if (nl.fNestedLoopsPro[0][0][AFO_INTEGRATED] && !TString(nl.fNestedLoopsPro[0][0][AFO_INTEGRATED]->GetXaxis()->GetTitle()).EqualTo("integrated")) { @@ -2356,6 +2743,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() //============================================================ @@ -2369,7 +2760,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: @@ -2494,6 +2885,10 @@ void BookNUAHistograms() } // for(Int_t pdf=0;pdfSetStats(kFALSE); iv.fInternalValidationFlagsPro->SetLineColor(eColor); iv.fInternalValidationFlagsPro->SetFillColor(eFillColor); @@ -2581,6 +2976,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() //============================================================ @@ -2595,7 +2994,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: @@ -2620,6 +3019,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) @@ -2630,21 +3032,23 @@ 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? // 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; - // b3) Loop over particles; + // b2) Loop over particles; + // b3) Fill event histograms; // b4) Calculate correlations; // b5) Optionally, cross-check with nested loops; // c) Delete persistent objects. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Fourier like p.d.f. for azimuthal angles and flow amplitudes: @@ -2679,8 +3083,8 @@ 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"); - } // if (tc.fVerbose) { + 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. // Remark: The last parameter [3] is a random reaction plane, keep in sync with fPhiPDF->SetParameter(3,fReactionPlane); below @@ -2702,41 +3106,30 @@ 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 - - // b2) Fill event histograms: - 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); - } + 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 // 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); @@ -2748,7 +3141,7 @@ void InternalValidation() 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 @@ -2759,15 +3152,15 @@ 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]) { 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]) { 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: @@ -2809,11 +3202,11 @@ void InternalValidation() } // *) 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 + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT] || t0.fCalculateTest0AsFunctionOf[AFO_PT])) { + this->Fillqvector(dPhi, dPt, PTq); // first 2 arguments are passed by reference, 3rd argument is enum } - 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 + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA] || t0.fCalculateTest0AsFunctionOf[AFO_ETA])) { + this->Fillqvector(dPhi, dEta, ETAq); // first 2 arguments are passed by reference, 3rd argument is enum } // *) Fill nested loops containers: @@ -2822,6 +3215,7 @@ 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]) { break; @@ -2829,18 +3223,26 @@ void InternalValidation() } // for(Int_t p=0;pFill(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[eOccupancy][eSim][eAfter] ? true : eh.fEventHistograms[eCentrality][eSim][eAfter]->Fill(ebye.fOccupancy); + } + // *) 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)); + + // *) Print info on the current event number (total): + PrintEventCounter(eAfter); // *) If I reached max number of events, ignore the remaining collisions: if (MaxNumberOfEvents(eAfter)) { @@ -2859,6 +3261,10 @@ void InternalValidation() delete fvnPDF; } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void InternalValidation() //============================================================ @@ -2917,7 +3323,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: @@ -2967,6 +3373,9 @@ void BookTest0Histograms() if (AFO_ETA == v && !t0.fCalculateTest0AsFunctionOf[AFO_ETA]) { continue; } + if (AFO_OCCUPANCY == v && !t0.fCalculateTest0AsFunctionOf[AFO_OCCUPANCY]) { + continue; + } if (!res.fResultsPro[v]) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -2984,10 +3393,10 @@ void BookTest0Histograms() } */ t0.fTest0List->Add(t0.fTest0Pro[mo][mi][v]); // yes, this has to be here - } // for(Int_t v=0;vGetXaxis()->GetTitle()).EqualTo("integrated")) { @@ -2997,6 +3406,10 @@ 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() //============================================================ @@ -3009,7 +3422,7 @@ void BookResultsHistograms() // 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) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the profile holding flags: @@ -3039,6 +3452,10 @@ void BookResultsHistograms() } } // for (Int_t v = 0; v < eAsFunctionOf_N; v++) { + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookResultsHistograms() //============================================================ @@ -3051,7 +3468,7 @@ void BookTheRest() // *) ... if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Book the timer: @@ -3061,6 +3478,10 @@ void BookTheRest() tc.fTimer[eLocal] = new TStopwatch(); } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void BookTheRest() //============================================================ @@ -3071,8 +3492,7 @@ void Preprocess(T const& collision) // 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__); } // *) If I reached max number of events, ignore the remaining collisions: @@ -3097,6 +3517,10 @@ void Preprocess(T const& collision) } } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // template void Preprocess(T const& collision) //============================================================ @@ -3114,8 +3538,7 @@ void DetermineAndPropagateRunNumber(T const& collision) // b) Propagate run number to all booked objects, wherever that info is relevant. 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: @@ -3128,7 +3551,7 @@ void DetermineAndPropagateRunNumber(T const& collision) // b) Propagate run number to all booked objects, wherever that info is relevant: // *) 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 = ""; @@ -3165,8 +3588,8 @@ void DetermineAndPropagateRunNumber(T const& collision) eh.fEventHistograms[t][rs][ba]->SetTitle(histTitle.Data()); } } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for(Int_t t=0;tSetTitle(histTitle.Data()); } } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) // type, see enum eEventHistograms2D + } // for(Int_t rs=0;rs<2;rs++) // reco/sim + } // for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) // type, see enum eEventHistograms2D // *) particle histograms 2D: for (Int_t t = 0; t < eQAParticleHistograms2D_N; t++) // type, see enum eParticleHistograms2D @@ -3203,8 +3626,8 @@ void DetermineAndPropagateRunNumber(T const& collision) qa.fQAParticleHistograms2D[t][rs][ba]->SetTitle(histTitle.Data()); } } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for (Int_t t = 0; t < eQAParticleHistograms2D_N; t++) // type, see enum eParticleHistograms2D + } // for(Int_t rs=0;rs<2;rs++) // reco/sim + } // for (Int_t t = 0; t < eQAParticleHistograms2D_N; t++) // type, see enum eParticleHistograms2D // *) particle cuts: for (Int_t rs = 0; rs < 2; rs++) // reco/sim @@ -3239,8 +3662,8 @@ void DetermineAndPropagateRunNumber(T const& collision) ph.fParticleHistograms[t][rs][ba]->SetTitle(histTitle.Data()); } } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for(Int_t t=0;tSetTitle(histTitle.Data()); } } // for(Int_t ba=0;ba<2;ba++) - } // for(Int_t rs=0;rs<2;rs++) // reco/sim - } // for(Int_t t=0;t void DetermineAndPropagateRunNumber(T const& collision) @@ -3270,11 +3697,19 @@ void CheckCurrentRunNumber(T const& collision) { // Insanity check for the current run number. + if (tc.fVerbose) { + StartFunction(__FUNCTION__); + } + 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()); } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // template void CheckCurrentRunNumber(T const& collision) //============================================================ @@ -3289,12 +3724,13 @@ 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.fCentrality = 0.; + ebye.fOccupancy = 0.; // b) Q-vectors: if (qv.fCalculateQvectors) { @@ -3316,9 +3752,9 @@ void ResetEventByEventQuantities() qv.fqvector[PTq][bin - 1][h][wp] = TComplex(0., 0.); qv.fqvector[ETAq][bin - 1][h][wp] = TComplex(0., 0.); } // for (Int_t wp = 0; wp < gMaxCorrelator + 1; wp++) { // weight power - } // for (Int_t h = 0; h < gMaxHarmonic * gMaxCorrelator + 1; h++) { - } // for (Int_t b = 0; b < gMaxNoBinsKine; b++ ) { - } // if(qv.fCalculateQvectors) + } // for (Int_t h = 0; h < gMaxHarmonic * gMaxCorrelator + 1; h++) { + } // for (Int_t b = 0; b < gMaxNoBinsKine; b++ ) { + } // if(qv.fCalculateQvectors) // c) Reset ebe containers for nested loops: if (nl.fCalculateNestedLoops || nl.fCalculateCustomNestedLoops) { @@ -3350,6 +3786,10 @@ void ResetEventByEventQuantities() // ... TBI 20240117 port the rest ... + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void ResetEventByEventQuantities() //============================================================ @@ -3360,7 +3800,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: @@ -3436,6 +3876,10 @@ void EventCutsCounters(T1 const& collision, T2 const& tracks) // 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) //============================================================ @@ -3445,6 +3889,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); @@ -3455,7 +3901,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) ... @@ -3533,7 +3979,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; } @@ -3548,7 +3994,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; } @@ -3559,7 +4005,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; } @@ -3570,7 +4016,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; } @@ -3581,7 +4027,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; } @@ -3592,7 +4038,7 @@ 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; } @@ -3634,7 +4080,7 @@ 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; } @@ -3653,7 +4099,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) 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; } @@ -3664,7 +4110,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; } @@ -3675,7 +4121,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; } @@ -3705,7 +4151,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eMultFV0M]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eMultFV0M, eCutCounterBinning); - } else if (collision.multFV0M() < ec.fdEventCuts[eMultFV0M][eMin] || collision.multFV0M() > ec.fdEventCuts[eMultFV0M][eMax]) { + } else if (collision.multFV0M() < ec.fdEventCuts[eMultFV0M][eMin] || collision.multFV0M() > ec.fdEventCuts[eMultFV0M][eMax] || TMath::Abs(collision.multFV0M() - ec.fdEventCuts[eMultFV0M][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eVertex_z, cutModus)) { return kFALSE; } @@ -3716,7 +4162,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eMultFT0M]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eMultFT0M, eCutCounterBinning); - } else if (collision.multFT0M() < ec.fdEventCuts[eMultFT0M][eMin] || collision.multFT0M() > ec.fdEventCuts[eMultFT0M][eMax]) { + } else if (collision.multFT0M() < ec.fdEventCuts[eMultFT0M][eMin] || collision.multFT0M() > ec.fdEventCuts[eMultFT0M][eMax] || TMath::Abs(collision.multFT0M() - ec.fdEventCuts[eMultFT0M][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eVertex_z, cutModus)) { return kFALSE; } @@ -3727,7 +4173,7 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eMultTPC]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eMultTPC, eCutCounterBinning); - } else if (collision.multTPC() < ec.fdEventCuts[eMultTPC][eMin] || collision.multTPC() > ec.fdEventCuts[eMultTPC][eMax]) { + } else if (collision.multTPC() < ec.fdEventCuts[eMultTPC][eMin] || collision.multTPC() > ec.fdEventCuts[eMultTPC][eMax] || TMath::Abs(collision.multTPC() - ec.fdEventCuts[eMultTPC][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eVertex_z, cutModus)) { return kFALSE; } @@ -3738,13 +4184,24 @@ Bool_t EventCuts(T1 const& collision, T2 const& tracks, eCutModus cutModus) if (ec.fUseEventCuts[eMultNTracksPV]) { if (cutModus == eCutCounterBinning) { EventCut(eRec, eMultNTracksPV, eCutCounterBinning); - } else if (collision.multNTracksPV() < ec.fdEventCuts[eMultNTracksPV][eMin] || collision.multNTracksPV() > ec.fdEventCuts[eMultNTracksPV][eMax]) { + } else if (collision.multNTracksPV() < ec.fdEventCuts[eMultNTracksPV][eMin] || collision.multNTracksPV() > ec.fdEventCuts[eMultNTracksPV][eMax] || TMath::Abs(collision.multNTracksPV() - ec.fdEventCuts[eMultNTracksPV][eMax]) < tc.fFloatingPointPrecision) { if (!EventCut(eRec, eMultNTracksPV, cutModus)) { return kFALSE; } } } + // *) Occupancy: + if (ec.fUseEventCuts[eOccupancy]) { + if (cutModus == eCutCounterBinning) { + 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; + } + } + } + // ... // ... and corresponding MC truth simulated (Run 3 specific): @@ -3816,7 +4273,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; } @@ -3867,7 +4324,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; } @@ -3878,7 +4335,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; } @@ -3889,7 +4346,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; } @@ -3957,7 +4414,7 @@ Bool_t EventCut(Int_t rs, Int_t eventCut, eCutModus cutModus) template void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) { - // Fill all event histograms for reconstructed or simulated data. + // Fill all event histograms for reconstructed or simulated data. QA event histograms are also filled here. // a) Fill reconstructed, and corresponding MC truth simulated (common to Run 3, Run 2 and Run 1); // b) Fill only simulated (common to Run 3, Run 2 and Run 1); @@ -3968,22 +4425,23 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) // g) Test case. 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): if constexpr (rs == eRec || rs == eRecAndSim || rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { - // 1D: - !eh.fEventHistograms[eNumberOfEvents][eRec][ba] ? true : eh.fEventHistograms[eNumberOfEvents][eRec][ba]->Fill(0.5); // basically, if histogram is not booked, do nothing. 'true' is a placeholder, for the time being - !eh.fEventHistograms[eVertex_x][eRec][ba] ? true : eh.fEventHistograms[eVertex_x][eRec][ba]->Fill(collision.posX()); - !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[eCentrality][eRec][ba] ? true : eh.fEventHistograms[eCentrality][eRec][ba]->Fill(ebye.fCentrality); + if (eh.fFillEventHistograms) { + !eh.fEventHistograms[eNumberOfEvents][eRec][ba] ? true : eh.fEventHistograms[eNumberOfEvents][eRec][ba]->Fill(0.5); // basically, if histogram is not booked, do nothing. 'true' is a placeholder, for the time being + !eh.fEventHistograms[eVertex_x][eRec][ba] ? true : eh.fEventHistograms[eVertex_x][eRec][ba]->Fill(collision.posX()); + !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[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()); @@ -3998,34 +4456,47 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) LOGF(warning, "No MC collision for this collision, skip..."); return; } - !eh.fEventHistograms[eNumberOfEvents][eSim][ba] ? true : eh.fEventHistograms[eNumberOfEvents][eSim][ba]->Fill(0.5); - !eh.fEventHistograms[eVertex_x][eSim][ba] ? true : eh.fEventHistograms[eVertex_x][eSim][ba]->Fill(collision.mcCollision().posX()); - !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[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[eCentrality][eSim][ba]->Fill(ebye.fCentrality); // TBI 20240120 this case is still not supported in DetermineCentrality() + if (eh.fFillEventHistograms) { + !eh.fEventHistograms[eNumberOfEvents][eSim][ba] ? true : eh.fEventHistograms[eNumberOfEvents][eSim][ba]->Fill(0.5); + !eh.fEventHistograms[eVertex_x][eSim][ba] ? true : eh.fEventHistograms[eVertex_x][eSim][ba]->Fill(collision.mcCollision().posX()); + !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[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[eCentrality][eSim][ba]->Fill(ebye.fCentrality); // TBI 20240120 this case is still not supported in DetermineCentrality() + } } // if constexpr (rs == eRecAndSim) { - } // if constexpr (rs == eRec || rs == eRecAndSim) { + } // if constexpr (rs == eRec || rs == eRecAndSim) { // ----------------------------------------------------------------------------- // b) Fill only simulated (common to Run 3, Run 2 and Run 1): if constexpr (rs == eSim || 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[eSelectedTracks][eSim][ba] ? true : eh.fEventHistograms[eSelectedTracks][eSim][ba]->Fill(ebye.fSelectedTracks); // TBI 20240108 this one makes sense only for eAfter - // eh.fEventHistograms[eCentrality][eSim][ba]->Fill(ebye.fCentrality); // TBI 20240120 this case is still not supported in DetermineCentrality() - // eh.fEventHistograms[eTotalMultiplicity][eSim][ba]->Fill(tracks.size()); // TBI 20231030 check further how to use the same thing for 'sim' - } // if constexpr (rs == eSim) { + 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[eCentrality][eSim][ba]->Fill(ebye.fCentrality); // TBI 20240120 this case is still not supported in DetermineCentrality() + // eh.fEventHistograms[eTotalMultiplicity][eSim][ba]->Fill(tracks.size()); // TBI 20231030 check further how to use the same thing for 'sim' + } + } // ----------------------------------------------------------------------------- // c) Fill reconstructed (Run 3 specific): if constexpr (rs == eRec || rs == eRecAndSim) { - !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()); + 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); + } + // QA: + if (qa.fFillQAEventHistograms2D) { + !qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange][eRec][ba] ? true : qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_FT0COccupancyInTimeRange][eRec][ba]->Fill(collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); + !qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_MultTPC][eRec][ba] ? true : qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_MultTPC][eRec][ba]->Fill(collision.trackOccupancyInTimeRange(), collision.multTPC()); + !qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_Vertex_z][eRec][ba] ? true : qa.fQAEventHistograms2D[eTrackOccupancyInTimeRange_vs_Vertex_z][eRec][ba]->Fill(collision.trackOccupancyInTimeRange(), collision.posZ()); + } // ... and corresponding MC truth simulated (Run 3 specific) // See https://github.com/AliceO2Group/O2Physics/blob/master/Tutorials/src/mcHistograms.cxx @@ -4036,7 +4507,7 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) } // !eh.fEventHistograms[eNumberOfEvents][eSim][ba] ? true : eh.fEventHistograms[eNumberOfEvents][eSim][ba]->Fill(0.5); } // if constexpr (rs == eRecAndSim) { - } // if constexpr (rs == eRec || rs == eRecAndSim) { + } // if constexpr (rs == eRec || rs == eRecAndSim) { // ----------------------------------------------------------------------------- @@ -4049,7 +4520,9 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) // e) Fill reconstructed (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 == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { - !eh.fEventHistograms[eMultTracklets][eRec][ba] ? true : eh.fEventHistograms[eMultTracklets][eRec][ba]->Fill(collision.multTracklets()); + if (eh.fFillEventHistograms) { + !eh.fEventHistograms[eMultTracklets][eRec][ba] ? true : eh.fEventHistograms[eMultTracklets][eRec][ba]->Fill(collision.multTracklets()); + } // 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]); @@ -4066,7 +4539,7 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) // !eh.fEventHistograms[eNumberOfEvents][eSim][ba] ? true : eh.fEventHistograms[eNumberOfEvents][eSim][ba]->Fill(0.5); } // if constexpr (rs == eRecAndSim_Run2 || rs == eRecAndSim_Run1) { - } // if constexpr (rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { + } // if constexpr (rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { // ----------------------------------------------------------------------------- @@ -4081,11 +4554,17 @@ void FillEventHistograms(T1 const& collision, T2 const& tracks, eBeforeAfter ba) if constexpr (rs == eTest) { // TBI 20240223 for the time being, eTest fills only eRec histos: // A few example histograms, just to check if I access corresponding tables: - !eh.fEventHistograms[eVertex_z][eRec][ba] ? true : eh.fEventHistograms[eVertex_z][eRec][ba]->Fill(collision.posZ()); - !eh.fEventHistograms[eTotalMultiplicity][eRec][ba] ? true : eh.fEventHistograms[eTotalMultiplicity][eRec][ba]->Fill(tracks.size()); - !eh.fEventHistograms[eCentrality][eRec][ba] ? true : eh.fEventHistograms[eCentrality][eRec][ba]->Fill(ebye.fCentrality); + if (eh.fFillEventHistograms) { + !eh.fEventHistograms[eVertex_z][eRec][ba] ? true : eh.fEventHistograms[eVertex_z][eRec][ba]->Fill(collision.posZ()); + !eh.fEventHistograms[eTotalMultiplicity][eRec][ba] ? true : eh.fEventHistograms[eTotalMultiplicity][eRec][ba]->Fill(tracks.size()); + !eh.fEventHistograms[eCentrality][eRec][ba] ? true : eh.fEventHistograms[eCentrality][eRec][ba]->Fill(ebye.fCentrality); + } } // if constexpr (rs == eTest) { + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // template void FillEventHistograms(...) //============================================================ @@ -4102,7 +4581,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: @@ -4175,9 +4654,9 @@ void CheckUnderflowAndOverflow() LOGF(fatal, "\033[1;31m%s at line %d : overflow in y variable in fParticleHistograms2D[%d][%d][%d], for binX = %d => optimize default binning for this histogram\033[0m", __FUNCTION__, __LINE__, t, rs, ba, binX); } } // for (Int_t binX = 0; binX <= ph.fParticleHistograms2D[t][rs][ba]->GetNbinsX(); binX++) { - } // for (Int_t ba = 0; ba < 2; ba++) // before/after cuts - } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim - } // for (Int_t t = 0; t < eParticleHistograms2D_N; t++) // type, see enum eParticleHistograms2D + } // for (Int_t ba = 0; ba < 2; ba++) // before/after cuts + } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim + } // for (Int_t t = 0; t < eParticleHistograms2D_N; t++) // type, see enum eParticleHistograms2D // e) QA Event histograms 2D: for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) // type, see enum eQAEventHistograms2D @@ -4210,9 +4689,9 @@ void CheckUnderflowAndOverflow() LOGF(fatal, "\033[1;31m%s at line %d : overflow in y variable in fEventHistograms2D[%d][%d][%d], for binX = %d => optimize default binning for this histogram\033[0m", __FUNCTION__, __LINE__, t, rs, ba, binX); } } // for (Int_t binX = 0; binX <= qa.fQAEventHistograms2D[t][rs][ba]->GetNbinsX(); binX++) { - } // for (Int_t ba = 0; ba < 2; ba++) // before/after cuts - } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim - } // for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) // type, see enum eQAEventHistograms2D + } // for (Int_t ba = 0; ba < 2; ba++) // before/after cuts + } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim + } // for (Int_t t = 0; t < eQAEventHistograms2D_N; t++) // type, see enum eQAEventHistograms2D // f) QA Particle histograms 2D: for (Int_t t = 0; t < eQAParticleHistograms2D_N; t++) // type, see enum eQAParticleHistograms2D @@ -4245,9 +4724,13 @@ void CheckUnderflowAndOverflow() LOGF(fatal, "\033[1;31m%s at line %d : overflow in y variable in fParticleHistograms2D[%d][%d][%d], for binX = %d => optimize default binning for this histogram\033[0m", __FUNCTION__, __LINE__, t, rs, ba, binX); } } // for (Int_t binX = 0; binX <= qa.fQAParticleHistograms2D[t][rs][ba]->GetNbinsX(); binX++) { - } // for (Int_t ba = 0; ba < 2; ba++) // before/after cuts - } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim - } // for (Int_t t = 0; t < eQAParticleHistograms2D_N; t++) // type, see enum eParticleHistograms2D + } // for (Int_t ba = 0; ba < 2; ba++) // before/after cuts + } // 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() @@ -4266,7 +4749,7 @@ bool ValidTrack(T const& track) // 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()); @@ -4330,7 +4813,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: @@ -4391,6 +4874,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); @@ -4402,7 +4887,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) ... @@ -4412,7 +4897,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; } @@ -4423,7 +4908,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; } @@ -4434,7 +4919,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; } @@ -4446,7 +4931,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; } @@ -4523,7 +5009,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; } @@ -4534,7 +5020,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; } @@ -4545,7 +5031,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; } @@ -4556,7 +5042,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; } @@ -4567,7 +5053,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; } @@ -4711,7 +5197,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; } @@ -4722,7 +5208,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; } @@ -4733,7 +5219,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; } @@ -4842,7 +5328,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; } @@ -4853,7 +5339,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; } @@ -4864,7 +5350,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; } @@ -4927,7 +5413,7 @@ Bool_t ParticleCuts(T const& track, eCutModus cutModus) } } // if constexpr (rs == eRecAndSim || rs == eRecAndSim_Run2 || rs == eRecAndSim_Run1) { - } // if constexpr (rs == eRec || rs == eRecAndSim || rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { + } // if constexpr (rs == eRec || rs == eRecAndSim || rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { // *) Apply Toy NUA on info available only in simulated data: if constexpr (rs == eSim || rs == eSim_Run2 || rs == eSim_Run1) { @@ -5017,7 +5503,7 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // 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) { @@ -5033,34 +5519,39 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // But I have already tc.fProcess[eGenericRec] and tc.fProcess[eGenericRecSim], available, shall I simply re-use them? // 1D: - // 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 - - // 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 - - // 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 + 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 + + // 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 + + // 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 + } // 2D: - !ph.fParticleHistograms2D[ePhiPt][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eRec][ba]->Fill(track.phi(), track.pt(), weight); // 3 2 - !ph.fParticleHistograms2D[ePhiEta][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eRec][ba]->Fill(track.phi(), track.eta(), weight); + if (ph.fFillParticleHistograms2D) { + !ph.fParticleHistograms2D[ePhiPt][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eRec][ba]->Fill(track.phi(), track.pt(), weight); // 3 2 + !ph.fParticleHistograms2D[ePhiEta][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eRec][ba]->Fill(track.phi(), track.eta(), weight); + } // if (ph.fFillParticleHistograms2D) { + // QA: if (qa.fFillQAParticleHistograms2D) { - !qa.fQAParticleHistograms2D[edcaXY_vs_Pt][eRec][ba] ? true : qa.fQAParticleHistograms2D[edcaXY_vs_Pt][eRec][ba]->Fill(track.dcaXY(), track.pt()); + !qa.fQAParticleHistograms2D[ePt_vs_dcaXY][eRec][ba] ? true : qa.fQAParticleHistograms2D[ePt_vs_dcaXY][eRec][ba]->Fill(track.pt(), track.dcaXY()); } // ... and corresponding MC truth simulated (common to Run 3, Run 2 and Run 1) @@ -5073,18 +5564,24 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) return; } auto mcparticle = track.mcParticle(); // corresponding MC truth simulated particle + // 1D: - !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[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 + 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[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 + } + // 2D: - !ph.fParticleHistograms2D[ePhiPt][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eSim][ba]->Fill(mcparticle.phi(), mcparticle.pt(), weight); - !ph.fParticleHistograms2D[ePhiEta][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eSim][ba]->Fill(mcparticle.phi(), mcparticle.eta(), weight); + if (ph.fFillParticleHistograms2D) { + !ph.fParticleHistograms2D[ePhiPt][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eSim][ba]->Fill(mcparticle.phi(), mcparticle.pt(), weight); + !ph.fParticleHistograms2D[ePhiEta][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eSim][ba]->Fill(mcparticle.phi(), mcparticle.eta(), weight); + } // if(ph.fFillParticleHistograms2D) { } // if constexpr (rs == eRecAndSim || rs == eRecAndSim_Run2 || rs == eRecAndSim_Run1) { - } // if constexpr (rs == eRec || rs == eRecAndSim || rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { + } // if constexpr (rs == eRec || rs == eRecAndSim || rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { // ----------------------------------------------------------------------------- @@ -5093,14 +5590,19 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // Remark #2: In this branch, 'track' is always TracksSim = aod::McParticles, see https://aliceo2group.github.io/analysis-framework/docs/datamodel/ao2dTables.html#montecarlo if constexpr (rs == eSim || rs == eSim_Run2 || rs == eSim_Run1) { // 1D: - !ph.fParticleHistograms[ePhi][eSim][ba] ? true : ph.fParticleHistograms[ePhi][eSim][ba]->Fill(track.phi(), weight); - !ph.fParticleHistograms[ePt][eSim][ba] ? true : ph.fParticleHistograms[ePt][eSim][ba]->Fill(track.pt(), weight); - !ph.fParticleHistograms[eEta][eSim][ba] ? true : ph.fParticleHistograms[eEta][eSim][ba]->Fill(track.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(track.pdgCode(), weight); + if (ph.fFillParticleHistograms) { + !ph.fParticleHistograms[ePhi][eSim][ba] ? true : ph.fParticleHistograms[ePhi][eSim][ba]->Fill(track.phi(), weight); + !ph.fParticleHistograms[ePt][eSim][ba] ? true : ph.fParticleHistograms[ePt][eSim][ba]->Fill(track.pt(), weight); + !ph.fParticleHistograms[eEta][eSim][ba] ? true : ph.fParticleHistograms[eEta][eSim][ba]->Fill(track.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(track.pdgCode(), weight); + } // if(ph.fFillParticleHistograms) { + // 2D: - !ph.fParticleHistograms2D[ePhiPt][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eSim][ba]->Fill(track.phi(), track.pt(), weight); - !ph.fParticleHistograms2D[ePhiEta][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eSim][ba]->Fill(track.phi(), track.eta(), weight); + if (ph.fFillParticleHistograms2D) { + !ph.fParticleHistograms2D[ePhiPt][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eSim][ba]->Fill(track.phi(), track.pt(), weight); + !ph.fParticleHistograms2D[ePhiEta][eSim][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eSim][ba]->Fill(track.phi(), track.eta(), weight); + } // if(ph.fFillParticleHistograms2D) { } // if constexpr (rs == eSim || rs == eSim_Run2 || rs == eSim_Run1) { // ----------------------------------------------------------------------------- @@ -5125,7 +5627,7 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // ... } // if constexpr (rs == eRecAndSim) { - } // if constexpr (rs == eRec || rs == eRecAndSim) { + } // if constexpr (rs == eRec || rs == eRecAndSim) { // ----------------------------------------------------------------------------- @@ -5160,7 +5662,7 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // ... } // if constexpr (rs == eRecAndSim_Run2 || rs == eRecAndSim_Run1) { - } // if constexpr (rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { + } // if constexpr (rs == eRec_Run2 || rs == eRecAndSim_Run2 || rs == eRec_Run1 || rs == eRecAndSim_Run1) { // ----------------------------------------------------------------------------- @@ -5181,12 +5683,16 @@ void FillParticleHistograms(T const& track, eBeforeAfter ba, Int_t weight = 1) // This branch corresponds to process with minimal subscription - I implement just a few example cuts, just for testing purposes. // Only eRec is support in Test for the time being. // 1D: - !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); + if (ph.fFillParticleHistograms) { + !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); + } // 2D: - !ph.fParticleHistograms2D[ePhiPt][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eRec][ba]->Fill(track.phi(), track.pt(), weight); - !ph.fParticleHistograms2D[ePhiEta][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eRec][ba]->Fill(track.phi(), track.eta(), weight); + if (ph.fFillParticleHistograms2D) { + !ph.fParticleHistograms2D[ePhiPt][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiPt][eRec][ba]->Fill(track.phi(), track.pt(), weight); + !ph.fParticleHistograms2D[ePhiEta][eRec][ba] ? true : ph.fParticleHistograms2D[ePhiEta][eRec][ba]->Fill(track.phi(), track.eta(), weight); + } } // if constexpr (rs == eTest) { } // template void FillParticleHistograms(...) @@ -5204,7 +5710,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: @@ -5243,10 +5749,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; @@ -5269,6 +5775,10 @@ 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); + } // 4p: if (ebye.fSelectedTracks < 4) { @@ -5296,10 +5806,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; @@ -5322,6 +5832,10 @@ 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); + } // 6p: if (ebye.fSelectedTracks < 6) { @@ -5351,10 +5865,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; @@ -5377,6 +5891,10 @@ 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); + } // 8p: if (ebye.fSelectedTracks < 8) { @@ -5408,10 +5926,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; @@ -5434,12 +5952,66 @@ 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); + } + } // for(Int_t h=1;h<=gMaxHarmonic;h++) // harmonic - // c) Flush the generic Q-vectors: - ResetQ(); + // 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 stamenent \033[0m", __FUNCTION__, __LINE__); + } -} // void CalculateCorrelations() + // ... + + 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) //============================================================ @@ -5452,7 +6024,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: @@ -5610,11 +6182,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; @@ -5648,13 +6220,21 @@ void CalculateTest0() 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); + } } // if(t0.fTest0Labels[mo][mi]) - } // for(Int_t mi=0;miAt(h)->GetName()).Atoi(); delete oa; // yes, otherwise it's a memory leak @@ -5811,10 +6390,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; @@ -5857,11 +6436,15 @@ void CalculateKineTest0(eAsFunctionOf AFO_variable) } // fill in the bin center } // if(fTest0Labels[mo][mi]) - } // for(Int_t mi=0;miAddAt(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) //============================================================ @@ -5924,7 +6511,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); @@ -5977,9 +6564,14 @@ 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); + } } // for(int h=1; h<=6; h++) - } // for(int i2=0; i2Fill(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); + } } // 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); } - // 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); + } } // 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); } - // 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); + } } // for(int h=0; hGetNbinsX(); nBinsNL = nl.fNestedLoopsPro[0][0][v]->GetNbinsX(); if (nBinsQV != nBinsNL) { @@ -6211,16 +6820,20 @@ 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++) + } // 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++) LOGF(info, ""); // new line - } // for(Int_t o=0;o<4;o++) - } // for (Int_t v = 0; v < 3; v++) + } // for(Int_t o=0;o<4;o++) + } // for (Int_t v = 0; v < 3; v++) + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // void ComparisonNestedLoopsVsCorrelations() @@ -6455,7 +7068,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++) { @@ -6465,6 +7078,10 @@ void ResetQ() } } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void ResetQ() //============================================================ @@ -6474,7 +7091,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: @@ -6494,12 +7111,20 @@ void SetWeightsHist(TH1D* const hist, eWeights whichWeight) pw.fWeightsHist[whichWeight]->GetYaxis()->SetTitle(sWeights[whichWeight].Data()); pw.fWeightsHist[whichWeight]->SetFillColor(eFillColor); pw.fWeightsHist[whichWeight]->SetLineColor(eColor); - pw.fWeightsList->Add(pw.fWeightsHist[whichWeight]); + if (!pw.fWeightsList) { + LOGF(fatal, "\033[1;31m%s at line %d: fWeightsList is NULL. That means that you have called SetWeightsHist(...) in init(), before this TList was booked.\033[0m", __FUNCTION__, __LINE__); + } + pw.fWeightsList->Add(pw.fWeightsHist[whichWeight]); // This is working at the moment, because I am fetching all 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: pw.fUseWeights[whichWeight] = kTRUE; -} // void SetWeightsHist(TH1D* const hist, , eWeights whichWeight) + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + +} // void SetWeightsHist(TH1D* const hist, eWeights whichWeight) //============================================================ @@ -6507,8 +7132,11 @@ void SetDiffWeightsHist(TH1D* const hist, eDiffWeights whichDiffWeight, Int_t bi { // Copy histogram holding differential weights from an external file to the corresponding data member. + // Remark: Do not edit histogram title here, because that's done in GetHistogramWithWeights(), because I have "filePath" info there locally. + // 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: @@ -6521,14 +7149,15 @@ void SetDiffWeightsHist(TH1D* const hist, eDiffWeights whichDiffWeight, Int_t bi // Cosmetics: TBI 20240216 do I really want to overwrite initial cosmetics, perhaps this shall go better into MakeWeights.C ? // Or I could move all this to GetHistogramWithWeights, where in any case I am setting e.g. histogram title, etc. - TString sVariable[eWeights_N] = {"#varphi", "p_{t}", "#eta"}; // [phi,pt,eta] - TString sWeights[eWeights_N] = {"w_{#varphi}", "w_{p_{t}}", "w_{#eta}"}; + TString sVariable[eDiffWeights_N] = {"#varphi", "#varphi"}; // yes, for the time being, x-axis is always phi + TString sWeights[eDiffWeights_N] = {"(w_{#varphi})_{| p_{T}}", "(w_{#varphi})_{| #eta}"}; pw.fDiffWeightsHist[whichDiffWeight][bin]->SetStats(kFALSE); pw.fDiffWeightsHist[whichDiffWeight][bin]->GetXaxis()->SetTitle(sVariable[whichDiffWeight].Data()); pw.fDiffWeightsHist[whichDiffWeight][bin]->GetYaxis()->SetTitle(sWeights[whichDiffWeight].Data()); pw.fDiffWeightsHist[whichDiffWeight][bin]->SetFillColor(eFillColor); pw.fDiffWeightsHist[whichDiffWeight][bin]->SetLineColor(eColor); - pw.fWeightsList->Add(pw.fDiffWeightsHist[whichDiffWeight][bin]); + pw.fWeightsList->Add(pw.fDiffWeightsHist[whichDiffWeight][bin]); // This is working at the moment, because I am fetching all 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: if (!pw.fUseDiffWeights[whichDiffWeight]) // yes, set it only once to kTRUE, for all bins @@ -6536,6 +7165,10 @@ 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) //============================================================ @@ -6545,7 +7178,13 @@ 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: @@ -6567,6 +7206,10 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const // Nevertheless, I could switch to enums and make it more general, i.e. I could introduce additional data members and configurables, // for the names of histograms with weights. Like I did it in void GetHistogramWithCustomNUA(const char* filePath, eNUAPDF variable) + // 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. + // If I decide to promote filePath to data member, implement it as an array, to allow possibility that different catagories of weights are fetched from different external files. + // a) Return value; // b) Basic protection for arguments; // c) Determine from filePath if the file in on a local machine, or in AliEn, or in CCDB; @@ -6576,7 +7219,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); @@ -6610,7 +7253,7 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const if (TString(filePath).BeginsWith("/alice-ccdb.cern.ch/")) { bFileIsInCCDB = kTRUE; } // else { - } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { + } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { if (bFileIsInAliEn) { // d) Handle the AliEn case: @@ -6634,7 +7277,12 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumber)); if (!listWithRuns) { - LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + 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) { @@ -6666,10 +7314,14 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - listWithRuns = - reinterpret_cast(GetObjectFromList(baseList, runNumber)); + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumber)); if (!listWithRuns) { - LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + 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 { @@ -6700,10 +7352,14 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - listWithRuns = - reinterpret_cast(GetObjectFromList(baseList, runNumber)); + listWithRuns = reinterpret_cast(GetObjectFromList(baseList, runNumber)); if (!listWithRuns) { - LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + 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 { @@ -6729,7 +7385,7 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } hist->SetDirectory(0); - hist->SetTitle(Form("%s, %s", filePath, runNumber)); + hist->SetTitle(Form("%s, %s", filePath, runNumber)); // I have to do it here, because only here I have "filePath" av } else { // Differential weights: @@ -6746,21 +7402,65 @@ TH1D* GetHistogramWithWeights(const char* filePath, const char* runNumber, const hist = reinterpret_cast(GetObjectFromList(listWithRuns, Form("%s[%d]", variable, bin))); // yes, for some simple tests I can have only histogram named e.g. 'phipt[0]' } if (!hist) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + LOGF(info, "\033[1;31m Form(\"%%s[%%d]\", variable, bin) = %s\033[0m", Form("%s[%d]", variable, bin)); listWithRuns->ls(); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } - hist->SetDirectory(0); + // *) insanity check for differential weights => check if boundaries of current bin are the same as bin boundaries for which these weights were calculated. + // This way I ensure that weights correspond to same kinematic cuts and binning as in current analysis. + // Current example format which was set in MakeWeights.C: someString(s), min < kinematic-variable-name < max + // Algorithm: IFS is " " and I take (N-1)th and (N-5)th entry: + TObjArray* oa = TString(hist->GetTitle()).Tokenize(" "); + if (!oa) { + LOGF(fatal, "in function \033[1;31m%s at line %d \n hist->GetTitle() = %s\033[0m", __FUNCTION__, __LINE__, hist->GetTitle()); + } + Int_t nEntries = oa->GetEntries(); + + // I need to figure out corresponding variable from results histograms and its formatting: + eAsFunctionOf AFO = eAsFunctionOf_N; + const char* lVariableName = ""; if (TString(variable).EqualTo("phipt")) { - hist->SetTitle(Form("%s, %.2f < p_{T} < %.2f", filePath, res.fResultsProVariableLengthBins[AFO_PT]->At(bin), res.fResultsProVariableLengthBins[AFO_PT]->At(bin + 1))); + AFO = AFO_PT; + lVariableName = FancyFormatting("Pt"); + } else if (TString(variable).EqualTo("phieta")) { + AFO = AFO_ETA; + lVariableName = FancyFormatting("Eta"); + } else { + LOGF(fatal, "\033[1;31m%s at line %d : name = %s is not supported yet. \033[0m", __FUNCTION__, __LINE__, static_cast(variable)); + } + + // Get min and max value for bin, stored locally: + Float_t min = res.fResultsPro[AFO]->GetBinLowEdge(bin + 1); + Float_t max = res.fResultsPro[AFO]->GetBinLowEdge(bin + 2); + if (min > max) { + LOGF(fatal, "\033[1;33m min = %f, max = %f, res.fResultsPro[AFO]->GetName() = %s\033[0m", min, max, res.fResultsPro[AFO]->GetName()); } - if (TString(variable).EqualTo("phieta")) { - hist->SetTitle(Form("%s, %.2f < #eta < %.2f", filePath, res.fResultsProVariableLengthBins[AFO_ETA]->At(bin), res.fResultsProVariableLengthBins[AFO_ETA]->At(bin + 1))); + + // 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) < 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) < 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); } + delete oa; // yes, otherwise it's a memory leak + + // *) final settings and cosmetics: + hist->SetDirectory(0); + hist->SetTitle(Form("%s, %.2f < %s < %.2f", filePath, min, lVariableName, max)); } // else + // 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) @@ -6783,7 +7483,7 @@ TObjArray* GetObjArrayWithLabels(const char* filePath) // e) Handle the local case. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Return value: @@ -6805,7 +7505,7 @@ TObjArray* GetObjArrayWithLabels(const char* filePath) if (TString(filePath).BeginsWith("/alice-ccdb.cern.ch/")) { bFileIsInCCDB = kTRUE; } // else { - } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { + } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { TFile* oaFile = NULL; // file holding TObjArray with all labels if (bFileIsInAliEn) { @@ -6897,6 +7597,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; @@ -6926,7 +7627,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()); @@ -6960,7 +7661,7 @@ void GetHistogramWithCustomNUA(const char* filePath, eNUAPDF variable) if (TString(filePath).BeginsWith("/alice-ccdb.cern.ch/")) { bFileIsInCCDB = kTRUE; } // else { - } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { + } // if (TString(filePath).BeginsWith("/alice/cern.ch/")) { if (bFileIsInAliEn) { // d) Handle the AliEn case: @@ -7039,6 +7740,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) //============================================================ @@ -7054,7 +7759,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; @@ -7112,10 +7817,14 @@ void StoreLabelsInPlaceholder() if (TMath::Abs(TString(temp->At(h)->GetName()).Atoi()) > gMaxHarmonic) { LOGF(info, "\033[1;31m bin = %d, label = %s, gMaxHarmonic = %d\033[0m", b, t0.fTest0LabelsPlaceholder->GetXaxis()->GetBinLabel(b), static_cast(gMaxHarmonic)); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); - } // if(TString(temp->At(h)->GetName()).Atoi() > gMaxHarmonic) { - } // for(Int_t h = 0; h < temp->GetEntries(); h++) { + } // if(TString(temp->At(h)->GetName()).Atoi() > gMaxHarmonic) { + } // for(Int_t h = 0; h < temp->GetEntries(); h++) { delete temp; // yes, otherwise it's a memory leak - } // for(Int_t b = 1; b <= t0.fTest0LabelsPlaceholder->GetXaxis()->GetNbins(); b++) { + } // for(Int_t b = 1; b <= t0.fTest0LabelsPlaceholder->GetXaxis()->GetNbins(); b++) { + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // void StoreLabelsInPlaceholder() @@ -7127,7 +7836,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? @@ -7150,21 +7859,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 @@ -7184,6 +7893,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__); @@ -7214,6 +7927,10 @@ TObject* GetObjectFromList(TList* list, } } // while(objectIter = next()) + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + return NULL; } // TObject* GetObjectFromList(TList *list, Char_t *objectName) @@ -7225,7 +7942,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)); } @@ -7243,6 +7960,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 @@ -7253,6 +7974,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 @@ -7321,6 +8046,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) @@ -7340,7 +8069,7 @@ void GetParticleWeights() // b) Differential weights. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Integrated weights: @@ -7377,10 +8106,26 @@ void GetParticleWeights() TH1D* phiptWeights = NULL; Int_t nPtBins = res.fResultsPro[AFO_PT]->GetXaxis()->GetNbins(); for (Int_t b = 0; b < nPtBins; b++) { + + // *) check if particles in this pt bin survive particle cuts in pt. If not, skip this bin, because for that pt bin weights are simply not available: + if (!(res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2) > pc.fdParticleCuts[ePt][eMin])) { + // this branch protects against the case when I am e.g. in pt bin [0.0,0.2], and pt cut is 0.2 < pt < 5.0 + LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(pt) weight for pt bin = %d from (%f,%f), which is outside (below) pt phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2), pc.fdParticleCuts[ePt][eMin], pc.fdParticleCuts[ePt][eMax]); + continue; + } + if (!(res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1) < pc.fdParticleCuts[ePt][eMax])) { + // this branch protects against the case when I am e.g. in pt bin [5.0,10.0], and pt cut is 0.2 < pt < 5.0 + LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(pt) weight for pt bin = %d from (%f,%f), which is outside (above) pt phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_PT]->GetBinLowEdge(b + 2), pc.fdParticleCuts[ePt][eMin], pc.fdParticleCuts[ePt][eMax]); + continue; + } + + // *) okay, this pt bin is within pt phase-space window, defined by pt cut: phiptWeights = GetHistogramWithWeights(pw.fFileWithWeights.Data(), tc.fRunNumber.Data(), "phipt", b); if (!phiptWeights) { LOGF(fatal, "\033[1;31m%s at line %d : phiptWeights is NULL. Check the external file %s with particle weights\033[0m", __FUNCTION__, __LINE__, pw.fFileWithWeights.Data()); } + + // *) okay, just use this histogram with weights: SetDiffWeightsHist(phiptWeights, wPHIPT, b); } } // if (pw.fUseDiffWeights[wPHIPT]) { @@ -7390,13 +8135,33 @@ void GetParticleWeights() TH1D* phietaWeights = NULL; Int_t nEtaBins = res.fResultsPro[AFO_ETA]->GetXaxis()->GetNbins(); for (Int_t b = 0; b < nEtaBins; b++) { + + // *) check if particles in this eta bin survive particle cuts in eta. If not, skip this bin, because for that eta bin weights are simply not available: + if (!(res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2) > pc.fdParticleCuts[eEta][eMin])) { + // this branch protects against the case when I am e.g. in eta bin [-1.0,-0.8], and eta cut is -0.8 < eta < 0.8 + LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(eta) weight for eta bin = %d from (%f,%f), which is outside (below) eta phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2), pc.fdParticleCuts[eEta][eMin], pc.fdParticleCuts[eEta][eMax]); + continue; + } + if (!(res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1) < pc.fdParticleCuts[eEta][eMax])) { + // this branch protects against the case when I am e.g. in eta bin [0.8,1.0], and eta cut is 0.8 < eta < 1.0 + LOGF(info, "\033[1;33m%s at line %d : you are requesting phi(eta) weight for eta bin = %d from (%f,%f), which is outside (above) eta phase space = (%f,%f). Skipping this bin. \033[0m", __FUNCTION__, __LINE__, b, res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 1), res.fResultsPro[AFO_ETA]->GetBinLowEdge(b + 2), pc.fdParticleCuts[eEta][eMin], pc.fdParticleCuts[eEta][eMax]); + continue; + } + + // *) okay, this eta bin is within eta phase-space window, defined by eta cut: phietaWeights = GetHistogramWithWeights(pw.fFileWithWeights.Data(), tc.fRunNumber.Data(), "phieta", b); if (!phietaWeights) { LOGF(fatal, "\033[1;31m%s at line %d : phietaWeights is NULL. Check the external file %s with particle weights\033[0m", __FUNCTION__, __LINE__, pw.fFileWithWeights.Data()); } + + // *) okay, just use this histogram with weights: SetDiffWeightsHist(phietaWeights, wPHIETA, b); } // 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; @@ -7450,6 +8215,9 @@ Bool_t MaxNumberOfEvents(eBeforeAfter ba) } // *) Hasta la vista: + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } return reachedMaxNumberOfEvents; } // void MaxNumberOfEvents(eBeforeAfter ba) @@ -7459,9 +8227,10 @@ Bool_t MaxNumberOfEvents(eBeforeAfter ba) void PrintEventCounter(eBeforeAfter ba) { // Print how many events were processed by now. + // 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: @@ -7474,19 +8243,30 @@ void PrintEventCounter(eBeforeAfter ba) } 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))); - } + + // *) special treatment for internal validation - for the time being, I fill there only [eSim][eAfter]: + if (iv.fUseInternalValidation && eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]) { + LOGF(info, " Processing on-the-fly event # %d (total) .... ", static_cast(eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]->GetBinContent(1))); + break; + } + + // *) all other cases, besides internal validation: + if (eh.fEventHistograms[eNumberOfEvents][eRec][eBefore] && eh.fEventHistograms[eNumberOfEvents][eRec][eAfter]) { + 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] && eh.fEventHistograms[eNumberOfEvents][eSim][eAfter]) { + 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))); } + break; default: LOGF(fatal, "\033[1;31m%s at line %d : enum ba = %d is not supported yet. \033[0m", __FUNCTION__, __LINE__, static_cast(ba)); break; } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void PrintEventCounter(eBeforeAfter ba) //============================================================ @@ -7498,7 +8278,7 @@ void EventCounter(eEventCounter eVar) // 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) { @@ -7513,10 +8293,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; @@ -7525,6 +8305,10 @@ void EventCounter(eEventCounter eVar) break; } // switch(eVar) + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void EventCounter() //============================================================ @@ -7538,8 +8322,9 @@ 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: @@ -7567,6 +8352,20 @@ const char* FancyFormatting(const char* name) } } 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")) { + if (ec.fsEventCuts[eOccupancyEstimator].BeginsWith("Track")) { + fancyFormatting = "Occupancy (getter trackOccupancyInTimeRange())"; + } else if (ec.fsEventCuts[eOccupancyEstimator].BeginsWith("FT0C")) { + fancyFormatting = "Occupancy (getter ft0cOccupancyInTimeRange())"; + } + } + + if (tc.fVerboseUtility) { + ExitFunction(__FUNCTION__); } return fancyFormatting; @@ -7585,7 +8384,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) { @@ -7764,22 +8563,25 @@ Double_t CalculateCustomNestedLoops(TArrayI* harmonics) // ... it's easy to continue the above pattern here } // for(int i12=0; i12GetBinContent(1); delete profile; profile = NULL; + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } return finalValue; } // Double_t CalculateCustomNestedLoops(TArrayI *harmonics) @@ -7796,7 +8598,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) { @@ -7805,12 +8607,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)); @@ -7836,15 +8641,16 @@ 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... @@ -8004,22 +8810,25 @@ Double_t CalculateKineCustomNestedLoops(TArrayI* harmonics, eAsFunctionOf AFO_va // ... it's easy to continue the above pattern here } // for(int i12=0; i12GetBinContent(1); delete profile; profile = NULL; + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } return finalValue; } // Double_t CalculateKineCustomNestedLoops(TArrayI *harmonics, eAsFunctionOf AFO_variable, Int_t bin) @@ -8037,10 +8846,11 @@ 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: @@ -8112,24 +8922,73 @@ 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) + +//============================================================ + 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) { @@ -8149,6 +9008,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) //============================================================ @@ -8168,7 +9031,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: @@ -8191,7 +9054,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.): @@ -8216,7 +9079,7 @@ void BanishmentLoopOverParticles(T const& tracks) lSelectedTracks++; // *) Banish particle histograms after particle cuts: - if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D) { + if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D || qa.fFillQAParticleHistograms2D) { FillParticleHistograms(track, eAfter, -1); // with negative weight -1, I effectively remove the previous fill for this track } @@ -8233,6 +9096,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) { //============================================================ @@ -8245,7 +9112,7 @@ void PrintCutCounterContent() // b) Print or die. if (tc.fVerbose) { - LOGF(info, "\033[1;32m%s\033[0m", __FUNCTION__); + StartFunction(__FUNCTION__); } // a) Insanity checks: @@ -8269,7 +9136,11 @@ void PrintCutCounterContent() LOGF(info, "bin = %d => %s : %d", bin, ec.fEventCutCounterHist[rs][cc]->GetXaxis()->GetBinLabel(bin), static_cast(ec.fEventCutCounterHist[rs][cc]->GetBinContent(bin))); } } // for (Int_t cc = 0; cc < eCutCounter_N; cc++) // enum eCutCounter - } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim + } // for (Int_t rs = 0; rs < 2; rs++) // reco/sim + + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } } // void PrintCutCounterContent() @@ -8286,12 +9157,32 @@ void Trace(const char* functionName, Int_t lineNumber) //============================================================ +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() { // 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 (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? @@ -8335,7 +9226,10 @@ void BailOut() f->Close(); // *) 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 (tc.fVerbose) { + 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()); + ExitFunction(__FUNCTION__); + } } // void BailOut() @@ -8350,7 +9244,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); @@ -8396,8 +9290,12 @@ void FillQvector(const Double_t& dPhi, const Double_t& dPt, const Double_t& dEta qv.fQvector[h][wp] += TComplex(TMath::Cos(h * dPhi), TMath::Sin(h * dPhi)); // bare Q-vector without weights } } // for(Int_t wp=0;wpFillqvector(dPhi, dPt, PTq); 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: @@ -8487,7 +9385,7 @@ void Fillqvector(const Double_t& dPhi, const Double_t& kineVarValue, eqvectorKin qv.fqvector[kineVarChoice][bin - 1][h][wp] += TComplex(TMath::Cos(h * dPhi), TMath::Sin(h * dPhi)); // bare q-vector without weights } } // for(Int_t wp=0;wp(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) { @@ -8544,10 +9446,16 @@ 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. } } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // void CalculateEverything() //============================================================ @@ -8560,13 +9468,14 @@ void Steer(T1 const& collision, T2 const& tracks) // 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 + StartFunction(__FUNCTION__); } // *) 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; } @@ -8585,14 +9494,17 @@ void Steer(T1 const& collision, T2 const& tracks) 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.): + // *) 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); // *) Determine collision centrality: DetermineCentrality(collision); + // *) Determine collision occupancy: + DetermineOccupancy(collision); + // *) Fill event histograms before event cuts: - if (eh.fFillEventHistograms) { + if (eh.fFillEventHistograms || qa.fFillQAEventHistograms2D) { FillEventHistograms(collision, tracks, eBefore); } @@ -8634,7 +9546,7 @@ void Steer(T1 const& collision, T2 const& tracks) } // *) 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) { + if (eh.fFillEventHistograms || qa.fFillQAEventHistograms2D) { FillEventHistograms(collision, tracks, eAfter); } @@ -8663,6 +9575,10 @@ void Steer(T1 const& collision, T2 const& tracks) tc.fTimer[eGlobal]->Continue(); // yes } + if (tc.fVerbose) { + ExitFunction(__FUNCTION__); + } + } // template void Steer(T1 const* collision, T2 const* tracks) //============================================================ @@ -8684,7 +9600,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: @@ -8719,7 +9635,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.): @@ -8728,7 +9644,7 @@ void MainLoopOverParticles(T const& tracks) } // *) Fill particle histograms before particle cuts: - if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D) { + if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D || qa.fFillQAParticleHistograms2D) { FillParticleHistograms(track, eBefore); } @@ -8743,7 +9659,7 @@ void MainLoopOverParticles(T const& tracks) } // *) Fill particle histograms after particle cuts: - if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D) { + if (ph.fFillParticleHistograms || ph.fFillParticleHistograms2D || qa.fFillQAParticleHistograms2D) { FillParticleHistograms(track, eAfter); } @@ -8759,11 +9675,11 @@ void MainLoopOverParticles(T const& tracks) } // *) 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 + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_PT] || t0.fCalculateTest0AsFunctionOf[AFO_PT])) { + this->Fillqvector(dPhi, dPt, PTq); // first 2 arguments are passed by reference, 3rd argument is enum } - 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 + if (qv.fCalculateQvectors && (mupa.fCalculateCorrelationsAsFunctionOf[AFO_ETA] || t0.fCalculateTest0AsFunctionOf[AFO_ETA])) { + this->Fillqvector(dPhi, dEta, ETAq); // first 2 arguments are passed by reference, 3rd argument is enum } // *) Fill nested loops containers: @@ -8796,6 +9712,9 @@ 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) { #endif // PWGCF_MULTIPARTICLECORRELATIONS_CORE_MUPA_MEMBERFUNCTIONS_H_ diff --git a/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx b/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx index face9b469d2..f16e72accd1 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/ThreeParticleCorrelations.cxx @@ -15,6 +15,9 @@ #include "Common/DataModel/PIDResponse.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "TPDGCode.h" +#include "TLorentzVector.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; @@ -24,11 +27,14 @@ struct ThreePartCorr { // Histogram registry HistogramRegistry MECorrRegistry{"MECorrRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry SECorrRegistry{"SECorrRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry MCRegistry{"MCRegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry QARegistry{"QARegistry", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; - // Collision filters + // Collision & Event filters Filter CollCent = aod::cent::centFT0C > 0.0f && aod::cent::centFT0C < 90.0f; Filter CollZvtx = nabs(aod::collision::posZ) < 7.0f; + Filter MCCollZvtx = nabs(aod::mccollision::posZ) < 7.0f; + Filter EvSelect = aod::evsel::sel8 == true; // V0 filters Filter V0Pt = aod::v0data::pt > 0.6f && aod::v0data::pt < 12.0f; @@ -37,15 +43,26 @@ struct ThreePartCorr { // Track filters Filter TrackPt = aod::track::pt > 0.2f && aod::track::pt < 3.0f; Filter TrackEta = nabs(aod::track::eta) < 0.8f; + Filter GlobalTracks = requireGlobalTrackInFilter(); + + // Particle filters + Filter ParticlePt = aod::mcparticle::pt > 0.2f && aod::mcparticle::pt < 3.0f; + Filter ParticleEta = nabs(aod::mcparticle::eta) < 0.8f; - // Table aliases - using MyFilteredCollisions = soa::Filtered>; + // Table aliases - Data + using MyFilteredCollisions = soa::Filtered>; using MyFilteredCollision = MyFilteredCollisions::iterator; using MyFilteredV0s = soa::Filtered; - using MyFilteredTracks = soa::Filtered>; + // Table aliases - MC + using MyFilteredMCGenCollision = soa::Filtered::iterator; + using MyFilteredMCParticles = soa::Filtered; + using MyFilteredMCRecCollision = soa::Filtered>::iterator; + using MyFilteredMCTracks = soa::Filtered>; + // Mixed-events binning policy SliceCache cache; ConfigurableAxis ConfCentBins{"ConfCentBins", {VARIABLE_WIDTH, 0.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f, 90.0f}, "ME Centrality binning"}; @@ -55,8 +72,12 @@ struct ThreePartCorr { BinningType CollBinning{{ConfCentBins, ConfZvtxBins}, true}; Pair pair{CollBinning, 5, -1, &cache}; + // Process configurables + Configurable ConfFilterSwitch{"ConfFilterSwitch", false, "Switch for the FakeV0Filter function"}; + // Particle masses - Double_t massLambda = 1.115683; + Double_t massLambda = o2::constants::physics::MassLambda0; + Double_t DGaussSigma = 0.0021; // Correlation variables Int_t T_Sign; @@ -74,7 +95,8 @@ struct ThreePartCorr { const AxisSpec ZvtxAxis{ConfZvtxBins}; const AxisSpec PhiAxis{36, (-1. / 2) * M_PI, (3. / 2) * M_PI}; const AxisSpec EtaAxis{32, -1.52, 1.52}; - const AxisSpec PtAxis{120, 0, 12}; + const AxisSpec V0PtAxis{114, 0.6, 12}; + const AxisSpec TrackPtAxis{28, 0.2, 3}; const AxisSpec LambdaInvMassAxis{100, 1.08, 1.16}; QARegistry.add("hTrackPt", "hTrackPt", {HistType::kTH1D, {{100, 0, 4}}}); @@ -91,12 +113,25 @@ struct ThreePartCorr { QARegistry.add("hBetaPion", "hBetaPion", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); QARegistry.add("hBetaKaon", "hBetaKaon", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); QARegistry.add("hBetaProton", "hBetaProton", {HistType::kTH2D, {{56, 0.2, 3.0}, {70, 0.4, 1.1}}}); - // QARegistry.add("hNSigmaPion", "hNSigmaPion", {HistType::kTH2D, {{28, 0.2, 3.0}, {201, -5.025, 5.025}}}); - // QARegistry.add("hNSigmaKaon", "hNSigmaKaon", {HistType::kTH2D, {{28, 0.2, 3.0}, {201, -5.025, 5.025}}}); - // QARegistry.add("hNSigmaProton", "hNSigmaProton", {HistType::kTH2D, {{28, 0.2, 3.0}, {201, -5.025, 5.025}}}); - - QARegistry.add("hInvMassLambda", "hInvMassLambda", {HistType::kTH3D, {{LambdaInvMassAxis}, {PtAxis}, {CentralityAxis}}}); - QARegistry.add("hInvMassAntiLambda", "hInvMassAntiLambda", {HistType::kTH3D, {{LambdaInvMassAxis}, {PtAxis}, {CentralityAxis}}}); + QARegistry.add("hNSigmaPion", "hNSigmaPion", {HistType::kTH2D, {{201, -5.025, 5.025}, {201, -5.025, 5.025}}}); + QARegistry.add("hNSigmaKaon", "hNSigmaKaon", {HistType::kTH2D, {{201, -5.025, 5.025}, {201, -5.025, 5.025}}}); + QARegistry.add("hNSigmaProton", "hNSigmaProton", {HistType::kTH2D, {{201, -5.025, 5.025}, {201, -5.025, 5.025}}}); + + QARegistry.add("hInvMassLambda", "hInvMassLambda", {HistType::kTH3D, {{LambdaInvMassAxis}, {V0PtAxis}, {CentralityAxis}}}); + QARegistry.add("hInvMassAntiLambda", "hInvMassAntiLambda", {HistType::kTH3D, {{LambdaInvMassAxis}, {V0PtAxis}, {CentralityAxis}}}); + + 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("hRecPionP", "hRecPionP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hRecPionN", "hRecPionN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hRecKaonP", "hRecKaonP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hRecKaonN", "hRecKaonN", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hRecProtonP", "hRecProtonP", {HistType::kTH1D, {TrackPtAxis}}); + MCRegistry.add("hRecProtonN", "hRecProtonN", {HistType::kTH1D, {TrackPtAxis}}); 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}}}); @@ -133,15 +168,15 @@ struct ThreePartCorr { if (A_PID[0] == 0.0) { // Pions QARegistry.fill(HIST("hdEdxPion"), track.p(), track.tpcSignal()); QARegistry.fill(HIST("hBetaPion"), track.p(), track.beta()); - // QARegistry.fill(HIST("hNSigmaPion"), track.pt(), track.tpcNSigmaPi()); + QARegistry.fill(HIST("hNSigmaPion"), track.tpcNSigmaPi(), track.tofNSigmaPi()); } else if (A_PID[0] == 1.0) { // Kaons QARegistry.fill(HIST("hdEdxKaon"), track.p(), track.tpcSignal()); QARegistry.fill(HIST("hBetaKaon"), track.p(), track.beta()); - // QARegistry.fill(HIST("hNSigmaKaon"), track.pt(), track.tpcNSigmaKa()); + QARegistry.fill(HIST("hNSigmaKaon"), track.tpcNSigmaKa(), track.tofNSigmaKa()); } else if (A_PID[0] == 2.0) { // Protons QARegistry.fill(HIST("hdEdxProton"), track.p(), track.tpcSignal()); QARegistry.fill(HIST("hBetaProton"), track.p(), track.beta()); - // QARegistry.fill(HIST("hNSigmaProton"), track.pt(), track.tpcNSigmaPr()); + QARegistry.fill(HIST("hNSigmaProton"), track.tpcNSigmaPr(), track.tofNSigmaPr()); } } } @@ -162,26 +197,28 @@ struct ThreePartCorr { for (const auto& associate : tracks) { if (TrackFilters(trigger, associate)) { - - A_PID = TrackPID(associate); - DeltaPhi = DeltaPhiShift(trigger.phi(), associate.phi()); - DeltaEta = trigger.eta() - associate.eta(); - - if (CandMass >= 1.10 && CandMass <= 1.13) { - if (A_PID[0] == 0) { // Pions - SECorrRegistry.fill(HIST("hSameLambdaPion_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 1) { // Kaons - SECorrRegistry.fill(HIST("hSameLambdaKaon_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 2) { // Protons - SECorrRegistry.fill(HIST("hSameLambdaProton_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); - } - } else { - if (A_PID[0] == 0) { // Pions - SECorrRegistry.fill(HIST("hSameLambdaPion_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 1) { // Kaons - SECorrRegistry.fill(HIST("hSameLambdaKaon_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 2) { // Protons - SECorrRegistry.fill(HIST("hSameLambdaProton_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + if (FakeV0Filter(trigger, associate)) { + + A_PID = TrackPID(associate); + DeltaPhi = DeltaPhiShift(trigger.phi(), associate.phi()); + DeltaEta = trigger.eta() - associate.eta(); + + 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()); + } else if (A_PID[0] == 1.0) { // Kaons + SECorrRegistry.fill(HIST("hSameLambdaKaon_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + } else if (A_PID[0] == 2.0) { // Protons + SECorrRegistry.fill(HIST("hSameLambdaProton_SGNL"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + } + } 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()); + } else if (A_PID[0] == 1.0) { // Kaons + SECorrRegistry.fill(HIST("hSameLambdaKaon_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + } else if (A_PID[0] == 2.0) { // Protons + SECorrRegistry.fill(HIST("hSameLambdaProton_SB"), DeltaPhi, DeltaEta, collision.centFT0C(), collision.posZ(), T_Sign, associate.sign()); + } } } } @@ -190,44 +227,43 @@ struct ThreePartCorr { } // End of the V0-Track Correlations } - PROCESS_SWITCH(ThreePartCorr, processSame, "Process same-event correlations", true); - void processMixed(MyFilteredCollisions const& collisions, MyFilteredV0s const& v0s, MyFilteredTracks const& tracks) + void processMixed(MyFilteredCollisions const&, MyFilteredV0s const&, MyFilteredTracks const&) { - LOGF(info, "Input data Collisions %d, V0s %d, Tracks %d ", collisions.size(), v0s.size(), tracks.size()); - // Start of the Mixed-events Correlations for (const auto& [coll_1, v0_1, coll_2, track_2] : pair) { for (const auto& [trigger, associate] : soa::combinations(soa::CombinationsFullIndexPolicy(v0_1, track_2))) { if (V0Filters(trigger) && TrackFilters(trigger, associate)) { + if (FakeV0Filter(trigger, associate)) { - T_Sign = V0Sign(trigger); - if (T_Sign == 1) { - CandMass = trigger.mLambda(); - } else if (T_Sign == -1) { - CandMass = trigger.mAntiLambda(); - } - - A_PID = TrackPID(associate); - DeltaPhi = DeltaPhiShift(trigger.phi(), associate.phi()); - DeltaEta = trigger.eta() - associate.eta(); - - if (CandMass >= 1.10 && CandMass <= 1.13) { - if (A_PID[0] == 0) { // Pions - MECorrRegistry.fill(HIST("hMixLambdaPion_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 1) { // Kaons - MECorrRegistry.fill(HIST("hMixLambdaKaon_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 2) { // Protons - MECorrRegistry.fill(HIST("hMixLambdaProton_SGNL"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + T_Sign = V0Sign(trigger); + if (T_Sign == 1) { + CandMass = trigger.mLambda(); + } else if (T_Sign == -1) { + CandMass = trigger.mAntiLambda(); } - } else { - if (A_PID[0] == 0) { // Pions - MECorrRegistry.fill(HIST("hMixLambdaPion_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 1) { // Kaons - MECorrRegistry.fill(HIST("hMixLambdaKaon_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); - } else if (A_PID[0] == 2) { // Protons - MECorrRegistry.fill(HIST("hMixLambdaProton_SB"), DeltaPhi, DeltaEta, coll_1.centFT0C(), coll_1.posZ(), T_Sign, associate.sign()); + + A_PID = TrackPID(associate); + DeltaPhi = DeltaPhiShift(trigger.phi(), associate.phi()); + DeltaEta = trigger.eta() - associate.eta(); + + 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()); + } 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()); + } 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()); + } + } 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()); + } 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()); + } 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()); + } } } } @@ -235,7 +271,70 @@ struct ThreePartCorr { } // End of the Mixed-events Correlations } + + void processMCGen(MyFilteredMCGenCollision const&, MyFilteredMCParticles const& particles) + { + + // Start of the Monte-Carlo generated QA + for (const auto& particle : particles) { + if (particle.isPhysicalPrimary()) { + + if (particle.pdgCode() == kPiPlus) { // Pos pions + MCRegistry.fill(HIST("hGenPionP"), particle.pt()); + } else if (particle.pdgCode() == kPiMinus) { // Neg pions + MCRegistry.fill(HIST("hGenPionN"), particle.pt()); + } else if (particle.pdgCode() == kKPlus) { // Pos kaons + MCRegistry.fill(HIST("hGenKaonP"), particle.pt()); + } else if (particle.pdgCode() == kKMinus) { // Neg kaons + MCRegistry.fill(HIST("hGenKaonN"), particle.pt()); + } else if (particle.pdgCode() == kProton) { // Pos protons + MCRegistry.fill(HIST("hGenProtonP"), particle.pt()); + } else if (particle.pdgCode() == kProtonBar) { // Neg protons + MCRegistry.fill(HIST("hGenProtonN"), particle.pt()); + } + } + } + // End of the Monte-Carlo generated QA + } + + void processMCRec(MyFilteredMCRecCollision const& collision, MyFilteredMCTracks const& tracks, aod::McCollisions const&, aod::McParticles const&) + { + + if (!collision.has_mcCollision()) { + return; + } + + // Start of the Monte-Carlo reconstructed QA + for (const auto& track : tracks) { + if (!track.has_mcParticle()) { + continue; + } + + auto particle = track.mcParticle(); + if (particle.isPhysicalPrimary()) { + + if (particle.pdgCode() == kPiPlus) { // Pos pions + MCRegistry.fill(HIST("hRecPionP"), track.pt()); + } else if (particle.pdgCode() == kPiMinus) { // Neg pions + MCRegistry.fill(HIST("hRecPionN"), track.pt()); + } else if (particle.pdgCode() == kKPlus) { // Pos kaons + MCRegistry.fill(HIST("hRecKaonP"), track.pt()); + } else if (particle.pdgCode() == kKMinus) { // Neg kaons + MCRegistry.fill(HIST("hRecKaonN"), track.pt()); + } else if (particle.pdgCode() == kProton) { // Pos protons + MCRegistry.fill(HIST("hRecProtonP"), track.pt()); + } else if (particle.pdgCode() == kProtonBar) { // Neg protons + MCRegistry.fill(HIST("hRecProtonN"), track.pt()); + } + } + } + // End of the Monte-Carlo reconstructed QA + } + + PROCESS_SWITCH(ThreePartCorr, processSame, "Process same-event correlations", true); PROCESS_SWITCH(ThreePartCorr, processMixed, "Process mixed-event correlations", true); + PROCESS_SWITCH(ThreePartCorr, processMCGen, "Process Monte-Carlo, generator level", false); + PROCESS_SWITCH(ThreePartCorr, processMCRec, "Process Monte-Carlo, reconstructed level", false); //================================================================================================================================================================================================================ @@ -310,13 +409,11 @@ struct ThreePartCorr { if (TMath::Abs(posDaughter.tpcNSigmaPr()) > 4.0) { return kFALSE; } - // if(V0.mLambda() < 1.10 || V0.mLambda() > 1.13) { return kFALSE; } } else if (V0Sign(V0) == -1) { const auto& negDaughter = V0.template negTrack_as(); if (TMath::Abs(negDaughter.tpcNSigmaPr()) > 4.0) { return kFALSE; } - // if(V0.mAntiLambda() < 1.10 || V0.mAntiLambda() > 1.13) { return kFALSE; } } return kTRUE; @@ -335,6 +432,41 @@ struct ThreePartCorr { return kTRUE; } + + template + Bool_t FakeV0Filter(const V0Cand& V0, const TrackCand& Track) + { + + 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) { + return kFALSE; + } + } + + return kTRUE; + } }; //================================================================================================================================================================================================================== diff --git a/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx b/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx index aac8b255ef4..47a66f60ca0 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/multiparticle-correlations-ab.cxx @@ -93,11 +93,11 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to { // *) Trick to avoid name clashes, part 1; // *) Default configuration, booking, binning and cuts; - // *) Insanity checks; + // *) Insanity checks before booking; // *) Book random generator; // *) Book base list; // *) Book all remaining objects; - // ... + // *) Insanity checks after booking; // *) Trick to avoid name clashes, part 2; // *) Trick to avoid name clashes, part 1: @@ -105,16 +105,15 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to TH1::AddDirectory(kFALSE); // *) Default configuration, booking, binning and cuts: - DefaultConfiguration(); - DefaultBooking(); // here I decide only which histograms are booked, not details like binning, etc. That's done later in Book* member functions. - DefaultBinning(); - DefaultCuts(); // Remark: has to be called after DefaultBinning(), since some default cuts are defined through default binning, to ease bookeeping + 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() - // *) Set what to process - only rec, both rec and sim, only sim: - // WhatToProcess(); // yes, this can be called here, after calling all Default* member functions above, because this has an effect only on Book* members functions, and the ones called afterward - - // *) Insanity checks: - InsanityChecks(); + // *) Insanity checks before booking: + InsanityChecksBeforeBooking(); // check only harwired values and the ones obtained from configurables // *) Book random generator: delete gRandom; @@ -140,6 +139,9 @@ struct MultiparticleCorrelationsAB // this name is used in lower-case format to BookTest0Histograms(); BookTheRest(); // here I book everything that was not sorted (yet) in the specific functions above + // *) Insanity checks after booking: + InsanityChecksAfterBooking(); // pointers of all local histograms, etc., are available, so I can do insanity checks directly on all booked objects + // *) Trick to avoid name clashes, part 2: TH1::AddDirectory(oldHistAddStatus); diff --git a/PWGCF/TableProducer/dptdptfilter.cxx b/PWGCF/TableProducer/dptdptfilter.cxx index 400f92a2c39..986370739b4 100644 --- a/PWGCF/TableProducer/dptdptfilter.cxx +++ b/PWGCF/TableProducer/dptdptfilter.cxx @@ -11,10 +11,13 @@ #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" @@ -29,6 +32,7 @@ #include "Framework/RunningWorkflowInfo.h" #include #include +#include #include #include #include @@ -163,6 +167,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 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"}; @@ -189,6 +356,8 @@ struct DptDptFilter { Produces acceptedtrueevents; Produces gencollisionsinfo; + Multiplicity multiplicity; + void init(InitContext const&) { using namespace dptdptfilter; @@ -212,6 +381,8 @@ struct DptDptFilter { /* the centrality/multiplicity estimation */ if (doprocessWithoutCent || doprocessWithoutCentDetectorLevel || doprocessWithoutCentGeneratorLevel) { fCentMultEstimator = kNOCM; + } else if (doprocessOnTheFlyGeneratorLevel) { + fCentMultEstimator = kFV0A; } else { fCentMultEstimator = getCentMultEstimator(cfgCentMultEstimator); } @@ -271,14 +442,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 +481,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 +508,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); }; @@ -398,7 +579,7 @@ 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; @@ -411,6 +592,7 @@ void DptDptFilter::processGenerated(CollisionObject const& mccollision, Particle } else { gencollisionsinfo(acceptedevent, centormult); } + return static_cast(acceptedevent); } template @@ -471,6 +653,26 @@ 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 (IsEvtSelected(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) { @@ -517,6 +719,7 @@ struct DptDptFilterTracks { Configurable cfgOutDebugInfo{"outdebuginfo", false, "Out detailed debug information per track into a text file. Default false"}; Configurable cfgFullDerivedData{"fullderiveddata", false, "Produce the full derived data for external storage. Default false"}; Configurable cfgTrackType{"trktype", 4, "Type of selected tracks: 0 = no selection;1 = Run2 global tracks FB96;3 = Run3 tracks;4 = Run3 tracks MM sel;5 = Run2 TPC only tracks;7 = Run 3 TPC only tracks;30-33 = any/two on 3 ITS,any/all in 7 ITS;40-43 same as 30-33 w tighter DCAxy;50-53 w tighter pT DCAz. Default 4"}; + Configurable cfgOnlyInOneSide{"onlyinoneside", false, "select tracks that don't cross the TPC central membrane. Default false"}; Configurable cfgTraceDCAOutliers{"trackdcaoutliers", {false, 0.0, 0.0}, "Track the generator level DCAxy outliers: false/true, low dcaxy, up dcaxy. Default {false,0.0,0.0}"}; Configurable cfgTraceOutOfSpeciesParticles{"trackoutparticles", false, "Track the particles which are not e,mu,pi,K,p: false/true. Default false"}; Configurable cfgRecoIdMethod{"recoidmethod", 0, "Method for identifying reconstructed tracks: 0 No PID, 1 PID, 2 mcparticle, 3 mcparticle only primaries, 4 mcparticle only sec, 5 mcparicle only sec from decays, 6 mcparticle only sec from material. Default 0"}; @@ -572,6 +775,7 @@ struct DptDptFilterTracks { traceDCAOutliers = cfgTraceDCAOutliers; traceOutOfSpeciesParticles = cfgTraceOutOfSpeciesParticles; recoIdMethod = cfgRecoIdMethod; + onlyInOneSide = cfgOnlyInOneSide.value; /* self configure system type and data type */ /* if the system type is not known at this time, we have to put the initialization somewhere else */ @@ -838,7 +1042,7 @@ struct DptDptFilterTracks { template int8_t trackIdentification(TrackObject const& track); - template + template int8_t selectTrack(TrackObject const& track); template int8_t selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track); @@ -1102,7 +1306,7 @@ int8_t DptDptFilterTracks::trackIdentification(TrackObject const& track) return sp; } -template +template int8_t DptDptFilterTracks::selectTrack(TrackObject const& track) { using namespace dptdptfilter; @@ -1112,7 +1316,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); @@ -1167,7 +1371,7 @@ 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); @@ -1184,7 +1388,7 @@ int8_t DptDptFilterTracks::selectTrackAmbiguousCheck(CollisionObjects const& col /* feedback of no ambiguous tracks only if checks required */ fhAmbiguousTrackType->Fill(ambtracktype, multiplicityclass); } - return selectTrack(track); + return selectTrack(track); } } diff --git a/PWGCF/TableProducer/dptdptfilter.h b/PWGCF/TableProducer/dptdptfilter.h index 60fb6e592c4..b4a6f2859b8 100644 --- a/PWGCF/TableProducer/dptdptfilter.h +++ b/PWGCF/TableProducer/dptdptfilter.h @@ -135,6 +135,7 @@ float zvtxlow = -10.0, zvtxup = 10.0; int phibins = 72; float philow = 0.0; float phiup = constants::math::TwoPI; +bool onlyInOneSide = false; /* select only tracks that don't cross the TPC central membrane */ /* selection criteria from PWGMM */ // default quality criteria for tracks with ITS contribution @@ -797,7 +798,14 @@ inline bool IsEvtSelected(CollisionObject const& collision, float& centormult) bool zvtxsel = false; /* TODO: vertex quality checks */ if (zvtxlow < collision.posZ() && collision.posZ() < zvtxup) { - zvtxsel = true; + if (onlyInOneSide) { + if (collision.posZ() != 0.0) { + /* if only one side, we accept collisions which have zvtx different than zero */ + zvtxsel = true; + } + } else { + zvtxsel = true; + } } bool centmultsel = centralitySelection(collision, centormult); @@ -861,9 +869,12 @@ inline bool matchTrackType(TrackObject const& track) /// \brief Checks if the passed track is within the acceptance conditions of the analysis /// \param track the track of interest /// \return true if the track is in the acceptance, otherwise false -template +template inline bool InTheAcceptance(TrackObject const& track) { + /* the side on which the collision happened */ + float side = track.template collision_as().posZ(); + /* overall minimum momentum cut for the analysis */ if (!(overallminp < track.p())) { return false; @@ -875,6 +886,22 @@ inline bool InTheAcceptance(TrackObject const& track) } } + /* check the side of the collision and decide if one side */ + if (onlyInOneSide) { + if (side < 0) { + if (track.eta() >= 0.0) { + return false; + } + } else if (side > 0) { + if (track.eta() <= 0.0) { + return false; + } + } else { + /* if only one side we should not have collisions with zvtx = 0 */ + LOGF(fatal, "Selecting one side tracks with a zvtx zero collision"); + } + } + if (ptlow < track.pt() && track.pt() < ptup && etalow < track.eta() && track.eta() < etaup) { return true; } @@ -884,10 +911,10 @@ inline bool InTheAcceptance(TrackObject const& track) /// \brief Accepts or not the passed track /// \param track the track of interest /// \return true if the track is accepted, otherwise false -template +template inline bool AcceptTrack(TrackObject const& track) { - if (InTheAcceptance(track)) { + if (InTheAcceptance(track)) { if (matchTrackType(track)) { return true; } @@ -959,6 +986,7 @@ struct PIDSpeciesSelection { const std::vector sptitles = {"e", "#mu", "#pi", "K", "p"}; const std::vector spfnames = {"E", "Mu", "Pi", "Ka", "Pr"}; const std::vector spadjnames = {"Electron", "Muon", "Pion", "Kaon", "Proton"}; + const std::vector spmasses = {o2::constants::physics::MassElectron, o2::constants::physics::MassMuon, o2::constants::physics::MassPionCharged, o2::constants::physics::MassKaonCharged, o2::constants::physics::MassProton}; const std::vector chadjnames = {"P", "M"}; const char* hadname = "h"; const char* hadtitle = "h"; @@ -967,6 +995,7 @@ struct PIDSpeciesSelection { const char* getSpeciesName(uint8_t ix) { return spnames[species[ix]].data(); } const char* getSpeciesTitle(uint8_t ix) { return sptitles[species[ix]].data(); } const char* getSpeciesFName(uint8_t ix) { return spfnames[species[ix]].data(); } + double getSpeciesMass(uint8_t ix) { return spmasses[species[ix]]; } const char* getHadName() { return hadname; } const char* getHadTitle() { return hadtitle; } const char* getHadFName() { return hadfname; } diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index d6e0e94752b..5ad33872ccb 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -85,6 +85,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"}; @@ -149,7 +150,7 @@ struct CorrelationTask { 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("invMass", "2-prong invariant mass (GeV/c^2)", {HistType::kTH3F, {axisInvMassHistogram, axisPtTrigger, 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"}}}); @@ -231,6 +232,8 @@ struct CorrelationTask { template 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) @@ -243,6 +246,10 @@ struct CorrelationTask { } registry.fill(HIST("invMass"), track1.invMass(), track1.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()); } @@ -314,6 +321,11 @@ struct CorrelationTask { continue; } + 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; @@ -343,6 +355,11 @@ struct CorrelationTask { continue; } } + 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; @@ -724,8 +741,11 @@ struct CorrelationTask { case 2212: // proton case -2212: return 2; - default: + case 421: // D0 + case -421: return 3; + default: + return 4; } } diff --git a/PWGCF/Tasks/dptdptcorrelations.cxx b/PWGCF/Tasks/dptdptcorrelations.cxx index 8ccdc1f93a0..ad227a09e7d 100644 --- a/PWGCF/Tasks/dptdptcorrelations.cxx +++ b/PWGCF/Tasks/dptdptcorrelations.cxx @@ -62,9 +62,11 @@ float deltaphibinwidth = constants::math::TwoPI / deltaphibins; float deltaphilow = 0.0 - deltaphibinwidth / 2.0; float deltaphiup = constants::math::TwoPI - deltaphibinwidth / 2.0; -bool processpairs = false; -bool processmixedevents = false; -bool ptorder = false; +bool processpairs = false; // process pairs analysis +bool processmixedevents = false; // process mixed events +bool ptorder = false; // consider pt ordering +bool invmass = false; // produce the invariant mass histograms +bool corrana = false; // produce the correlation analysis histograms PairCuts fPairCuts; // pair suppression engine bool fUseConversionCuts = false; // suppress resonances and conversions @@ -72,6 +74,7 @@ bool fUseTwoTrackCut = false; // suppress too close tracks std::vector poinames; ///< the species of interest names std::vector tnames; ///< the track names +std::vector poimass; ///< the species of interest mass std::vector> trackPairsNames; ///< the track pairs names } // namespace correlationstask @@ -102,6 +105,8 @@ struct DptDptCorrelationsTask { std::vector> 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}}; //! fhN1_vsC{nch, nullptr}; //! fhSum1Pt_vsC{nch, nullptr}; //! + 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 deltaeta_ix = etaix_1 - etaix_2 + etabins - 1; + + return deltaetalow + (deltaeta_ix + 0.5) * deltaetabinwidth; + } + + /// \brief Returns the delta phi value for the differential phi + /// \param t1 the intended track one + /// \param t2 the intended track two + /// \return the delta phi value within [-pi,pi] for delta phi + /// + /// WARNING: for performance reasons no checks are done about the consistency + /// of tracks' eta and phi within the corresponding ranges so, it is suppossed + /// 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) + { + 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); + /* consider a potential phi origin shift */ + phi = GetShiftedPhi(t2.phi()); + int phiix_2 = static_cast((phi - philow) / phibinwidth); + + int deltaphi_ix = phiix_1 - phiix_2; + if (deltaphi_ix < 0) { + deltaphi_ix += phibins; + } + + float value = deltaphilow + (deltaphi_ix + 0.5) * deltaphibinwidth; + + return (value < (deltaphiup - constants::math::PI)) ? value : value - constants::math::TwoPI; + } + + /// \brief Returns the TH2 global bin for the differential histograms /// \param t1 the intended track one /// \param t2 the intended track two /// \return the globl TH2 bin for delta eta delta phi @@ -170,7 +232,7 @@ 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 GetDEtaDPhiGlobalIndex(TrackObject const& t1, TrackObject const& t2) + int GetDEtaDPhiGlobalBin(TrackObject const& t1, TrackObject const& t2) { using namespace correlationstask; using namespace o2::analysis::dptdptfilter; @@ -194,6 +256,39 @@ struct DptDptCorrelationsTask { return fhN2_vsDEtaDPhi[0][0]->GetBin(deltaeta_ix + 1, deltaphi_ix + 1); } + /* taken from PWGCF/Core/PairCuts.h implemented by JFGO */ + template + double getInvMassSquared(TrackObject const& track1, double m0_1, TrackObject const& track2, double m0_2) + { + // calculate inv mass squared + // same can be achieved, but with more computing time with + /*TLorentzVector photon, p1, p2; + p1.SetPtEtaPhiM(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), 0.510e-3); + p2.SetPtEtaPhiM(particle->Pt(), eta[j], particle->Phi(), 0.510e-3); + photon = p1+p2; + photon.M()*/ + + float tantheta1 = 1e10; + + if (track1.eta() < -1e-10 || track1.eta() > 1e-10) { + float expTmp = std::exp(-track1.eta()); + tantheta1 = 2.0 * expTmp / (1.0 - expTmp * expTmp); + } + + float tantheta2 = 1e10; + if (track2.eta() < -1e-10 || track2.eta() > 1e-10) { + float expTmp = std::exp(-track2.eta()); + tantheta2 = 2.0 * expTmp / (1.0 - expTmp * expTmp); + } + + float e1squ = m0_1 * m0_1 + track1.pt() * track1.pt() * (1.0 + 1.0 / tantheta1 / tantheta1); + float e2squ = m0_2 * m0_2 + track2.pt() * track2.pt() * (1.0 + 1.0 / tantheta2 / tantheta2); + + float mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * (std::sqrt(e1squ * e2squ) - (track1.pt() * track2.pt() * (std::cos(track1.phi() - track2.phi()) + 1.0 / tantheta1 / tantheta2))); + + return mass2; + } + void storeTrackCorrections(std::vector corrs) { LOGF(info, "Stored NUA&NUE corrections for %d track ids", corrs.size()); @@ -315,7 +410,7 @@ struct DptDptCorrelationsTask { /// \param trks2 filtered table with the tracks associated to the second track in the pair /// \param cmul centrality - multiplicity for the collision being analyzed /// Be aware that in most of the cases traks1 and trks2 will have the same content (exception: mixed events) - template + template void processTrackPairs(TrackOneListObject const& trks1, TrackTwoListObject const& trks2, std::vector* corrs1, std::vector* corrs2, std::vector* ptavgs1, std::vector* ptavgs2, float cmul, int bfield) { using namespace correlationstask; @@ -329,6 +424,8 @@ struct DptDptCorrelationsTask { std::vector> sum2PtPtnw(nch, std::vector(nch, 0.0)); ///< accumulated sum of not weighted track 1 track 2 \f${p_T}_1 {p_T}_2\f$ for current collision std::vector> sum2DptDptnw(nch, std::vector(nch, 0.0)); ///< accumulated sum of not weighted number of track 1 tracks times not weighted track 2 \f$p_T\f$ for current collision int index1 = 0; + int globalbin = 0; + LOGF(debug, "Initializing globalbin to ", globalbin); for (auto& track1 : trks1) { double ptavg_1 = (*ptavgs1)[index1]; @@ -356,7 +453,9 @@ struct DptDptCorrelationsTask { double dptdptw = (corr1 * track1.pt() - ptavg_1) * (corr2 * track2.pt() - ptavg_2); /* get the global bin for filling the differential histograms */ - int globalbin = GetDEtaDPhiGlobalIndex(track1, track2); + if constexpr (docorrelations) { + globalbin = GetDEtaDPhiGlobalBin(track1, track2); + } float deltaeta = track1.eta() - track2.eta(); float deltaphi = track1.phi() - track2.phi(); while (deltaphi >= deltaphiup) { @@ -367,8 +466,10 @@ struct DptDptCorrelationsTask { } if ((fUseConversionCuts && fPairCuts.conversionCuts(track1, track2)) || (fUseTwoTrackCut && fPairCuts.twoTrackCut(track1, track2, bfield))) { /* suppress the pair */ - fhSupN1N1_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, corr); - fhSupPt1Pt1_vsDEtaDPhi[track1.trackacceptedid()][track2.trackacceptedid()]->AddBinContent(globalbin, track1.pt() * track2.pt() * corr); + 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); + } n2sup[track1.trackacceptedid()][track2.trackacceptedid()] += corr; } else { /* count the pair */ @@ -379,12 +480,22 @@ struct DptDptCorrelationsTask { sum2PtPtnw[track1.trackacceptedid()][track2.trackacceptedid()] += track1.pt() * track2.pt(); sum2DptDptnw[track1.trackacceptedid()][track2.trackacceptedid()] += dptdptnw; - 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); + 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); + } + 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); + } + } } - fhN2_vsPtPt[track1.trackacceptedid()][track2.trackacceptedid()]->Fill(track1.pt(), track2.pt(), corr); index2++; } index1++; @@ -398,11 +509,13 @@ struct DptDptCorrelationsTask { fhSum2PtPtnw_vsC[pid1][pid2]->Fill(cmul, sum2PtPtnw[pid1][pid2]); fhSum2DptDptnw_vsC[pid1][pid2]->Fill(cmul, sum2DptDptnw[pid1][pid2]); /* let's also update the number of entries in the differential histograms */ - 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]); + 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]); + } } } } @@ -442,15 +555,40 @@ struct DptDptCorrelationsTask { /* process pair magnitudes */ if constexpr (mixed) { if (ptorder) { - processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); + /* no invariant mass analysis on a mixed event data collection */ + processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); } else { - processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); + processTrackPairs(Tracks1, Tracks2, corrs1, corrs2, ptavgs1, ptavgs2, centmult, bfield); } } else { if (ptorder) { - processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + if (invmass) { + if (corrana) { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } else { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } + } else { + if (corrana) { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } else { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } + } } else { - processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + if (invmass) { + if (corrana) { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } else { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } + } else { + if (corrana) { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } else { + processTrackPairs(Tracks1, Tracks1, corrs1, corrs1, ptavgs1, ptavgs1, centmult, bfield); + } + } } } @@ -465,11 +603,14 @@ struct DptDptCorrelationsTask { } } + template void init(TList* fOutputList) { using namespace correlationstask; using namespace o2::analysis::dptdptfilter; + LOGF(info, "Do invariant mass: %s; do correlation histograms: %s", doinvmass ? "yes" : "no", docorrelations ? "yes" : "no"); + /* create the histograms */ Bool_t oldstatus = TH1::AddDirectoryStatus(); TH1::AddDirectory(kFALSE); @@ -596,24 +737,34 @@ struct DptDptCorrelationsTask { bool defSumw2 = TH1::GetDefaultSumw2(); TH1::SetDefaultSumw2(false); const char* pname = trackPairsNames[i][j].c_str(); - 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), + 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); - 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), + 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); - 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), - 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), + 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), 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), + 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); + } + if constexpr (doinvmass) { + if (!(j < i)) { + /* only 12 combinations, 21 are exactly the same */ + fhInvMassDEta[i][j] = new TH2D(TString::Format("n2_invMassDeta_%s", pname), TString::Format("%s invariant mass;#Delta#eta;Mass (MeV/#it{c}^{2})", pname), + deltaetabins, deltaetalow, deltaetaup, 5000, 0, 5000); + fhInvMassDPhi[i][j] = new TH2D(TString::Format("n2_invMassDphi_%s", pname), TString::Format("%s invariant mass;#Delta#varphi;Mass (MeV/#it{c}^{2})", pname), + deltaphibins, deltaphilow - constants::math::PI, deltaphiup - constants::math::PI, 5000, 0, 5000); + } + } /* we return it back to previuos state */ TH1::SetDefaultSumw2(defSumw2); - 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); - 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); @@ -622,26 +773,46 @@ struct DptDptCorrelationsTask { 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); /* the statistical uncertainties will be estimated by the subsamples method so let's get rid of the error tracking */ - 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); - - 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]); + 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); + } + if constexpr (doinvmass) { + if (!(j < i)) { + /* only 12 combinations, 21 are exactly the same */ + fhInvMassDEta[i][j]->SetBit(TH1::kIsNotW); + fhInvMassDEta[i][j]->Sumw2(false); + fhInvMassDPhi[i][j]->SetBit(TH1::kIsNotW); + fhInvMassDPhi[i][j]->Sumw2(false); + } + } + + 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]); + } + if constexpr (doinvmass) { + if (!(j < i)) { + /* only 12 combinations, 21 are exactly the same */ + fOutputList->Add(fhInvMassDEta[i][j]); + fOutputList->Add(fhInvMassDPhi[i][j]); + } + } fOutputList->Add(fhN2_vsC[i][j]); fOutputList->Add(fhSum2PtPt_vsC[i][j]); fOutputList->Add(fhSum2DptDpt_vsC[i][j]); @@ -684,6 +855,8 @@ struct DptDptCorrelationsTask { Configurable cfgTwoTrackCutMinRadius{"twotrackcutminradius", 0.8f, "Two-tracks cut: radius in m from which two-tracks cut is applied"}; Configurable cfgSmallDCE{"smalldce", true, "Use small data collecting engine for singles processing, true = yes. Default = true"}; + Configurable cfgDoInvMass{"doinvmass", false, "Do the invariant mass analyis, true = yes. Default = false"}; + Configurable cfgDoCorrelations{"docorrelations", true, "Do the correlations analysis, true = yes. Default = true"}; 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"}; @@ -727,6 +900,8 @@ struct DptDptCorrelationsTask { processpairs = cfgProcessPairs.value; processmixedevents = cfgProcessME.value; ptorder = cfgPtOrder.value; + invmass = cfgDoInvMass.value; + corrana = cfgDoCorrelations.value; /* self configure the CCDB access to the input file */ getTaskOptionValue(initContext, "dpt-dpt-filter", "input_ccdburl", cfgCCDBUrl, false); @@ -803,7 +978,8 @@ struct DptDptCorrelationsTask { poinames.push_back(std::string(pidselector.getSpeciesFName(ix))); tnames.push_back(std::string(TString::Format("%sP", pidselector.getSpeciesFName(ix)).Data())); tnames.push_back(std::string(TString::Format("%sM", pidselector.getSpeciesFName(ix)).Data())); - LOGF(info, "Incorporated species name %s to the analysis", poinames[ix].c_str()); + poimass.push_back(pidselector.getSpeciesMass(ix)); + LOGF(info, "Incorporated species name %s with mass %f to the analysis", poinames[ix].c_str(), poimass[ix]); } } uint ntracknames = tnames.size(); @@ -839,7 +1015,6 @@ struct DptDptCorrelationsTask { fCentMultMin[0] = 0.0f; fCentMultMax[0] = 100.0f; } - dataCE = new DataCollectingEngine*[ncmranges]; if (cfgSmallDCE) { dataCE_small = new DataCollectingEngine*[ncmranges]; } else { @@ -850,23 +1025,36 @@ struct DptDptCorrelationsTask { } for (int i = 0; i < ncmranges; ++i) { - auto initializeCEInstance = [&fGlobalOutputList](auto dce, auto name) { + auto initializeCEInstance = [&fGlobalOutputList](auto dce, auto name, bool im, bool corr) { /* crete the output list for the passed centrality/multiplicity range */ TList* fOutputList = new TList(); fOutputList->SetName(name); fOutputList->SetOwner(true); /* init the data collection instance */ - dce->init(fOutputList); + if (im) { + if (corr) { + dce->template init(fOutputList); + } else { + dce->template init(fOutputList); + } + } else { + if (corr) { + dce->template init(fOutputList); + } else { + dce->template init(fOutputList); + } + } fGlobalOutputList->Add(fOutputList); }; auto builSmallDCEInstance = [&initializeCEInstance](auto rg, bool me = false) { + /* only for singles analysis, no sense of inv mass nor no correlations */ DataCollectingEngine* dce = new DataCollectingEngine(); - initializeCEInstance(dce, TString::Format("DptDptCorrelationsData%s-%s", me ? "ME" : "", rg)); + initializeCEInstance(dce, TString::Format("DptDptCorrelationsData%s-%s", me ? "ME" : "", rg), false, false); return dce; }; - auto buildCEInstance = [&initializeCEInstance](auto rg, bool me = false) { + auto buildCEInstance = [&initializeCEInstance](auto rg, bool im, bool corr, bool me = false) { DataCollectingEngine* dce = new DataCollectingEngine(); - initializeCEInstance(dce, TString::Format("DptDptCorrelationsData%s-%s", me ? "ME" : "", rg)); + initializeCEInstance(dce, TString::Format("DptDptCorrelationsData%s-%s", me ? "ME" : "", rg), im, corr); return dce; }; TString range = TString::Format("%d-%d", static_cast(fCentMultMin[i]), static_cast(fCentMultMax[i])); @@ -874,16 +1062,30 @@ struct DptDptCorrelationsTask { if (processpairs) { LOGF(fatal, "Processing pairs cannot be used with the small DCE, please configure properly!!"); } + 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()); } else { - dataCE[i] = buildCEInstance(range.Data()); + if (invmass) { + if (!processpairs) { + LOGF(fatal, "Invariant mass cannot be used in processing singles, please configure properly!!"); + } + } + dataCE[i] = buildCEInstance(range.Data(), invmass, corrana); } if (processmixedevents) { /* consistency check */ if (cfgSmallDCE.value) { LOGF(fatal, "Mixed events cannot be used with the small DCE, please configure properly!!"); } - dataCEME[i] = buildCEInstance(range.Data(), true); + if (invmass) { + LOGF(warning, "Invariant mass will not be used with Mixed events!!"); + } + if (!corrana) { + LOGF(fatal, "Mixed events makes not sense to run it without correlations, please configure properly!!"); + } + dataCEME[i] = buildCEInstance(range.Data(), false, false, true); } } for (int i = 0; i < ncmranges; ++i) { diff --git a/PWGCF/Tasks/match-reco-gen.cxx b/PWGCF/Tasks/match-reco-gen.cxx index 3cba78997b2..adf0b363e6b 100644 --- a/PWGCF/Tasks/match-reco-gen.cxx +++ b/PWGCF/Tasks/match-reco-gen.cxx @@ -409,7 +409,7 @@ struct CheckGeneratorLevelVsDetectorLevel { float centormult = -100.0f; if (IsEvtSelected(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 e5f2aa908ca..fb6355c55b2 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx +++ b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx @@ -65,6 +65,9 @@ using IdBfFullTracksFullPIDDetLevelAmbiguous = soa::Join& vec) } struct IdentifiedBfFilterTracks { + + struct : ConfigurableGroup { + Configurable cfgCCDBUrl{"input_ccdburl", "http://ccdb-test.cern.ch:8080", "The CCDB url for the input file"}; + Configurable cfgCCDBPathName{"input_ccdbpath", "", "The CCDB path for the input file. Default \"\", i.e. don't load from CCDB"}; + Configurable cfgCCDBDate{"input_ccdbdate", "20220307", "The CCDB date for the input file"}; + } cfgcentersinputfile; + Service ccdb; + + TList* getCCDBInput(const char* ccdbpath, const char* ccdbdate) + { + + std::tm cfgtm = {}; + std::stringstream ss(ccdbdate); + ss >> std::get_time(&cfgtm, "%Y%m%d"); + cfgtm.tm_hour = 12; + int64_t timestamp = std::mktime(&cfgtm) * 1000; + + TList* lst = ccdb->getForTimeStamp(ccdbpath, timestamp); + if (lst != nullptr) { + LOGF(info, "Correctly loaded CCDB input object"); + } else { + LOGF(error, "CCDB input object could not be loaded"); + } + return lst; + } + Produces scannedtracks; Produces tracksinfo; Produces scannedgentracks; @@ -608,6 +642,8 @@ struct IdentifiedBfFilterTracks { Configurable minRejectSigma{"minrejectsigma", -1.0, "Minimum required sigma for PID double match rejection"}; Configurable maxRejectSigma{"maxrejectsigma", 1.0, "Maximum required sigma for PID double match rejection"}; + Configurable tofCut{"TOFCutoff", 0.8, "Momentum under which we don't use TOF PID data"}; + OutputObj fOutput{"IdentifiedBfFilterTracksInfo", OutputObjHandlingPolicy::AnalysisObject}; bool checkAmbiguousTracks = false; @@ -615,6 +651,26 @@ struct IdentifiedBfFilterTracks { { LOGF(info, "IdentifiedBfFilterTracks::init()"); + // ccdb info + ccdb->setURL(cfgcentersinputfile.cfgCCDBUrl); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + LOGF(info, "Initizalized CCDB"); + + loadfromccdb = cfgcentersinputfile.cfgCCDBPathName->length() > 0; + + if (ccdblst == nullptr) { + if (loadfromccdb) { + LOGF(info, "Loading CCDB Objects"); + + ccdblst = getCCDBInput(cfgcentersinputfile.cfgCCDBPathName->c_str(), cfgcentersinputfile.cfgCCDBDate->c_str()); + for (int i = 0; i < kIdBfNoOfSpecies; i++) { + fhNSigmaCorrection[i] = reinterpret_cast(ccdblst->FindObject(Form("centerBin_%s", speciesName[i]))); + } + } + } + LOGF(info, "Loaded CCDB Objects"); + fullDerivedData = cfgFullDerivedData; /* update with the configurable values */ @@ -873,6 +929,7 @@ struct IdentifiedBfFilterTracks { fOutputList->Add(fhTrueDeltaNA[sp]); } } + /* initialize access to the CCDB */ } template @@ -881,6 +938,8 @@ struct IdentifiedBfFilterTracks { MatchRecoGenSpecies trackIdentification(TrackObject const& track); template int8_t AcceptTrack(TrackObject const& track); + template + int8_t AcceptParticle(ParticleObject& particle, MCCollisionObject const&); template int8_t selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track); template @@ -1125,7 +1184,6 @@ template inline MatchRecoGenSpecies IdentifiedBfFilterTracks::IdentifyParticle(ParticleObject const& particle) { using namespace identifiedbffilter; - constexpr int pdgcodeEl = 11; constexpr int pdgcodePi = 211; constexpr int pdgcodeKa = 321; @@ -1161,20 +1219,32 @@ template void fillNSigmaHistos(TrackObject const& track) { - fhNSigmaTPC[kIdBfElectron]->Fill(track.tpcNSigmaEl(), track.tpcInnerParam()); - fhNSigmaTPC[kIdBfPion]->Fill(track.tpcNSigmaPi(), track.tpcInnerParam()); - fhNSigmaTPC[kIdBfKaon]->Fill(track.tpcNSigmaKa(), track.tpcInnerParam()); - fhNSigmaTPC[kIdBfProton]->Fill(track.tpcNSigmaPr(), track.tpcInnerParam()); + float actualTPCNSigmaEl = track.tpcNSigmaEl(); + float actualTPCNSigmaPi = track.tpcNSigmaPi(); + float actualTPCNSigmaKa = track.tpcNSigmaKa(); + float actualTPCNSigmaPr = track.tpcNSigmaPr(); + + if (loadfromccdb) { + actualTPCNSigmaEl = actualTPCNSigmaEl - fhNSigmaCorrection[kIdBfElectron]->GetBinContent(fhNSigmaCorrection[kIdBfElectron]->FindBin(track.tpcInnerParam())); + actualTPCNSigmaPi = actualTPCNSigmaPi - fhNSigmaCorrection[kIdBfPion]->GetBinContent(fhNSigmaCorrection[kIdBfPion]->FindBin(track.tpcInnerParam())); + actualTPCNSigmaKa = actualTPCNSigmaKa - fhNSigmaCorrection[kIdBfKaon]->GetBinContent(fhNSigmaCorrection[kIdBfKaon]->FindBin(track.tpcInnerParam())); + actualTPCNSigmaPr = actualTPCNSigmaPr - fhNSigmaCorrection[kIdBfProton]->GetBinContent(fhNSigmaCorrection[kIdBfProton]->FindBin(track.tpcInnerParam())); + } + + fhNSigmaTPC[kIdBfElectron]->Fill(actualTPCNSigmaEl, track.tpcInnerParam()); + fhNSigmaTPC[kIdBfPion]->Fill(actualTPCNSigmaPi, track.tpcInnerParam()); + fhNSigmaTPC[kIdBfKaon]->Fill(actualTPCNSigmaKa, track.tpcInnerParam()); + fhNSigmaTPC[kIdBfProton]->Fill(actualTPCNSigmaPr, track.tpcInnerParam()); fhNSigmaTOF[kIdBfElectron]->Fill(track.tofNSigmaEl(), track.tpcInnerParam()); fhNSigmaTOF[kIdBfPion]->Fill(track.tofNSigmaPi(), track.tpcInnerParam()); fhNSigmaTOF[kIdBfKaon]->Fill(track.tofNSigmaKa(), track.tpcInnerParam()); fhNSigmaTOF[kIdBfProton]->Fill(track.tofNSigmaPr(), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfElectron]->Fill(sqrtf(track.tofNSigmaEl() * track.tofNSigmaEl() + track.tpcNSigmaEl() * track.tpcNSigmaEl()), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfPion]->Fill(sqrtf(track.tofNSigmaPi() * track.tofNSigmaPi() + track.tpcNSigmaPi() * track.tpcNSigmaPi()), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfKaon]->Fill(sqrtf(track.tofNSigmaKa() * track.tofNSigmaKa() + track.tpcNSigmaKa() * track.tpcNSigmaKa()), track.tpcInnerParam()); - fhNSigmaCombo[kIdBfProton]->Fill(sqrtf(track.tofNSigmaPr() * track.tofNSigmaPr() + track.tpcNSigmaPr() * track.tpcNSigmaPr()), track.tpcInnerParam()); + fhNSigmaCombo[kIdBfElectron]->Fill(sqrtf(track.tofNSigmaEl() * track.tofNSigmaEl() + actualTPCNSigmaEl * actualTPCNSigmaEl), track.tpcInnerParam()); + fhNSigmaCombo[kIdBfPion]->Fill(sqrtf(track.tofNSigmaPi() * track.tofNSigmaPi() + actualTPCNSigmaPi * actualTPCNSigmaPi), track.tpcInnerParam()); + fhNSigmaCombo[kIdBfKaon]->Fill(sqrtf(track.tofNSigmaKa() * track.tofNSigmaKa() + actualTPCNSigmaKa * actualTPCNSigmaKa), track.tpcInnerParam()); + fhNSigmaCombo[kIdBfProton]->Fill(sqrtf(track.tofNSigmaPr() * track.tofNSigmaPr() + actualTPCNSigmaPr * actualTPCNSigmaPr), track.tpcInnerParam()); } template @@ -1184,26 +1254,40 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::IdentifyTrack(TrackObject c fillNSigmaHistos(track); + float actualTPCNSigmaEl = track.tpcNSigmaEl(); + float actualTPCNSigmaPi = track.tpcNSigmaPi(); + float actualTPCNSigmaKa = track.tpcNSigmaKa(); + float actualTPCNSigmaPr = track.tpcNSigmaPr(); + float nsigmas[kIdBfNoOfSpecies]; - if (track.p() < 0.8 && !reqTOF && !onlyTOF) { - nsigmas[kIdBfElectron] = track.tpcNSigmaEl(); - nsigmas[kIdBfPion] = track.tpcNSigmaPi(); - nsigmas[kIdBfKaon] = track.tpcNSigmaKa(); - nsigmas[kIdBfProton] = track.tpcNSigmaPr(); + + if (loadfromccdb) { + actualTPCNSigmaEl = actualTPCNSigmaEl - fhNSigmaCorrection[kIdBfElectron]->GetBinContent(fhNSigmaCorrection[kIdBfElectron]->FindBin(track.tpcInnerParam())); + actualTPCNSigmaPi = actualTPCNSigmaPi - fhNSigmaCorrection[kIdBfPion]->GetBinContent(fhNSigmaCorrection[kIdBfPion]->FindBin(track.tpcInnerParam())); + actualTPCNSigmaKa = actualTPCNSigmaKa - fhNSigmaCorrection[kIdBfKaon]->GetBinContent(fhNSigmaCorrection[kIdBfKaon]->FindBin(track.tpcInnerParam())); + actualTPCNSigmaPr = actualTPCNSigmaPr - fhNSigmaCorrection[kIdBfProton]->GetBinContent(fhNSigmaCorrection[kIdBfProton]->FindBin(track.tpcInnerParam())); + } + + if (track.tpcInnerParam() < tofCut && !reqTOF && !onlyTOF) { + + nsigmas[kIdBfElectron] = actualTPCNSigmaEl; + nsigmas[kIdBfPion] = actualTPCNSigmaPi; + nsigmas[kIdBfKaon] = actualTPCNSigmaKa; + nsigmas[kIdBfProton] = actualTPCNSigmaPr; } else { /* introduce require TOF flag */ if (track.hasTOF() && !onlyTOF) { - nsigmas[kIdBfElectron] = sqrtf(track.tpcNSigmaEl() * track.tpcNSigmaEl() + track.tofNSigmaEl() * track.tofNSigmaEl()); - nsigmas[kIdBfPion] = sqrtf(track.tpcNSigmaPi() * track.tpcNSigmaPi() + track.tofNSigmaPi() * track.tofNSigmaPi()); - nsigmas[kIdBfKaon] = sqrtf(track.tpcNSigmaKa() * track.tpcNSigmaKa() + track.tofNSigmaKa() * track.tofNSigmaKa()); - nsigmas[kIdBfProton] = sqrtf(track.tpcNSigmaPr() * track.tpcNSigmaPr() + track.tofNSigmaPr() * track.tofNSigmaPr()); + nsigmas[kIdBfElectron] = sqrtf(actualTPCNSigmaEl * actualTPCNSigmaEl + track.tofNSigmaEl() * track.tofNSigmaEl()); + nsigmas[kIdBfPion] = sqrtf(actualTPCNSigmaPi * actualTPCNSigmaPi + track.tofNSigmaPi() * track.tofNSigmaPi()); + nsigmas[kIdBfKaon] = sqrtf(actualTPCNSigmaKa * actualTPCNSigmaKa + track.tofNSigmaKa() * track.tofNSigmaKa()); + nsigmas[kIdBfProton] = sqrtf(actualTPCNSigmaPr * actualTPCNSigmaPr + track.tofNSigmaPr() * track.tofNSigmaPr()); } else if (!reqTOF || !onlyTOF) { - nsigmas[kIdBfElectron] = track.tpcNSigmaEl(); - nsigmas[kIdBfPion] = track.tpcNSigmaPi(); - nsigmas[kIdBfKaon] = track.tpcNSigmaKa(); - nsigmas[kIdBfProton] = track.tpcNSigmaPr(); + nsigmas[kIdBfElectron] = actualTPCNSigmaEl; + nsigmas[kIdBfPion] = actualTPCNSigmaPi; + nsigmas[kIdBfKaon] = actualTPCNSigmaKa; + nsigmas[kIdBfProton] = actualTPCNSigmaPr; } else if (track.hasTOF() && onlyTOF) { nsigmas[kIdBfElectron] = track.tofNSigmaEl(); @@ -1241,7 +1325,7 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::IdentifyTrack(TrackObject c if (min_nsigma < maxPIDSigma && min_nsigma > minPIDSigma) { // Check that current nsigma is in accpetance range for (int sp = 0; (sp < kIdBfNoOfSpecies) && !doublematch; ++sp) { // iterate over all species while there's no double match and we're in the list if (sp != sp_min_nsigma) { // for species not current minimum nsigma species - if (nsigmas[sp] < maxRejectSigma && min_nsigma > minRejectSigma) { // If secondary species is in rejection range + if (nsigmas[sp] < maxRejectSigma && nsigmas[sp] > minRejectSigma) { // If secondary species is in rejection range doublematch = true; // Set double match true spDouble = MatchRecoGenSpecies(sp); } @@ -1254,20 +1338,19 @@ inline MatchRecoGenSpecies IdentifiedBfFilterTracks::IdentifyTrack(TrackObject c fhDoublePID->Fill(sp_min_nsigma, spDouble); return kWrongSpecies; // Return wrong species value } else { - if (track.hasTOF() && (reqTOF || onlyTOF)) { - if (sp_min_nsigma == 0) { - fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(track.tpcNSigmaEl(), track.tpcInnerParam()); - } - if (sp_min_nsigma == 1) { - fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(track.tpcNSigmaPi(), track.tpcInnerParam()); - } - if (sp_min_nsigma == 2) { - fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(track.tpcNSigmaKa(), track.tpcInnerParam()); - } - if (sp_min_nsigma == 3) { - fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(track.tpcNSigmaPr(), track.tpcInnerParam()); - } + if (sp_min_nsigma == 0) { + fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(actualTPCNSigmaEl, track.tpcInnerParam()); + } + if (sp_min_nsigma == 1) { + fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(actualTPCNSigmaPi, track.tpcInnerParam()); } + if (sp_min_nsigma == 2) { + fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(actualTPCNSigmaKa, track.tpcInnerParam()); + } + if (sp_min_nsigma == 3) { + fhNSigmaTPC_IdTrks[sp_min_nsigma]->Fill(actualTPCNSigmaPr, track.tpcInnerParam()); + } + return sp_min_nsigma; } } else { @@ -1279,7 +1362,6 @@ template MatchRecoGenSpecies IdentifiedBfFilterTracks::trackIdentification(TrackObject const& track) { using namespace identifiedbffilter; - MatchRecoGenSpecies sp = kWrongSpecies; if (recoIdMethod == 0) { sp = kIdBfCharged; @@ -1342,6 +1424,41 @@ 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&) +{ + /* 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 (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 439edfc6854..392bcd73afe 100644 --- a/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h +++ b/PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h @@ -12,6 +12,8 @@ #ifndef PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ #define PWGCF_TWOPARTICLECORRELATIONS_TABLEPRODUCER_IDENTIFIEDBFFILTER_H_ +#include + #include #include @@ -43,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 { @@ -126,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 { @@ -714,54 +720,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/efficiencyAndQc.cxx b/PWGCF/TwoParticleCorrelations/Tasks/efficiencyAndQc.cxx index 5b76d50d1a2..216f273fde3 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/efficiencyAndQc.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/efficiencyAndQc.cxx @@ -286,7 +286,7 @@ struct QADataCollectingEngine { } } - template + template void processTrack(float zvtx, TrackObject const& track) { using namespace efficiencyandqatask; @@ -320,7 +320,7 @@ struct QADataCollectingEngine { 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)) { + if (InTheAcceptance(track)) { /* efficiency histograms */ fillhisto(fhPt_vs_EtaItsAcc, hasits); fillhisto(fhPt_vs_EtaTpcAcc, hastpc); @@ -800,8 +800,8 @@ struct DptDptEfficiencyAndQc { } } - template - void processTracks(FilterdCollision const& collision, PassedTracks const& tracks) + template + void processTracks(FilteredCollisions::iterator const& collision, PassedTracks const& tracks) { using namespace efficiencyandqatask; @@ -814,7 +814,7 @@ struct DptDptEfficiencyAndQc { mom = track.tpcInnerParam(); } } - qaDataCE[ixDCE]->processTrack(collision.posZ(), track); + qaDataCE[ixDCE]->processTrack(collision.posZ(), track); if constexpr (dopid) { pidDataCE[ixDCE]->processTrack(track, mom); } @@ -838,7 +838,7 @@ struct DptDptEfficiencyAndQc { { using namespace efficiencyandqatask; - processTracks(collision, tracks); + processTracks>, true, kReco>(collision, tracks); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processReconstructedNotStored, "Process reconstructed efficiency and QA for not stored derived data", false); @@ -848,7 +848,7 @@ struct DptDptEfficiencyAndQc { { using namespace efficiencyandqatask; - processTracks(collision, tracks); + processTracks>, true, kReco>(collision, tracks); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processDetectorLevelNotStored, "Process MC detector level efficiency and QA for not stored derived data", false); @@ -857,7 +857,7 @@ struct DptDptEfficiencyAndQc { { using namespace efficiencyandqatask; - processTracks(collision, particles); + processTracks>, false, kGen>(collision, particles); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processGeneratorLevelNotStored, "Process MC generator level efficiency and QA for not stored derived data", true); @@ -866,7 +866,7 @@ struct DptDptEfficiencyAndQc { { using namespace efficiencyandqatask; - processTracks(collision, tracks); + processTracks>, false, kReco>(collision, tracks); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processReconstructedNotStoredNoPID, "Process reconstructed efficiency and QA for not stored derived data", false); @@ -876,7 +876,7 @@ struct DptDptEfficiencyAndQc { { using namespace efficiencyandqatask; - processTracks(collision, tracks); + processTracks>, false, kReco>(collision, tracks); } PROCESS_SWITCH(DptDptEfficiencyAndQc, processDetectorLevelNotStoredNoPID, "Process MC detector level efficiency and QA for not stored derived data", true); }; diff --git a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx index b530c3d8fa8..55222b26eb4 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx @@ -13,7 +13,8 @@ /// \brief R2 correlation of Lambda baryons. /// \author Yash Patley -#include +#include +#include #include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Centrality.h" @@ -25,6 +26,8 @@ #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; @@ -56,25 +59,35 @@ using LambdaMCGenCollision = LambdaMCGenCollisions::iterator; namespace lambdatrack { DECLARE_SOA_INDEX_COLUMN(LambdaCollision, lambdaCollision); +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(MassWindow, masswindow, int8_t); +DECLARE_SOA_COLUMN(Cospa, cospa, float); +DECLARE_SOA_COLUMN(DcaDau, dcadau, float); } // namespace lambdatrack DECLARE_SOA_TABLE(LambdaTracks, "AOD", "LAMBDATRACKS", o2::soa::Index<>, lambdatrack::LambdaCollisionId, + lambdatrack::Px, + lambdatrack::Py, + lambdatrack::Pz, lambdatrack::Pt, - lambdatrack::Rap, + lambdatrack::Eta, lambdatrack::Phi, + lambdatrack::Rap, lambdatrack::Mass, lambdatrack::PosTrackId, lambdatrack::NegTrackId, lambdatrack::V0Type, - lambdatrack::MassWindow); + lambdatrack::Cospa, + lambdatrack::DcaDau); using LambdaTrack = LambdaTracks::iterator; namespace lambdamcgentrack @@ -83,22 +96,23 @@ DECLARE_SOA_INDEX_COLUMN(LambdaMCGenCollision, lambdaMcGenCollision); } DECLARE_SOA_TABLE(LambdaMCGenTracks, "AOD", "LMCGENTRACKS", o2::soa::Index<>, lambdamcgentrack::LambdaMCGenCollisionId, - o2::aod::mcparticle::Pt, + o2::aod::mcparticle::Px, + o2::aod::mcparticle::Py, + o2::aod::mcparticle::Pz, + lambdatrack::Pt, + lambdatrack::Eta, + lambdatrack::Phi, lambdatrack::Rap, - o2::aod::mcparticle::Phi, lambdatrack::Mass, lambdatrack::PosTrackId, lambdatrack::NegTrackId, - lambdatrack::V0Type); + lambdatrack::V0Type, + lambdatrack::Cospa, + lambdatrack::DcaDau); using LambdaMCGenTrack = LambdaMCGenTracks::iterator; } // namespace o2::aod -enum PidType { - kPion = 0, - kProton -}; - enum ParticleType { kLambda = 0, kAntiLambda @@ -110,13 +124,6 @@ enum ParticlePairType { kAntiLambdaAntiLambda }; -enum MassWindowType { - kCentralWindow = 0, - kLeftWindow, - kRightWindow, - kNoOfMassWindows -}; - enum RecGenType { kRec = 0, kGen @@ -130,7 +137,8 @@ struct lambdaCorrTableProducer { Produces lambdaMCGenTrackTable; // Collisions - Configurable cfg_z_vtx{"cfg_z_vtx", 10.0, "z vertex cut"}; + Configurable cfg_min_z_vtx{"cfg_min_z_vtx", -10.0, "z vertex cut"}; + Configurable cfg_max_z_vtx{"cfg_max_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"}; @@ -144,9 +152,8 @@ struct lambdaCorrTableProducer { 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", 3.0, "TPC NSigma Selection Cut"}; - Configurable cfg_tof_nsigma{"cfg_tof_nsigma", 3.0, "TOF NSigma Selection Cut"}; - Configurable cfg_tpc_only{"cfg_tpc_only", true, "TPC Only Selection"}; + 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"}; // V0s Configurable cfg_min_dca_V0_daughters{"cfg_min_dca_V0_daughters", 1.0, "min DCA between V0 daughters"}; @@ -157,9 +164,12 @@ struct lambdaCorrTableProducer { 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.995, "Minimum V0 CosPA to PV"}; - Configurable cfg_lambda_mass_window{"cfg_lambda_mass_window", 0.01, "Mass Window to select Lambda"}; + 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"}; // V0s kinmatic acceptance Configurable cfg_v0_pt_min{"cfg_v0_pt_min", 0.3, "Minimum V0 pT"}; @@ -170,45 +180,41 @@ struct lambdaCorrTableProducer { Configurable cfg_do_eta_analysis{"cfg_do_eta_analysis", false, "Eta Analysis"}; // V0s MC - Configurable cfg_is_primary_lambda{"cfg_is_primary_lambda", true, "Primary Lambda"}; - Configurable cfg_casc_lambda{"cfg_casc_lambda", false, "Lambda from Cascade"}; - Configurable cfg_has_mc_flag{"cfg_has_mc_flag", false, "Has Mc Tag"}; - - // lambda mass windows - Configurable> cfg_lambda_mass{"cfg_lambda_mass", {1.11, 1.12}, "Minimum Central Window"}; - Configurable> cfg_lambda_left{"cfg_lambda_left", {1.08, 1.09}, "Minimum Left Window"}; - Configurable> cfg_lambda_right{"cfg_lambda_right", {1.13, 1.14}, "Minimum Right Window"}; - - // global variable declaration - std::map> mass_win_map; + 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"}; // Histogram Registry. HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext const&) { - // global variable - mass_win_map = {{kCentralWindow, cfg_lambda_mass}, {kLeftWindow, cfg_lambda_left}, {kRightWindow, cfg_lambda_right}}; - - const AxisSpec axisCol(5, 0, 5, ""); + const AxisSpec axisCol(10, 0, 10, ""); 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(100, 1.06, 1.16, "Inv Mass (GeV/#it{c}^{2})"); - const AxisSpec axisV0Pt(200, 0., 5., "p_{T} (GeV/#it{c})"); - const AxisSpec axisV0Rap(16, -0.8, 0.8, "rap"); + const AxisSpec axisV0Mass(200, 1.09, 1.14, "M_{p#pi} (GeV/#it{c}^{2})"); + 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., 2. * TMath::Pi(), "#phi (rad)"); - const AxisSpec axisRadius(200, 0, 100, "r(cm)"); - const AxisSpec axisCosPA(120, 0.97, 1.0, "cos(#theta_{PA})"); - const AxisSpec axisDcaV0PV(200, 0, 2., "dca (cm)"); - const AxisSpec axisDcaProngPV(200, 0, 20., "dca (cm)"); - const AxisSpec axisDcaDau(75, 0., 1.5, "Daug DCA (cm^{2})"); - const AxisSpec axisCTau(200, 0, 100, "c#tau (cm/#it{c})"); + const AxisSpec axisRadius(400, 0, 200, "r(cm)"); + const AxisSpec axisCosPA(100, 0.99, 1.0, "cos(#theta_{PA})"); + const AxisSpec axisDcaV0PV(1000, -5., 5., "dca (cm)"); + const AxisSpec axisDcaProngPV(1000, -50., 50., "dca (cm)"); + const AxisSpec axisDcaDau(75, 0., 1.5, "Daug DCA (#sigma)"); + const AxisSpec axisCTau(400, 0, 200, "c#tau (cm)"); + const AxisSpec axisGCTau(400, 0, 200, "#gammac#tau (cm)"); const AxisSpec axisAlpha(40, -1, 1, "#alpha"); const AxisSpec axisQtarm(40, 0, 0.4, "q_{T}"); + const AxisSpec axisTrackPt(80, 0, 4, "p_{T} (GeV/#it{c})"); + const AxisSpec axisTrackDCA(200, -1, 1, "dca_{XY} (cm)"); const AxisSpec axisMomPID(80, 0, 4, "p (GeV/#it{c})"); const AxisSpec axisNsigma(401, -10.025, 10.025, {"n#sigma"}); const AxisSpec axisdEdx(360, 20, 200, "#frac{dE}{dx}"); @@ -221,7 +227,9 @@ struct lambdaCorrTableProducer { // 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/h2d_n1_V0_ptmass", "p_{T} vs M_{#Lambda}", kTH2F, {axisV0Mass, axisV0Pt}); + 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}); @@ -230,12 +238,13 @@ struct lambdaCorrTableProducer { // 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_eta", "#eta-distribution", kTH1F, {axisV0Eta}); 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_n1_V0_pteta", "p_{T} vs #eta", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("QA_Sel_Lambda/h2d_n1_V0_ptrap", "p_{T} vs y", kTH2F, {axisV0Rap, axisV0Pt}); - histos.add("QA_Sel_Lambda/h2d_n1_V0_ptphi", "p_{T} vs #phi", kTH2F, {axisV0Phi, axisV0Pt}); + histos.add("QA_Sel_Lambda/h2d_V0_pt_vs_eta", "p_{T} vs #eta", kTH2F, {axisV0Eta, 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}); @@ -244,46 +253,55 @@ struct lambdaCorrTableProducer { 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, {axisV0Pt}); - histos.add("QA_Sel_Lambda/h1d_neg_prong_pt", "Neg-Prong p_{T}", kTH1F, {axisV0Pt}); - 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_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, {axisV0Eta}); + histos.add("QA_Sel_Lambda/h1d_neg_prong_eta", "Neg-Prong #eta-distribution", kTH1F, {axisV0Eta}); 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_nsigma_pr_tpc", "TPC n#sigma Pos-Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_pos_prong_nsigma_pi_tpc", "TPC n#sigma Pos-Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_nsigma_pr_tpc", "TPC n#sigma Neg-Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_nsigma_pi_tpc", "TPC n#sigma Neg-Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_pos_prong_nsigma_pr_tof", "TOF n#sigma Pos-Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_pos_prong_nsigma_pi_tof", "TOF n#sigma Pos-Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_nsigma_pr_tof", "TOF n#sigma Neg-Prong", kTH2F, {axisMomPID, axisNsigma}); - histos.add("QA_Sel_Lambda/h2d_neg_prong_nsigma_pi_tof", "TOF n#sigma Neg-Prong", kTH2F, {axisMomPID, axisNsigma}); - - histos.add("QA_Sel_Lambda/h2d_pt_vs_alpha", "Armentros-Podolanski Plot", kTH2F, {axisAlpha, axisQtarm}); + 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}); // QA Anti-Lambda histos.addClone("QA_Sel_Lambda/", "QA_Sel_AntiLambda/"); // MC Generated Histograms if (doprocessMCGen) { + // McReco Histos + histos.add("QA_Checks/h2d_tracks_pid_before_sel", "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}); + + // 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_eta_lambda", "#Lambda #eta-distribution", kTH1F, {axisV0Eta}); 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_pteta_lambda", "#Lambda p_{T} vs #eta", kTH2F, {axisV0Eta, 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_eta_antilambda", "#bar{#Lambda} #eta-distribution", kTH1F, {axisV0Eta}); 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_pteta_antilambda", "#bar{#Lambda} p_{T} vs #eta", kTH2F, {axisV0Eta, 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}); } @@ -293,7 +311,7 @@ struct lambdaCorrTableProducer { bool selCol(C const& col) { - if (fabs(col.posZ()) > cfg_z_vtx) { + if (col.posZ() < cfg_min_z_vtx || col.posZ() >= cfg_max_z_vtx) { return false; } @@ -328,34 +346,37 @@ struct lambdaCorrTableProducer { return true; } - template - bool topologicalCutsV0(V const& v0, T const&) + template + bool dauTrackSelection(T const& track) { - auto postrack = v0.template posTrack_as(); - auto negtrack = v0.template negTrack_as(); - - if (postrack.pt() < cfg_pt_min || postrack.pt() > cfg_pt_max) { + if (track.pt() < cfg_pt_min || track.pt() > cfg_pt_max) { return false; } - if (negtrack.pt() < cfg_pt_min || negtrack.pt() > cfg_pt_max) { + if (fabs(track.eta()) >= cfg_eta_cut) { return false; } - if (fabs(postrack.eta()) > cfg_eta_cut) { + if (track.tpcNClsCrossedRows() < cfg_min_crossed_rows) { return false; } - if (fabs(negtrack.eta()) > cfg_eta_cut) { + if (fabs(track.dcaXY()) < cfg_track_dcaXY_min) { return false; } - if (postrack.tpcNClsCrossedRows() < cfg_min_crossed_rows) { - return false; - } + return true; + } + + template + bool topologicalCutsV0(C const& col, V const& v0, T const&) + { + + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); - if (negtrack.tpcNClsCrossedRows() < cfg_min_crossed_rows) { + if (!dauTrackSelection(postrack) || !dauTrackSelection(negtrack)) { return false; } @@ -379,6 +400,12 @@ struct lambdaCorrTableProducer { return false; } + // ctau + float ctau = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * MassLambda0; + if (ctau < cfg_min_ctau || ctau > cfg_max_ctau) { + return false; + } + if (v0.v0cosPA() < cfg_min_V0_cosPA) { return false; } @@ -386,45 +413,75 @@ struct lambdaCorrTableProducer { return true; } - template - bool selPIDTrack(T const& track) + template + bool selPIDTrack(T const& postrack, T const& negtrack) { + bool return_flag = false; + float tpcNSigmaPr = 0., tpcNSigmaPi = 0.; + + switch (part) { + // postrack = Proton, negtrack = Pion + case kLambda: + tpcNSigmaPr = postrack.tpcNSigmaPr(); + tpcNSigmaPi = negtrack.tpcNSigmaPi(); + break; + + // negtrack = Proton, postrack = Pion + case kAntiLambda: + tpcNSigmaPr = negtrack.tpcNSigmaPr(); + tpcNSigmaPi = postrack.tpcNSigmaPi(); + break; + } - bool selTPCv0type = false, selTOFv0type = false; - float tpcNSigma = 0., tofNSigma = 0.; + if (fabs(tpcNSigmaPr) < cfg_tpc_nsigma && fabs(tpcNSigmaPi) < cfg_tpc_nsigma) { + return_flag = true; + } - switch (pid) { + return return_flag; + } - case kPion: - tpcNSigma = track.tpcNSigmaPi(); - tofNSigma = track.tofNSigmaPi(); - break; + template + bool checkKinCuts(T const& v0track) + { - case kProton: - tpcNSigma = track.tpcNSigmaPr(); - tofNSigma = track.tofNSigmaPr(); - break; + // pT cut + if (v0track.pt() <= cfg_v0_pt_min || v0track.pt() >= cfg_v0_pt_max) { + return false; } - if (!cfg_tpc_only && track.hasTOF()) { - if (fabs(tofNSigma) < cfg_tof_nsigma) { - selTOFv0type = true; - } - if (fabs(tpcNSigma) < cfg_tpc_nsigma) { - selTPCv0type = true; - } + // apply rapidity/pseudorapidity acceptance + float rap = 0.; + if (cfg_do_eta_analysis) { + rap = v0track.eta(); } else { - selTOFv0type = true; - if (fabs(tpcNSigma) < cfg_tpc_nsigma) { - selTPCv0type = true; + rap = v0track.yLambda(); + } + + if (fabs(rap) >= cfg_v0_rap_max) { + return false; + } + + return true; + } + + template + void getPDGsIDs(T const& mcparts, std::vector& PDGs, std::vector& IDs) + { + + for (auto mcpart : mcparts) { + if (mcpart.globalIndex() != 0) { + IDs.push_back(mcpart.globalIndex()); + PDGs.push_back(mcpart.pdgCode()); } } - if (selTPCv0type && selTOFv0type) { - return true; + while (IDs.size() > 2) { + IDs.pop_back(); } - return false; + while (PDGs.size() > 2) { + PDGs.pop_back(); + } } template @@ -433,14 +490,10 @@ struct lambdaCorrTableProducer { static constexpr std::string_view sub_dir[] = {"QA_Sel_Lambda/", "QA_Sel_AntiLambda/"}; - // ctau - float ctau = v0.distovertotmom(col.posX(), col.posY(), col.posZ()) * MassLambda0; - // daugthers auto postrack = v0.template posTrack_as(); auto negtrack = v0.template negTrack_as(); - - float mass; + float mass = 0.; if constexpr (part == kLambda) { mass = v0.mLambda(); @@ -448,67 +501,72 @@ struct lambdaCorrTableProducer { mass = v0.mAntiLambda(); } + // ctau + float e = RecoDecay::e(v0.px(), v0.py(), v0.pz(), mass); + float gamma = e / mass; + 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_pt_vs_alpha"), v0.alpha(), v0.qtarm()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_n1_V0_pteta"), v0.eta(), v0.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_n1_V0_ptrap"), v0.yLambda(), v0.pt()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_n1_V0_ptphi"), v0.phi(), v0.pt()); + 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"), fabs(v0.dcapostopv())); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_dca_neg_to_PV"), fabs(v0.dcanegtopv())); - histos.fill(HIST(sub_dir[part]) + HIST("h1d_dca_V0_to_PV"), fabs(v0.dcav0topv())); + 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_nsigma_pr_tpc"), postrack.tpcInnerParam(), postrack.tpcNSigmaPr()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_pos_prong_nsigma_pi_tpc"), postrack.tpcInnerParam(), postrack.tpcNSigmaPi()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_nsigma_pr_tpc"), negtrack.tpcInnerParam(), negtrack.tpcNSigmaPr()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_nsigma_pi_tpc"), negtrack.tpcInnerParam(), negtrack.tpcNSigmaPi()); - - if (!cfg_tpc_only && postrack.hasTOF()) { - histos.fill(HIST(sub_dir[part]) + HIST("h2d_pos_prong_nsigma_pr_tof"), postrack.tofExpMom(), postrack.tofNSigmaPr()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_pos_prong_nsigma_pi_tof"), postrack.tofExpMom(), postrack.tofNSigmaPi()); - } - - if (!cfg_tpc_only && negtrack.hasTOF()) { - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_nsigma_pr_tof"), negtrack.tofExpMom(), negtrack.tofNSigmaPr()); - histos.fill(HIST(sub_dir[part]) + HIST("h2d_neg_prong_nsigma_pi_tof"), negtrack.tofExpMom(), negtrack.tofNSigmaPi()); - } + 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()); } template void selV0Particle(C const& collision, V const& v0track, T const& tracks) { - // initialize variables + // apply kinematic cuts + if (!checkKinCuts(v0track)) { + 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) && selPIDTrack(negtrack)) { + if (selPIDTrack(postrack, negtrack)) { mass = v0track.mLambda(); v0part = kLambda; - } else if (selPIDTrack(postrack) && selPIDTrack(negtrack)) { + } else if (selPIDTrack(postrack, negtrack)) { mass = v0track.mAntiLambda(); v0part = kAntiLambda; } else { @@ -518,73 +576,99 @@ struct lambdaCorrTableProducer { 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 mass window selection [global] - if ((fabs(mass - MassLambda0) >= cfg_lambda_mass_window) || (fabs(v0track.mK0Short() - MassK0Short) <= cfg_kshort_rej)) { + // apply Armentros-Podolanski Selection + if (cfg_armpod_flag && (fabs(v0track.alpha()) < v0track.qtarm() / cfg_armpod_val)) { return; } - histos.fill(HIST("QA_Checks/h2d_after_masswincut_pt_vs_alpha"), v0track.alpha(), v0track.qtarm()); - - // apply kinematic acceptance on pT - if (v0track.pt() <= cfg_v0_pt_min || v0track.pt() >= cfg_v0_pt_max) { + // apply kshort rejection hypothesis + if (cfg_kshort_rej_flag && (fabs(v0track.mK0Short() - MassK0Short) <= cfg_kshort_rej)) { return; } - float rap = 0.; - if (cfg_do_eta_analysis) { - rap = v0track.eta(); - } else { - rap = v0track.yLambda(); + // 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()); } - if (fabs(rap) >= cfg_v0_rap_max) { + // apply mass window cut (Selection of Lambda/AntiLambda) + if (fabs(mass - MassLambda0) >= cfg_lambda_mass_window) { 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); - // apply MC Reco cuts + // MC Reco Analysis if constexpr (reco) { - auto v0mcpart = v0track.mcParticle(); - if (cfg_is_primary_lambda && !v0mcpart.isPhysicalPrimary()) { - return; - } else if (cfg_casc_lambda && v0mcpart.isPhysicalPrimary()) { - return; - } + // Get information of all the reconstructed V0s + histos.fill(HIST("QA_Checks/h2d_tracks_pid_before_sel"), v0mcpart.pdgCode(), v0mcpart.pt()); - if (v0part == kLambda && v0mcpart.pdgCode() != 3122) { - return; - } else if (v0part == kAntiLambda && v0mcpart.pdgCode() != -3122) { - return; - } - } + // 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(); - // fill mass histogram before mass window cuts - histos.fill(HIST("QA_Checks/h1d_tracks_info"), 5.5); - histos.fill(HIST("QA_Checks/h1d_lambda_mass"), mass); - histos.fill(HIST("QA_Checks/h2d_n1_V0_ptmass"), mass, v0track.pt()); + if (cfg_rec_pid_flag) { - // loop over mass windows - for (auto m = mass_win_map.begin(); m != mass_win_map.end(); ++m) { + if (v0part == kLambda && v0mcpart.pdgCode() != kLambda0) { + return; + } else if (v0part == kAntiLambda && v0mcpart.pdgCode() != kLambda0Bar) { + return; + } - // apply mass window cut - if (mass > m->second[0] && mass < m->second[1]) { + getPDGsIDs(mcpart_daughters, daughterPDGs, daughterIDs); + getPDGsIDs(mcpart_mothers, motherPDGs, motherIDs); - if (m->first == kCentralWindow) { - if (v0part == kLambda) { - fillQALambda(collision, v0track, tracks); - } else { - fillQALambda(collision, v0track, tracks); - } + // Decay to Proton-Pion + if (abs(daughterPDGs[0]) == kProton && abs(daughterPDGs[1]) == kPiPlus) { + decay_channel_flag = true; } - lambdaTrackTable(lambdaCollisionTable.lastIndex(), v0track.pt(), rap, v0track.phi(), mass, postrack.index(), negtrack.index(), (int8_t)v0part, (int8_t)m->first); + // check for correct decay channel + if (!decay_channel_flag) { + return; + } - break; + // check whether the selected lambda is a Physical Primary / Secondary + if (cfg_rec_primary_lambda && !v0mcpart.isPhysicalPrimary()) { + histos.fill(HIST("QA_Checks/h1d_tracks_info"), 7.5); + return; + } else if (cfg_rec_secondary_lambda && v0mcpart.isPhysicalPrimary()) { + histos.fill(HIST("QA_Checks/h1d_tracks_info"), 8.5); + return; + } + + // 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()); + } + + if (abs(motherPDGs[0]) == kXiMinus || abs(motherPDGs[1]) == kXiMinus) { + histos.fill(HIST("QA_Checks/h2d_lambda_from_cascade"), v0mcpart.pdgCode(), v0mcpart.pt()); + } } + + // Fill the counter for selected primary/secondary Lambda/AntiLambda + histos.fill(HIST("QA_Checks/h1d_tracks_info"), 5.5); + histos.fill(HIST("QA_Checks/h2d_tracks_pid_after_sel"), v0mcpart.pdgCode(), v0mcpart.pt()); } + + 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(), v0track.eta(), v0track.phi(), v0track.yLambda(), mass, postrack.index(), negtrack.index(), (int8_t)v0part, v0track.v0cosPA(), v0track.dcaV0daughters()); } using Collisions = soa::Join; @@ -611,7 +695,7 @@ struct lambdaCorrTableProducer { histos.fill(HIST("QA_Checks/h2d_before_topo_cuts_pt_vs_alpha"), v0.alpha(), v0.qtarm()); // apply topological cuts on v0 candidates - if (!topologicalCutsV0(v0, tracks)) { + if (!topologicalCutsV0(collision, v0, tracks)) { continue; } @@ -678,7 +762,7 @@ struct lambdaCorrTableProducer { histos.fill(HIST("QA_Checks/h2d_before_topo_cuts_pt_vs_alpha"), v0.alpha(), v0.qtarm()); // apply topological cuts on v0 candidates - if (!topologicalCutsV0(v0, tracks)) { + if (!topologicalCutsV0(collision, v0, tracks)) { continue; } @@ -698,28 +782,29 @@ struct lambdaCorrTableProducer { histos.fill(HIST("McGen/h1d_collisions_info"), 1.5); // apply collision cuts - if (fabs(mcCollision.posZ()) > cfg_z_vtx) { + if (mcCollision.posZ() < cfg_min_z_vtx || mcCollision.posZ() > cfg_max_z_vtx) { return; } histos.fill(HIST("McGen/h1d_collisions_info"), 2.5); histos.fill(HIST("McGen/h1d_collision_posZ"), mcCollision.posZ()); lambdaMCGenCollisionTable(mcCollision.posX(), mcCollision.posY(), mcCollision.posZ()); - - TLorentzVector p; - int64_t postrackid = 0, negtrackid = 0; + float mass = 0.; for (auto const& mcpart : mcParticles) { - // check for Primary Lambdas/AntiLambdas - if (cfg_is_primary_lambda && !mcpart.isPhysicalPrimary()) { + // check for Lambda first + if (abs(mcpart.pdgCode()) != kLambda0) { continue; - } else if (cfg_casc_lambda && mcpart.isPhysicalPrimary()) { + } + + // check for Primary Lambdas/AntiLambdas + if (cfg_gen_primary_lambda && !mcpart.isPhysicalPrimary()) { continue; } // apply kinematic acceptance - if (mcpart.pt() < cfg_v0_pt_min || mcpart.pt() > cfg_v0_pt_max) { + if (mcpart.pt() <= cfg_v0_pt_min || mcpart.pt() >= cfg_v0_pt_max) { continue; } @@ -730,33 +815,34 @@ struct lambdaCorrTableProducer { rap = mcpart.y(); } - if (fabs(rap) > cfg_v0_rap_max) { + if (fabs(rap) >= cfg_v0_rap_max) { continue; } - p.SetPxPyPzE(mcpart.px(), mcpart.py(), mcpart.pz(), mcpart.e()); - - // find daughter ids - auto mcpart_daughters = mcpart.daughters_as(); - - for (auto const& mcpart_daughter : mcpart_daughters) { - if (mcpart.pdgCode() == 3122) { - if (mcpart_daughter.pdgCode() == 2212) { - postrackid = mcpart_daughter.index(); - } else { - negtrackid = mcpart_daughter.index(); - } - } else if (mcpart.pdgCode() == -3122) { - if (mcpart_daughter.pdgCode() == -2212) { - negtrackid = mcpart_daughter.index(); - } else { - postrackid = mcpart_daughter.index(); - } - } + // 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() == 3122) { + 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()); @@ -764,8 +850,11 @@ struct lambdaCorrTableProducer { 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.pt(), rap, mcpart.phi(), p.M(), postrackid, negtrackid, (int8_t)kLambda); - } else if (mcpart.pdgCode() == -3122) { + lambdaMCGenTrackTable(lambdaMCGenCollisionTable.lastIndex(), mcpart.px(), mcpart.py(), mcpart.pz(), mcpart.pt(), mcpart.eta(), mcpart.phi(), mcpart.y(), mass, daughterIDs[0], daughterIDs[1], (int8_t)kLambda, -999., -999.); + } 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()); @@ -773,7 +862,7 @@ struct lambdaCorrTableProducer { 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.pt(), rap, mcpart.phi(), p.M(), postrackid, negtrackid, (int8_t)kAntiLambda); + lambdaMCGenTrackTable(lambdaMCGenCollisionTable.lastIndex(), mcpart.px(), mcpart.py(), mcpart.pz(), mcpart.pt(), mcpart.eta(), mcpart.phi(), mcpart.y(), mass, daughterIDs[1], daughterIDs[0], (int8_t)kAntiLambda, -999., -999.); } } } @@ -784,13 +873,23 @@ struct lambdaCorrTableProducer { struct lambdaCorrelationAnalysis { // 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_nRapBins{"cfg_nRapBins", 12, "N Rapidity Bins"}; + Configurable cfg_Rap_Min{"cfg_Rap_Min", -0.6, "Minimum Rapidity"}; + Configurable cfg_Rap_Max{"cfg_Rap_Max", 0.6, "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"}; + // remove lambda with shared daughters + Configurable cfg_remove_lambda{"cfg_remove_lambda", true, "Flag to remove lambda"}; + + // Efficiency Correction + Configurable cfg_eff_corr_flag{"cfg_eff_corr_flag", true, "Efficiency Correction Flag"}; + + // CCDB + Configurable cfg_ccdb_url{"cfg_ccdb_url", "http://ccdb-test.cern.ch:8080", "url of ccdb"}; + Configurable cfg_ccdb_path{"cfg_ccdb_path", "Users/y/ypatley/lambda_corr_fact", "Path for ccdb-object"}; + // Histogram Registry. HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -803,9 +902,19 @@ struct lambdaCorrelationAnalysis { float kmaxphi = 0.; float rapbinwidth = 0.; float phibinwidth = 0.; + float q = 0., e = 0., qinv = 0.; + + // Initialize CCDB Service + Service ccdb; void init(InitContext const&) { + + // Set CCDB url + ccdb->setURL(cfg_ccdb_url.value); + ccdb->setCaching(true); + + // Set Density Histogram Attributes nrapbins = static_cast(cfg_nRapBins); kminrap = static_cast(cfg_Rap_Min); kmaxrap = static_cast(cfg_Rap_Max); @@ -820,14 +929,24 @@ struct lambdaCorrelationAnalysis { float kminrapphi = 0.; float kmaxrapphi = knrapphibins; + const AxisSpec axisCheck(1, 0, 1, ""); const AxisSpec axisPosZ(220, -11, 11, "V_{z} (cm)"); 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.2, 3.2, "p_{T} (GeV/#it{c})"); - const AxisSpec axisRap(cfg_nRapBins, cfg_Rap_Min, cfg_Rap_Max, "rap"); + const AxisSpec axisPt(64, 0.3, 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(cfg_nRapBins, cfg_Rap_Min, cfg_Rap_Max, "y"); const AxisSpec axisPhi(cfg_nPhiBins, cfg_Phi_Min, cfg_Phi_Max, "#phi (rad)"); - const AxisSpec axisRapPhi(knrapphibins, kminrapphi, kmaxrapphi, "rap #phi"); + const AxisSpec axisRapPhi(knrapphibins, kminrapphi, kmaxrapphi, "y #phi"); + const AxisSpec axisQinv(100, 0, 10, "q_{inv} (GeV/#it{c})"); + + const AxisSpec axisEfPt(16, 0.3, 3.5, "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 @@ -835,53 +954,145 @@ struct lambdaCorrelationAnalysis { 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}); + + // InvMass, DcaDau and CosPA + histos.add("Reco/QA_Lambda/h1d_V0_mass", "M_{p#pi}", kTH1F, {axisMass}); + histos.add("Reco/QA_Lambda/h1d_V0_cpa", "cos(#theta_{PA})", kTH1F, {axisCPA}); + histos.add("Reco/QA_Lambda/h1d_V0_dcadau", "DCA_{p#pi} at V0 Decay Vertex", kTH1F, {axisDcaDau}); - // Lambda - histos.add("Reco/Lambda/h1d_inv_mass", "M_{p#pi}", kTH1F, {axisMass}); + histos.addClone("Reco/QA_Lambda/", "Reco/QA_AntiLambda/"); - // Anti-Lambda - histos.addClone("Reco/Lambda/", "Reco/AntiLambda/"); + // Efficiency Histograms + 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 - histos.add("Reco/Lambda_Mass/h2d_n1_LaP", "#rho_{1}^{#Lambda}", kTH2D, {axisRap, axisPhi}); - histos.add("Reco/Lambda_Mass/h2d_n1_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2D, {axisRap, axisPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_LaP_LaM", "#rho_{2}^{#Lambda - #bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_LaP_LaP", "#rho_{2}^{#Lambda - #Lambda}", kTH2D, {axisRapPhi, axisRapPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_LaM_LaM", "#rho_{2}^{#bar{#Lambda} - #bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1pt2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisPt}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1pt2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisPt}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1pt2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisPt}); - histos.add("Reco/Lambda_Mass/h2d_n2_eta1eta2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisRap, axisRap}); - histos.add("Reco/Lambda_Mass/h2d_n2_eta1eta2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisRap, axisRap}); - histos.add("Reco/Lambda_Mass/h2d_n2_eta1eta2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisRap, axisRap}); - histos.add("Reco/Lambda_Mass/h2d_n2_phi1phi2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPhi, axisPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_phi1phi2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPhi, axisPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_phi1phi2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPhi, axisPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1eta2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisRap}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1eta2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisRap}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1eta2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisRap}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1phi2_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisPt, axisPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1phi2_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisPt, axisPhi}); - histos.add("Reco/Lambda_Mass/h2d_n2_pt1phi2_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisPt, axisPhi}); - - histos.addClone("Reco/Lambda_Mass/", "Reco/Lambda_Right/"); - histos.addClone("Reco/Lambda_Mass/", "Reco/Lambda_Left/"); + // 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_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}); + 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}); + 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, {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_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) { histos.addClone("Event/Reco/", "Event/McGen/"); - histos.addClone("Reco/Lambda_Mass/", "McGen/Lambda_Mass/"); - histos.addClone("Reco/Lambda/", "McGen/Lambda/"); - histos.addClone("McGen/Lambda/", "McGen/AntiLambda/"); + histos.addClone("Reco/", "McGen/"); + } + } + + template + bool removeLambdaSharingDau(T const& v, V const& vs) + { + // check whether to remove lambda or not + if (!cfg_remove_lambda) { + return true; + } + + static constexpr std::string_view sub_dir_recgen[] = {"Reco/", "McGen/"}; + static constexpr std::string_view sub_dir[] = {"QA_Lambda/", "QA_AntiLambda/"}; + + bool ret_flag = true; + + for (auto const& x : vs) { + if ((v.index() != x.index()) && (v.postrackid() == x.postrackid() || v.negtrackid() == x.negtrackid())) { + if (fillHist) { + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir[part]) + HIST("h1d_V0_mass"), x.mass()); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir[part]) + HIST("h1d_V0_cpa"), x.cospa()); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir[part]) + HIST("h1d_V0_dcadau"), x.dcadau()); + } + if (std::abs(v.mass() - MassLambda0) > std::abs(x.mass() - MassLambda0)) { + ret_flag = false; + break; + } + } + } + + return ret_flag; + } + + template + void get_corr_factor(float& corfact, C const& col, T const& track) + { + + // Check for efficiency correction flag and Rec/Gen Data + if (!cfg_eff_corr_flag || rec_gen == kGen) { + return; + } + + // Get from CCDB + auto ccdb_obj = ccdb->getForTimeStamp(cfg_ccdb_path.value, -1); + + // Check CCDB Object + if (!ccdb_obj) { + LOGF(warning, "CCDB OBJECT NOT FOUND"); + return; } + + std::string str; + + if (track.v0type() == kLambda) { + str = "h3f_lambda_corr_fact"; + } else { + str = "h3f_antilambda_corr_fact"; + } + + TH3F* hist = reinterpret_cast(ccdb_obj->FindObject(Form("%s", str.c_str()))); + + int pt_bin = hist->GetXaxis()->FindBin(track.pt()); + int eta_bin = hist->GetYaxis()->FindBin(track.eta()); + int vz_bin = hist->GetZaxis()->FindBin(col.posZ()); + + corfact = hist->GetBinContent(pt_bin + 0.00001, eta_bin + 0.00001, vz_bin + 0.01); + + return; } - template - void fillPairHistos(U& p1, U& p2) + template + void fillPairHistos(C const& col, U& p1, U& p2) { static constexpr std::string_view sub_dir_recgen[] = {"Reco/", "McGen/"}; - static constexpr std::string_view sub_dir_type[] = {"Lambda_Mass/", "Lambda_Left/", "Lambda_Right/"}; static constexpr std::string_view sub_dir_hist[] = {"LaP_LaM", "LaP_LaP", "LaM_LaM"}; int rapbin1 = static_cast((p1.rap() - kminrap) / rapbinwidth); @@ -890,57 +1101,112 @@ struct lambdaCorrelationAnalysis { int phibin1 = static_cast(p1.phi() / phibinwidth); int phibin2 = static_cast(p2.phi() / phibinwidth); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir_type[mass_win]) + HIST("h2d_n2_pt1pt2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.pt()); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir_type[mass_win]) + HIST("h2d_n2_eta1eta2_") + HIST(sub_dir_hist[part_pair]), p1.rap(), p2.rap()); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir_type[mass_win]) + HIST("h2d_n2_phi1phi2_") + HIST(sub_dir_hist[part_pair]), p1.phi(), p2.phi()); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir_type[mass_win]) + HIST("h2d_n2_pt1eta2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.rap()); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir_type[mass_win]) + HIST("h2d_n2_pt1phi2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.phi()); + float corfac1 = 1., corfac2 = 1.; + + get_corr_factor(corfac1, col, p1); + get_corr_factor(corfac2, col, p2); + + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_pt1pt2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.pt(), corfac1 * corfac2); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_eta1eta2_") + HIST(sub_dir_hist[part_pair]), p1.eta(), p2.eta(), corfac1 * corfac2); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_phi1phi2_") + HIST(sub_dir_hist[part_pair]), p1.phi(), p2.phi(), corfac1 * corfac2); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_rap1rap2_") + HIST(sub_dir_hist[part_pair]), p1.rap(), p2.rap(), corfac1 * corfac2); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_pt1eta2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.eta(), corfac1 * corfac2); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_pt1phi2_") + HIST(sub_dir_hist[part_pair]), p1.pt(), p2.phi(), corfac1 * corfac2); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_pt1rap2_") + HIST(sub_dir_hist[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(sub_dir_type[mass_win]) + HIST("h2d_n2_") + HIST(sub_dir_hist[part_pair]), rapphix + 0.5, rapphiy + 0.5); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n2_") + HIST(sub_dir_hist[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, 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_part[] = {"Lambda/", "AntiLambda/"}; - static constexpr std::string_view sub_dir_mass_win[] = {"Lambda_Mass/", "Lambda_Left/", "Lambda_Right/"}; static constexpr std::string_view sub_dir_hist[] = {"LaP", "LaM"}; - int ntrk = 0; + int ntrk1 = 0, ntrk2 = 0, ntrk3 = 0; + float corfac = 1.; for (auto const& track : tracks) { - ++ntrk; - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir_part[part]) + HIST("h1d_inv_mass"), track.mass()); - histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST(sub_dir_mass_win[masswin]) + HIST("h2d_n1_") + HIST(sub_dir_hist[part]), track.rap(), track.phi()); + ++ntrk1; + if (!removeLambdaSharingDau(track, tracks)) { + ++ntrk2; + continue; + } + ++ntrk3; + + // Get Correction Factor + get_corr_factor(corfac, col, track); + + // QA Plots + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n1_pt_") + HIST(sub_dir_hist[part]), track.pt(), corfac); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n1_eta_") + HIST(sub_dir_hist[part]), track.eta(), corfac); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n1_phi_") + HIST(sub_dir_hist[part]), track.phi(), corfac); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_n1_rap_") + HIST(sub_dir_hist[part]), track.rap(), corfac); + + // Efficiency Calculation Plots + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("Efficiency/h3f_n1_ptetaposz_") + HIST(sub_dir_hist[part]), track.pt(), track.eta(), col.posZ()); + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("Efficiency/h3f_n1_ptrapposz_") + HIST(sub_dir_hist[part]), track.pt(), track.rap(), col.posZ()); + + // Rho1 for R2 Calculation + histos.fill(HIST(sub_dir_recgen[rec_gen]) + HIST("h2d_n1_") + HIST(sub_dir_hist[part]), track.rap(), track.phi(), corfac); } - if (masswin == kCentralWindow && ntrk != 0) { + // fill multiplicity histograms + if (ntrk1 != 0) { if (part == kLambda) { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_lambda_multiplicity"), ntrk); + histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_lambda_totmult"), ntrk1); } else { - histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_antilambda_multiplicity"), ntrk); + histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_antilambda_totmult"), ntrk1); + } + } + + if (ntrk2 != 0) { + if (part == kLambda) { + histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_lambda_sdau"), ntrk2); + } else { + histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_antilambda_sdau"), ntrk2); + } + } + + if (ntrk3 != 0) { + if (part == kLambda) { + histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_lambda_multiplicity"), ntrk3); + } else { + histos.fill(HIST("Event/") + HIST(sub_dir_recgen[rec_gen]) + HIST("h1d_antilambda_multiplicity"), ntrk3); } } } - template - void analyzePairs(T const& trks_1, T const& trks_2) + template + void analyzePairs(C const& col, T const& trks_1, T const& trks_2) { - for (auto const& trk_1 : trks_1) { + if (!removeLambdaSharingDau(trk_1, trks_1)) { + continue; + } for (auto const& trk_2 : trks_2) { - if (samelambda && ((trk_1.index() == trk_2.index()) || (trk_1.postrackid() == trk_2.postrackid()) || (trk_1.negtrackid() == trk_2.negtrackid()))) { + // check for same index for Lambda-Lambda / AntiLambda-AntiLambda + if (samelambda && ((trk_1.index() == trk_2.index()))) { continue; } - fillPairHistos(trk_1, trk_2); + // check if Lambda shares a daughter and select the one closest to PDG Mass + if (!removeLambdaSharingDau(trk_2, trks_2)) { + continue; + } + fillPairHistos(col, trk_1, trk_2); } } } @@ -950,49 +1216,22 @@ struct lambdaCorrelationAnalysis { SliceCache cache; - Partition part_lambda_tracks = (aod::lambdatrack::v0type == (int8_t)kLambda && aod::lambdatrack::masswindow == (int8_t)kCentralWindow); - Partition part_anti_lambda_tracks = (aod::lambdatrack::v0type == (int8_t)kAntiLambda && aod::lambdatrack::masswindow == (int8_t)kCentralWindow); - - Partition part_lambda_tracks_left_masswin = (aod::lambdatrack::v0type == (int8_t)kLambda && aod::lambdatrack::masswindow == (int8_t)kLeftWindow); - Partition part_anti_lambda_tracks_left_masswin = (aod::lambdatrack::v0type == (int8_t)kAntiLambda && aod::lambdatrack::masswindow == (int8_t)kLeftWindow); - - Partition part_lambda_tracks_right_masswin = (aod::lambdatrack::v0type == (int8_t)kLambda && aod::lambdatrack::masswindow == (int8_t)kRightWindow); - Partition part_anti_lambda_tracks_right_masswin = (aod::lambdatrack::v0type == (int8_t)kAntiLambda && aod::lambdatrack::masswindow == (int8_t)kRightWindow); + Partition part_lambda_tracks = (aod::lambdatrack::v0type == (int8_t)kLambda); + Partition part_anti_lambda_tracks = (aod::lambdatrack::v0type == (int8_t)kAntiLambda); void processDataReco(Lambda_Collisions::iterator const& collision, Lambda_Tracks const&) { - 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 lambda_tracks_left = part_lambda_tracks_left_masswin->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); - auto anti_lambda_tracks_left = part_anti_lambda_tracks_left_masswin->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); - - auto lambda_tracks_right = part_lambda_tracks_right_masswin->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); - auto anti_lambda_tracks_right = part_anti_lambda_tracks_right_masswin->sliceByCached(aod::lambdatrack::lambdaCollisionId, collision.globalIndex(), cache); - - analyzeSingles(lambda_tracks); - analyzeSingles(lambda_tracks_left); - analyzeSingles(lambda_tracks_right); - - analyzeSingles(anti_lambda_tracks); - analyzeSingles(anti_lambda_tracks_left); - analyzeSingles(anti_lambda_tracks_right); - - analyzePairs(lambda_tracks, anti_lambda_tracks); - analyzePairs(lambda_tracks_left, anti_lambda_tracks_left); - analyzePairs(lambda_tracks_right, anti_lambda_tracks_right); - - analyzePairs(lambda_tracks, lambda_tracks); - analyzePairs(lambda_tracks_left, lambda_tracks_left); - analyzePairs(lambda_tracks_right, lambda_tracks_right); - - analyzePairs(anti_lambda_tracks, anti_lambda_tracks); - analyzePairs(anti_lambda_tracks_left, anti_lambda_tracks_left); - analyzePairs(anti_lambda_tracks_right, anti_lambda_tracks_right); + analyzeSingles(collision, lambda_tracks); + analyzeSingles(collision, anti_lambda_tracks); + analyzePairs(collision, lambda_tracks, anti_lambda_tracks); + analyzePairs(collision, lambda_tracks, lambda_tracks); + analyzePairs(collision, anti_lambda_tracks, anti_lambda_tracks); } PROCESS_SWITCH(lambdaCorrelationAnalysis, processDataReco, "Process for Data and MCReco", true); @@ -1012,11 +1251,11 @@ struct lambdaCorrelationAnalysis { 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); - 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, lambda_mcgen_tracks); + analyzeSingles(mcgencol, antilambda_mcgen_tracks); + analyzePairs(mcgencol, lambda_mcgen_tracks, antilambda_mcgen_tracks); + analyzePairs(mcgencol, lambda_mcgen_tracks, lambda_mcgen_tracks); + analyzePairs(mcgencol, antilambda_mcgen_tracks, antilambda_mcgen_tracks); } PROCESS_SWITCH(lambdaCorrelationAnalysis, processMCGen, "Process for MC Generated", false); diff --git a/PWGDQ/Core/CutsLibrary.cxx b/PWGDQ/Core/CutsLibrary.cxx index 064f26b1938..283820693cf 100644 --- a/PWGDQ/Core/CutsLibrary.cxx +++ b/PWGDQ/Core/CutsLibrary.cxx @@ -412,6 +412,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")); @@ -765,6 +788,18 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } + if (!nameStr.compare("posTrackKaonRej")) { + cut->AddCut(GetAnalysisCut("posTrack")); + cut->AddCut(GetAnalysisCut("kaonRejNsigma")); + return cut; + } + + if (!nameStr.compare("negTrackKaonRej")) { + cut->AddCut(GetAnalysisCut("negTrack")); + cut->AddCut(GetAnalysisCut("kaonRejNsigma")); + return cut; + } + if (!nameStr.compare("pTLow04")) { cut->AddCut(GetAnalysisCut("pTLow04")); return cut; @@ -889,7 +924,7 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } - for (int iCut = 0; iCut < 7; iCut++) { + for (int iCut = 0; iCut < 10; iCut++) { if (!nameStr.compare(Form("jpsiEleSel%d_ionut", iCut))) { cut->AddCut(GetAnalysisCut("kineJpsiEle_ionut")); cut->AddCut(GetAnalysisCut("dcaCut1_ionut")); @@ -2500,6 +2535,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 @@ -2537,6 +2588,11 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName) return cut; } + if (!nameStr.compare("matchedQualityCutsMFTeta")) { + cut->AddCut(GetAnalysisCut("matchedQualityCutsMFTeta")); + return cut; + } + if (!nameStr.compare("muonQualityCuts3SigmaPDCA")) { cut->AddCut(GetAnalysisCut("muonQualityCuts3SigmaPDCA")); return cut; @@ -3453,6 +3509,26 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cutAorC; } + if (!nameStr.compare("eventUPCMode")) { + cut->AddCut(VarManager::kIsITSUPCMode, 0.5, 1.5); + return cut; + } + + if (!nameStr.compare("eventSingleGapACZDC_UPCMode")) { + AnalysisCompositeCut* cutA = new AnalysisCompositeCut("singleGapAZDC", "singleGapAZDC", kTRUE); + cutA->AddCut(GetAnalysisCut("eventSingleGapAZDC")); + cutA->AddCut(GetAnalysisCut("eventUPCMode")); + + AnalysisCompositeCut* cutC = new AnalysisCompositeCut("singleGapCZDC", "singleGapCZDC", kTRUE); + cutC->AddCut(GetAnalysisCut("eventSingleGapCZDC")); + cutC->AddCut(GetAnalysisCut("eventUPCMode")); + + AnalysisCompositeCut* cutAorC = new AnalysisCompositeCut("singleGapACZDC", "singleGapACZDC", kFALSE); + cutAorC->AddCut(cutA); + cutAorC->AddCut(cutC); + return cutAorC; + } + // Event cuts based on centrality if (!nameStr.compare("eventStandardNoINT7Cent090")) { cut->AddCut(VarManager::kVtxZ, -10.0, 10.0); @@ -3769,6 +3845,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); @@ -4017,6 +4104,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); @@ -4093,6 +4186,24 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("pidJpsiEle7_ionut")) { + cut->AddCut(VarManager::kTOFnSigmaEl, -3.0, 4.0); + cut->AddCut(VarManager::kTPCnSigmaEl, -1.0, 4.0); + return cut; + } + + if (!nameStr.compare("pidJpsiEle8_ionut")) { + cut->AddCut(VarManager::kTOFnSigmaEl, -3.0, 4.0); + cut->AddCut(VarManager::kTPCnSigmaEl, -1.5, 4.0); + return cut; + } + + if (!nameStr.compare("pidJpsiEle9_ionut")) { + cut->AddCut(VarManager::kTOFnSigmaEl, -3.0, 4.0); + cut->AddCut(VarManager::kTPCnSigmaEl, -2.0, 4.0); + return cut; + } + if (!nameStr.compare("standardPrimaryTrackDCAz")) { cut->AddCut(VarManager::kTrackDCAxy, -3.0, 3.0); cut->AddCut(VarManager::kTrackDCAz, -1.0, 1.0); @@ -4359,6 +4470,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 @@ -4730,6 +4856,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); @@ -4769,6 +4902,11 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName) return cut; } + if (!nameStr.compare("kaonRejNsigma")) { + cut->AddCut(VarManager::kTPCnSigmaKa, -3.0, 3.0, true); + return cut; + } + if (!nameStr.compare("kaonPIDnsigma2")) { cut->AddCut(VarManager::kTPCnSigmaKa, -2.0, 2.0); return cut; @@ -4889,6 +5027,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; @@ -5213,6 +5356,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); diff --git a/PWGDQ/Core/HistogramManager.cxx b/PWGDQ/Core/HistogramManager.cxx index 146baeb939a..f9ba930a0ec 100644 --- a/PWGDQ/Core/HistogramManager.cxx +++ b/PWGDQ/Core/HistogramManager.cxx @@ -121,7 +121,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) @@ -180,6 +180,7 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co varVector.push_back(varY); varVector.push_back(varZ); 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 +331,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 @@ -389,6 +390,7 @@ void HistogramManager::AddHistogram(const char* histClass, const char* hname, co varVector.push_back(varY); varVector.push_back(varZ); 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 +756,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 +786,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 +794,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[varW]); + } else { + (reinterpret_cast(h))->Fill(values[varX], 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 +831,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; 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 0ee10b5f844..e23ef4549d8 100644 --- a/PWGDQ/Core/HistogramsLibrary.cxx +++ b/PWGDQ/Core/HistogramsLibrary.cxx @@ -30,7 +30,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 +76,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")) { @@ -231,6 +231,10 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h 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, "Corr2REFerrors", "", 4, std::array{VarManager::kCentFT0C, VarManager::kCORR2REFw, VarManager::kCORR2REFsquaredw, VarManager::kM11REF}.data(), std::array{18, 200, 200, 200}.data(), std::array{0.0, -40000.0, -10.0, 0.0}.data(), std::array{90.0, 40000.0, 1000.0, 7000000.0}.data(), nullptr, -1, true, true); + hm->AddHistogram(histClass, "Corr4REFerrors", "", 4, std::array{VarManager::kCentFT0C, VarManager::kCORR4REFw, VarManager::kCORR4REFsquaredw, VarManager::kM1111REF}.data(), std::array{18, 200, 200, 200}.data(), std::array{0.0, -90000000.0, -1000.0, 0.0}.data(), std::array{90.0, 90000000.0, 40000.0, 9000000000000.0}.data(), nullptr, -1, true, true); 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); @@ -299,6 +303,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h 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); hm->AddHistogram(histClass, "IsSingleGapC", "Is single gap on side C", false, 2, -0.5, 1.5, VarManager::kIsSingleGapC); + hm->AddHistogram(histClass, "IsITSUPCMode", "UPC settings used", false, 2, -0.5, 1.5, VarManager::kIsITSUPCMode); + hm->AddHistogram(histClass, "IsITSUPCMode_IsSingleGap", "UPC settings used vs Is single gap", false, 2, -0.5, 1.5, VarManager::kIsITSUPCMode, 2, -0.5, 1.5, VarManager::kIsSingleGap); } if (subGroupStr.Contains("zdc")) { hm->AddHistogram(histClass, "energyCommonZNA_energyCommonZNC", "Common ZNA energy vs common ZNC energy", false, 1050, -10.0, 200.0, VarManager::kEnergyCommonZNA, 1050, -10.0, 200.0, VarManager::kEnergyCommonZNC); @@ -397,8 +403,6 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h 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, "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); @@ -454,6 +458,7 @@ 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, "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); @@ -464,7 +469,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h 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_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, "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); @@ -472,6 +478,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h 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); @@ -487,8 +494,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}; @@ -647,30 +654,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); @@ -812,15 +804,28 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "Mass_HighRange", "", false, 375, 0.0, 15.0, VarManager::kMass); hm->AddHistogram(histClass, "Pt", "", false, 2000, 0.0, 20., VarManager::kPt); hm->AddHistogram(histClass, "Mass_Pt", "", false, 125, 0.0, 5.0, VarManager::kMass, 40, 0.0, 20.0, VarManager::kPt); + double massBins[76]; + for (int i = 0; i < 76; i++) { + massBins[i] = 1.5 + i * 0.04; + } + double ptBins[70]; + for (int i = 0; i <= 50; i++) { + ptBins[i] = i * 0.01; + } + for (int i = 1; i <= 19; i++) { + ptBins[50 + i] = 0.5 + i * 0.5; + } + hm->AddHistogram(histClass, "Mass_PtFine", "", false, 75, massBins, VarManager::kMass, 69, ptBins, VarManager::kPt); hm->AddHistogram(histClass, "Eta_Pt", "", false, 40, -2.0, 2.0, VarManager::kEta, 40, 0.0, 20.0, VarManager::kPt); hm->AddHistogram(histClass, "Mass_VtxZ", "", true, 30, -15.0, 15.0, VarManager::kVtxZ, 500, 0.0, 5.0, VarManager::kMass); if (subGroupStr.Contains("pbpb")) { - hm->AddHistogram(histClass, "Mass_CentFT0C", "", false, 500, 0.0, 5.0, VarManager::kMass, 20, 0.0, 100.0, VarManager::kCentFT0C); - hm->AddHistogram(histClass, "Pt_CentFT0C", "", false, 500, 0.0, 1.5, VarManager::kPt, 20, 0.0, 100.0, VarManager::kCentFT0C); - hm->AddHistogram(histClass, "Mass_Pt_CentFT0C", "", false, 500, 0.0, 5.0, VarManager::kMass, 250, 0.0, 10.0, VarManager::kPt, 10, 0.0, 100.0, VarManager::kCentFT0C); + hm->AddHistogram(histClass, "Mass_CentFT0C", "", false, 125, 0.0, 5.0, VarManager::kMass, 20, 0.0, 100.0, VarManager::kCentFT0C); + hm->AddHistogram(histClass, "Pt_CentFT0C", "", false, 100, 0.0, 10.0, VarManager::kPt, 20, 0.0, 100.0, VarManager::kCentFT0C); + hm->AddHistogram(histClass, "Mass_Pt_CentFT0C", "", false, 75, 1.5, 4.5, VarManager::kMass, 20, 0.0, 10.0, VarManager::kPt, 10, 0.0, 100.0, VarManager::kCentFT0C); } if (subGroupStr.Contains("mult")) { hm->AddHistogram(histClass, "Mass_Pt_MultFV0A", "", false, 200, 0.0, 5.0, VarManager::kMass, 40, 0.0, 40.0, VarManager::kPt, 100, 0.0, 25000.0, VarManager::kMultFV0A); + hm->AddHistogram(histClass, "Mass_VtxNcontribReal", "Mass vs VtxNcontribReal", false, 200, 0.0, 5.0, VarManager::kMass, 200, 0, 200.0, VarManager::kVtxNcontribReal); } if (subGroupStr.Contains("polarization")) { hm->AddHistogram(histClass, "cosThetaHE", "", false, 100, -1., 1., VarManager::kCosThetaHE); @@ -966,35 +971,56 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "U2Q2_CentFT0C_ev1", "mass vs. centrality vs. U2Q2_event1", false, 125, 0.0, 5.0, VarManager::kMass, 9, 0.0, 90.0, VarManager::kCentFT0C, 100, -10.0, 10.0, VarManager::kU2Q2Ev1); 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); + } 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-rap")) { int vars[4] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kRap}; - int binspT[4] = {150, 200, 10, 8}; - double xminpT[4] = {2., 0., 0, 2.0}; - double xmaxpT[4] = {5., 20., 100, 4.5}; + int binspT[4] = {150, 200, 10, 6}; + double xminpT[4] = {2., 0., 0, 2.5}; + double xmaxpT[4] = {5., 20., 100, 4.0}; hm->AddHistogram(histClass, "Mass_Pt_Cent_Rap", "", 4, vars, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } if (subGroupStr.Contains("dimuon-polarization-he-pbpb")) { @@ -1004,7 +1030,13 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h double xmaxpT[5] = {5., 3., 100, 1., 3.14}; hm->AddHistogram(histClass, "Mass_Pt_Cent_cosThetaHE", "", 5, varsHEpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } - + if (subGroupStr.Contains("dimuon-polarization-lowmass-he-pbpb")) { + int varsHEpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaHE, VarManager::kPhiHE}; + int binspT[5] = {200, 30, 10, 10, 10}; + double xminpT[5] = {0.2, 0., 0, -1., -3.14}; + double xmaxpT[5] = {1.2, 3., 100, 1., 3.14}; + hm->AddHistogram(histClass, "Mass_Pt_Cent_cosThetaHE_lowmass", "", 5, varsHEpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); + } if (subGroupStr.Contains("dimuon-polarization-cs-pbpb")) { int varsCSpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaCS, VarManager::kPhiCS}; int binspT[5] = {150, 30, 10, 10, 10}; @@ -1012,18 +1044,25 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h double xmaxpT[5] = {5., 3., 100, 1., 3.14}; hm->AddHistogram(histClass, "Mass_Pt_Cent_cosThetaCS", "", 5, varsCSpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } + if (subGroupStr.Contains("dimuon-polarization-lowmass-cs-pbpb")) { + int varsCSpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaCS, VarManager::kPhiCS}; + int binspT[5] = {200, 30, 10, 10, 10}; + double xminpT[5] = {0.2, 0., 0, -1., -3.14}; + 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-rap-polarization-he-pbpb")) { int varsHEpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaHE, VarManager::kRap}; - int binspT[5] = {150, 30, 10, 10, 8}; - double xminpT[5] = {2., 0., 0, -1., 2.0}; - double xmaxpT[5] = {5., 3., 100, 1., 4.5}; + int binspT[5] = {150, 30, 10, 10, 6}; + double xminpT[5] = {2., 0., 0, -1., 2.5}; + double xmaxpT[5] = {5., 3., 100, 1., 4.0}; hm->AddHistogram(histClass, "Mass_Pt_Cent_cosThetaHE_Rap", "", 5, varsHEpbpb, binspT, xminpT, xmaxpT, 0, -1, kFALSE); } if (subGroupStr.Contains("dimuon-rap-polarization-cs-pbpb")) { int varsCSpbpb[5] = {VarManager::kMass, VarManager::kPt, VarManager::kCentFT0C, VarManager::kCosThetaCS, VarManager::kRap}; - int binspT[5] = {150, 30, 10, 10, 8}; - double xminpT[5] = {2., 0., 0, -1., 2.0}; - double xmaxpT[5] = {5., 3., 100, 1., 4.5}; + int binspT[5] = {150, 30, 10, 10, 6}; + double xminpT[5] = {2., 0., 0, -1., 2.5}; + 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")) { @@ -1069,7 +1108,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}; @@ -1120,6 +1161,8 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h } if (subGroupStr.Contains("correlation-emu")) { hm->AddHistogram(histClass, "DeltaPhiPair2", "", false, 600, -0.5 * TMath::Pi(), 1.5 * TMath::Pi(), VarManager::kDeltaPhiPair2); + hm->AddHistogram(histClass, "DeltaEtaPair2", "", false, 600, -1.0, 5.0, VarManager::kDeltaEtaPair2); + hm->AddHistogram(histClass, "DeltaPhiPair2_DeltaEtaPair2", "", false, 600, -0.5 * TMath::Pi(), 1.5 * TMath::Pi(), VarManager::kDeltaPhiPair2, 600, -1.0, 5.0, VarManager::kDeltaEtaPair2); } if (subGroupStr.Contains("dielectrons")) { if (subGroupStr.Contains("prefilter")) { @@ -1221,27 +1264,11 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h } if (subGroupStr.Contains("opencharm")) { if (subGroupStr.Contains("dmeson")) { - double mD0_bins[141]; - for (int i = 0; i <= 140; i++) { - mD0_bins[i] = 1.5 + i * 0.005; - } - int nbins_mD0 = sizeof(mD0_bins) / sizeof(*mD0_bins) - 1; - - double ptD0_bins[31]; - for (int i = 0; i <= 16; i++) - ptD0_bins[i] = 0.125 * i; - for (int i = 1; i <= 8; i++) - ptD0_bins[16 + i] = 2 + 0.25 * i; - for (int i = 1; i <= 4; i++) - ptD0_bins[24 + i] = 4 + 1 * i; - ptD0_bins[29] = 8; - ptD0_bins[30] = 20; - int nbins_ptD0 = sizeof(ptD0_bins) / sizeof(*ptD0_bins) - 1; - hm->AddHistogram(histClass, "MassD0region", "", false, nbins_mD0, mD0_bins, VarManager::kMass); - hm->AddHistogram(histClass, "MassD0region_Pt", "", false, nbins_mD0, mD0_bins, VarManager::kMass, nbins_ptD0, ptD0_bins, VarManager::kPt); + hm->AddHistogram(histClass, "MassD0region", "", false, 140, 1.5, 2.2, VarManager::kMass); + hm->AddHistogram(histClass, "MassD0region_Pt", "", false, 70, 1.5, 2.2, VarManager::kMass, 160, 0., 20., VarManager::kPt); hm->AddHistogram(histClass, "MassD0region_Rapidity", "", false, 140, 1.5, 2.2, VarManager::kMass, 10, -0.8, 0.8, VarManager::kRap); hm->AddHistogram(histClass, "MassD0region_eta", "", false, 140, 1.5, 2.2, VarManager::kMass, 40, -2., 2., VarManager::kEta); - hm->AddHistogram(histClass, "MassD0region_TauxyzProj", "", false, 140, 1.5, 2.2, VarManager::kMass, 1000, -0.03, 0.03, VarManager::kVertexingTauxyzProjected); + hm->AddHistogram(histClass, "MassD0region_TauxyzProj", "", false, 140, 1.5, 2.2, VarManager::kMass, 200, -0.03, 0.03, VarManager::kVertexingTauxyzProjected); hm->AddHistogram(histClass, "MassD0region_VtxNContribReal", "", false, 140, 1.5, 2.2, VarManager::kMass, 50, 0, 50, VarManager::kVtxNcontribReal); hm->AddHistogram(histClass, "MassD0region_Rapidity_AveragePt", "", true, 140, 1.5, 2.2, VarManager::kMass, 10, -0.8, 0.8, VarManager::kRap, 150, 0.0, 30.0, VarManager::kPt); } @@ -1269,7 +1296,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); } @@ -1293,6 +1320,33 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h hm->AddHistogram(histClass, "TauxyProj", "", false, 4000, -0.5, 0.5, VarManager::kVertexingTauxyProjected); hm->AddHistogram(histClass, "CosPointingAngle", "", false, 100, 0.0, 1.0, VarManager::kCosPointingAngle); } + 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); hm->AddHistogram(histClass, "DeltaEta_DeltaPhiSym", "", false, 20, -2.0, 2.0, VarManager::kDeltaEta, 50, -8.0, 8.0, VarManager::kDeltaPhiSym); 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/MCSignalLibrary.cxx b/PWGDQ/Core/MCSignalLibrary.cxx index 7a33333b0a7..b4061743a7d 100644 --- a/PWGDQ/Core/MCSignalLibrary.cxx +++ b/PWGDQ/Core/MCSignalLibrary.cxx @@ -119,6 +119,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 +179,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}); @@ -709,6 +729,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); diff --git a/PWGDQ/Core/VarManager.cxx b/PWGDQ/Core/VarManager.cxx index 3026f9408a2..6b9af9bb7cc 100644 --- a/PWGDQ/Core/VarManager.cxx +++ b/PWGDQ/Core/VarManager.cxx @@ -435,6 +435,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 +595,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"; @@ -759,12 +763,28 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kM0111POI] = ""; fgVariableNames[kCORR2REF] = "<2> "; fgVariableUnits[kCORR2REF] = ""; + fgVariableNames[kCORR2REFw] = "<2w> "; + fgVariableUnits[kCORR2REFw] = ""; + fgVariableNames[kCORR2REFsquaredw] = " "; + fgVariableUnits[kCORR2REFsquaredw] = ""; fgVariableNames[kCORR2POI] = "<2'> "; fgVariableUnits[kCORR2POI] = ""; + fgVariableNames[kCORR2POIw] = "<2'w> "; + fgVariableUnits[kCORR2POIw] = ""; + fgVariableNames[kCORR2POIsquaredw] = " "; + fgVariableUnits[kCORR2POIsquaredw] = ""; fgVariableNames[kCORR4REF] = "<4> "; fgVariableUnits[kCORR4REF] = ""; + fgVariableNames[kCORR4REFw] = "<4w> "; + fgVariableUnits[kCORR4REFw] = ""; + fgVariableNames[kCORR4REFsquaredw] = " "; + fgVariableUnits[kCORR4REFsquaredw] = ""; fgVariableNames[kCORR4POI] = "<4'> "; fgVariableUnits[kCORR4POI] = ""; + fgVariableNames[kCORR4POIw] = "<4'w> "; + fgVariableUnits[kCORR4POIw] = ""; + fgVariableNames[kCORR4POIsquaredw] = " "; + fgVariableUnits[kCORR4POIsquaredw] = ""; fgVariableNames[kM11REFoverMp] = "M_{11}^{REF}/M_{p} "; fgVariableUnits[kM11REFoverMp] = ""; fgVariableNames[kM01POIoverMp] = "M^{'}_{01}^{POI}/M_{p} "; @@ -775,8 +795,16 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kM0111POIoverMp] = ""; fgVariableNames[kCORR2POIMp] = "<2'> M_{p} "; fgVariableUnits[kCORR2POIMp] = ""; + fgVariableNames[kCORR2POIMpw] = "<2'w> M_{p} "; + fgVariableUnits[kCORR2POIMpw] = ""; + fgVariableNames[kCORR2POIsquaredMpw] = "<2'w>^{2} M_{p} "; + fgVariableUnits[kCORR2POIsquaredMpw] = ""; fgVariableNames[kCORR4POIMp] = "<4'> M_{p} "; fgVariableUnits[kCORR4POIMp] = ""; + fgVariableNames[kCORR4POIMpw] = "<4'w> M_{p} "; + fgVariableUnits[kCORR4POIMpw] = ""; + fgVariableNames[kCORR4POIsquaredMpw] = "<4'w>^{2} M_{p} "; + fgVariableUnits[kCORR4POIsquaredMpw] = ""; fgVariableNames[kCos2DeltaPhi] = "cos 2(#varphi-#Psi_{2}^{A}) "; fgVariableUnits[kCos2DeltaPhi] = ""; fgVariableNames[kCos3DeltaPhi] = "cos 3(#varphi-#Psi_{3}^{A}) "; @@ -851,6 +879,8 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kPhiCS] = "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"; @@ -895,6 +925,10 @@ void VarManager::SetDefaultVarNames() fgVariableUnits[kIsSingleGapA] = ""; fgVariableNames[kIsSingleGapC] = "is single gap event side C"; fgVariableUnits[kIsSingleGapC] = ""; + fgVariableNames[kIsSingleGap] = "is single gap event"; + fgVariableUnits[kIsSingleGap] = ""; + fgVariableNames[kIsITSUPCMode] = "UPC settings used"; + fgVariableUnits[kIsITSUPCMode] = ""; fgVariableNames[kQuadMass] = "mass quadruplet"; fgVariableUnits[kQuadMass] = "GeV/c2"; fgVariableNames[kQuadPt] = "p_{T}"; diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index e0a6085f44e..d676d0efcf5 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -145,6 +146,7 @@ class VarManager : public TObject kDecayToKPi, // e.g. D0 -> K+ pi- or cc. kTripleCandidateToKPiPi, // e.g. D+ -> K- pi+ pi+ kTripleCandidateToPKPi, // e.g. Lambda_c -> p K- pi+ + kTripleCandidateToKKPi, // e.g. D_s -> K+ K- pi+ kNMaxCandidateTypes }; @@ -332,6 +334,7 @@ class VarManager : public TObject kIsSingleGapA, // Rapidity gap on side A kIsSingleGapC, // Rapidity gap on side C kIsSingleGap, // Rapidity gap on either side + kIsITSUPCMode, // UPC mode used for event kTwoEvPosZ1, // vtx-z for collision 1 in two events correlations kTwoEvPosZ2, // vtx-z for collision 2 in two events correlations kTwoEvPosR1, // vtx-R for collision 1 in two events correlations @@ -365,10 +368,22 @@ 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 + 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 // Basic track/muon/pair wise variables kX, @@ -430,6 +445,7 @@ class VarManager : public TObject kTPCncls, kITSClusterMap, kTPCnclsCR, + kTPCnCRoverFindCls, kTPCchi2, kTPCsignal, kTPCsignalRandomized, @@ -577,6 +593,7 @@ class VarManager : public TObject kPhiHE, kPhiCS, kDeltaPhiPair2, + kDeltaEtaPair2, kPsiPair, kDeltaPhiPair, kOpeningAngle, @@ -606,15 +623,27 @@ class VarManager : public TObject kM1111REF, kM0111POI, kCORR2REF, + kCORR2REFw, + kCORR2REFsquaredw, kCORR2POI, + kCORR2POIw, + kCORR2POIsquaredw, + kCORR2POIsquaredMpw, kCORR4REF, + kCORR4REFw, + kCORR4REFsquaredw, kCORR4POI, + kCORR4POIw, + kCORR4POIsquaredw, + kCORR4POIsquaredMpw, kM11REFoverMp, kM01POIoverMp, kM1111REFoverMp, kM0111POIoverMp, kCORR2POIMp, kCORR4POIMp, + kCORR2POIMpw, + kCORR4POIMpw, kPsi2A, kPsi2APOS, kPsi2ANEG, @@ -716,7 +745,8 @@ class VarManager : public TObject enum EventFilters { kDoubleGap = 0, kSingleGapA, - kSingleGapC + kSingleGapC, + kITSUPCMode }; enum MuonExtrapolation { @@ -1463,6 +1493,9 @@ void VarManager::FillEvent(T const& event, float* values) values[kIsSingleGapC] = (event.tag_bit(56 + kSingleGapC) > 0); values[kIsSingleGap] = values[kIsSingleGapA] || values[kIsSingleGapC]; } + if (fgUsedVars[kIsITSUPCMode]) { + values[kIsITSUPCMode] = (event.tag_bit(56 + kITSUPCMode) > 0); + } values[kCollisionTime] = event.collisionTime(); values[kCollisionTimeRes] = event.collisionTimeRes(); } @@ -1575,8 +1608,12 @@ 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[kCORR2REF] = event.corr2ref(); + values[kCORR2REFw] = event.corr2ref(); + values[kCORR2REFsquaredw] = event.corr2ref(); + values[kCORR4REF] = event.corr4ref(); + values[kCORR4REFw] = event.corr4ref(); + values[kCORR4REFsquaredw] = event.corr4ref(); values[kMultA] = event.multa(); } } @@ -1665,6 +1702,7 @@ void VarManager::FillEvent(T const& event, float* values) values[kIsSingleGapA] = (event.eventFilter() & (uint64_t(1) << kSingleGapA)) > 0; values[kIsSingleGapC] = (event.eventFilter() & (uint64_t(1) << kSingleGapC)) > 0; values[kIsSingleGap] = values[kIsSingleGapA] || values[kIsSingleGapC]; + values[kIsITSUPCMode] = (event.eventFilter() & (uint64_t(1) << kITSUPCMode)) > 0; } if constexpr ((fillMap & ReducedZdc) > 0) { @@ -1771,21 +1809,78 @@ void VarManager::FillTwoMixEvents(T1 const& ev1, T1 const& ev2, T2 const& /*trac for (auto& track2 : tracks2) { Track2Filter = uint32_t(track2.isMuonSelected());} */ 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 - values[kQ2X0A1] = ev1.q2x0a(); - values[kQ2X0A2] = ev2.q2x0a(); - values[kQ2Y0A1] = ev1.q2y0a(); - values[kQ2Y0A2] = ev2.q2y0a(); + values[kQ2X0A1] = (ev1.qvecBPosRe() * ev1.nTrkBPos() + ev1.qvecBNegRe() * ev1.nTrkBNeg()) / (ev1.nTrkBPos() + ev1.nTrkBNeg()); + 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) { @@ -1794,6 +1889,24 @@ void VarManager::FillTwoMixEvents(T1 const& ev1, T1 const& ev2, T2 const& /*trac 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.; + } } template @@ -1950,6 +2063,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 } @@ -2443,6 +2559,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()); @@ -2728,6 +2848,21 @@ void VarManager::FillTriple(T1 const& t1, T2 const& t2, T3 const& t3, float* val values[kPhi] = v123.Phi(); values[kRap] = -v123.Rapidity(); } + + if (pairType == kTripleCandidateToKKPi) { + float m1 = o2::constants::physics::MassKaonCharged; + float m2 = o2::constants::physics::MassPionCharged; + + ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), m1); + ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), t2.phi(), m1); + ROOT::Math::PtEtaPhiMVector v3(t3.pt(), t3.eta(), t3.phi(), m2); + ROOT::Math::PtEtaPhiMVector v123 = v1 + v2 + v3; + values[kMass] = v123.M(); + values[kPt] = v123.Pt(); + values[kEta] = v123.Eta(); + values[kPhi] = v123.Phi(); + values[kRap] = -v123.Rapidity(); + } } template @@ -2766,6 +2901,21 @@ 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(); + 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(); + } + // 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()); @@ -3739,9 +3889,9 @@ void VarManager::FillDileptonTrackVertexing(C const& collision, T1 const& lepton values[kVertexingTauxyProjectedNs] = values[kVertexingTauxyProjected] / o2::constants::physics::LightSpeedCm2NS; values[kVertexingTauzProjected] = (values[kVertexingLzProjected] * KFGeoThreeProng.GetMass()) / TMath::Abs(KFGeoThreeProng.GetPz()); } // end Run 2 quantities - } // end eventHasVtxCov - } // end (candidateType == kBtoJpsiEEK) && trackHasCov - } // end KF + } // end eventHasVtxCov + } // end (candidateType == kBtoJpsiEEK) && trackHasCov + } // end KF } template @@ -3810,6 +3960,12 @@ 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[kCORR2REFw] = values[kCORR2REF] * values[kM11REF]; + values[kCORR2REFsquaredw] = values[kCORR2REF] * values[kCORR2REF] * values[kM11REF]; + values[kCORR4REFw] = values[kCORR4REF] * values[kM1111REF]; + values[kCORR4REFsquaredw] = values[kCORR4REF] * values[kCORR4REF] * values[kM1111REF]; // TODO: provide different computations for R // Compute the R factor using the 2 sub-events technique for second and third harmonic @@ -3841,14 +3997,14 @@ void VarManager::FillQVectorFromCentralFW(C const& collision, float* values) values = fgValues; } - float xQVecFT0a = collision.qvecFT0ARe(); // already normalised - float yQVecFT0a = collision.qvecFT0AIm(); // already normalised - float xQVecFT0c = collision.qvecFT0CRe(); // already normalised - float yQVecFT0c = collision.qvecFT0CIm(); // already normalised - float xQVecFT0m = collision.qvecFT0MRe(); // already normalised - float yQVecFT0m = collision.qvecFT0MIm(); // already normalised - float xQVecFV0a = collision.qvecFV0ARe(); // already normalised - float yQVecFV0a = collision.qvecFV0AIm(); // already normalised + float xQVecFT0a = collision.qvecFT0ARe(); // already normalised + float yQVecFT0a = collision.qvecFT0AIm(); // already normalised + float xQVecFT0c = collision.qvecFT0CRe(); // already normalised + float yQVecFT0c = collision.qvecFT0CIm(); // already normalised + float xQVecFT0m = collision.qvecFT0MRe(); // already normalised + float yQVecFT0m = collision.qvecFT0MIm(); // already normalised + float xQVecFV0a = collision.qvecFV0ARe(); // already normalised + float yQVecFV0a = collision.qvecFV0AIm(); // already normalised float xQVecBPos = collision.qvecTPCposRe(); // already normalised float yQVecBPos = collision.qvecTPCposIm(); // already normalised float xQVecBNeg = collision.qvecTPCnegRe(); // already normalised diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index ba3add306c7..3be2d6ec906 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -25,6 +25,8 @@ #include "Common/DataModel/PIDResponse.h" #include "MathUtils/Utils.h" +#include "PWGHF/Utils/utilsPid.h" + namespace o2::aod { @@ -108,18 +110,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, @@ -574,6 +569,8 @@ DECLARE_SOA_COLUMN(FwdDcaY1, fwdDcaY1, float); //! Y component of forward DCA DECLARE_SOA_COLUMN(FwdDcaX2, fwdDcaX2, float); //! X component of forward DCA DECLARE_SOA_COLUMN(FwdDcaY2, fwdDcaY2, float); //! Y component of forward DCA DECLARE_SOA_COLUMN(ITSNCls1, itsNCls1, int); //! Number of ITS clusters +DECLARE_SOA_COLUMN(ITSClusterMap1, itsClusterMap1, uint8_t); //! ITS clusters map +DECLARE_SOA_COLUMN(ITSChi2NCl1, itsChi2NCl1, float); //! ITS chi2/Ncls DECLARE_SOA_COLUMN(TPCNClsFound1, tpcNClsFound1, float); //! Number of TPC clusters found DECLARE_SOA_COLUMN(TPCNClsCR1, tpcNClsCR1, float); //! Number of TPC crossed rows DECLARE_SOA_COLUMN(TPCChi2NCl1, tpcChi2NCl1, float); //! TPC chi2/Ncls @@ -588,6 +585,8 @@ DECLARE_SOA_COLUMN(TOFNSigmaEl1, tofNSigmaEl1, float); //! TOF nSigma electron DECLARE_SOA_COLUMN(TOFNSigmaPi1, tofNSigmaPi1, float); //! TOF nSigma pion DECLARE_SOA_COLUMN(TOFNSigmaPr1, tofNSigmaPr1, float); //! TOF nSigma proton DECLARE_SOA_COLUMN(ITSNCls2, itsNCls2, int); //! Number of ITS clusters +DECLARE_SOA_COLUMN(ITSClusterMap2, itsClusterMap2, uint8_t); //! ITS clusters map +DECLARE_SOA_COLUMN(ITSChi2NCl2, itsChi2NCl2, float); //! ITS chi2/Ncls DECLARE_SOA_COLUMN(TPCNClsFound2, tpcNClsFound2, float); //! Number of TPC clusters found DECLARE_SOA_COLUMN(TPCNClsCR2, tpcNClsCR2, float); //! Number of TPC crossed rows DECLARE_SOA_COLUMN(TPCChi2NCl2, tpcChi2NCl2, float); //! TPC chi2/Ncls @@ -693,28 +692,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, @@ -765,8 +752,8 @@ DECLARE_SOA_TABLE(DielectronsAll, "AOD", "RTDIELECTRONALL", //! reducedpair::Pt, reducedpair::Eta, reducedpair::Phi, reducedpair::Sign, reducedpair::FilterMap, reducedpair::McDecision, - dilepton_track_index::Pt1, dilepton_track_index::Eta1, dilepton_track_index::Phi1, dilepton_track_index::TPCNClsCR1, dilepton_track_index::TPCNClsFound1, dilepton_track_index::TPCChi2NCl1, dilepton_track_index::DcaXY1, dilepton_track_index::DcaZ1, dilepton_track_index::TPCSignal1, dilepton_track_index::TPCNSigmaEl1, dilepton_track_index::TPCNSigmaPi1, dilepton_track_index::TPCNSigmaPr1, dilepton_track_index::TOFBeta1, dilepton_track_index::TOFNSigmaEl1, dilepton_track_index::TOFNSigmaPi1, dilepton_track_index::TOFNSigmaPr1, - dilepton_track_index::Pt2, dilepton_track_index::Eta2, dilepton_track_index::Phi2, dilepton_track_index::TPCNClsCR2, dilepton_track_index::TPCNClsFound2, dilepton_track_index::TPCChi2NCl2, dilepton_track_index::DcaXY2, dilepton_track_index::DcaZ2, dilepton_track_index::TPCSignal2, dilepton_track_index::TPCNSigmaEl2, dilepton_track_index::TPCNSigmaPi2, dilepton_track_index::TPCNSigmaPr2, dilepton_track_index::TOFBeta2, dilepton_track_index::TOFNSigmaEl2, dilepton_track_index::TOFNSigmaPi2, dilepton_track_index::TOFNSigmaPr2, + dilepton_track_index::Pt1, dilepton_track_index::Eta1, dilepton_track_index::Phi1, dilepton_track_index::ITSClusterMap1, dilepton_track_index::ITSChi2NCl1, dilepton_track_index::TPCNClsCR1, dilepton_track_index::TPCNClsFound1, dilepton_track_index::TPCChi2NCl1, dilepton_track_index::DcaXY1, dilepton_track_index::DcaZ1, dilepton_track_index::TPCSignal1, dilepton_track_index::TPCNSigmaEl1, dilepton_track_index::TPCNSigmaPi1, dilepton_track_index::TPCNSigmaPr1, dilepton_track_index::TOFBeta1, dilepton_track_index::TOFNSigmaEl1, dilepton_track_index::TOFNSigmaPi1, dilepton_track_index::TOFNSigmaPr1, + dilepton_track_index::Pt2, dilepton_track_index::Eta2, dilepton_track_index::Phi2, dilepton_track_index::ITSClusterMap2, dilepton_track_index::ITSChi2NCl2, dilepton_track_index::TPCNClsCR2, dilepton_track_index::TPCNClsFound2, dilepton_track_index::TPCChi2NCl2, dilepton_track_index::DcaXY2, dilepton_track_index::DcaZ2, dilepton_track_index::TPCSignal2, dilepton_track_index::TPCNSigmaEl2, dilepton_track_index::TPCNSigmaPi2, dilepton_track_index::TPCNSigmaPr2, dilepton_track_index::TOFBeta2, dilepton_track_index::TOFNSigmaEl2, dilepton_track_index::TOFNSigmaPi2, dilepton_track_index::TOFNSigmaPr2, dilepton_track_index::DCAxyzTrk0KF, dilepton_track_index::DCAxyzTrk1KF, reducedpair::DCAxyzBetweenTrksKF, dilepton_track_index::DCAxyTrk0KF, dilepton_track_index::DCAxyTrk1KF, reducedpair::DCAxyBetweenTrksKF, dilepton_track_index::DeviationTrk0KF, dilepton_track_index::DeviationTrk1KF, dilepton_track_index::DeviationxyTrk0KF, dilepton_track_index::DeviationxyTrk1KF, reducedpair::MassKFGeo, reducedpair::Chi2OverNDFKFGeo, reducedpair::DecayLengthKFGeo, reducedpair::DecayLengthOverErrKFGeo, reducedpair::DecayLengthXYKFGeo, reducedpair::DecayLengthXYOverErrKFGeo, reducedpair::PseudoproperDecayTimeKFGeo, reducedpair::PseudoproperDecayTimeErrKFGeo, reducedpair::CosPAKFGeo, reducedpair::PairDCAxyz, reducedpair::PairDCAxy, @@ -915,33 +902,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", //! @@ -972,6 +988,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); @@ -986,18 +1026,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 { diff --git a/PWGDQ/TableProducer/tableMaker.cxx b/PWGDQ/TableProducer/tableMaker.cxx index 93871082aa5..7c123b30959 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" @@ -95,6 +101,8 @@ using MyBarrelTracksWithV0AndDalitzBits = soa::Join; +using MyBarrelTracksForElectronMuon = soa::Join; using MyEvents = soa::Join; using MyEventsWithMults = soa::Join; using MyEventsWithFilter = soa::Join; @@ -109,9 +117,9 @@ using ExtBCs = soa::Join, 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 +DECLARE_SOA_TABLE(AmbiguousTracksFwd, "AOD", "AMBIGUOUSFWDTRU", //! 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 @@ -127,6 +135,7 @@ constexpr static uint32_t gkTrackFillMapWithV0Bits = gkTrackFillMap | VarManager constexpr static uint32_t gkTrackFillMapWithV0BitsForMaps = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackV0Bits | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackTPCPID; constexpr static uint32_t gkTrackFillMapWithDalitzBits = gkTrackFillMap | VarManager::ObjTypes::DalitzBits; constexpr static uint32_t gkTrackFillMapWithV0AndDalitzBits = gkTrackFillMap | VarManager::ObjTypes::TrackV0Bits | VarManager::ObjTypes::DalitzBits; +constexpr static uint32_t gkTrackFillMapForElectronMuon = VarManager::ObjTypes::Track | VarManager::ObjTypes::TrackExtra | VarManager::ObjTypes::TrackDCA | VarManager::ObjTypes::TrackSelection | VarManager::ObjTypes::TrackTPCPID; constexpr static uint32_t gkMuonFillMap = VarManager::ObjTypes::Muon; constexpr static uint32_t gkMuonFillMapWithCov = VarManager::ObjTypes::Muon | VarManager::ObjTypes::MuonCov; constexpr static uint32_t gkMuonFillMapWithCovAmbi = VarManager::ObjTypes::Muon | VarManager::ObjTypes::MuonCov | VarManager::ObjTypes::AmbiMuon; @@ -160,9 +169,11 @@ struct TableMaker { 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 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 fConfigAddEventHistogram{"cfgAddEventHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddTrackHistogram{"cfgAddTrackHistogram", "", "Comma separated list of histograms"}; + Configurable fConfigAddMuonHistogram{"cfgAddMuonHistogram", "", "Comma separated list of histograms"}; + } addHistoConfigurations; Configurable fConfigBarrelTrackPtLow{"cfgBarrelLowPt", 1.0f, "Low pt cut for tracks in the barrel"}; Configurable fConfigBarrelTrackMaxAbsEta{"cfgBarrelMaxAbsEta", 0.9f, "Eta absolute value cut for tracks in the barrel"}; Configurable fConfigMuonPtLow{"cfgMuonLowPt", 1.0f, "Low pt cut for muons"}; @@ -172,13 +183,19 @@ struct TableMaker { Configurable fConfigDetailedQA{"cfgDetailedQA", false, "If true, include more QA histograms (BeforeCuts classes)"}; Configurable fIsRun2{"cfgIsRun2", false, "Whether we analyze Run-2 or Run-3 data"}; Configurable fIsAmbiguous{"cfgIsAmbiguous", false, "Whether we enable QA plots for ambiguous tracks"}; - 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 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"}; 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"}; @@ -261,7 +278,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") || @@ -402,11 +419,11 @@ 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) { - if (!fConfigRunZorro) { + if (!useZorro.fConfigRunZorro) { tag |= (collision.eventFilter() << 56); } } @@ -426,18 +443,23 @@ 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)); } } (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(kNaliases)); - if (fConfigRunZorro) { + if (useZorro.fConfigRunZorro) { zorro.setBaseCCDBPath(useCCDBConfigurations.fConfigCcdbPathZorro.value); - zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value); - if (zorro.isSelected(bc.globalBC())) { + zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), useZorro.fConfigZorroTrigMask.value); + 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; @@ -446,7 +468,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)); } } @@ -508,7 +530,7 @@ struct TableMaker { } } - trackFilteringTag = uint64_t(0); + trackFilteringTag = static_cast(0); trackTempFilterMap = uint8_t(0); VarManager::FillTrack(track); if (fDoDetailedQA) { @@ -544,35 +566,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 } } @@ -604,6 +626,10 @@ struct TableMaker { track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), track.trdSignal()); } + if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackTPCPID)) { + trackBarrelPID(track.tpcSignal(), track.tpcNSigmaEl(), -1, track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), + -1, -1, -1, -1, -1, -1, -1); + } } } // end if constexpr (TTrackFillMap) @@ -663,7 +689,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); @@ -806,7 +832,7 @@ struct TableMaker { } } } // end if constexpr (TMuonFillMap) - } // end fullSkimming() + } // end fullSkimming() // Templated function instantianed for all of the process functions template @@ -857,11 +883,11 @@ 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) { - if (!fConfigRunZorro) { + if (!useZorro.fConfigRunZorro) { tag |= (collision.eventFilter() << 56); } } @@ -880,18 +906,23 @@ 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)); } } (reinterpret_cast(fStatsList->At(0)))->Fill(2.0, static_cast(kNaliases)); - if (fConfigRunZorro) { + if (useZorro.fConfigRunZorro) { zorro.setBaseCCDBPath(useCCDBConfigurations.fConfigCcdbPathZorro.value); - zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value); - if (zorro.isSelected(bc.globalBC())) { + zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), useZorro.fConfigZorroTrigMask.value); + 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; @@ -900,7 +931,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)); } } @@ -948,7 +979,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) { @@ -978,37 +1009,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()); @@ -1037,6 +1068,10 @@ struct TableMaker { track.tofNSigmaEl(), track.tofNSigmaMu(), track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(), track.trdSignal()); } + if constexpr (static_cast(TTrackFillMap & VarManager::ObjTypes::TrackTPCPID)) { + trackBarrelPID(track.tpcSignal(), track.tpcNSigmaEl(), -1, track.tpcNSigmaPi(), track.tpcNSigmaKa(), track.tpcNSigmaPr(), + -1, -1, -1, -1, -1, -1, -1); + } } } // end if constexpr (TTrackFillMap) @@ -1058,7 +1093,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 @@ -1088,7 +1123,7 @@ struct TableMaker { isAmbiguous = (muon.compatibleCollIds().size() != 1); } } - trackFilteringTag = uint64_t(0); + trackFilteringTag = static_cast(0); trackTempFilterMap = uint8_t(0); VarManager::FillTrack(muon); @@ -1160,22 +1195,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) { @@ -1199,28 +1234,28 @@ struct TableMaker { } } - TString histEventName = fConfigAddEventHistogram.value; + TString histEventName = addHistoConfigurations.fConfigAddEventHistogram.value; if (classStr.Contains("Event")) { if (fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "event", histEventName); } } - TString histTrackName = fConfigAddTrackHistogram.value; + TString histTrackName = addHistoConfigurations.fConfigAddTrackHistogram.value; if (classStr.Contains("Track")) { if (fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histTrackName); } } - TString histMuonName = fConfigAddMuonHistogram.value; + TString histMuonName = addHistoConfigurations.fConfigAddMuonHistogram.value; if (classStr.Contains("Muons")) { if (fConfigQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histMuonName); } } - TString histMftName = fConfigAddMuonHistogram.value; + TString histMftName = addHistoConfigurations.fConfigAddMuonHistogram.value; if (classStr.Contains("Mft")) { if (fConfigDetailedQA) { dqhistograms::DefineHistograms(fHistMan, objArray->At(iclass)->GetName(), "track", histMftName); @@ -1228,7 +1263,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"}; @@ -1241,7 +1282,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); @@ -1253,13 +1294,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 ------------------------------------------------------------------------------------------------------------- @@ -1326,6 +1373,13 @@ struct TableMaker { } } + // Produce barrel + muon tables for the eletron-muon analysis, without PIDTOF---------------------------------------------------------------------- + void processFullForElectronMuon(MyEvents::iterator const& collision, aod::BCsWithTimestamps const& bcs, + soa::Filtered const& tracksBarrel, soa::Filtered const& tracksMuon) + { + fullSkimming(collision, bcs, tracksBarrel, tracksMuon, nullptr, nullptr); + } + // Produce barrel only tables, with V0Bits ------------------------------------------------------------------------------------------------ void processBarrelOnlyWithV0Bits(MyEvents::iterator const& collision, aod::BCsWithTimestamps const& bcs, soa::Filtered const& tracksBarrel) @@ -1333,6 +1387,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) @@ -1683,7 +1744,9 @@ struct TableMaker { PROCESS_SWITCH(TableMaker, processFullWithCent, "Build full DQ skimmed data model, w/ centrality", false); PROCESS_SWITCH(TableMaker, processFullWithCentAndMults, "Build full DQ skimmed data model, w/ centrality and multiplicities", false); 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..bee0f0880a1 100644 --- a/PWGDQ/TableProducer/tableMakerMC.cxx +++ b/PWGDQ/TableProducer/tableMakerMC.cxx @@ -86,9 +86,9 @@ using MyEventsWithCentAndMults = soa::Join, 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 +DECLARE_SOA_TABLE(AmbiguousTracksFwd, "AOD", "AMBIGUOUSFWDTRU", //! 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 diff --git a/PWGDQ/TableProducer/tableMaker_withAssoc.cxx b/PWGDQ/TableProducer/tableMaker_withAssoc.cxx index f7df4a672bc..e51d0959116 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" @@ -102,9 +108,9 @@ using ExtBCs = soa::Join, 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 +DECLARE_SOA_TABLE(AmbiguousTracksFwd, "AOD", "AMBIGUOUSFWDTRU", //! 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 @@ -164,7 +170,8 @@ struct TableMaker { 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"}; + Configurable fConfigZorroTrigMask{"cfgZorroTriggerMask", "fDiMuon", "DQ Trigger masks: fSingleE,fLMeeIMR,fLMeeHMR,fDiElectron,fSingleMuLow,fSingleMuHigh,fDiMuon"}; + Configurable fConfigRunZorroSel{"cfgRunZorroSel", false, "Select events with trigger mask"}; // Steer QA output Configurable fConfigQA{"cfgQA", false, "If true, fill QA histograms"}; @@ -187,7 +194,7 @@ struct TableMaker { // 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 fConfigCcdbPathZorro{"ccdb-path-zorro", "/Users/m/mpuccio/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"}; @@ -406,7 +413,14 @@ struct TableMaker { } } - // create statistics histograms (event, tracks, muons) + // create statistics histograms + // 0: Event statistics + // 1: Track statistics + // 2: Muon statistics + // 3: Orphan track statistics + // 4: Zorro information + // 5: 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"}; @@ -419,7 +433,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->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); @@ -431,13 +445,23 @@ 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 + 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->Add(histOrphanTracks); // At index 3 + + TH2D* histZorroInfo = new TH2D("ZorroInfo", "Zorro information", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->Add(histZorroInfo); // At index 4 + + TH2D* histZorroSel = new TH2D("ZorroSel", "trigger of interested", 1, -0.5, 0.5, 1, -0.5, 0.5); + fStatsList->Add(histZorroSel); // At index 5 } template @@ -485,7 +509,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) { @@ -520,9 +544,14 @@ struct TableMaker { if (fConfigRunZorro) { zorro.setBaseCCDBPath(fConfigCcdbPathZorro.value); zorro.initCCDB(fCCDB.service, fCurrentRun, bc.timestamp(), fConfigZorroTrigMask.value); - if (zorro.isSelected(bc.globalBC())) { + zorro.populateExternalHists(fCurrentRun, reinterpret_cast(fStatsList->At(4)), reinterpret_cast(fStatsList->At(5))); + bool zorroSel = zorro.isSelected(bc.globalBC(), 100UL, reinterpret_cast(fStatsList->At(5))); + if (zorroSel) { tag |= (static_cast(true) << 56); // the same bit is used for this zorro selections from ccdb } + if (fConfigRunZorroSel && (!zorroSel || !fEventCut->IsSelected(VarManager::fgValues))) { + continue; + } } else { if (!fEventCut->IsSelected(VarManager::fgValues)) { continue; @@ -591,7 +620,7 @@ 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 trackFilteringTag = static_cast(0); uint64_t trackTempFilterMap = uint8_t(0); // material correction for track propagation @@ -602,7 +631,7 @@ struct TableMaker { // get track auto track = assoc.template track_as(); - trackFilteringTag = uint64_t(0); + trackFilteringTag = static_cast(0); trackTempFilterMap = uint8_t(0); VarManager::FillTrack(track); @@ -634,49 +663,61 @@ struct TableMaker { // 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)); } } 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 (fConfigSaveElectronSample) { // only save electron sample - if (!(trackFilteringTag & (uint64_t(1) << VarManager::kIsConversionLeg))) { + 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); + 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()]; + // reducedEventIdx = fCollIndexMap[collision.globalIndex()]; // This gives the first collision form the table + + // Calculating the percentage of orphan tracks i.e., tracks which have no collisions associated to it + if (!track.has_collision()) { + (reinterpret_cast(fStatsList->At(3)))->Fill(static_cast(-1)); + } else { + (reinterpret_cast(fStatsList->At(3)))->Fill(0.9); + } + + // Protection against crash, where the original collision IDs of tracks were removed by pp-filter or zorro selection and hence the track is now orphaned + if (fCollIndexMap.find(track.collisionId()) == fCollIndexMap.end()) { + continue; + } + 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()); @@ -709,7 +750,7 @@ struct TableMaker { // 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) @@ -728,7 +769,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()); @@ -865,7 +906,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 (collisions, bcs, nullptr, nullptr, muons, nullptr, nullptr, fwdTrackAssocs, nullptr); } diff --git a/PWGDQ/Tasks/CMakeLists.txt b/PWGDQ/Tasks/CMakeLists.txt index 7ba233973ab..8807aad7200 100644 --- a/PWGDQ/Tasks/CMakeLists.txt +++ b/PWGDQ/Tasks/CMakeLists.txt @@ -102,4 +102,9 @@ o2physics_add_dpl_workflow(task-mch-align-record o2physics_add_dpl_workflow(task-muon-mid-eff SOURCES MIDefficiency.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::MIDBase + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(task-fwd-track-pid + SOURCES taskFwdTrackPid.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGDQCore COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGDQ/Tasks/MIDefficiency.cxx b/PWGDQ/Tasks/MIDefficiency.cxx index efcbe07af85..13377e5cc5c 100644 --- a/PWGDQ/Tasks/MIDefficiency.cxx +++ b/PWGDQ/Tasks/MIDefficiency.cxx @@ -16,14 +16,14 @@ /// Struct for writing the table and convert the data /// to MID tracks needed to compute the efficiency of the MID RPCs /// -/// \author Luca Quaglia -/// +/// \author Luca Quaglia // O2 physics classes #include "PWGDQ/DataModel/ReducedInfoTables.h" @@ -42,6 +42,7 @@ using namespace o2; using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; +using MyEvents = soa::Join; using MyMuonTracks = soa::Join; struct midEfficiency { @@ -50,20 +51,33 @@ struct midEfficiency { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; // Configurables for histogram axes - Configurable nBinsLocal{"nBinsLocal", 936, "N bins in local board counts histo"}; - Configurable nBinsRPC{"nBinsRPC", 72, "N bins in RPC counts histo"}; - Configurable nBinsPlane{"nBinsPlane", 4, "N bins in plane counts histo"}; - Configurable nBinsTrackType{"nBinsTrackType", 5, "N bins in track type debug histo"}; - Configurable createRootFile{"createRootFile", false, "if true it creates the mid-reco.root file for debug purposes"}; - - // Vector of MID tracks to pass to the efficiency calculator - std::vector dummyTrack; + // Centrality + Configurable nBinsCentrality{"nBinsCentrality", 9, "N bins for centrality histo in PbPb"}; + Configurable minCentrality{"minCentrality", 0., "minimum of axis in centrality histo in PbPb"}; + Configurable maxCentrality{"maxCentrality", 90., "maximum of axis in centrality histo in PbPb"}; + Configurable isPbPb{"isPbPb", false, "If true, the task will be used to run on PbPb data and will enable the filling of THnSparse for centrality studies"}; + + // pt + Configurable nBinsPt{"nBinsPt", 2000, "N bins for pt histo"}; + Configurable minPt{"minPt", 0., "minimum of pt axis"}; // GeV/c + Configurable maxPt{"maxPt", 20., "maximum of pt axis"}; + + // eta + Configurable nBinsEta{"nBinsEta", 500, "N bins for eta histo"}; + Configurable minEta{"minEta", -5., "minimum of eta axis"}; // + Configurable maxEta{"maxEta", 5., "maximum of eta axis"}; + + // phi + Configurable nBinsPhi{"nBinsPhi", 500, "N bins for phi histo"}; + Configurable minPhi{"minPhi", -2. * TMath::Pi(), "minimum of phi axis"}; // + Configurable maxPhi{"maxPhi", 2 * TMath::Pi(), "maximum of phi axis"}; + // MID track placeholder for processing o2::mid::Track trk; // MID mapping for LB calculation o2::mid::Mapping mapping; - // Filter only for MCH-MID tracks + // Filter only for MCH-MID matched tracks Filter muonTrackType = aod::fwdtrack::trackType == uint8_t(3); void init(o2::framework::InitContext const& /*ic*/) @@ -72,14 +86,18 @@ struct midEfficiency { LOGF(debug, "Initialization starting"); // Axes definition - const AxisSpec axisLocalBoards{nBinsLocal, 0.5, 936.5, "Local board"}; - const AxisSpec axisRPCs{nBinsRPC, -0.5, 71.5, "RPC"}; - const AxisSpec axisPlanes{nBinsPlane, -0.5, 3.5, "Plane"}; - const AxisSpec axisTrackType{nBinsTrackType, -0.5, 4.5, "Muon track type"}; + const AxisSpec axisLocalBoards{936, 0.5, 936.5, "Local board"}; // These are not defined as configurable since they are fixed + const AxisSpec axisRPCs{72, -0.5, 71.5, "RPC"}; // These are not defined as configurable since they are fixed + const AxisSpec axisPlanes{4, -0.5, 3.5, "Plane"}; // These are not defined as configurable since they are fixed + const AxisSpec axisTrackType{5, -0.5, 4.5, "Muon track type"}; // These are not defined as configurable since they are fixed + + const AxisSpec axisCent{nBinsCentrality, minCentrality, maxCentrality, "Centrality"}; + const AxisSpec axisPt{nBinsPt, minPt, maxPt, "track p_{t} [GeV/c]"}; + const AxisSpec axisEta{nBinsEta, minEta, maxEta, "track #eta"}; + const AxisSpec axisPhi{nBinsPhi, minPhi, maxPhi, "track #phi"}; LOGF(debug, "Creating histograms"); - // Same names as O2 task // Local boards histos.add("nFiredBPperBoard", "nFiredBPperBoard", kTH1F, {axisLocalBoards}); histos.add("nFiredNBPperBoard", "nFiredNBPperBoard", kTH1F, {axisLocalBoards}); @@ -95,16 +113,62 @@ struct midEfficiency { histos.add("nFiredNBPperPlane", "nFiredNBPperPlane", kTH1F, {axisPlanes}); histos.add("nFiredBothperPlane", "nFiredBothperPlane", kTH1F, {axisPlanes}); histos.add("nTotperPlane", "nTotperPlane", kTH1F, {axisPlanes}); - // Track type for debug only + // Centrality test + histos.add("hCentr", "hCentr", kTH1F, {axisCent}); + + // Track type histos.add("hTrackType", "hTrackType", kTH1F, {axisTrackType}); + // If this is true -> PbPb data, add THnSparse with centrality + if (isPbPb) { + // Local boards + histos.add("hSparseCentFiredBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredNBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredBothperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredTotperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisCent, axisPt, axisEta, axisPhi}); + + // RPCs + histos.add("hSparseCentFiredBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredNBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredBothperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredTotperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisCent, axisPt, axisEta, axisPhi}); + + // Planes + histos.add("hSparseCentFiredBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredNBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredBothperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredTotperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisCent, axisPt, axisEta, axisPhi}); + } else { // THnSparse without centrality in pp + // Local boards + histos.add("hSparseCentFiredBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredNBPperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredBothperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredTotperBoard", "THn for centrality studies", HistType::kTHnSparseF, {axisLocalBoards, axisPt, axisEta, axisPhi}); + + // RPCs + histos.add("hSparseCentFiredBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredNBPperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredBothperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredTotperRPC", "THn for centrality studies", HistType::kTHnSparseF, {axisRPCs, axisPt, axisEta, axisPhi}); + + // Planes + histos.add("hSparseCentFiredBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredNBPperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredBothperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi}); + histos.add("hSparseCentFiredTotperPlane", "THn for centrality studies", HistType::kTHnSparseF, {axisPlanes, axisPt, axisEta, axisPhi}); + } } // end of init template - void runMidEffCounters(TEvent const& /*event*/, Muons const& muons) + void runMidEffCounters(TEvent const& event, Muons const& muons) { LOGF(debug, "Calling process function"); + float cent = event.centFT0C(); + + if (isPbPb) + histos.fill(HIST("hCentr"), cent); // Fill centrality histo + // Loop over all forward tracks for (auto& track : muons) { @@ -119,6 +183,10 @@ struct midEfficiency { auto rpcLine = o2::mid::detparams::getRPCLine(deIdMT11); auto effFlag = trk.getEfficiencyFlag(); + float pt = track.pt(); + float eta = track.eta(); + float phi = track.phi(); + if (effFlag < 0) { continue; } @@ -126,17 +194,38 @@ struct midEfficiency { // Loop on the four planes and fill histograms accordingly for (int ich = 0; ich < 4; ++ich) { + // Check if BP/NBP has been fired by the track bool isFiredBP = trk.isFiredChamber(ich, 0); bool isFiredNBP = trk.isFiredChamber(ich, 1); + // Plane - // Fill all counts - plane - histos.fill(HIST("nTotperPlane"), ich); - if (isFiredBP) + histos.fill(HIST("nTotperPlane"), ich); // All counts - plane + if (isPbPb) + histos.fill(HIST("hSparseCentFiredTotperPlane"), ich, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredTotperPlane"), ich, pt, eta, phi); + + if (isFiredBP) { histos.fill(HIST("nFiredBPperPlane"), ich); // BP - Plane - if (isFiredNBP) + if (isPbPb) + histos.fill(HIST("hSparseCentFiredBPperPlane"), ich, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredBPperPlane"), ich, pt, eta, phi); + } + if (isFiredNBP) { histos.fill(HIST("nFiredNBPperPlane"), ich); // NBP - Plane - if (isFiredBP && isFiredNBP) + if (isPbPb) + histos.fill(HIST("hSparseCentFiredNBPperPlane"), ich, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredNBPperPlane"), ich, pt, eta, phi); + } + if (isFiredBP && isFiredNBP) { histos.fill(HIST("nFiredBothperPlane"), ich); // Both planes - plane + if (isPbPb) + histos.fill(HIST("hSparseCentFiredBothperPlane"), ich, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredBothperPlane"), ich, pt, eta, phi); + } if (effFlag < 2) { continue; @@ -145,39 +234,80 @@ struct midEfficiency { // Get RPC id auto deId = o2::mid::detparams::getDEId(isRight, ich, rpcLine); - // Fill all counts - RPC - histos.fill(HIST("nTotperRPC"), deId); - if (isFiredBP) + // RPC + histos.fill(HIST("nTotperRPC"), deId); // All counts - RPC + if (isPbPb) + histos.fill(HIST("hSparseCentFiredTotperRPC"), deId, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredTotperRPC"), deId, pt, eta, phi); + + if (isFiredBP) { histos.fill(HIST("nFiredBPperRPC"), deId); // BP - RPC - if (isFiredNBP) + if (isPbPb) + histos.fill(HIST("hSparseCentFiredBPperRPC"), deId, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredBPperRPC"), deId, pt, eta, phi); + } + if (isFiredNBP) { histos.fill(HIST("nFiredNBPperRPC"), deId); // NBP - RPC - if (isFiredBP && isFiredNBP) + if (isPbPb) + histos.fill(HIST("hSparseCentFiredNBPperRPC"), deId, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredNBPperRPC"), deId, pt, eta, phi); + } + if (isFiredBP && isFiredNBP) { histos.fill(HIST("nFiredBothperRPC"), deId); // Both planes - RPC + if (isPbPb) + histos.fill(HIST("hSparseCentFiredBothperRPC"), deId, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredBothperRPC"), deId, pt, eta, phi); + } if (effFlag < 3) { continue; } + // Get fired column and line -> needed for LB calculation + auto firedColumn = trk.getFiredColumnId(); + auto firedLine = trk.getFiredLineId(); // Get LB ID - auto firedColumn = trk.getFiredColumnId(); // Get fired column - needed for LB calculation - auto firedLine = trk.getFiredLineId(); // Get fired line - needed for LB calculation - auto LB = ich * o2::mid::detparams::NLocalBoards + mapping.getBoardId(firedLine, firedColumn, deId); - histos.fill(HIST("nTotperBoard"), LB); - - if (isFiredBP) - histos.fill(HIST("nFiredBPperBoard"), LB); - if (isFiredNBP) - histos.fill(HIST("nFiredNBPperBoard"), LB); - if (isFiredBP && isFiredNBP) - histos.fill(HIST("nFiredBothperBoard"), LB); + // LB + histos.fill(HIST("nTotperBoard"), LB); // All counts - LB + if (isPbPb) + histos.fill(HIST("hSparseCentFiredTotperBoard"), LB, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredTotperBoard"), LB, pt, eta, phi); + + if (isFiredBP) { + histos.fill(HIST("nFiredBPperBoard"), LB); // BP - LB + if (isPbPb) + histos.fill(HIST("hSparseCentFiredBPperBoard"), LB, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredBPperBoard"), LB, pt, eta, phi); + } + if (isFiredNBP) { + histos.fill(HIST("nFiredNBPperBoard"), LB); // NBP - LB + if (isPbPb) + histos.fill(HIST("hSparseCentFiredNBPperBoard"), LB, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredNBPperBoard"), LB, pt, eta, phi); + } + if (isFiredBP && isFiredNBP) { + histos.fill(HIST("nFiredBothperBoard"), LB); // Both Planes - LB + if (isPbPb) + histos.fill(HIST("hSparseCentFiredBothperBoard"), LB, cent, pt, eta, phi); + else + histos.fill(HIST("hSparseCentFiredBothperBoard"), LB, pt, eta, phi); + } } } } // end of runMidEffCounters - void processMidEffCounter(aod::ReducedEvents::iterator const& event, soa::Filtered const& muons) + // void processMidEffCounter(aod::ReducedEvents::iterator const& event, soa::Filtered const& muons) + void processMidEffCounter(MyEvents::iterator const& event, soa::Filtered const& muons) { runMidEffCounters(event, muons); // call efficiency calculator function } diff --git a/PWGDQ/Tasks/dqEfficiency.cxx b/PWGDQ/Tasks/dqEfficiency.cxx index 2704cbc36a1..ee8cd2af5c1 100644 --- a/PWGDQ/Tasks/dqEfficiency.cxx +++ b/PWGDQ/Tasks/dqEfficiency.cxx @@ -97,8 +97,12 @@ struct AnalysisEventSelection { HistogramManager* fHistMan; AnalysisCompositeCut* fEventCut; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fEventCut = new AnalysisCompositeCut(true); TString eventCutStr = fConfigEventCuts.value; fEventCut->AddCut(dqcuts::GetAnalysisCut(eventCutStr.Data())); @@ -167,8 +171,12 @@ struct AnalysisTrackSelection { std::vector fHistNamesReco; std::vector> fHistNamesMCMatched; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + // Setting the cut names TString cutNamesStr = fConfigCuts.value; if (!cutNamesStr.IsNull()) { @@ -327,8 +335,12 @@ struct AnalysisMuonSelection { std::vector fHistNamesReco; std::vector> fHistNamesMCMatched; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + // Setting the cut names TString cutNamesStr = fConfigCuts.value; if (!cutNamesStr.IsNull()) { @@ -532,6 +544,10 @@ struct AnalysisSameEventPairing { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; ccdb->setURL(ccdburl.value); @@ -797,8 +813,8 @@ struct AnalysisSameEventPairing { if constexpr ((TPairType == VarManager::kDecayToEE) && (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelPID) > 0) { if (fConfigFlatTables.value) { dielectronAllList(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), dileptonFilterMap, dileptonMcDecision, - t1.pt(), t1.eta(), t1.phi(), 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.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(), + 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(), VarManager::fgValues[VarManager::kKFTrack0DCAxyz], VarManager::fgValues[VarManager::kKFTrack1DCAxyz], VarManager::fgValues[VarManager::kKFDCAxyzBetweenProngs], VarManager::fgValues[VarManager::kKFTrack0DCAxy], VarManager::fgValues[VarManager::kKFTrack1DCAxy], VarManager::fgValues[VarManager::kKFDCAxyBetweenProngs], VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], @@ -1046,6 +1062,10 @@ struct AnalysisDileptonTrack { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + TString sigNamesStr = fConfigMCRecSignals.value; std::unique_ptr objRecSigArray(sigNamesStr.Tokenize(",")); TString histNames; diff --git a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx index 7c1a51ddbc0..03faa87837e 100644 --- a/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx +++ b/PWGDQ/Tasks/dqEfficiency_withAssoc.cxx @@ -63,6 +63,8 @@ DECLARE_SOA_BITMAP_COLUMN(IsBarrelSelected, isBarrelSelected, 32); 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 DECLARE_SOA_BITMAP_COLUMN(IsMuonSelected, isMuonSelected, 32); //! Muon track decisions (joinable to ReducedMuonsAssoc) +DECLARE_SOA_COLUMN(MuonAmbiguityInBunch, muonAmbiguityInBunch, int8_t); //! Muon track in-bunch ambiguity +DECLARE_SOA_COLUMN(MuonAmbiguityOutOfBunch, muonAmbiguityOutOfBunch, int8_t); //! Muon track out of bunch ambiguity DECLARE_SOA_BITMAP_COLUMN(IsBarrelSelectedPrefilter, isBarrelSelectedPrefilter, 32); //! Barrel prefilter decisions (joinable to ReducedTracksAssoc) // Bcandidate columns for ML analysis of B->Jpsi+K DECLARE_SOA_COLUMN(massBcandidate, MBcandidate, float); @@ -80,6 +82,7 @@ DECLARE_SOA_TABLE(EventCuts, "AOD", "DQANAEVCUTS", dqanalysisflags::IsEventSelec 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); } // namespace o2::aod @@ -101,6 +104,7 @@ using MyDielectronCandidates = soa::Join; using MyMuonTracks = soa::Join; using MyMuonTracksWithCov = soa::Join; +using MyMuonTracksWithCovWithAmbiguities = soa::Join; // using MyMuonTracksSelectedWithColl = soa::Join; // bit maps used for the Fill functions of the VarManager @@ -152,8 +156,12 @@ struct AnalysisEventSelection { std::map fMetadataRCT, fHeader; int fCurrentRun; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fEventCut = new AnalysisCompositeCut(true); TString eventCutStr = fConfigEventCuts.value; fEventCut->AddCut(dqcuts::GetAnalysisCut(eventCutStr.Data())); @@ -361,8 +369,12 @@ struct AnalysisTrackSelection { std::map> fNAssocsInBunch; // key: track global index, value: vector of global index for events associated in-bunch (events that have in-bunch pileup or splitting) std::map> fNAssocsOutOfBunch; // key: track global index, value: vector of global index for events associated out-of-bunch (events that have no in-bunch pileup) - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; TString cutNamesStr = fConfigCuts.value; if (!cutNamesStr.IsNull()) { @@ -612,6 +624,7 @@ struct AnalysisTrackSelection { // Here one should add all the track cuts needed through the workflow (e.g. cuts for same-event pairing, track for dilepton-track correlations) struct AnalysisMuonSelection { Produces muonSel; + Produces muonAmbiguities; OutputObj fOutputList{"output"}; Configurable fConfigCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; @@ -637,8 +650,12 @@ struct AnalysisMuonSelection { std::map> fNAssocsInBunch; // key: track global index, value: vector of global index for events associated in-bunch (events that have in-bunch pileup or splitting) std::map> fNAssocsOutOfBunch; // key: track global index, value: vector of global index for events associated out-of-bunch (events that have no in-bunch pileup) - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; TString cutNamesStr = fConfigCuts.value; if (!cutNamesStr.IsNull()) { @@ -731,8 +748,6 @@ struct AnalysisMuonSelection { auto track = assoc.template reducedmuon_as(); VarManager::FillTrack(track); - // compute quantities which depend on the associated collision - VarManager::FillPropagateMuon(track, event); bool isCorrectAssoc = false; if (track.has_reducedMCTrack()) { @@ -757,6 +772,7 @@ struct AnalysisMuonSelection { } } // end loop over cuts muonSel(filterMap); + muonAmbiguities.reserve(muons.size()); // if no filter fulfilled, continue if (!filterMap) { @@ -841,6 +857,19 @@ struct AnalysisMuonSelection { 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); + } } void processSkimmed(ReducedMuonsAssoc const& assocs, MyEventsSelected const& events, MyMuonTracks const& muons, ReducedMCEvents const& eventsMC, ReducedMCTracks const& tracksMC) @@ -884,8 +913,12 @@ struct AnalysisPrefilterSelection { Preslice trackAssocsPerCollision = aod::reducedtrack_association::reducedeventId; - void init(o2::framework::InitContext& initContext) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + // get the list of track cuts to be prefiltered TString trackCutsStr = fConfigTrackCuts.value; TObjArray* objArrayTrackCuts = nullptr; @@ -901,7 +934,7 @@ struct AnalysisPrefilterSelection { fPrefilterMask = 0; fPrefilterCutBit = -1; string trackCuts; - getTaskOptionValue(initContext, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); + getTaskOptionValue(context, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); TString allTrackCutsStr = trackCuts; TString prefilterTrackCutStr = fConfigPrefilterTrackCut.value; if (!trackCutsStr.IsNull()) { @@ -1045,6 +1078,7 @@ struct AnalysisSameEventPairing { 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 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)"}; @@ -1057,8 +1091,9 @@ struct AnalysisSameEventPairing { Configurable fConfigCollisionSystem{"syst", "pp", "Collision system, pp or PbPb"}; Configurable fConfigCenterMassEnergy{"energy", 13600, "Center of mass energy in GeV"}; - Configurable fConfigMCRecSignals{"cfgBarrelMCRecSignals", "", "Comma separated list of MC signals (reconstructed)"}; + 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"}; // Track related options @@ -1095,6 +1130,10 @@ struct AnalysisSameEventPairing { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + 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"); @@ -1167,13 +1206,15 @@ struct AnalysisSameEventPairing { Form("PairsBarrelSEPM_%s", objArray->At(icut)->GetName()), Form("PairsBarrelSEPP_%s", objArray->At(icut)->GetName()), Form("PairsBarrelSEMM_%s", objArray->At(icut)->GetName())}; - // assign separate hist directories for ambiguous tracks - names.push_back(Form("PairsBarrelSEPM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); - names.push_back(Form("PairsBarrelSEPP_ambiguousInBunch_%s", objArray->At(icut)->GetName())); - names.push_back(Form("PairsBarrelSEMM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); - names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); - names.push_back(Form("PairsBarrelSEPP_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); - names.push_back(Form("PairsBarrelSEMM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + if (fConfigQA) { + // assign separate hist directories for ambiguous tracks + names.push_back(Form("PairsBarrelSEPM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsBarrelSEPP_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsBarrelSEMM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsBarrelSEPP_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsBarrelSEMM_ambiguousOutOfBunch_%s", objArray->At(icut)->GetName())); + } for (auto& n : names) { histNames += Form("%s;", n.Data()); } @@ -1199,21 +1240,28 @@ struct AnalysisSameEventPairing { // assign hist directories for the MC matched pairs for each (track cut,MCsignal) combination if (!sigNamesStr.IsNull()) { - for (auto& sig : fRecMCSignals) { + for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { + auto sig = fRecMCSignals.at(isig); names = { Form("PairsBarrelSEPM_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPMCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPMIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPM_ambiguousInBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPM_ambiguousInBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPM_ambiguousInBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPM_ambiguousOutOfBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPM_ambiguousOutOfBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsBarrelSEPM_ambiguousOutOfBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())}; - histNames += Form("%s;%s;%s;%s;%s;%s;%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data(), names[3].Data(), names[4].Data(), names[5].Data(), names[6].Data(), names[7].Data(), names[8].Data()); + Form("PairsBarrelSEPP_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), + Form("PairsBarrelSEMM_%s_%s", objArray->At(icut)->GetName(), sig.GetName())}; + if (fConfigQA) { + names.push_back(Form("PairsBarrelSEPMCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsBarrelSEPMIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsBarrelSEPM_ambiguousInBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsBarrelSEPM_ambiguousInBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsBarrelSEPM_ambiguousInBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsBarrelSEPM_ambiguousOutOfBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + } + for (auto& n : names) { + histNames += Form("%s;", n.Data()); + } + fBarrelHistNamesMCmatched.try_emplace(icut * fRecMCSignals.size() + isig, names); } // end loop over MC signals } - fBarrelHistNamesMCmatched[icut] = names; } // end if enableBarrelHistos } } @@ -1239,7 +1287,18 @@ struct AnalysisSameEventPairing { Form("PairsMuonSEPM_%s", objArray->At(icut)->GetName()), Form("PairsMuonSEPP_%s", objArray->At(icut)->GetName()), Form("PairsMuonSEMM_%s", objArray->At(icut)->GetName())}; - histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); + if (fConfigQA) { + // assign separate hist directories for ambiguous tracks + names.push_back(Form("PairsMuonSEPM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonSEPP_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + names.push_back(Form("PairsMuonSEMM_ambiguousInBunch_%s", objArray->At(icut)->GetName())); + 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())); + } + for (auto& n : names) { + histNames += Form("%s;", n.Data()); + } fMuonHistNames[icut] = names; // if there are specified pair cuts, assign hist dirs for each muon cut - pair cut combination @@ -1261,11 +1320,23 @@ struct AnalysisSameEventPairing { if (!sigNamesStr.IsNull()) { for (auto& sig : fRecMCSignals) { names = { - Form("PairsMuonsSEPM_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsMuonsSEPMCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), - Form("PairsMuonsSEPMIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), + Form("PairsMuonSEPM_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), + Form("PairsMuonSEPP_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), + Form("PairsMuonSEMM_%s_%s", objArray->At(icut)->GetName(), sig.GetName()), }; - histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data()); + if (fConfigQA) { + names.push_back(Form("PairsMuonSEPMCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsMuonSEPMIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsMuonSEPM_ambiguousInBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsMuonSEPM_ambiguousInBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsMuonSEPM_ambiguousInBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsMuonSEPM_ambiguousOutOfBunch_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsMuonSEPM_ambiguousOutOfBunchCorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + names.push_back(Form("PairsMuonSEPM_ambiguousOutOfBunchIncorrectAssoc_%s_%s", objArray->At(icut)->GetName(), sig.GetName())); + } + for (auto& n : names) { + histNames += Form("%s;", n.Data()); + } } // end loop over MC signals } fMuonHistNamesMCmatched[icut] = names; @@ -1409,7 +1480,7 @@ struct AnalysisSameEventPairing { for (auto& [a1, a2] : o2::soa::combinations(groupedAssocs, groupedAssocs)) { - if constexpr (TPairType == VarManager::kDecayToEE || TPairType == VarManager::kDecayToPiPi) { + if constexpr (TPairType == VarManager::kDecayToEE) { twoTrackFilter = a1.isBarrelSelected_raw() & a2.isBarrelSelected_raw() & a1.isBarrelSelectedPrefilter_raw() & a2.isBarrelSelectedPrefilter_raw() & fTrackFilterMask; if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue @@ -1481,8 +1552,25 @@ struct AnalysisSameEventPairing { } auto t1 = a1.template reducedmuon_as(); auto t2 = a2.template reducedmuon_as(); + if (t1.matchMCHTrackId() == t2.matchMCHTrackId()) + continue; + if (t1.matchMFTTrackId() == t2.matchMFTTrackId()) + continue; 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 + if (t1.muonAmbiguityInBunch() > 1) { + twoTrackFilter |= (uint32_t(1) << 28); + } + if (t2.muonAmbiguityInBunch() > 1) { + twoTrackFilter |= (uint32_t(1) << 29); + } + if (t1.muonAmbiguityOutOfBunch() > 1) { + twoTrackFilter |= (uint32_t(1) << 30); + } + if (t2.muonAmbiguityOutOfBunch() > 1) { + twoTrackFilter |= (uint32_t(1) << 31); + } // run MC matching for this pair int isig = 0; @@ -1524,7 +1612,7 @@ struct AnalysisSameEventPairing { dimuonAllList(event.posX(), event.posY(), event.posZ(), event.numContrib(), -999., -999., -999., VarManager::fgValues[VarManager::kMass], - false, + mcDecision, VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), VarManager::fgValues[VarManager::kVertexingChi2PCA], VarManager::fgValues[VarManager::kVertexingTauz], VarManager::fgValues[VarManager::kVertexingTauzErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], @@ -1540,7 +1628,7 @@ struct AnalysisSameEventPairing { -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., - t1.isAmbiguous(), t2.isAmbiguous(), + (twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 30)), (twoTrackFilter & (uint32_t(1) << 29)) || (twoTrackFilter & (uint32_t(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], @@ -1568,46 +1656,70 @@ struct AnalysisSameEventPairing { 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)) { - fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size()].Data(), VarManager::fgValues); // matched signal - if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { // correct track-collision association - fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 1].Data(), VarManager::fgValues); - } else { // incorrect track-collision association - fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 2].Data(), VarManager::fgValues); - } - if (isAmbiInBunch) { // ambiguous in bunch - fHistMan->FillHistClass(histNames[icut][isig * fRecMCSignals.size() + 3].Data(), VarManager::fgValues); - if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { - fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 4].Data(), VarManager::fgValues); - } else { - fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 5].Data(), VarManager::fgValues); + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][0].Data(), VarManager::fgValues); // matched signal + if (fConfigQA) { + if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { // correct track-collision association + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][3].Data(), VarManager::fgValues); + } else { // incorrect track-collision association + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][4].Data(), VarManager::fgValues); } - } - if (isAmbiOutOfBunch) { // ambiguous out of bunch - fHistMan->FillHistClass(histNames[icut][isig * fRecMCSignals.size() + 6].Data(), VarManager::fgValues); - if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { - fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 7].Data(), VarManager::fgValues); - } else { - fHistMan->FillHistClass(histNamesMC[icut][isig * fRecMCSignals.size() + 8].Data(), VarManager::fgValues); + if (isAmbiInBunch) { // ambiguous in bunch + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][5].Data(), VarManager::fgValues); + if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][6].Data(), VarManager::fgValues); + } else { + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][7].Data(), VarManager::fgValues); + } + } + if (isAmbiOutOfBunch) { // ambiguous out of bunch + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][8].Data(), VarManager::fgValues); + if (isCorrectAssoc_leg1 && isCorrectAssoc_leg2) { + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][9].Data(), VarManager::fgValues); + } else { + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][10].Data(), VarManager::fgValues); + } } } } + if (fConfigQA) { + if (isAmbiInBunch) { + fHistMan->FillHistClass(histNames[icut][3].Data(), VarManager::fgValues); + } + if (isAmbiOutOfBunch) { + fHistMan->FillHistClass(histNames[icut][3 + 3].Data(), VarManager::fgValues); + } + } } } else { if (sign1 > 0) { // ++ pairs fHistMan->FillHistClass(histNames[icut][1].Data(), VarManager::fgValues); - if (isAmbiInBunch) { - fHistMan->FillHistClass(histNames[icut][4].Data(), VarManager::fgValues); + for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals + if (mcDecision & (uint32_t(1) << isig)) { + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][1].Data(), VarManager::fgValues); + } } - if (isAmbiOutOfBunch) { - fHistMan->FillHistClass(histNames[icut][4 + 3].Data(), VarManager::fgValues); + if (fConfigQA) { + if (isAmbiInBunch) { + fHistMan->FillHistClass(histNames[icut][4].Data(), VarManager::fgValues); + } + if (isAmbiOutOfBunch) { + fHistMan->FillHistClass(histNames[icut][4 + 3].Data(), VarManager::fgValues); + } } } else { // -- pairs fHistMan->FillHistClass(histNames[icut][2].Data(), VarManager::fgValues); - if (isAmbiInBunch) { - fHistMan->FillHistClass(histNames[icut][5].Data(), VarManager::fgValues); + for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals + if (mcDecision & (uint32_t(1) << isig)) { + fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][2].Data(), VarManager::fgValues); + } } - if (isAmbiOutOfBunch) { - fHistMan->FillHistClass(histNames[icut][5 + 3].Data(), VarManager::fgValues); + if (fConfigQA) { + if (isAmbiInBunch) { + fHistMan->FillHistClass(histNames[icut][5].Data(), VarManager::fgValues); + } + if (isAmbiOutOfBunch) { + fHistMan->FillHistClass(histNames[icut][5 + 3].Data(), VarManager::fgValues); + } } } } @@ -1684,12 +1796,13 @@ struct AnalysisSameEventPairing { void processAllSkimmed(MyEventsVtxCovSelected const& events, soa::Join const& barrelAssocs, MyBarrelTracksWithCovWithAmbiguities const& barrelTracks, - soa::Join const& muonAssocs, MyMuonTracksWithCov const& muons, + soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, mcEvents, mcTracks); runSameEventPairing(events, muonAssocsPerCollision, muonAssocs, muons, mcEvents, mcTracks); - runMCGen(mcEvents, mcTracks); + if (fConfigRunMCGenPair) + runMCGen(mcEvents, mcTracks); // runSameEventPairing(event, tracks, muons); } @@ -1698,7 +1811,8 @@ struct AnalysisSameEventPairing { MyBarrelTracksWithCovWithAmbiguities const& barrelTracks, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, mcEvents, mcTracks); - runMCGen(mcEvents, mcTracks); + if (fConfigRunMCGenPair) + runMCGen(mcEvents, mcTracks); } void processBarrelOnlyWithCollSkimmed(MyEventsVtxCovSelected const& events, @@ -1706,14 +1820,16 @@ struct AnalysisSameEventPairing { MyBarrelTracksWithCovWithAmbiguitiesWithColl const& barrelTracks, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { runSameEventPairing(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, mcEvents, mcTracks); - runMCGen(mcEvents, mcTracks); + if (fConfigRunMCGenPair) + runMCGen(mcEvents, mcTracks); } void processMuonOnlySkimmed(MyEventsVtxCovSelected const& events, - soa::Join const& muonAssocs, MyMuonTracksWithCov const& muons, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) + soa::Join const& muonAssocs, MyMuonTracksWithCovWithAmbiguities const& muons, ReducedMCEvents const& mcEvents, ReducedMCTracks const& mcTracks) { runSameEventPairing(events, muonAssocsPerCollision, muonAssocs, muons, mcEvents, mcTracks); - runMCGen(mcEvents, mcTracks); + if (fConfigRunMCGenPair) + runMCGen(mcEvents, mcTracks); } void processDummy(MyEvents&) @@ -1779,6 +1895,10 @@ struct AnalysisDileptonTrack { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + bool isBarrel = context.mOptions.get("processBarrelSkimmed"); bool isMuon = context.mOptions.get("processMuonSkimmed"); bool isAnyProcessEnabled = isBarrel || isMuon; @@ -2138,7 +2258,7 @@ void DefineHistograms(HistogramManager* histMan, TString histClasses, const char } } } - if (classStr.Contains("Muon")) { + if (classStr.Contains("Muon") && !classStr.Contains("Pairs")) { if (!classStr.Contains("Ambiguity")) { dqhistograms::DefineHistograms(histMan, objArray->At(iclass)->GetName(), "track", histName); } else { diff --git a/PWGDQ/Tasks/dqFlow.cxx b/PWGDQ/Tasks/dqFlow.cxx index d8f8b6c417e..36293babf41 100644 --- a/PWGDQ/Tasks/dqFlow.cxx +++ b/PWGDQ/Tasks/dqFlow.cxx @@ -69,13 +69,12 @@ using MyEventsWithCentRun3 = soa::Join; using MyEventsWithCentQvectRun3 = soa::Join; -using MyBarrelTracks = soa::Join; -using MyBarrelTracksWithCov = soa::Join; @@ -115,9 +114,10 @@ struct DQEventQvector { Configurable fConfigCutPtMax{"cfgCutPtMax", 12.0f, "Maximal pT for tracks"}; Configurable fConfigCutEtaMin{"cfgCutEtaMin", -0.8f, "Eta min range for tracks"}; Configurable fConfigCutEtaMax{"cfgCutEtaMax", 0.8f, "Eta max range for tracks"}; + 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 @@ -131,7 +131,7 @@ struct DQEventQvector { ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1}, "multiplicity / centrality axis for histograms"}; // Define the filter for barrel tracks and forward tracks - Filter trackFilter = (nabs(aod::track::eta) <= fConfigCutEtaMax) && (aod::track::pt > fConfigCutPtMin) && (aod::track::pt < fConfigCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)); + Filter trackFilter = (requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true); Filter fwdFilter = (aod::fwdtrack::eta < -2.45f) && (aod::fwdtrack::eta > -3.6f); // Histograms used for optionnal efficiency and non-uniform acceptance corrections @@ -219,6 +219,45 @@ struct DQEventQvector { fGFW->CreateRegions(); } + template + bool isTrackSelected(TTrack const& track) + { + constexpr bool isBarrelTrack = ((TTrackFillMap & VarManager::ObjTypes::Track) > 0); + if constexpr (isBarrelTrack) { + if (!(track.pt() > fConfigCutPtMin && track.pt() < fConfigCutPtMax)) { + return false; + } + if (!(track.eta() > fConfigCutEtaMin && track.eta() < fConfigCutEtaMax)) { + return false; + } + if (track.tpcNClsFound() <= fConfigCutTPCNClMin) { + 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; + } + void loadCorrections(uint64_t timestamp) { if (cfg.correctionsLoaded) { @@ -337,6 +376,11 @@ struct DQEventQvector { // Fill the GFW object in the track loop for (auto& track : tracks1) { + // Selections for barrel tracks + if (!isTrackSelected(track)) { + continue; + } + // Fill weights for Q-vector correction: this should be enabled for a first run to get weights if (fConfigFillWeights) { fWeights->Fill(track.phi(), track.eta(), collision.posZ(), track.pt(), centrality, 0); diff --git a/PWGDQ/Tasks/filterPbPb.cxx b/PWGDQ/Tasks/filterPbPb.cxx index a562b34d4df..81dfa35a996 100644 --- a/PWGDQ/Tasks/filterPbPb.cxx +++ b/PWGDQ/Tasks/filterPbPb.cxx @@ -17,6 +17,7 @@ #include "PWGDQ/DataModel/ReducedInfoTables.h" #include "PWGDQ/Core/VarManager.h" #include "CommonConstants/LHCConstants.h" +#include "ReconstructionDataFormats/Vertex.h" using namespace std; @@ -58,7 +59,7 @@ struct DQFilterPbPbTask { fStats->GetXaxis()->SetBinLabel(1, "Events inspected"); fStats->GetXaxis()->SetBinLabel(2, "Events selected"); // setup the FilterOutcome histogram - fFilterOutcome.setObject(new TH1D("Filter outcome", "Filter outcome", 8, 0.5, 8.5)); + fFilterOutcome.setObject(new TH1D("Filter outcome", "Filter outcome", 9, 0.5, 9.5)); fFilterOutcome->GetXaxis()->SetBinLabel(1, "Events inspected"); fFilterOutcome->GetXaxis()->SetBinLabel(2, "Events selected"); fFilterOutcome->GetXaxis()->SetBinLabel(3, "!A && !C"); @@ -67,6 +68,7 @@ struct DQFilterPbPbTask { fFilterOutcome->GetXaxis()->SetBinLabel(6, "A && C"); fFilterOutcome->GetXaxis()->SetBinLabel(7, Form("numContrib not in [%d, %d]", fConfigMinNPVCs.value, fConfigMaxNPVCs.value)); fFilterOutcome->GetXaxis()->SetBinLabel(8, "BC not found"); + fFilterOutcome->GetXaxis()->SetBinLabel(9, "ITS UPC settings used"); TString eventTypesString = fConfigEventTypes.value; for (std::vector::size_type i = 0; i < eventTypeOptions.size(); i++) { @@ -265,6 +267,12 @@ struct DQFilterPbPbTask { bool isSelected = filter; fStats->Fill(-1.0, isSelected); + // Record whether UPC settings were used for this event + if (collision.flags() & dataformats::Vertex>::Flags::UPCMode) { + filter |= (uint64_t(1) << VarManager::kITSUPCMode); + fFilterOutcome->Fill(9, 1); + } + eventFilter(filter); } 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/tableReader.cxx b/PWGDQ/Tasks/tableReader.cxx index 34435873ff6..7f871927ece 100644 --- a/PWGDQ/Tasks/tableReader.cxx +++ b/PWGDQ/Tasks/tableReader.cxx @@ -188,8 +188,12 @@ struct AnalysisEventSelection { Service fCCDB; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fEventCut = new AnalysisCompositeCut(true); TString eventCutStr = fConfigEventCuts.value; fEventCut->AddCut(dqcuts::GetAnalysisCut(eventCutStr.Data())); @@ -332,8 +336,12 @@ struct AnalysisTrackSelection { int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; TString cutNamesStr = fConfigCuts.value; @@ -456,8 +464,12 @@ struct AnalysisMuonSelection { HistogramManager* fHistMan; std::vector fMuonCuts; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + TString cutNamesStr = fConfigCuts.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); @@ -550,8 +562,12 @@ struct AnalysisPrefilterSelection { std::map fPrefiltermap; AnalysisCompositeCut* fPairCut; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; ccdb->setURL(ccdburl.value); @@ -662,6 +678,10 @@ struct AnalysisEventMixing { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; ccdb->setURL(ccdburl.value); @@ -798,9 +818,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 @@ -977,6 +997,10 @@ struct AnalysisSameEventPairing { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; ccdb->setURL(ccdburl.value); @@ -1040,9 +1064,9 @@ 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")) { @@ -1074,9 +1098,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; @@ -1107,10 +1131,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 @@ -1251,8 +1275,8 @@ struct AnalysisSameEventPairing { if constexpr ((TPairType == pairTypeEE) && (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelPID) > 0) { if (fConfigFlatTables.value) { dielectronAllList(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), dileptonFilterMap, dileptonMcDecision, - t1.pt(), t1.eta(), t1.phi(), 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.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(), + 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(), VarManager::fgValues[VarManager::kKFTrack0DCAxyz], VarManager::fgValues[VarManager::kKFTrack1DCAxyz], VarManager::fgValues[VarManager::kKFDCAxyzBetweenProngs], VarManager::fgValues[VarManager::kKFTrack0DCAxy], VarManager::fgValues[VarManager::kKFTrack1DCAxy], VarManager::fgValues[VarManager::kKFDCAxyBetweenProngs], VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], @@ -1375,12 +1399,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) @@ -1556,61 +1580,6 @@ struct AnalysisSameEventPairing { PROCESS_SWITCH(AnalysisSameEventPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", false); }; -struct AnalysisFwdTrackPid { - Produces fwdPidAllList; - - Filter filterEventSelected = aod::dqanalysisflags::isEventSelected == 1; - - Configurable fConfigMaxDCA{"cfgMaxDCA", 0.5f, "Manually set maximum DCA of the track"}; - - void init(o2::framework::InitContext&) - { - } - - // Template function to pair mft tracks and muon tracks - template - void runFwdTrackPid(TEvent const& event, Muons const& muons, MftTracks const& mftTracks) - { - 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()); - } - } - if constexpr (TMatchedOnly == false) { - for (const auto& mftTrack : mftTracks) { - 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); - } - } - } - } - - void processFwdPidMatchedSkimmed(soa::Filtered::iterator const& event, MyMuonTracks const& muons, MyMftTracks const& mftTracks) - { - if (muons.size() > 0 && mftTracks.size() > 0) { - runFwdTrackPid(event, muons, mftTracks); - } - } - - void processFwdPidMatchedOnlySkimmed(soa::Filtered::iterator const& event, MyMuonTracks const& muons, MyMftTracks const& mftTracks) - { - if (muons.size() > 0) { - runFwdTrackPid(event, muons, mftTracks); - } - } - - void processDummy(MyEvents&) - { - // do nothing - } - - PROCESS_SWITCH(AnalysisFwdTrackPid, processFwdPidMatchedSkimmed, "Run MFT - muon track pairing filling tree with MFT and global tracks", false); - PROCESS_SWITCH(AnalysisFwdTrackPid, processFwdPidMatchedOnlySkimmed, "Run MFT - muon track pairing filling tree with global tracks only", false); - PROCESS_SWITCH(AnalysisFwdTrackPid, processDummy, "Dummy function", false); -}; - struct AnalysisDileptonHadron { // // This task combines dilepton candidates with a track and could be used for example @@ -1663,6 +1632,10 @@ struct AnalysisDileptonHadron { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; fValuesDilepton = new float[VarManager::kNVars]; fValuesHadron = new float[VarManager::kNVars]; @@ -1821,7 +1794,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 } @@ -1871,6 +1844,10 @@ struct AnalysisDileptonTrackTrack { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fValuesDitrack = new float[VarManager::kNVars]; fValuesQuadruplet = new float[VarManager::kNVars]; VarManager::SetDefaultVarNames(); @@ -1994,7 +1971,7 @@ struct AnalysisDileptonTrackTrack { } } } // check if the Ditrack cut is selected - } // loop over hadron cuts + } // loop over hadron cuts } } } @@ -2022,7 +1999,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc)}; } diff --git a/PWGDQ/Tasks/tableReader_withAssoc.cxx b/PWGDQ/Tasks/tableReader_withAssoc.cxx index f16d172f0ce..e38e03d054a 100644 --- a/PWGDQ/Tasks/tableReader_withAssoc.cxx +++ b/PWGDQ/Tasks/tableReader_withAssoc.cxx @@ -165,6 +165,7 @@ struct AnalysisEventSelection { 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 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"}; @@ -179,8 +180,12 @@ struct AnalysisEventSelection { std::map> fBCCollMap; // key: global BC, value: vector of reduced event global indices int fCurrentRun; - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fEventCut = new AnalysisCompositeCut(true); TString eventCutStr = fConfigEventCuts.value; fEventCut->AddCut(dqcuts::GetAnalysisCut(eventCutStr.Data())); @@ -244,8 +249,15 @@ struct AnalysisEventSelection { bool decision = false; fHistMan->FillHistClass("Event_BeforeCuts", VarManager::fgValues); // automatically fill all the histograms in the class Event 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] + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + decision = true; + } + } else { + fHistMan->FillHistClass("Event_AfterCuts", VarManager::fgValues); + decision = true; + } } fSelMap[event.globalIndex()] = decision; if (fBCCollMap.find(event.globalBC()) == fBCCollMap.end()) { @@ -371,10 +383,13 @@ struct AnalysisTrackSelection { std::map> fNAssocsInBunch; // key: track global index, value: vector of global index for events associated in-bunch (events that have in-bunch pileup or splitting) std::map> fNAssocsOutOfBunch; // key: track global index, value: vector of global index for events associated out-of-bunch (events that have no in-bunch pileup) - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { - fCurrentRun = 0; + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; TString cutNamesStr = fConfigCuts.value; if (!cutNamesStr.IsNull()) { std::unique_ptr objArray(cutNamesStr.Tokenize(",")); @@ -592,8 +607,12 @@ struct AnalysisMuonSelection { std::map> fNAssocsInBunch; // key: muon global index, value: vector of global index for events associated in-bunch (events that have in-bunch pileup or splitting) std::map> fNAssocsOutOfBunch; // key: muon global index, value: vector of global index for events associated out-of-bunch (events that have no in-bunch pileup) - void init(o2::framework::InitContext&) + void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fCurrentRun = 0; TString cutNamesStr = fConfigCuts.value; if (!cutNamesStr.IsNull()) { @@ -666,8 +685,6 @@ struct AnalysisMuonSelection { auto track = assoc.template reducedmuon_as(); filterMap = 0; VarManager::FillTrack(track); - // compute quantities which depend on the associated collision - VarManager::FillPropagateMuon(track, event); if (fConfigQA) { fHistMan->FillHistClass("TrackMuon_BeforeCuts", VarManager::fgValues); } @@ -775,12 +792,12 @@ struct AnalysisPrefilterSelection { Preslice trackAssocsPerCollision = aod::reducedtrack_association::reducedeventId; - void init(o2::framework::InitContext& initContext) + void init(o2::framework::InitContext& context) { - if (initContext.mOptions.get("processDummy")) { - LOG(info) << "Dummy function enabled. Skipping the rest of init()" << endl; + if (context.mOptions.get("processDummy")) { return; } + // get the list of track cuts to be prefiltered TString trackCutsStr = fConfigTrackCuts.value; TObjArray* objArrayTrackCuts = nullptr; @@ -796,7 +813,7 @@ struct AnalysisPrefilterSelection { fPrefilterMask = 0; fPrefilterCutBit = -1; string trackCuts; - getTaskOptionValue(initContext, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); + getTaskOptionValue(context, "analysis-track-selection", "cfgTrackCuts", trackCuts, false); TString allTrackCutsStr = trackCuts; TString prefilterTrackCutStr = fConfigPrefilterTrackCut.value; if (!trackCutsStr.IsNull()) { @@ -986,19 +1003,14 @@ struct AnalysisSameEventPairing { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + fEnableBarrelHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processBarrelOnlySkimmed") || context.mOptions.get("processBarrelOnlyWithCollSkimmed") || context.mOptions.get("processBarrelOnlySkimmedNoCov"); fEnableBarrelMixingHistos = context.mOptions.get("processMixingAllSkimmed") || context.mOptions.get("processMixingBarrelSkimmed"); fEnableMuonHistos = context.mOptions.get("processAllSkimmed") || context.mOptions.get("processMuonOnlySkimmed"); fEnableMuonMixingHistos = context.mOptions.get("processMixingAllSkimmed"); - bool isDummy = context.mOptions.get("processDummy"); - if (isDummy) { - if (fEnableBarrelHistos || fEnableBarrelMixingHistos || fEnableMuonHistos || fEnableMuonMixingHistos) { - 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 = ""; @@ -1071,8 +1083,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 } } } @@ -1106,8 +1118,26 @@ 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; @@ -1122,7 +1152,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) } } } @@ -1299,7 +1329,7 @@ struct AnalysisSameEventPairing { bool isFirst = true; for (auto& [a1, a2] : o2::soa::combinations(groupedAssocs, groupedAssocs)) { - if constexpr (TPairType == VarManager::kDecayToEE || TPairType == VarManager::kDecayToPiPi) { + if constexpr (TPairType == VarManager::kDecayToEE) { twoTrackFilter = a1.isBarrelSelected_raw() & a2.isBarrelSelected_raw() & a1.isBarrelSelectedPrefilter_raw() & a2.isBarrelSelectedPrefilter_raw() & fTrackFilterMask; if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue @@ -1349,8 +1379,8 @@ struct AnalysisSameEventPairing { if constexpr ((TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelPID) > 0) { if (fConfigFlatTables.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.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.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(), + 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(), VarManager::fgValues[VarManager::kKFTrack0DCAxyz], VarManager::fgValues[VarManager::kKFTrack1DCAxyz], VarManager::fgValues[VarManager::kKFDCAxyzBetweenProngs], VarManager::fgValues[VarManager::kKFTrack0DCAxy], VarManager::fgValues[VarManager::kKFTrack1DCAxy], VarManager::fgValues[VarManager::kKFDCAxyBetweenProngs], VarManager::fgValues[VarManager::kKFTrack0DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationFromPV], VarManager::fgValues[VarManager::kKFTrack0DeviationxyFromPV], VarManager::fgValues[VarManager::kKFTrack1DeviationxyFromPV], VarManager::fgValues[VarManager::kKFMass], VarManager::fgValues[VarManager::kKFChi2OverNDFGeo], VarManager::fgValues[VarManager::kVertexingLxyz], VarManager::fgValues[VarManager::kVertexingLxyzOverErr], VarManager::fgValues[VarManager::kVertexingLxy], VarManager::fgValues[VarManager::kVertexingLxyOverErr], VarManager::fgValues[VarManager::kVertexingTauxy], VarManager::fgValues[VarManager::kVertexingTauxyErr], VarManager::fgValues[VarManager::kKFCosPA], VarManager::fgValues[VarManager::kKFJpsiDCAxyz], VarManager::fgValues[VarManager::kKFJpsiDCAxy], @@ -1369,9 +1399,9 @@ struct AnalysisSameEventPairing { auto t1 = a1.template reducedmuon_as(); auto t2 = a2.template reducedmuon_as(); - if (t1.matchMCHTrackId() == t2.matchMCHTrackId()) + if (t1.matchMCHTrackId() == t2.matchMCHTrackId() && t1.matchMCHTrackId() >= 0) continue; - if (t1.matchMFTTrackId() == t2.matchMFTTrackId()) + if (t1.matchMFTTrackId() == t2.matchMFTTrackId() && t1.matchMFTTrackId() >= 0) continue; sign1 = t1.sign(); sign2 = t2.sign(); @@ -1463,10 +1493,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)); + isUnambiguous = !((twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 29)) || (twoTrackFilter & (uint32_t(1) << 30)) || (twoTrackFilter & (uint32_t(1) << 31))); if (sign1 * sign2 < 0) { fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); if (isAmbiInBunch) { @@ -1475,6 +1507,9 @@ struct AnalysisSameEventPairing { if (isAmbiOutOfBunch) { fHistMan->FillHistClass(histNames[icut][3 + histIdxOffset + 3].Data(), VarManager::fgValues); } + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][3 + histIdxOffset + 6].Data(), VarManager::fgValues); + } } else { if (sign1 > 0) { fHistMan->FillHistClass(histNames[icut][1].Data(), VarManager::fgValues); @@ -1484,6 +1519,9 @@ struct AnalysisSameEventPairing { if (isAmbiOutOfBunch) { fHistMan->FillHistClass(histNames[icut][4 + histIdxOffset + 3].Data(), VarManager::fgValues); } + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][4 + histIdxOffset + 6].Data(), VarManager::fgValues); + } } else { fHistMan->FillHistClass(histNames[icut][2].Data(), VarManager::fgValues); if (isAmbiInBunch) { @@ -1492,6 +1530,9 @@ struct AnalysisSameEventPairing { if (isAmbiOutOfBunch) { fHistMan->FillHistClass(histNames[icut][5 + histIdxOffset + 3].Data(), VarManager::fgValues); } + if (isUnambiguous) { + fHistMan->FillHistClass(histNames[icut][5 + histIdxOffset + 6].Data(), VarManager::fgValues); + } } } for (unsigned int iPairCut = 0; iPairCut < fPairCuts.size(); iPairCut++) { @@ -1510,8 +1551,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 @@ -1553,6 +1594,19 @@ struct AnalysisSameEventPairing { 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 |= (uint32_t(1) << 28); + } + if (t2.muonAmbiguityInBunch() > 1) { + twoTrackFilter |= (uint32_t(1) << 29); + } + if (t1.muonAmbiguityOutOfBunch() > 1) { + twoTrackFilter |= (uint32_t(1) << 30); + } + if (t2.muonAmbiguityOutOfBunch() > 1) { + twoTrackFilter |= (uint32_t(1) << 31); + } ncuts = fNCutsMuon; histNames = fMuonHistNames; } @@ -1560,22 +1614,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))) { continue; // cut not passed } + isAmbiInBunch = (twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 29)); + isAmbiOutOfBunch = (twoTrackFilter & (uint32_t(1) << 30)) || (twoTrackFilter & (uint32_t(1) << 31)); + isUnambiguous = !((twoTrackFilter & (uint32_t(1) << 28)) || (twoTrackFilter & (uint32_t(1) << 29)) || (twoTrackFilter & (uint32_t(1) << 30)) || (twoTrackFilter & (uint32_t(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 @@ -1636,7 +1723,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); @@ -1729,9 +1816,7 @@ struct AnalysisAsymmetricPairing { void init(o2::framework::InitContext& context) { - bool isDummy = context.mOptions.get("processDummy"); - if (isDummy) { - LOG(info) << "Dummy function enabled. Skipping the rest of init()" << endl; + if (context.mOptions.get("processDummy")) { return; } @@ -1869,7 +1954,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"}; @@ -1920,7 +2005,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 @@ -2160,8 +2245,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+) @@ -2200,7 +2285,7 @@ struct AnalysisAsymmetricPairing { std::set> globIdxTriplets; // Based on triplet type, make suitable combinations of the partitions - if (tripletType == VarManager::kTripleCandidateToPKPi) { + if (tripletType == VarManager::kTripleCandidateToPKPi || tripletType == VarManager::kTripleCandidateToKKPi) { for (auto& [a1, a2, a3] : combinations(soa::CombinationsFullIndexPolicy(groupedLegAAssocs, groupedLegBAssocs, groupedLegCAssocs))) { readTriplet(a1, a2, a3, tracks, event, tripletType, histNames); } @@ -2320,6 +2405,13 @@ struct AnalysisAsymmetricPairing { runThreeProng(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, VarManager::kTripleCandidateToKPiPi); } + void processKaonKaonPionSkimmed(MyEventsVtxCovZdcSelected const& events, + soa::Join const& barrelAssocs, + MyBarrelTracksWithCovWithAmbiguities const& barrelTracks) + { + runThreeProng(events, trackAssocsPerCollision, barrelAssocs, barrelTracks, VarManager::kTripleCandidateToKKPi); + } + void processProtonKaonPionSkimmed(MyEventsVtxCovZdcSelected const& events, soa::Join const& barrelAssocs, MyBarrelTracksWithCovWithAmbiguities const& barrelTracks) @@ -2334,6 +2426,7 @@ struct AnalysisAsymmetricPairing { PROCESS_SWITCH(AnalysisAsymmetricPairing, processKaonPionSkimmed, "Run kaon pion pairing, with skimmed tracks", false); PROCESS_SWITCH(AnalysisAsymmetricPairing, processKaonPionPionSkimmed, "Run kaon pion pion triplets, with skimmed tracks", false); + PROCESS_SWITCH(AnalysisAsymmetricPairing, processKaonKaonPionSkimmed, "Run kaon kaon pion triplets, with skimmed tracks", false); PROCESS_SWITCH(AnalysisAsymmetricPairing, processProtonKaonPionSkimmed, "Run proton kaon pion triplets, with skimmed tracks", false); PROCESS_SWITCH(AnalysisAsymmetricPairing, processDummy, "Dummy function, enabled only if none of the others are enabled", true); }; @@ -2388,21 +2481,15 @@ struct AnalysisDileptonTrack { void init(o2::framework::InitContext& context) { + if (context.mOptions.get("processDummy")) { + return; + } + bool isBarrel = context.mOptions.get("processBarrelSkimmed"); bool isBarrelME = context.mOptions.get("processBarrelMixedEvent"); bool isBarrelAsymmetric = context.mOptions.get("processDstarToD0Pi"); bool isMuon = context.mOptions.get("processMuonSkimmed"); bool isMuonME = context.mOptions.get("processMuonMixedEvent"); - bool isAnyProcessEnabled = isBarrel || isBarrelME || isMuon || isMuonME; - bool isDummy = context.mOptions.get("processDummy"); - if (isDummy) { - if (isAnyProcessEnabled) { - LOG(warning) << "Dummy function is enabled even if there are normal process functions running! Fix your config!" << endl; - } else { - LOG(info) << "Dummy function is enabled. Skipping the rest of the init function" << endl; - return; - } - } fCurrentRun = 0; fValuesDilepton = new float[VarManager::kNVars]; @@ -2767,8 +2854,8 @@ struct AnalysisDileptonTrack { } } } // end for (dileptons) - } // end for (assocs) - } // end event loop + } // end for (assocs) + } // end event loop } void processMuonMixedEvent(soa::Filtered& events, @@ -2806,8 +2893,8 @@ struct AnalysisDileptonTrack { } } } // end for (dileptons) - } // end for (assocs) - } // end event loop + } // end for (assocs) + } // end event loop } void processDummy(MyEvents&) diff --git a/PWGDQ/Tasks/taskFwdTrackPid.cxx b/PWGDQ/Tasks/taskFwdTrackPid.cxx new file mode 100644 index 00000000000..ce173ecf314 --- /dev/null +++ b/PWGDQ/Tasks/taskFwdTrackPid.cxx @@ -0,0 +1,128 @@ +// Copyright 2019-2024 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 taskFwdTrackPid.cxx +/// \brief Task for the analysis of forward PID with MFT +/// \author Luca Micheletti , INFN + +#include +#include +#include +#include +#include +#include +#include +#include +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "PWGDQ/DataModel/ReducedInfoTables.h" +#include "PWGDQ/Core/VarManager.h" +#include "PWGDQ/Core/HistogramManager.h" +#include "PWGDQ/Core/MixingHandler.h" +#include "PWGDQ/Core/AnalysisCut.h" +#include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/HistogramsLibrary.h" +#include "PWGDQ/Core/CutsLibrary.h" +#include "PWGDQ/Core/MixingLibrary.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "Field/MagneticField.h" +#include "TGeoGlobalMagField.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "ITSMFTBase/DPLAlpideParam.h" +#include "Common/CCDB/EventSelectionParams.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::aod; + +using MyEvents = soa::Join; + +using MyMuonTracks = soa::Join; +using MyMftTracks = 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 gkMuonFillMap = VarManager::ObjTypes::ReducedMuon | VarManager::ObjTypes::ReducedMuonExtra; + +struct taskFwdTrackPid { + Produces fwdPidAllList; + + Configurable fConfigMaxDCA{"cfgMaxDCA", 0.5f, "Manually set maximum DCA of the track"}; + Configurable downSampleFactor{"downSampleFactor", 1., "Fraction of candidates to keep for ML"}; + + void init(o2::framework::InitContext& context) + { + if (context.mOptions.get("processDummy")) { + return; + } + } + + // Template function to pair mft tracks and muon tracks + template + void runFwdTrackPid(TEvent const& event, Muons const& muons, MftTracks const& mftTracks) + { + 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()); + } + } + 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); + } + } + } + } + + void processFwdPidMatched(MyEvents::iterator const& event, MyMuonTracks const& muons, MyMftTracks const& mftTracks) + { + if (muons.size() > 0 && mftTracks.size() > 0) { + runFwdTrackPid(event, muons, mftTracks); + } + } + + void processFwdPidMatchedOnly(MyEvents::iterator const& event, MyMuonTracks const& muons, MyMftTracks const& mftTracks) + { + if (muons.size() > 0) { + runFwdTrackPid(event, muons, mftTracks); + } + } + + void processDummy(MyEvents&) + { + // do nothing + } + + 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, processDummy, "Dummy function", false); +}; // End of struct taskFwdTrackPid + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} 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..e5489fc33b6 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" @@ -301,7 +303,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()) < 5 && TMath::Abs(V0.negTrack_as().tpcNSigmaEl()) < 5 && TMath::Abs(psipair) < maxpsipair) { pidmap[V0.posTrackId()] |= (uint8_t(1) << kGamma); pidmap[V0.negTrackId()] |= (uint8_t(1) << kGamma); if (fillhisto) { diff --git a/PWGEM/Dilepton/Core/DielectronCut.cxx b/PWGEM/Dilepton/Core/DielectronCut.cxx index 0beed07efb2..3d1987801cc 100644 --- a/PWGEM/Dilepton/Core/DielectronCut.cxx +++ b/PWGEM/Dilepton/Core/DielectronCut.cxx @@ -13,13 +13,14 @@ // Class for dilepton Cut // +#include +#include + #include "Framework/Logger.h" #include "PWGEM/Dilepton/Core/DielectronCut.h" ClassImp(DielectronCut); -const char* DielectronCut::mCutNames[static_cast(DielectronCut::DielectronCuts::kNCuts)] = {"Mee", "PairPtRange", "PairRapidityRange", "PairDCARange", "PhivPair", "TrackPtRange", "TrackEtaRange", "TPCNCls", "TPCCrossedRows", "TPCCrossedRowsOverNCls", "TPCChi2NDF", "TPCNsigmaEl", "TPCNsigmaMu", "TPCNsigmaPi", "TPCNsigmaKa", "TPCNsigmaPr", "TOFNsigmaEl", "TOFNsigmaMu", "TOFNsigmaPi", "TOFNsigmaKa", "TOFNsigmaPr", "DCA3Dsigma", "DCAxy", "DCAz", "ITSNCls", "ITSChi2NDF", "ITSClusterSize", "Prefilter"}; - const std::pair> DielectronCut::its_ib_any_Requirement = {1, {0, 1, 2}}; // hits on any ITS ib layers. const std::pair> DielectronCut::its_ib_1st_Requirement = {1, {0}}; // hit on 1st ITS ib layers. @@ -47,16 +48,42 @@ void DielectronCut::SetMeeRange(float min, float max) mMaxMee = max; LOG(info) << "Dielectron Cut, set mee range: " << mMinMee << " - " << mMaxMee; } +void DielectronCut::SetPairOpAng(float minOpAng, float maxOpAng) +{ + mMinOpAng = minOpAng; + mMaxOpAng = maxOpAng; + LOG(info) << "Dielectron Cut, set pair opening angle range: " << mMinOpAng << " - " << mMaxOpAng; +} void DielectronCut::SetMaxPhivPairMeeDep(std::function meeDepCut) { mMaxPhivPairMeeDep = meeDepCut; LOG(info) << "Dielectron Cut, set max phiv pair mee dep: " << mMaxPhivPairMeeDep(0.02); } +void DielectronCut::SetPhivPairRange(float min_phiv, float max_phiv, float min_mee, float max_mee) +{ + mMinPhivPair = min_phiv; + mMaxPhivPair = max_phiv; + mMinMeeForPhivPair = min_mee; + mMaxMeeForPhivPair = max_mee; + LOG(info) << "Dielectron Cut, set phiv range: " << mMinPhivPair << " - " << mMaxPhivPair << " and mee range: " << mMinMeeForPhivPair << " - " << mMaxMeeForPhivPair; +} void DielectronCut::SelectPhotonConversion(bool flag) { mSelectPC = flag; LOG(info) << "Dielectron Cut, select photon conversion: " << mSelectPC; } +void DielectronCut::SetMindEtadPhi(bool flag, float min_deta, float min_dphi) +{ + mApplydEtadPhi = flag; + mMinDeltaEta = min_deta; + 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; @@ -69,6 +96,12 @@ void DielectronCut::SetTrackEtaRange(float minEta, float maxEta) mMaxTrackEta = maxEta; LOG(info) << "Dielectron Cut, set track eta range: " << mMinTrackEta << " - " << mMaxTrackEta; } +void DielectronCut::SetTrackPhiRange(float minPhi, float maxPhi) +{ + mMinTrackPhi = minPhi; + mMaxTrackPhi = maxPhi; + LOG(info) << "Dielectron Cut, set track phi range (rad.): " << mMinTrackPhi << " - " << mMaxTrackPhi; +} void DielectronCut::SetMinNClustersTPC(int minNClustersTPC) { mMinNClustersTPC = minNClustersTPC; @@ -84,6 +117,17 @@ void DielectronCut::SetMinNCrossedRowsOverFindableClustersTPC(float minNCrossedR mMinNCrossedRowsOverFindableClustersTPC = minNCrossedRowsOverFindableClustersTPC; LOG(info) << "Dielectron Cut, set min N crossed rows over findable clusters TPC: " << mMinNCrossedRowsOverFindableClustersTPC; } +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; @@ -103,31 +147,39 @@ void DielectronCut::SetChi2PerClusterITS(float min, float max) mMaxChi2PerClusterITS = max; LOG(info) << "Dielectron Cut, set chi2 per cluster ITS range: " << mMinChi2PerClusterITS << " - " << mMaxChi2PerClusterITS; } -void DielectronCut::SetMeanClusterSizeITS(float min, float max, float maxP) +void DielectronCut::SetMeanClusterSizeITS(float min, float max, float minP, float maxP) { mMinMeanClusterSizeITS = min; mMaxMeanClusterSizeITS = max; + mMinP_ITSClusterSize = minP; mMaxP_ITSClusterSize = maxP; LOG(info) << "Dielectron Cut, set mean cluster size ITS range: " << mMinMeanClusterSizeITS << " - " << mMaxMeanClusterSizeITS; } -void DielectronCut::SetDca3DRange(float min, float max) +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; mMaxDca3D = max; LOG(info) << "Dielectron Cut, set DCA 3D range in sigma: " << mMinDca3D << " - " << mMaxDca3D; } -void DielectronCut::SetMaxDcaXY(float maxDcaXY) +void DielectronCut::SetTrackMaxDcaXY(float maxDcaXY) { mMaxDcaXY = maxDcaXY; LOG(info) << "Dielectron Cut, set max DCA xy: " << mMaxDcaXY; } -void DielectronCut::SetMaxDcaZ(float maxDcaZ) +void DielectronCut::SetTrackMaxDcaZ(float maxDcaZ) { mMaxDcaZ = maxDcaZ; LOG(info) << "Dielectron Cut, set max DCA z: " << mMaxDcaZ; } -void DielectronCut::SetMaxDcaXYPtDep(std::function ptDepCut) +void DielectronCut::SetTrackMaxDcaXYPtDep(std::function ptDepCut) { mMaxDcaXYPtDep = ptDepCut; LOG(info) << "Dielectron Cut, set max DCA xy pt dep: " << mMaxDcaXYPtDep(1.0); @@ -248,38 +300,3 @@ void DielectronCut::RequireITSib1st(bool flag) mRequireITSib1st = flag; LOG(info) << "Dielectron Cut, require ITS ib 1st: " << mRequireITSib1st; } - -void DielectronCut::print() const -{ - LOG(info) << "Dalitz EE Cut:"; - for (int i = 0; i < static_cast(DielectronCuts::kNCuts); i++) { - switch (static_cast(i)) { - case DielectronCuts::kTrackPtRange: - LOG(info) << mCutNames[i] << " in [" << mMinTrackPt << ", " << mMaxTrackPt << "]"; - break; - case DielectronCuts::kTrackEtaRange: - LOG(info) << mCutNames[i] << " in [" << mMinTrackEta << ", " << mMaxTrackEta << "]"; - break; - case DielectronCuts::kTPCNCls: - LOG(info) << mCutNames[i] << " > " << mMinNClustersTPC; - break; - case DielectronCuts::kTPCCrossedRows: - LOG(info) << mCutNames[i] << " > " << mMinNCrossedRowsTPC; - break; - case DielectronCuts::kTPCCrossedRowsOverNCls: - LOG(info) << mCutNames[i] << " > " << mMinNCrossedRowsOverFindableClustersTPC; - break; - case DielectronCuts::kTPCChi2NDF: - LOG(info) << mCutNames[i] << " < " << mMaxChi2PerClusterTPC; - break; - case DielectronCuts::kDCAxy: - LOG(info) << mCutNames[i] << " < " << mMaxDcaXY; - break; - case DielectronCuts::kDCAz: - LOG(info) << mCutNames[i] << " < " << mMaxDcaZ; - break; - default: - LOG(fatal) << "Cut unknown!"; - } - } -} diff --git a/PWGEM/Dilepton/Core/DielectronCut.h b/PWGEM/Dilepton/Core/DielectronCut.h index e09fd72fc17..b44ccc37b61 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 { @@ -52,9 +52,12 @@ class DielectronCut : public TNamed // track cut kTrackPtRange, kTrackEtaRange, + kTrackPhiRange, kTPCNCls, kTPCCrossedRows, kTPCCrossedRowsOverNCls, + kTPCFracSharedClusters, + kRelDiffPin, kTPCChi2NDF, kTPCNsigmaEl, kTPCNsigmaMu, @@ -71,11 +74,10 @@ class DielectronCut : public TNamed kDCAz, kITSNCls, kITSChi2NDF, - kITSCluserSize, + kITSClusterSize, kPrefilter, kNCuts }; - static const char* mCutNames[static_cast(DielectronCuts::kNCuts)]; enum class PIDSchemes : int { kUnDef = -1, @@ -105,46 +107,76 @@ 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 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 (mMaxPhivPairMeeDep) { + if ((phiv < mMinPhivPair || mMaxPhivPairMeeDep(v12.M()) < phiv) ^ mSelectPC) { + return false; + } + } else { + if ((!(mMinPhivPair < phiv && phiv < mMaxPhivPair) && !(mMinMeeForPhivPair < v12.M() && v12.M() < mMaxMeeForPhivPair)) ^ 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 + return false; + } + + if (mRequireDiffSides && t1.eta() * t2.eta() > 0.0) { + return false; + } + + float deta = v1.Eta() - v2.Eta(); + float dphi = v1.Phi() - v2.Phi(); + o2::math_utils::bringToPMPi(dphi); + if (mApplydEtadPhi && std::pow(deta / mMinDeltaEta, 2) + std::pow(dphi / mMinDeltaPhi, 2) < 1.f) { + 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 (!dont_require_pteta) { + if (!IsSelectedTrack(track, DielectronCuts::kTrackPtRange)) { + return false; + } + if (!IsSelectedTrack(track, DielectronCuts::kTrackEtaRange)) { + return false; + } } - if (!IsSelectedTrack(track, DielectronCuts::kTrackEtaRange)) { + + if (!IsSelectedTrack(track, DielectronCuts::kTrackPhiRange)) { return false; } if (!IsSelectedTrack(track, DielectronCuts::kDCA3Dsigma)) { @@ -164,7 +196,7 @@ class DielectronCut : public TNamed if (!IsSelectedTrack(track, DielectronCuts::kITSChi2NDF)) { return false; } - if (!IsSelectedTrack(track, DielectronCuts::kITSCluserSize)) { + if (!IsSelectedTrack(track, DielectronCuts::kITSClusterSize)) { return false; } @@ -192,6 +224,12 @@ class DielectronCut : public TNamed if (!IsSelectedTrack(track, DielectronCuts::kTPCCrossedRowsOverNCls)) { return false; } + if (!IsSelectedTrack(track, DielectronCuts::kTPCFracSharedClusters)) { + return false; + } + if (!IsSelectedTrack(track, DielectronCuts::kRelDiffPin)) { + return false; + } if (!IsSelectedTrack(track, DielectronCuts::kTPCChi2NDF)) { return false; } @@ -200,11 +238,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)) { @@ -222,19 +255,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 @@ -272,7 +298,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; } @@ -284,7 +310,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; } @@ -300,7 +326,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 = 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; } @@ -314,6 +340,9 @@ class DielectronCut : public TNamed case DielectronCuts::kTrackEtaRange: return track.eta() >= mMinTrackEta && track.eta() <= mMaxTrackEta; + case DielectronCuts::kTrackPhiRange: + return track.phi() >= mMinTrackPhi && track.phi() <= mMaxTrackPhi; + case DielectronCuts::kTPCNCls: return track.tpcNClsFound() >= mMinNClustersTPC; @@ -323,6 +352,12 @@ class DielectronCut : public TNamed case DielectronCuts::kTPCCrossedRowsOverNCls: return track.tpcCrossedRowsOverFindableCls() >= mMinNCrossedRowsOverFindableClustersTPC; + 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; @@ -341,8 +376,8 @@ class DielectronCut : public TNamed case DielectronCuts::kITSChi2NDF: return mMinChi2PerClusterITS < track.itsChi2NCl() && track.itsChi2NCl() < mMaxChi2PerClusterITS; - case DielectronCuts::kITSCluserSize: - return track.p() < mMaxP_ITSClusterSize ? mMinMeanClusterSizeITS < track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())) && track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())) < mMaxMeanClusterSizeITS : true; + case DielectronCuts::kITSClusterSize: + return ((mMinP_ITSClusterSize < track.p() && track.p() < mMaxP_ITSClusterSize) ? (mMinMeanClusterSizeITS < track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())) && track.meanClusterSizeITS() * std::cos(std::atan(track.tgl())) < mMaxMeanClusterSizeITS) : true); case DielectronCuts::kPrefilter: return track.pfb() <= 0; @@ -357,18 +392,26 @@ 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 SetPairOpAng(float minOpAng = 0.f, float maxOpAng = 1e10f); void SetMaxPhivPairMeeDep(std::function meeDepCut); + void SetPhivPairRange(float min_phiv, float max_phiv, float min_mee, float max_mee); 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); + void SetTrackPhiRange(float minPhi = 0.f, float maxPhi = 2.f * M_PI); void SetMinNClustersTPC(int minNClustersTPC); 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 maxP = 0.f); + 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); @@ -389,24 +432,21 @@ class DielectronCut : public TNamed void RequireITSibAny(bool flag); void RequireITSib1st(bool flag); - void SetDca3DRange(float min, float max); // in sigma - void SetMaxDcaXY(float maxDcaXY); // in cm - void SetMaxDcaZ(float maxDcaZ); // in cm - void SetMaxDcaXYPtDep(std::function ptDepCut); + void SetTrackDca3DRange(float min, float max); // in sigma + void SetTrackMaxDcaXY(float maxDcaXY); // in cm + void SetTrackMaxDcaZ(float maxDcaZ); // in cm + void SetTrackMaxDcaXYPtDep(std::function ptDepCut); 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 bool IsPhotonConversionSelected() const { return mSelectPC; } - /// @brief Print the track selection - void print() const; - private: static const std::pair> its_ib_any_Requirement; static const std::pair> its_ib_1st_Requirement; @@ -416,24 +456,34 @@ 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}; + float mMinMeeForPhivPair{0.f}, mMaxMeeForPhivPair{1e10f}; 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{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 - float mMinTrackEta{-1e10f}, mMaxTrackEta{1e10f}; // range in eta + float mMinTrackPt{0.f}, mMaxTrackPt{1e10f}; // range in pT + float mMinTrackEta{-1e10f}, mMaxTrackEta{1e10f}; // range in eta + float mMinTrackPhi{0.f}, mMaxTrackPhi{2.f * M_PI}; // range in phi // track quality cuts int mMinNClustersTPC{0}; // min number of TPC clusters int mMinNCrossedRowsTPC{0}; // min number of crossed rows in TPC 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 @@ -443,7 +493,7 @@ class DielectronCut : public TNamed bool mApplyPhiV{true}; bool mApplyPF{false}; float mMinMeanClusterSizeITS{-1e10f}, mMaxMeanClusterSizeITS{1e10f}; // max x cos(Lmabda) - float mMaxP_ITSClusterSize{0.0}; + float mMinP_ITSClusterSize{0.0}, mMaxP_ITSClusterSize{0.0}; // pid cuts int mPIDScheme{-1}; @@ -461,7 +511,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 9bd0c72b637..39e65abf7ae 100644 --- a/PWGEM/Dilepton/Core/Dilepton.h +++ b/PWGEM/Dilepton/Core/Dilepton.h @@ -45,7 +45,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" @@ -57,6 +56,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 +65,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; @@ -101,7 +102,8 @@ struct Dilepton { Configurable cfgAnalysisType{"cfgAnalysisType", static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC), "kQC:0, kUPC:1, kFlowV2:2, kFlowV3:3, kPolarization:4, kVM:5, kHFll:6"}; 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, NTPV:3"}; + 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 +117,7 @@ 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"}; 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"}; @@ -123,10 +125,13 @@ struct Dilepton { // ConfigurableAxis ConfMmumuBins{"ConfMmumuBins", {VARIABLE_WIDTH, 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, 4.10, 4.20, 4.30, 4.40, 4.50, 4.60, 4.70, 4.80, 4.90, 5.00, 5.10, 5.20, 5.30, 5.40, 5.50, 5.60, 5.70, 5.80, 5.90, 6.00, 6.10, 6.20, 6.30, 6.40, 6.50, 6.60, 6.70, 6.80, 6.90, 7.00, 7.10, 7.20, 7.30, 7.40, 7.50, 7.60, 7.70, 7.80, 7.90, 8.00, 8.10, 8.20, 8.30, 8.40, 8.50, 8.60, 8.70, 8.80, 8.90, 9.00, 9.10, 9.20, 9.30, 9.40, 9.50, 9.60, 9.70, 9.80, 9.90, 10.00, 10.10, 10.20, 10.30, 10.40, 10.50, 10.60, 10.70, 10.80, 10.90, 11.00, 11.50, 12.00}, "mmumu bins for output histograms"}; // for dimuon. one can copy bins here to hyperloop page. + ConfigurableAxis ConfSPBins{"ConfSPBins", {200, -5, 5}, "SP bins for flow analysis"}; + EMEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + 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"}; Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; @@ -134,9 +139,14 @@ 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"}; } eventcuts; DielectronCut fDielectronCut; @@ -152,23 +162,44 @@ struct Dilepton { 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_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; - Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + Configurable cfg_apply_phiv_meedep{"cfg_apply_phiv_meedep", true, "flag to apply mee-dependent 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_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_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.2, "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_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, "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"}; + 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_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_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + 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"}; + Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "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_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"}; @@ -183,9 +214,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)"}; @@ -202,14 +237,19 @@ struct Dilepton { Configurable cfg_max_pair_y{"cfg_max_pair_y", -2.5, "max pair rapidity"}; 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_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 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_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"}; + 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_mft{"cfg_min_ncluster_mft", 5, "min ncluster MFT"}; Configurable cfg_min_ncluster_mch{"cfg_min_ncluster_mch", 5, "min ncluster MCH"}; - Configurable cfg_max_chi2{"cfg_max_chi2", 1e+10, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2{"cfg_max_chi2", 1e+10, "max chi2"}; Configurable cfg_max_matching_chi2_mftmch{"cfg_max_matching_chi2_mftmch", 1e+10, "max chi2 for MFT-MCH matching"}; Configurable cfg_max_matching_chi2_mchmid{"cfg_max_matching_chi2_mchmid", 1e+10, "max chi2 for MCH-MID matching"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1e+10, "max dca XY for single track in cm"}; @@ -309,6 +349,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()); @@ -357,6 +398,7 @@ struct Dilepton { // fwdfitter.setTGeoMat(false); } + 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); if (doprocessTriggerAnalysis) { fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); @@ -438,17 +480,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; } @@ -463,8 +497,10 @@ 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)"; } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { mass_axis_title = "m_{#mu#mu} (GeV/c^{2})"; @@ -479,8 +515,11 @@ 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/hsDeltaP", "difference of p between 2 tracks;|p_{T,1} - p_{T,2}|/|p_{T,1} + p_{T,2}|;#Delta#eta;#Delta#varphi (rad.);", kTHnSparseD, {{20, 0, 1}, {100, -0.5, +0.5}, {100, -0.5, 0.5}}, 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/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, {{100, 0, 2.0}, {20, 0.0f, 3.2}}, true); } fRegistry.addClone("Pair/same/uls/", "Pair/same/lspp/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); @@ -501,37 +540,16 @@ struct Dilepton { nmod = 3; } - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca}, 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); + 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.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/"); - // std::string detname1 = qvec_det_names[cfgQvecEstimator]; - // std::string detname2 = ""; - // std::string detname3 = ""; - // if (detname1.find("FT0") != std::string::npos) { // for dielectrons - // detname2 = qvec_det_names[4]; - // detname3 = qvec_det_names[5]; - // subdet2 = 4; - // subdet3 = 5; - // } else if (detname1.find("B") != std::string::npos) { // for dimuon - // detname2 = qvec_det_names[1]; - // detname3 = qvec_det_names[2]; - // subdet2 = 1; - // subdet3 = 2; - // } - - // fRegistry.add("Pair/mix/ev1/hPrf_SP12_CentFT0C", Form("Q_{%d}^{%s} #upoint Q_{%d}^{%s};centrality FT0C (%%);Q_{%d}^{%s} #upoint Q_{%d}^{%s}", nmod, detname1.data(), nmod, detname2.data(), nmod, detname1.data(), nmod, detname2.data()), kTProfile, {{110, 0, 110}}, true); - // fRegistry.add("Pair/mix/ev1/hPrf_SP13_CentFT0C", Form("Q_{%d}^{%s} #upoint Q_{%d}^{%s};centrality FT0C (%%);Q_{%d}^{%s} #upoint Q_{%d}^{%s}", nmod, detname1.data(), nmod, detname3.data(), nmod, detname1.data(), nmod, detname3.data()), kTProfile, {{110, 0, 110}}, true); - // fRegistry.add("Pair/mix/ev1/hPrf_SP23_CentFT0C", Form("Q_{%d}^{%s} #upoint Q_{%d}^{%s};centrality FT0C (%%);Q_{%d}^{%s} #upoint Q_{%d}^{%s}", nmod, detname2.data(), nmod, detname3.data(), nmod, detname2.data(), nmod, detname3.data()), kTProfile, {{110, 0, 110}}, true); - // fRegistry.addClone("Pair/mix/ev1/", "Pair/mix/ev2/"); } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kPolarization)) { const AxisSpec axis_cos_theta_cs{10, 0.f, 1.f, "|cos(#theta_{CS})|"}; const AxisSpec axis_phi_cs{18, 0.f, M_PI, "|#varphi_{CS}| (rad.)"}; @@ -561,8 +579,9 @@ 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{18, 0, M_PI, "#Delta#varphi = #varphi_{e1} - #varphi_{e2} (rad.)"}; - fRegistry.add("Pair/same/uls/hs", "dilepton", kTHnSparseD, {axis_mass, axis_pt, axis_dca, axis_dphi_ee}, true); + 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/"); fRegistry.addClone("Pair/same/uls/", "Pair/same/lsmm/"); fRegistry.addClone("Pair/same/", "Pair/mix/"); @@ -590,17 +609,19 @@ struct Dilepton { fEMEventCut = EMEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); 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"); @@ -610,24 +631,35 @@ 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; }); + if (dielectroncuts.cfg_apply_phiv_meedep) { + fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + } else { + fDielectronCut.SetPhivPairRange(dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv, dielectroncuts.cfg_min_mee_for_phiv, dielectroncuts.cfg_max_mee_for_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); + 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.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(0, 16); - fDielectronCut.SetMaxDcaXY(dielectroncuts.cfg_max_dcaxy); - fDielectronCut.SetMaxDcaZ(dielectroncuts.cfg_max_dcaz); + 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); @@ -639,21 +671,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 } @@ -665,12 +706,14 @@ struct Dilepton { fDimuonCut.SetMassRange(dimuoncuts.cfg_min_mass, dimuoncuts.cfg_max_mass); fDimuonCut.SetPairPtRange(dimuoncuts.cfg_min_pair_pt, dimuoncuts.cfg_max_pair_pt); fDimuonCut.SetPairYRange(dimuoncuts.cfg_min_pair_y, dimuoncuts.cfg_max_pair_y); - fDimuonCut.SetPairDCAxyRange(dimuoncuts.cfg_min_pair_dcaxy, dimuoncuts.cfg_max_pair_dcaxy); // DCAxy in cm + fDimuonCut.SetPairDCAxyRange(dimuoncuts.cfg_min_pair_dcaxy, dimuoncuts.cfg_max_pair_dcaxy); + fDimuonCut.SetMindEtadPhi(dimuoncuts.cfg_apply_detadphi, dimuoncuts.cfg_min_deta, dimuoncuts.cfg_min_dphi); // for track fDimuonCut.SetTrackType(dimuoncuts.cfg_track_type); fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, 1e10f); 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); fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); @@ -749,11 +792,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; } } @@ -792,38 +835,46 @@ 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.); + 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); if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kQC)) { + float dpt = fabs(v1.Pt() - v2.Pt()) / fabs(v1.Pt() + v2.Pt()); + 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/hsDeltaP"), dpt, deta, dphi, 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); } } 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/hsDeltaP"), dpt, deta, dphi, 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); } } 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/hsDeltaP"), dpt, deta, dphi, 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); } } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kUPC)) { @@ -871,14 +922,14 @@ 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, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hPrfUQ"), v12.M(), v12.Pt(), pair_dca, sp, weight); + 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, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hPrfUQ"), v12.M(), v12.Pt(), pair_dca, sp, weight); + 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, weight); - fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hPrfUQ"), v12.M(), v12.Pt(), pair_dca, sp, weight); + 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 @@ -912,14 +963,15 @@ struct Dilepton { } } else if (cfgAnalysisType == static_cast(o2::aod::pwgem::dilepton::utils::pairutil::DileptonAnalysisType::kHFll)) { float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); + dphi = RecoDecay::constrainAngle(dphi, -o2::constants::math::PIHalf); + float deta = v1.Eta() - v2.Eta(); 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, abs(dphi), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("uls/hs"), v12.M(), v12.Pt(), pair_dca, dphi, deta, 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, abs(dphi), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lspp/hs"), v12.M(), v12.Pt(), pair_dca, dphi, deta, 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, abs(dphi), weight); + fRegistry.fill(HIST("Pair/") + HIST(event_pair_types[ev_id]) + HIST("lsmm/hs"), v12.M(), v12.Pt(), pair_dca, dphi, deta, weight); } } else { // same as kQC to avoid seg. fault @@ -1012,28 +1064,26 @@ 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; 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 && 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_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); Partition positive_electrons = o2::aod::emprimaryelectron::sign > int8_t(0); Partition negative_electrons = o2::aod::emprimaryelectron::sign < int8_t(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; + 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 ttcaFilter_muon = ifnode(dimuoncuts.enableTTCA.node(), o2::aod::emprimarymuon::isAssociatedToMPC == true || o2::aod::emprimarymuon::isAssociatedToMPC == false, o2::aod::emprimarymuon::isAssociatedToMPC == true); Partition positive_muons = o2::aod::emprimarymuon::sign > int8_t(0); Partition negative_muons = o2::aod::emprimarymuon::sign < int8_t(0); 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; @@ -1044,7 +1094,7 @@ struct Dilepton { { for (auto& collision : collisions) { initCCDB(collision); - const float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; float centrality = centralities[cfgCentEstimator]; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -1161,7 +1211,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) { @@ -1224,68 +1282,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); @@ -1296,81 +1293,16 @@ struct Dilepton { 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; } } @@ -1401,7 +1333,7 @@ struct Dilepton { for (auto& collision : collisions) { initCCDB(collision); - const float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -1430,7 +1362,6 @@ struct Dilepton { {{999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}}, // 1st harmonics {q2ft0m, q2ft0a, q2ft0c, q2btot, q2bpos, q2bneg}, // 2nd harmonics {q3ft0m, q3ft0a, q3ft0c, q3btot, q3bpos, q3bneg}, // 3rd harmonics - {{999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}, {999.f, 999.f}}, // 4th harmonics }; if (!fEMEventCut.IsSelected(collision)) { @@ -1536,6 +1467,51 @@ struct Dilepton { } PROCESS_SWITCH(Dilepton, processTriggerAnalysis, "run dilepton analysis on triggered data", false); + void processNorm(aod::EMEventNormInfos const& collisions) + { + for (auto& collision : collisions) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 1.0); + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 2.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 3.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 4.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 5.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 6.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 7.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 8.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 9.0); + } + if (collision.sel8()) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 10.0); + } + if (abs(collision.posZ()) < 10.0) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 11.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 12.0); + } + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted + } // end of collision loop + } + PROCESS_SWITCH(Dilepton, processNorm, "process normalization info", false); + void processDummy(MyCollisions const&) {} PROCESS_SWITCH(Dilepton, processDummy, "Dummy function", false); }; diff --git a/PWGEM/Dilepton/Core/DileptonMC.h b/PWGEM/Dilepton/Core/DileptonMC.h index 282c01bd363..56367531a73 100644 --- a/PWGEM/Dilepton/Core/DileptonMC.h +++ b/PWGEM/Dilepton/Core/DileptonMC.h @@ -36,7 +36,6 @@ #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 +50,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,6 +59,7 @@ 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; @@ -91,13 +92,14 @@ struct DileptonMC { Configurable d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"}; Configurable cfgEventGeneratorType{"cfgEventGeneratorType", -1, "if positive, select event generator type. i.e. gap or signal"}; - Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2, NTPV:3"}; + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; 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"}; @@ -108,7 +110,8 @@ struct DileptonMC { EMEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + 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"}; Configurable cfgRequireNoTFB{"cfgRequireNoTFB", false, "require No time frame border in event cut"}; @@ -116,9 +119,14 @@ 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"}; } eventcuts; DielectronCut fDielectronCut; @@ -132,26 +140,46 @@ 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_require_itsib_any{"cfg_require_itsib_any", false, "flag to require ITS ib any hits"}; - Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; + Configurable cfg_apply_phiv_meedep{"cfg_apply_phiv_meedep", true, "flag to apply mee-dependent 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_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_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.2, "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_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"}; 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"}; + 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_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_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + 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"}; + Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "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_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"}; @@ -166,9 +194,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)"}; @@ -185,14 +217,19 @@ struct DileptonMC { Configurable cfg_max_pair_y{"cfg_max_pair_y", -2.5, "max pair rapidity"}; 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_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 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_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"}; + Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "max phi for single track"}; + Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for single track"}; Configurable cfg_min_ncluster_mft{"cfg_min_ncluster_mft", 5, "min ncluster MFT"}; Configurable cfg_min_ncluster_mch{"cfg_min_ncluster_mch", 5, "min ncluster MCH"}; - Configurable cfg_max_chi2{"cfg_max_chi2", 1e+10, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2{"cfg_max_chi2", 1e+10, "max chi2"}; Configurable cfg_max_matching_chi2_mftmch{"cfg_max_matching_chi2_mftmch", 1e+10, "max chi2 for MFT-MCH matching"}; Configurable cfg_max_matching_chi2_mchmid{"cfg_max_matching_chi2_mchmid", 1e+10, "max chi2 for MCH-MID matching"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1e+10, "max dca XY for single track in cm"}; @@ -220,12 +257,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() { @@ -244,8 +276,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; @@ -268,15 +302,16 @@ 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{18, 0, M_PI, "#Delta#varphi = #varphi_{l1} - #varphi_{l2} (rad.)"}; // 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_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + 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); fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Eta/"); fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/EtaPrime/"); fRegistry.addClone("Generated/sm/Pi0/", "Generated/sm/Rho/"); @@ -291,7 +326,7 @@ struct DileptonMC { fRegistry.add("Generated/sm/Omega2ll/hPtY", "pT of #omega meson", kTH2F, {axis_y_meson, axis_pt_meson}, true); fRegistry.add("Generated/sm/Phi2ll/hPtY", "pT of #phi meson", kTH2F, {axis_y_meson, axis_pt_meson}, true); - fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee}, true); + fRegistry.add("Generated/ccbar/c2l_c2l/hadron_hadron/hs", "generated 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); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Generated/ccbar/c2l_c2l/hadron_hadron/", "Generated/ccbar/c2l_c2l/meson_baryon/"); @@ -301,7 +336,7 @@ struct DileptonMC { fRegistry.addClone("Generated/ccbar/c2l_c2l/", "Generated/bbbar/b2c2l_b2l_diffb/"); // LS // reconstructed pair info - fRegistry.add("Pair/sm/Photon/hs", "rec. dilepton signal", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/sm/Photon/hs", "rec. 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, axis_dca}, true); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Pi0/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/Eta/"); fRegistry.addClone("Pair/sm/Photon/", "Pair/sm/EtaPrime/"); @@ -314,12 +349,13 @@ 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, 0.5f}}, 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.5f}}, true); } - fRegistry.add("Pair/ccbar/c2l_c2l/hadron_hadron/hs", "hs pair", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, 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); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_meson/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/baryon_baryon/"); fRegistry.addClone("Pair/ccbar/c2l_c2l/hadron_hadron/", "Pair/ccbar/c2l_c2l/meson_baryon/"); @@ -329,11 +365,29 @@ struct DileptonMC { fRegistry.addClone("Pair/ccbar/c2l_c2l/", "Pair/bbbar/b2c2l_b2l_diffb/"); // LS // for correlated bkg due to mis-identified hadrons, and true combinatorial bkg - fRegistry.add("Pair/corr_bkg_eh/uls/hs", "rec. bkg", kTHnSparseD, {axis_mass, axis_pt, axis_y, axis_dphi_ee, axis_cos_theta_cs, axis_phi_cs, axis_aco, axis_asym_pt, axis_dphi_e_ee, axis_dca}, true); + fRegistry.add("Pair/corr_bkg_eh/uls/hs", "rec. bkg", 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); fRegistry.addClone("Pair/corr_bkg_eh/uls/", "Pair/corr_bkg_eh/lspp/"); 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 @@ -390,6 +444,7 @@ struct DileptonMC { // fwdfitter.setUseAbsDCA(true); // fwdfitter.setTGeoMat(false); } + fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); } template @@ -460,17 +515,19 @@ struct DileptonMC { fEMEventCut = EMEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); 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"); @@ -480,24 +537,35 @@ 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; }); + if (dielectroncuts.cfg_apply_phiv_meedep) { + fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + } else { + fDielectronCut.SetPhivPairRange(dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv, dielectroncuts.cfg_min_mee_for_phiv, dielectroncuts.cfg_max_mee_for_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); + 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.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); 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(0, 16); - fDielectronCut.SetMaxDcaXY(dielectroncuts.cfg_max_dcaxy); - fDielectronCut.SetMaxDcaZ(dielectroncuts.cfg_max_dcaz); + 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.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); @@ -508,23 +576,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 } @@ -537,11 +613,13 @@ struct DileptonMC { fDimuonCut.SetPairPtRange(dimuoncuts.cfg_min_pair_pt, dimuoncuts.cfg_max_pair_pt); fDimuonCut.SetPairYRange(dimuoncuts.cfg_min_pair_y, dimuoncuts.cfg_max_pair_y); fDimuonCut.SetPairDCAxyRange(dimuoncuts.cfg_min_pair_dcaxy, dimuoncuts.cfg_max_pair_dcaxy); // DCAxy in cm + fDimuonCut.SetMindEtadPhi(dimuoncuts.cfg_apply_detadphi, dimuoncuts.cfg_min_deta, dimuoncuts.cfg_min_dphi); // for track fDimuonCut.SetTrackType(dimuoncuts.cfg_track_type); fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, 1e10f); 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); fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); @@ -606,16 +684,16 @@ struct DileptonMC { } } - template + template bool fillTruePairInfo(TCollision const& collision, TTrack1 const& t1, TTrack2 const& t2, TCut const& cut, TMCParticles const& mcparticles) { 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; } } @@ -634,6 +712,79 @@ 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); + auto t1mc = mcparticles.iteratorAt(t1.emmcparticleId()); + auto t2mc = mcparticles.iteratorAt(t2.emmcparticleId()); + bool is_from_same_mcevent = t1mc.emmceventId() == t2mc.emmceventId(); + + if (!isInAcceptance(t1mc) || !isInAcceptance(t2mc)) { + return false; + } + 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; + + float deta_mc = v1mc.Eta() - v2mc.Eta(); + float dphi_mc = v1mc.Phi() - v2mc.Phi(); + o2::math_utils::bringToPMPi(dphi_mc); + + 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; + } + if (dielectroncuts.cfg_apply_detadphi && std::pow(deta_mc / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi_mc / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + 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; + } + if (dimuoncuts.cfg_apply_detadphi && std::pow(deta_mc / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi_mc / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + return false; + } + } + float weight = 1.f; if (cfgApplyWeightTTCA) { weight = map_weight[std::make_pair(t1.globalIndex(), t2.globalIndex())]; @@ -644,25 +795,23 @@ 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 aco = 1.f - abs(dphi) / M_PI; float asym = abs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -672,37 +821,33 @@ 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 if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/corr_bkg_hh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/corr_bkg_hh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/corr_bkg_hh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_hh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } } else { // eh correlated bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/corr_bkg_eh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_eh/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/corr_bkg_eh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_eh/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/corr_bkg_eh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/corr_bkg_eh/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } } } } else { // true combinatorial bkg if (t1.sign() * t2.sign() < 0) { // ULS - fRegistry.fill(HIST("Pair/comb_bkg/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/uls/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() > 0 && t2.sign() > 0) { // LS++ - fRegistry.fill(HIST("Pair/comb_bkg/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/lspp/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (t1.sign() < 0 && t2.sign() < 0) { // LS-- - fRegistry.fill(HIST("Pair/comb_bkg/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/comb_bkg/lsmm/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } } @@ -725,56 +870,55 @@ struct DileptonMC { if ((t1mc.isPhysicalPrimary() || t1mc.producedByGenerator()) && (t2mc.isPhysicalPrimary() || t2mc.producedByGenerator())) { switch (abs(mcmother.pdgCode())) { case 111: - fRegistry.fill(HIST("Pair/sm/Pi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Pi0/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/Pi0/hMvsPhiV"), phiv, v12.M()); } break; case 221: - fRegistry.fill(HIST("Pair/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); break; case 331: - fRegistry.fill(HIST("Pair/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); break; case 113: - fRegistry.fill(HIST("Pair/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); break; case 223: - fRegistry.fill(HIST("Pair/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Omega/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 (mcmother.daughtersIds().size() == 2) { // omeag->ee - fRegistry.fill(HIST("Pair/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; case 333: - fRegistry.fill(HIST("Pair/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Phi/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 (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Pair/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Pair/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; } 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), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + 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()); } @@ -791,46 +935,46 @@ struct DileptonMC { if (t1mc.pdgCode() * t2mc.pdgCode() < 0) { // ULS switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/hadron_hadron/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 (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/hadron_hadron/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 (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/hadron_hadron/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 (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/hadron_hadron/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 ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; } @@ -855,13 +999,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/hadron_hadron/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 ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } else { - fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); + fRegistry.fill(HIST("Pair/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee), pair_dca, weight); } break; } @@ -876,25 +1020,26 @@ 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 && 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; + 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 + template void runTruePairing(TCollisions const& collisions, TMCLeptons const& posTracks, TMCLeptons const& negTracks, TPreslice const& perCollision, TCut const& cut, TMCCollisions const&, TMCParticles const& mcparticles) { for (auto& collision : collisions) { initCCDB(collision); - float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -924,7 +1069,7 @@ struct DileptonMC { continue; } - fillTruePairInfo(collision, pos, neg, cut, mcparticles); + fillTruePairInfo(collision, pos, neg, cut, mcparticles); } // end of ULS pair loop for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { // LS++ @@ -938,7 +1083,7 @@ struct DileptonMC { if (cfgEventGeneratorType >= 0 && mccollision_from_pos2.getSubGeneratorId() != cfgEventGeneratorType) { continue; } - fillTruePairInfo(collision, pos1, pos2, cut, mcparticles); + fillTruePairInfo(collision, pos1, pos2, cut, mcparticles); } // end of LS++ pair loop for (auto& [neg1, neg2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { // LS-- @@ -952,12 +1097,11 @@ struct DileptonMC { if (cfgEventGeneratorType >= 0 && mccollision_from_neg2.getSubGeneratorId() != cfgEventGeneratorType) { continue; } - fillTruePairInfo(collision, neg1, neg2, cut, mcparticles); + fillTruePairInfo(collision, 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) @@ -965,13 +1109,22 @@ struct DileptonMC { // 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 + std::vector used_mccollisionIds; // used mc collisionIds + used_mccollisionIds.reserve(collisions.size()); + for (auto& collision : collisions) { - float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + 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;"); + continue; + } + used_mccollisionIds.emplace_back(mccollision.globalIndex()); + + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } - auto mccollision = collision.template emmcevent_as(); if (cfgEventGeneratorType >= 0 && mccollision.getSubGeneratorId() != cfgEventGeneratorType) { continue; } @@ -1053,18 +1206,26 @@ struct DileptonMC { ROOT::Math::PtEtaPhiMVector v2(pt2, eta2, phi2, leptonM2); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float deta = v1.Eta() - v2.Eta(); + float dphi = v1.Phi() - v2.Phi(); + o2::math_utils::bringToPMPi(dphi); + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } + if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + continue; + } } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { continue; } + if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + continue; + } } - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); float aco = 1.f - abs(dphi) / M_PI; float asym = abs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -1080,42 +1241,42 @@ struct DileptonMC { switch (abs(mcmother.pdgCode())) { case 111: - fRegistry.fill(HIST("Generated/sm/Pi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Pi0/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); break; case 221: - fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Eta/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); break; case 331: - fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/EtaPrime/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); break; case 113: - fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Rho/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); break; case 223: - fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // omega->ee - fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Omega2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; case 333: - fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if (mcmother.daughtersIds().size() == 2) { // phi->ee - fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/Phi2ll/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; case 443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptJPsi/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } case 100443: { if (IsFromBeauty(mcmother, mcparticles) > 0) { - fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/NonPromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/sm/PromptPsi2S/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } @@ -1128,46 +1289,46 @@ struct DileptonMC { auto mp2 = mcparticles.iteratorAt(t2.mothersIds()[0]); switch (hfee_type) { case static_cast(EM_HFeeType::kCe_Ce): { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/ccbar/c2l_c2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBe_Be): { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if (isBeautyMeson(mp1) && isBeautyMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else if (isBeautyBaryon(mp1) && isBeautyBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_BCe): { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2c2l/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if (isCharmMeson(mp1) && isCharmMeson(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else if (isCharmBaryon(mp1) && isCharmBaryon(mp2)) { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2l_b2l/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } case static_cast(EM_HFeeType::kBCe_Be_SameB): { // ULS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_sameb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } @@ -1245,6 +1406,26 @@ struct DileptonMC { ROOT::Math::PtEtaPhiMVector v2(pt2, eta2, phi2, leptonM2); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float deta = v1.Eta() - v2.Eta(); + float dphi = v1.Phi() - v2.Phi(); + o2::math_utils::bringToPMPi(dphi); + + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + continue; + } + if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + continue; + } + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + continue; + } + if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + continue; + } + } + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { continue; @@ -1255,8 +1436,6 @@ struct DileptonMC { } } - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); float aco = 1.f - abs(dphi) / M_PI; float asym = abs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -1283,13 +1462,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS++. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } @@ -1364,6 +1543,26 @@ struct DileptonMC { ROOT::Math::PtEtaPhiMVector v2(pt2, eta2, phi2, leptonM2); ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + float deta = v1.Eta() - v2.Eta(); + float dphi = v1.Phi() - v2.Phi(); + o2::math_utils::bringToPMPi(dphi); + + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { + if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { + continue; + } + if (dielectroncuts.cfg_apply_detadphi && std::pow(deta / dielectroncuts.cfg_min_deta, 2) + std::pow(dphi / dielectroncuts.cfg_min_dphi, 2) < 1.f) { + continue; + } + } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon) { + if (v12.Rapidity() < dimuoncuts.cfg_min_pair_y || dimuoncuts.cfg_max_pair_y < v12.Rapidity()) { + continue; + } + if (dimuoncuts.cfg_apply_detadphi && std::pow(deta / dimuoncuts.cfg_min_deta, 2) + std::pow(dphi / dimuoncuts.cfg_min_dphi, 2) < 1.f) { + continue; + } + } + if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron) { if (v12.Rapidity() < dielectroncuts.cfg_min_pair_y || dielectroncuts.cfg_max_pair_y < v12.Rapidity()) { continue; @@ -1374,8 +1573,6 @@ struct DileptonMC { } } - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); float aco = 1.f - abs(dphi) / M_PI; float asym = abs(v1.Pt() - v2.Pt()) / (v1.Pt() + v2.Pt()); float dphi_e_ee = v1.Phi() - v12.Phi(); @@ -1402,13 +1599,13 @@ struct DileptonMC { LOGF(info, "You should not see kBCe_Be_SameB in LS--. Good luck."); break; case static_cast(EM_HFeeType::kBCe_Be_DiffB): { // LS - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/hadron_hadron/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); if ((isCharmMeson(mp1) && isBeautyMeson(mp2)) || (isCharmMeson(mp2) && isBeautyMeson(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_meson/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else if ((isCharmBaryon(mp1) && isBeautyBaryon(mp2)) || (isCharmBaryon(mp2) && isBeautyBaryon(mp1))) { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/baryon_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } else { - fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); + fRegistry.fill(HIST("Generated/bbbar/b2c2l_b2l_diffb/meson_baryon/hs"), v12.M(), v12.Pt(), v12.Rapidity(), abs(dphi), deta, abs(cos_thetaCS), abs(phiCS), aco, asym, abs(dphi_e_ee)); } break; } @@ -1418,33 +1615,35 @@ 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; } } 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; } } @@ -1460,7 +1659,7 @@ struct DileptonMC { for (auto& collision : collisions) { initCCDB(collision); - const float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -1562,6 +1761,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 || t2.pt() < dielectroncuts.cfg_min_pt_track) { + 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 || t2.pt() < dimuoncuts.cfg_min_pt_track) { + 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 @@ -1580,14 +2118,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(); } @@ -1604,14 +2148,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(); } @@ -1621,7 +2171,7 @@ struct DileptonMC { { // for oemga, phi efficiency for (auto& collision : collisions) { - float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -1667,6 +2217,51 @@ struct DileptonMC { } PROCESS_SWITCH(DileptonMC, processGen_VM, "process generated info for vector mesons", false); + void processNorm(aod::EMEventNormInfos const& collisions) + { + for (auto& collision : collisions) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 1.0); + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 2.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 3.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 4.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 5.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 6.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 7.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 8.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 9.0); + } + if (collision.sel8()) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 10.0); + } + if (abs(collision.posZ()) < 10.0) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 11.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 12.0); + } + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted + } // end of collision loop + } + PROCESS_SWITCH(DileptonMC, processNorm, "process normalization info", false); + void processDummy(MyCollisions const&) {} PROCESS_SWITCH(DileptonMC, processDummy, "Dummy function", false); }; diff --git a/PWGEM/Dilepton/Core/DimuonCut.cxx b/PWGEM/Dilepton/Core/DimuonCut.cxx index 8f55e811dcb..ec101afa855 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.cxx +++ b/PWGEM/Dilepton/Core/DimuonCut.cxx @@ -42,6 +42,13 @@ void DimuonCut::SetPairDCAxyRange(float min, float max) mMaxPairDCAxy = max; LOG(info) << "Dimuon Cut, set pair 3d dca range: " << mMinPairDCAxy << " - " << mMaxPairDCAxy; } +void DimuonCut::SetMindEtadPhi(bool flag, float min_deta, float min_dphi) +{ + mApplydEtadPhi = flag; + mMinDeltaEta = min_deta; + mMinDeltaPhi = min_dphi; + LOG(info) << "Dimuon Cut, set apply deta-dphi cut: " << mApplydEtadPhi << " min_deta: " << mMinDeltaEta << " min_dphi: " << mMinDeltaPhi; +} void DimuonCut::SetTrackType(int track_type) { mTrackType = track_type; @@ -59,6 +66,12 @@ void DimuonCut::SetTrackEtaRange(float minEta, float maxEta) mMaxTrackEta = maxEta; LOG(info) << "Dimuon Cut, set track eta range: " << mMinTrackEta << " - " << mMaxTrackEta; } +void DimuonCut::SetTrackPhiRange(float minPhi, float maxPhi) +{ + mMinTrackPhi = minPhi; + mMaxTrackPhi = maxPhi; + LOG(info) << "Dimuon Cut, set track phi range (rad.): " << mMinTrackPhi << " - " << mMaxTrackPhi; +} void DimuonCut::SetChi2(float min, float max) { mMinChi2 = min; diff --git a/PWGEM/Dilepton/Core/DimuonCut.h b/PWGEM/Dilepton/Core/DimuonCut.h index 8af3161d670..b13569387da 100644 --- a/PWGEM/Dilepton/Core/DimuonCut.h +++ b/PWGEM/Dilepton/Core/DimuonCut.h @@ -24,6 +24,7 @@ #include "TNamed.h" #include "Math/Vector4D.h" +#include "MathUtils/Utils.h" #include "Framework/Logger.h" #include "Framework/DataTypes.h" #include "CommonConstants/PhysicsConstants.h" @@ -49,6 +50,7 @@ class DimuonCut : public TNamed kTrackType, kTrackPtRange, kTrackEtaRange, + kTrackPhiRange, kDCAxy, kMFTNCls, kMCHMIDNCls, @@ -77,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); @@ -92,30 +94,77 @@ class DimuonCut : public TNamed return false; } - if (v12.Pt() < mMinPairPt || mMaxPairPt < v12.Pt()) { + if (!dont_require_rapidity && (v12.Rapidity() < mMinPairY || mMaxPairY < v12.Rapidity())) { return false; } - if (v12.Rapidity() < mMinPairY || mMaxPairY < v12.Rapidity()) { + if (pair_dca_xy < mMinPairDCAxy || mMaxPairDCAxy < pair_dca_xy) { // in sigma for pair return false; } - if (pair_dca_xy < mMinPairDCAxy || mMaxPairDCAxy < pair_dca_xy) { // in sigma for pair + float deta = v1.Eta() - v2.Eta(); + float dphi = v1.Phi() - v2.Phi(); + o2::math_utils::bringToPMPi(dphi); + if (mApplydEtadPhi && std::pow(deta / mMinDeltaEta, 2) + std::pow(dphi / mMinDeltaPhi, 2) < 1.f) { return false; } + 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::kTrackEtaRange)) { + if (!IsSelectedTrack(track, DimuonCuts::kPDCA)) { + return false; + } + 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)) { return false; } if (!IsSelectedTrack(track, DimuonCuts::kDCAxy)) { @@ -159,6 +208,9 @@ class DimuonCut : public TNamed case DimuonCuts::kTrackEtaRange: return track.eta() > mMinTrackEta && track.eta() < mMaxTrackEta; + case DimuonCuts::kTrackPhiRange: + return track.phi() > mMinTrackPhi && track.phi() < mMaxTrackPhi; + case DimuonCuts::kDCAxy: return mMinDcaXY < std::sqrt(std::pow(track.fwdDcaX(), 2) + std::pow(track.fwdDcaY(), 2)) && std::sqrt(std::pow(track.fwdDcaX(), 2) + std::pow(track.fwdDcaY(), 2)) < mMaxDcaXY; @@ -193,10 +245,12 @@ class DimuonCut : public TNamed void SetPairPtRange(float minPt = 0.f, float maxPt = 1e10f); void SetPairYRange(float minY = -1e10f, float maxY = 1e10f); void SetPairDCAxyRange(float min = 0.f, float max = 1e10f); // DCAxy in cm + void SetMindEtadPhi(bool flag, float min_deta, float min_dphi); void SetTrackType(int track_type); // 0: MFT-MCH-MID (global muon), 3: MCH-MID (standalone muon) void SetTrackPtRange(float minPt = 0.f, float maxPt = 1e10f); void SetTrackEtaRange(float minEta = -1e10f, float maxEta = 1e10f); + void SetTrackPhiRange(float minPhi = 0.f, float maxPhi = 2.f * M_PI); void SetNClustersMFT(int min, int max); void SetNClustersMCHMID(int min, int max); void SetChi2(float min, float max); @@ -212,10 +266,14 @@ class DimuonCut : public TNamed float mMinPairPt{0.f}, mMaxPairPt{1e10f}; // range in pT float mMinPairY{-1e10f}, mMaxPairY{1e10f}; // range in rapidity float mMinPairDCAxy{0.f}, mMaxPairDCAxy{1e10f}; // range in 3D DCA in sigma + bool mApplydEtadPhi{false}; // flag to apply deta, dphi cut between 2 tracks + float mMinDeltaEta{0.f}; + float mMinDeltaPhi{0.f}; // kinematic cuts - float mMinTrackPt{0.f}, mMaxTrackPt{1e10f}; // range in pT - float mMinTrackEta{-1e10f}, mMaxTrackEta{1e10f}; // range in eta + float mMinTrackPt{0.f}, mMaxTrackPt{1e10f}; // range in pT + float mMinTrackEta{-1e10f}, mMaxTrackEta{1e10f}; // range in eta + float mMinTrackPhi{0.f}, mMaxTrackPhi{2.f * M_PI}; // range in phi // track quality cuts int mTrackType{3}; diff --git a/PWGEM/Dilepton/Core/EMEventCut.cxx b/PWGEM/Dilepton/Core/EMEventCut.cxx index 64fef030c21..a32edb39a55 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,20 @@ 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) { - mRequireNoCollInTimeRangeNarrow = flag; - LOG(info) << "EM Event Cut, require No collision in time range narrow: " << mRequireNoCollInTimeRangeNarrow; + mRequireNoCollInITSROFStrict = flag; + LOG(info) << "EM Event Cut, require No collision in ITS ROF strict: " << mRequireNoCollInITSROFStrict; } diff --git a/PWGEM/Dilepton/Core/EMEventCut.h b/PWGEM/Dilepton/Core/EMEventCut.h index b8af681d3dc..7287871bcc3 100644 --- a/PWGEM/Dilepton/Core/EMEventCut.h +++ b/PWGEM/Dilepton/Core/EMEventCut.h @@ -38,9 +38,10 @@ class EMEventCut : public TNamed kNoSameBunchPileup, kIsVertexITSTPC, kIsGoodZvtxFT0vsPV, - kOccupancy, kNoCollInTimeRangeStandard, - kNoCollInTimeRangeNarrow, + kNoCollInTimeRangeStrict, + kNoCollInITSROFStandard, + kNoCollInITSROFStrict, kNCuts }; @@ -71,13 +72,16 @@ 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 (mRequireNoCollInTimeRangeNarrow && !IsSelected(collision, EMEventCuts::kNoCollInTimeRangeNarrow)) { + if (mRequireNoCollInITSROFStrict && !IsSelected(collision, EMEventCuts::kNoCollInITSROFStrict)) { return false; } return true; @@ -111,14 +115,17 @@ 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); default: return true; @@ -129,27 +136,29 @@ 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); private: bool mRequireSel8{true}; 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 mRequireNoSameBunchPileup{false}; bool mRequireVertexITSTPC{false}; bool mRequireGoodZvtxFT0vsPV{false}; bool mRequireNoCollInTimeRangeStandard{false}; - bool mRequireNoCollInTimeRangeNarrow{false}; + bool mRequireNoCollInTimeRangeStrict{false}; + bool mRequireNoCollInITSROFStandard{false}; + bool mRequireNoCollInITSROFStrict{false}; ClassDef(EMEventCut, 1); }; diff --git a/PWGEM/Dilepton/Core/PhotonHBT.h b/PWGEM/Dilepton/Core/PhotonHBT.h index 7d8958d2372..e522388d969 100644 --- a/PWGEM/Dilepton/Core/PhotonHBT.h +++ b/PWGEM/Dilepton/Core/PhotonHBT.h @@ -25,6 +25,7 @@ #include #include #include +#include #include "TString.h" #include "Math/Vector4D.h" @@ -40,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" @@ -50,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 { @@ -95,7 +96,8 @@ 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, NTPV:3"}; + 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"}; @@ -118,7 +120,8 @@ struct PhotonHBT { EMEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + 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"}; Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; @@ -126,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; @@ -152,6 +160,7 @@ struct PhotonHBT { Configurable cfg_disable_itsonly_track{"cfg_disable_itsonly_track", false, "flag to disable ITSonly tracks"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 10, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "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_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; @@ -175,22 +184,33 @@ 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", 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"}; Configurable cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for single track"}; + Configurable cfg_max_dca3dsigma_track{"cfg_max_dca3dsigma_track", 1e+10, "max DCA 3D in sigma"}; 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", 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_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"}; @@ -206,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)"}; @@ -217,7 +240,8 @@ struct PhotonHBT { struct : ConfigurableGroup { std::string prefix = "ggpaircut_group"; - Configurable applydR{"applydR", false, "apply deta-dphi cut to avoid track splitting/merging"}; + Configurable applydRdZ{"applydRdZ", false, "apply dr-dz cut to avoid track splitting/merging only for kPCMPCM"}; + Configurable applydEtadPhi{"applydEtadPhi", false, "apply deta-dphi cut to avoid track splitting/merging"}; Configurable cfgMinDeltaEta{"cfgMinDeltaEta", 0.f, "min. delta-eta between 2 photons"}; Configurable cfgMinDeltaPhi{"cfgMinDeltaPhi", 0.f, "min. delta-phi between 2 photons"}; Configurable cfgMinDeltaR{"cfgMinDeltaR", 0.f, "min. delta-r between 2 photons"}; @@ -237,16 +261,15 @@ 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}; static constexpr std::string_view event_types[2] = {"before", "after"}; static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"}; + std::mt19937 engine; + std::uniform_int_distribution dist01; + o2::ccdb::CcdbApi ccdbApi; Service ccdb; int mRunNumber; @@ -310,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()); @@ -340,6 +364,10 @@ struct PhotonHBT { ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); + std::random_device seed_gen; + engine = std::mt19937(seed_gen()); + dist01 = std::uniform_int_distribution(0, 1); + fRegistry.add("Pair/mix/hDiffBC", "diff. global BC in mixed event;|BC_{current} - BC_{mixed}|", kTH1D, {{1001, -0.5, 1000.5}}, true); if (doprocessTriggerAnalysis) { fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); @@ -417,10 +445,9 @@ struct PhotonHBT { } } - if constexpr (pairtype == ggHBTPairType::kPCMPCM) { // dr, dz of conversion points - fRegistry.add("Pair/same/hDeltaRDeltaZ", "diphoton distance in RZ;#Deltar = #sqrt{(#Deltax)^{2} + (#Deltay)^{2}} (cm);#Deltaz (cm)", kTH2D, {{100, 0, +10}, {200, -10, 10}}, true); - } else { // deta, dphi of track momentum - fRegistry.add("Pair/same/hDeltaEtaDeltaPhi", "diphoton distance in #eta-#varphi plane;#Delta#varphi (rad.);#Delta#eta", kTH2D, {{200, -0.1, +0.1}, {200, -0.1, 0.1}}, true); + fRegistry.add("Pair/same/hDeltaEtaDeltaPhi", "distance between 2 LS tracks in #eta-#varphi plane;#Delta#varphi (rad.);#Delta#eta", kTH2D, {{80, -0.2, +0.2}, {80, -0.2, 0.2}}, true); // deta, dphi of track momentum + if constexpr (pairtype == ggHBTPairType::kPCMPCM) { // dr, dz of conversion points + fRegistry.add("Pair/same/hDeltaRDeltaZ", "diphoton distance in RZ;#Deltar = #sqrt{(#Deltax)^{2} + (#Deltay)^{2}} (cm);|#Deltaz| (cm)", kTH2D, {{40, 0, 20}, {40, 0, 20}}, true); } fRegistry.addClone("Pair/same/", "Pair/mix/"); @@ -431,14 +458,16 @@ struct PhotonHBT { fEMEventCut = EMEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); 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() @@ -460,6 +489,7 @@ struct PhotonHBT { fV0PhotonCut.SetMinNClustersTPC(pcmcuts.cfg_min_ncluster_tpc); fV0PhotonCut.SetMinNCrossedRowsTPC(pcmcuts.cfg_min_ncrossedrows); fV0PhotonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fV0PhotonCut.SetMaxFracSharedClustersTPC(pcmcuts.cfg_max_frac_shared_clusters_tpc); fV0PhotonCut.SetChi2PerClusterTPC(0.0, pcmcuts.cfg_max_chi2tpc); fV0PhotonCut.SetTPCNsigmaElRange(pcmcuts.cfg_min_TPCNsigmaEl, pcmcuts.cfg_max_TPCNsigmaEl); fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); @@ -496,7 +526,7 @@ struct PhotonHBT { } } - o2::ml::OnnxModel* eid_bdt = nullptr; + o2::analysis::MlResponseDielectronSingleTrack mlResponseSingleTrack; void DefineDileptonCut() { fDielectronCut = DielectronCut("fDielectronCut", "fDielectronCut"); @@ -505,7 +535,11 @@ 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); - fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + if (dielectroncuts.cfg_apply_phiv_meedep) { + fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + } else { + fDielectronCut.SetPhivPairRange(dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv, dielectroncuts.cfg_min_mee_for_phiv, dielectroncuts.cfg_max_mee_for_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); @@ -515,15 +549,19 @@ struct PhotonHBT { // for track fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); 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); 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_max_p_its_cluster_size); - fDielectronCut.SetMaxDcaXY(dielectroncuts.cfg_max_dcaxy); - fDielectronCut.SetMaxDcaZ(dielectroncuts.cfg_max_dcaz); + 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); @@ -536,41 +574,50 @@ 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 } template void fillPairHistogram(TCollision const&, const ROOT::Math::PtEtaPhiMVector v1, const ROOT::Math::PtEtaPhiMVector v2, const float weight = 1.f) { + float rndm = std::pow(-1, dist01(engine) % 2); // +1 or -1 to randomize order between 1 and 2. // Lab. frame - ROOT::Math::PtEtaPhiMVector q12 = v1 - v2; + ROOT::Math::PtEtaPhiMVector q12 = (v1 - v2) * rndm; ROOT::Math::PtEtaPhiMVector k12 = 0.5 * (v1 + v2); float qinv = -q12.M(); // for identical particles -> qinv = 2 x kstar float kt = k12.Pt(); - // ROOT::Math::XYZVector q_3d = q12.Vect(); // 3D q vector ROOT::Math::XYZVector uv_out(k12.Px() / k12.Pt(), k12.Py() / k12.Pt(), 0); // unit vector for out. i.e. parallel to kt ROOT::Math::XYZVector uv_long(0, 0, 1); // unit vector for long, beam axis ROOT::Math::XYZVector uv_side = uv_out.Cross(uv_long); // unit vector for side ROOT::Math::PxPyPzEVector v1_cartesian(v1); ROOT::Math::PxPyPzEVector v2_cartesian(v2); - ROOT::Math::PxPyPzEVector q12_cartesian = v1_cartesian - v2_cartesian; + ROOT::Math::PxPyPzEVector q12_cartesian = (v1_cartesian - v2_cartesian) * rndm; float beta = (v1 + v2).Beta(); float beta_x = beta * std::cos((v1 + v2).Phi()) * std::sin((v1 + v2).Theta()); float beta_y = beta * std::sin((v1 + v2).Phi()) * std::sin((v1 + v2).Theta()); @@ -592,7 +639,7 @@ struct PhotonHBT { ROOT::Math::Boost boostPRF = ROOT::Math::Boost(-beta_x, -beta_y, -beta_z); ROOT::Math::PxPyPzEVector v1_prf = boostPRF(v1_cartesian); ROOT::Math::PxPyPzEVector v2_prf = boostPRF(v2_cartesian); - ROOT::Math::PxPyPzEVector rel_k = v1_prf - v2_prf; + ROOT::Math::PxPyPzEVector rel_k = (v1_prf - v2_prf) * rndm; float kstar = 0.5 * rel_k.P(); // LOGF(info, "qabs_lcms = %f, qinv = %f, kstar = %f", qabs_lcms, qinv, kstar); @@ -627,7 +674,7 @@ struct PhotonHBT { for (auto& collision : collisions) { initCCDB(collision); int ndiphoton = 0; - const float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -675,7 +722,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) { @@ -708,10 +763,26 @@ struct PhotonHBT { float dz = g1.vz() - g2.vz(); float dr = std::sqrt(std::pow(g1.vx() - g2.vx(), 2) + std::pow(g1.vy() - g2.vy(), 2)); - if (ggpaircuts.applydR && std::pow(dz / ggpaircuts.cfgMinDeltaZ, 2) + std::pow(dr / ggpaircuts.cfgMinDeltaR, 2) < 1.f) { + if (ggpaircuts.applydRdZ && std::pow(dz / ggpaircuts.cfgMinDeltaZ, 2) + std::pow(dr / ggpaircuts.cfgMinDeltaR, 2) < 1.f) { + continue; + } + + float deta_pos = pos1.eta() - pos2.eta(); + float dphi_pos = pos1.phi() - pos2.phi(); + o2::math_utils::bringToPMPi(dphi_pos); + float deta_ele = ele1.eta() - ele2.eta(); + float dphi_ele = ele1.phi() - ele2.phi(); + o2::math_utils::bringToPMPi(dphi_ele); + if (ggpaircuts.applydEtadPhi && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + continue; + } + if (ggpaircuts.applydEtadPhi && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - fRegistry.fill(HIST("Pair/same/hDeltaRDeltaZ"), dr, dz, 1.f); + + fRegistry.fill(HIST("Pair/same/hDeltaRDeltaZ"), dr, fabs(dz), 1.f); + fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), pos1.phi() - pos2.phi(), pos1.eta() - pos2.eta(), 1.f); // distance between 2 LS tracks + fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), ele1.phi() - ele2.phi(), ele1.eta() - ele2.eta(), 1.f); // distance between 2 LS tracks fillPairHistogram<0>(collision, v1, v2, 1.f); ndiphoton++; @@ -721,12 +792,16 @@ struct PhotonHBT { if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { EMTrack g1tmp = EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); g1tmp.setConversionPointXYZ(g1.vx(), g1.vy(), g1.vz()); + g1tmp.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); + g1tmp.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); emh1->AddTrackToEventPool(key_df_collision, g1tmp); used_photonIds.emplace_back(pair_tmp_id1); } if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id2) == used_photonIds.end()) { EMTrack g2tmp = EMTrack(ndf, g2.globalIndex(), collision.globalIndex(), g2.globalIndex(), g2.pt(), g2.eta(), g2.phi(), 0); g2tmp.setConversionPointXYZ(g2.vx(), g2.vy(), g2.vz()); + g2tmp.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); + g2tmp.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); emh1->AddTrackToEventPool(key_df_collision, g2tmp); used_photonIds.emplace_back(pair_tmp_id2); } @@ -742,11 +817,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; } } @@ -770,11 +845,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; } } @@ -801,21 +876,21 @@ struct PhotonHBT { std::pair pair_tmp = std::make_pair(std::make_pair(pos1.trackId(), ele1.trackId()), std::make_pair(pos2.trackId(), ele2.trackId())); if (std::find(used_pairs_per_collision.begin(), used_pairs_per_collision.end(), pair_tmp) == used_pairs_per_collision.end()) { - float deta_pos = v_pos1.Eta() - v_pos2.Eta(); - float dphi_pos = v_pos1.Phi() - v_pos2.Phi(); + float deta_pos = pos1.eta() - pos2.eta(); + float dphi_pos = pos1.phi() - pos2.phi(); o2::math_utils::bringToPMPi(dphi_pos); - float deta_ele = v_ele1.Eta() - v_ele2.Eta(); - float dphi_ele = v_ele1.Phi() - v_ele2.Phi(); + float deta_ele = ele1.eta() - ele2.eta(); + float dphi_ele = ele1.phi() - ele2.phi(); o2::math_utils::bringToPMPi(dphi_ele); - if (ggpaircuts.applydR && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + if (ggpaircuts.applydEtadPhi && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - if (ggpaircuts.applydR && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + if (ggpaircuts.applydEtadPhi && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), v_pos1.Phi() - v_pos2.Phi(), v_pos1.Eta() - v_pos2.Eta(), weight1 * weight2); // distance between 2 LS tracks - fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), v_ele1.Phi() - v_ele2.Phi(), v_ele1.Eta() - v_ele2.Eta(), weight1 * weight2); // distance between 2 LS tracks + fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), dphi_pos, deta_pos, weight1 * weight2); // distance between 2 LS tracks + fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), dphi_ele, deta_ele, weight1 * weight2); // distance between 2 LS tracks fillPairHistogram<0>(collision, v1_ee, v2_ee, weight1 * weight2); ndiphoton++; used_pairs_per_collision.emplace_back(std::make_pair(pair_tmp.first, pair_tmp.second)); @@ -833,8 +908,8 @@ struct PhotonHBT { g1pair.setGlobalPosId(pos1.globalIndex()); g1pair.setGlobalNegId(ele1.globalIndex()); g1pair.setPairDca3DinSigmaOTF(dca1_3d); - g1pair.setPositiveLegPtEtaPhiM(v_pos1.Pt(), v_pos1.Eta(), v_pos1.Phi(), o2::constants::physics::MassElectron); - g1pair.setNegativeLegPtEtaPhiM(v_ele1.Pt(), v_ele1.Eta(), v_ele1.Phi(), o2::constants::physics::MassElectron); + g1pair.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); + g1pair.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); g1pair.setAmbPosLegSelfIds(possibleIds_pos1); g1pair.setAmbNegLegSelfIds(possibleIds_ele1); emh1->AddTrackToEventPool(key_df_collision, g1pair); @@ -850,8 +925,8 @@ struct PhotonHBT { g2pair.setGlobalPosId(pos2.globalIndex()); g2pair.setGlobalNegId(ele2.globalIndex()); g2pair.setPairDca3DinSigmaOTF(dca2_3d); - g2pair.setPositiveLegPtEtaPhiM(v_pos2.Pt(), v_pos2.Eta(), v_pos2.Phi(), o2::constants::physics::MassElectron); - g2pair.setNegativeLegPtEtaPhiM(v_ele2.Pt(), v_ele2.Eta(), v_ele2.Phi(), o2::constants::physics::MassElectron); + g2pair.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); + g2pair.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); g2pair.setAmbPosLegSelfIds(possibleIds_pos2); g2pair.setAmbNegLegSelfIds(possibleIds_ele2); emh1->AddTrackToEventPool(key_df_collision, g2pair); @@ -880,11 +955,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; } } @@ -909,25 +984,40 @@ struct PhotonHBT { ROOT::Math::PtEtaPhiMVector v_pos2(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v_ele2(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); ROOT::Math::PtEtaPhiMVector v2_ee = v_pos2 + v_ele2; - float deta = v1_gamma.Eta() - v2_ee.Eta(); - float dphi = v1_gamma.Phi() - v2_ee.Phi(); - o2::math_utils::bringToPMPi(dphi); - if (ggpaircuts.applydR && std::pow(deta / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + + float deta_pos = pos1.eta() - pos2.eta(); + float dphi_pos = pos1.phi() - pos2.phi(); + o2::math_utils::bringToPMPi(dphi_pos); + float deta_ele = ele1.eta() - ele2.eta(); + float dphi_ele = ele1.phi() - ele2.phi(); + o2::math_utils::bringToPMPi(dphi_ele); + if (ggpaircuts.applydEtadPhi && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), dphi, deta, weight); + if (ggpaircuts.applydEtadPhi && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + continue; + } + + fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), dphi_pos, deta_pos, weight); + fRegistry.fill(HIST("Pair/same/hDeltaEtaDeltaPhi"), dphi_ele, deta_ele, weight); fillPairHistogram<0>(collision, v1_gamma, v2_ee, weight); ndiphoton++; std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.globalIndex(), ele2.globalIndex()); if (std::find(used_photonIds.begin(), used_photonIds.end(), pair_tmp_id1) == used_photonIds.end()) { - emh1->AddTrackToEventPool(key_df_collision, EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0)); + EMTrack g1tmp = EMTrack(ndf, g1.globalIndex(), collision.globalIndex(), g1.globalIndex(), g1.pt(), g1.eta(), g1.phi(), 0); + g1tmp.setConversionPointXYZ(g1.vx(), g1.vy(), g1.vz()); + g1tmp.setPositiveLegPtEtaPhiM(pos1.pt(), pos1.eta(), pos1.phi(), o2::constants::physics::MassElectron); + g1tmp.setNegativeLegPtEtaPhiM(ele1.pt(), ele1.eta(), ele1.phi(), o2::constants::physics::MassElectron); + emh1->AddTrackToEventPool(key_df_collision, g1tmp); used_photonIds.emplace_back(pair_tmp_id1); } if (std::find(used_dileptonIds.begin(), used_dileptonIds.end(), tuple_tmp_id2) == used_dileptonIds.end()) { EMTrack g2pair = EMTrack(ndf, -1, collision.globalIndex(), -1, v2_ee.Pt(), v2_ee.Eta(), v2_ee.Phi(), v2_ee.M()); g2pair.setPairDca3DinSigmaOTF(dca2_3d); + g2pair.setPositiveLegPtEtaPhiM(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron); + g2pair.setNegativeLegPtEtaPhiM(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron); emh2->AddTrackToEventPool(key_df_collision, g2pair); used_dileptonIds.emplace_back(tuple_tmp_id2); } @@ -971,12 +1061,33 @@ struct PhotonHBT { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.); + auto pos1 = g1.getPositiveLeg(); + auto ele1 = g1.getNegativeLeg(); + auto pos2 = g2.getPositiveLeg(); + auto ele2 = g2.getNegativeLeg(); + float dz = g1.vz() - g2.vz(); float dr = std::sqrt(std::pow(g1.vx() - g2.vx(), 2) + std::pow(g1.vy() - g2.vy(), 2)); - if (ggpaircuts.applydR && std::pow(dz / ggpaircuts.cfgMinDeltaZ, 2) + std::pow(dr / ggpaircuts.cfgMinDeltaR, 2) < 1.f) { + if (ggpaircuts.applydRdZ && std::pow(dz / ggpaircuts.cfgMinDeltaZ, 2) + std::pow(dr / ggpaircuts.cfgMinDeltaR, 2) < 1.f) { continue; } - fRegistry.fill(HIST("Pair/mix/hDeltaRDeltaZ"), dr, dz, 1.f); + + float deta_pos = pos1.Eta() - pos2.Eta(); + float dphi_pos = pos1.Phi() - pos2.Phi(); + o2::math_utils::bringToPMPi(dphi_pos); + float deta_ele = ele1.Eta() - ele2.Eta(); + float dphi_ele = ele1.Phi() - ele2.Phi(); + o2::math_utils::bringToPMPi(dphi_ele); + if (ggpaircuts.applydEtadPhi && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + continue; + } + if (ggpaircuts.applydEtadPhi && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + continue; + } + + fRegistry.fill(HIST("Pair/mix/hDeltaRDeltaZ"), dr, fabs(dz), 1.f); + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_pos, deta_pos, 1.f); // distance between 2 LS tracks + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_ele, deta_ele, 1.f); // distance between 2 LS tracks fillPairHistogram<1>(collision, v1, v2, 1.f); } } @@ -1024,20 +1135,21 @@ struct PhotonHBT { ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), g1.mass()); ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); + float deta_pos = pos1.Eta() - pos2.Eta(); float dphi_pos = pos1.Phi() - pos2.Phi(); o2::math_utils::bringToPMPi(dphi_pos); float deta_ele = ele1.Eta() - ele2.Eta(); float dphi_ele = ele1.Phi() - ele2.Phi(); o2::math_utils::bringToPMPi(dphi_ele); - if (ggpaircuts.applydR && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + if (ggpaircuts.applydEtadPhi && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - if (ggpaircuts.applydR && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + if (ggpaircuts.applydEtadPhi && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), pos1.Phi() - pos2.Phi(), pos1.Eta() - pos2.Eta(), 1.f); - fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), ele1.Phi() - ele2.Phi(), ele1.Eta() - ele2.Eta(), 1.f); + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_pos, deta_pos, 1.f); // distance between 2 LS tracks + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_ele, deta_ele, 1.f); // distance between 2 LS tracks fillPairHistogram<1>(collision, v1, v2, 1.f); } } @@ -1064,13 +1176,27 @@ struct PhotonHBT { for (auto& g2 : photons2_from_event_pool) { // dielectron ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.0); // keep v1 for PCM ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), g2.mass()); - float deta = v1.Eta() - v2.Eta(); - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); - if (ggpaircuts.applydR && std::pow(deta / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + + auto pos1 = g1.getPositiveLeg(); + auto ele1 = g1.getNegativeLeg(); + auto pos2 = g2.getPositiveLeg(); + auto ele2 = g2.getNegativeLeg(); + + float deta_pos = pos1.Eta() - pos2.Eta(); + float dphi_pos = pos1.Phi() - pos2.Phi(); + o2::math_utils::bringToPMPi(dphi_pos); + float deta_ele = ele1.Eta() - ele2.Eta(); + float dphi_ele = ele1.Phi() - ele2.Phi(); + o2::math_utils::bringToPMPi(dphi_ele); + if (ggpaircuts.applydEtadPhi && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi, deta, 1.f); + if (ggpaircuts.applydEtadPhi && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + continue; + } + + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_pos, deta_pos, 1.f); // distance between 2 LS tracks + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_ele, deta_ele, 1.f); // distance between 2 LS tracks fillPairHistogram<1>(collision, v1, v2, 1.f); } } @@ -1097,13 +1223,27 @@ struct PhotonHBT { for (auto& g2 : photons1_from_event_pool) { // PCM ROOT::Math::PtEtaPhiMVector v1(g2.pt(), g2.eta(), g2.phi(), 0.0); // keep v1 for PCM ROOT::Math::PtEtaPhiMVector v2(g1.pt(), g1.eta(), g1.phi(), g1.mass()); - float deta = v1.Eta() - v2.Eta(); - float dphi = v1.Phi() - v2.Phi(); - o2::math_utils::bringToPMPi(dphi); - if (ggpaircuts.applydR && std::pow(deta / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + + auto pos1 = g1.getPositiveLeg(); + auto ele1 = g1.getNegativeLeg(); + auto pos2 = g2.getPositiveLeg(); + auto ele2 = g2.getNegativeLeg(); + + float deta_pos = pos1.Eta() - pos2.Eta(); + float dphi_pos = pos1.Phi() - pos2.Phi(); + o2::math_utils::bringToPMPi(dphi_pos); + float deta_ele = ele1.Eta() - ele2.Eta(); + float dphi_ele = ele1.Phi() - ele2.Phi(); + o2::math_utils::bringToPMPi(dphi_ele); + if (ggpaircuts.applydEtadPhi && std::pow(deta_pos / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_pos / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { + continue; + } + if (ggpaircuts.applydEtadPhi && std::pow(deta_ele / ggpaircuts.cfgMinDeltaEta, 2) + std::pow(dphi_ele / ggpaircuts.cfgMinDeltaPhi, 2) < 1.f) { continue; } - fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi, deta, 1.f); + + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_pos, deta_pos, 1.f); // distance between 2 LS tracks + fRegistry.fill(HIST("Pair/mix/hDeltaEtaDeltaPhi"), dphi_ele, deta_ele, 1.f); // distance between 2 LS tracks fillPairHistogram<1>(collision, v1, v2, 1.f); } } @@ -1127,7 +1267,7 @@ struct PhotonHBT { for (auto& collision : collisions) { initCCDB(collision); - const float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -1151,11 +1291,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; } } @@ -1208,7 +1348,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 47079887fff..477c11fa1b2 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; @@ -72,21 +72,23 @@ struct SingleTrackQC { // Configurables Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2, NTPV:3"}; + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; Configurable cfg_swt_name{"cfg_swt_name", "fHighTrackMult", "desired software trigger name"}; // 1 trigger name per 1 task. fHighTrackMult, fHighFt0Mult 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"}; EMEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + 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"}; Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; @@ -94,9 +96,14 @@ 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"}; } eventcuts; DielectronCut fDielectronCut; @@ -106,17 +113,27 @@ struct SingleTrackQC { 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"}; 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"}; + 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_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_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"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; - - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + 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_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"}; @@ -131,9 +148,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)"}; @@ -142,20 +163,16 @@ 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_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"}; + Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "max phi for single track"}; + Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for single track"}; Configurable cfg_min_ncluster_mft{"cfg_min_ncluster_mft", 5, "min ncluster MFT"}; Configurable cfg_min_ncluster_mch{"cfg_min_ncluster_mch", 5, "min ncluster MCH"}; - Configurable cfg_max_chi2{"cfg_max_chi2", 1e+10, "max chi2/NclsTPC"}; + Configurable cfg_max_chi2{"cfg_max_chi2", 1e+10, "max chi2"}; Configurable cfg_max_matching_chi2_mftmch{"cfg_max_matching_chi2_mftmch", 1e+10, "max chi2 for MFT-MCH matching"}; Configurable cfg_max_matching_chi2_mchmid{"cfg_max_matching_chi2_mchmid", 1e+10, "max chi2 for MCH-MID matching"}; Configurable cfg_max_dcaxy{"cfg_max_dcaxy", 1e+10, "max dca XY for single track in cm"}; @@ -170,12 +187,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() { @@ -187,10 +199,12 @@ 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{{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_axis_title}; + const AxisSpec axis_dca{ConfDCABins, dca_axis_title}; // track info fRegistry.add("Track/positive/hs", "rec. single electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca}, true); @@ -202,14 +216,19 @@ 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); 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.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/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {160, 0, 16}}, 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); @@ -225,7 +244,7 @@ struct SingleTrackQC { const AxisSpec axis_pt{ConfPtlBins, "p_{T,#mu} (GeV/c)"}; const AxisSpec axis_eta{25, -4.5, -2.0, "#eta_{#mu}"}; const AxisSpec axis_phi{36, 0.0, 2 * M_PI, "#varphi_{#mu} (rad.)"}; - const AxisSpec axis_dca{{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_{#mu}^{XY} (#sigma)"}; + const AxisSpec axis_dca{ConfDCABins, "DCA_{#mu}^{XY} (#sigma)"}; // track info fRegistry.add("Track/positive/hs", "rec. single muon", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_dca}, true); @@ -260,6 +279,7 @@ struct SingleTrackQC { addhistograms(); mRunNumber = 0; + fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); if (doprocessQC_TriggeredData) { fRegistry.add("Event/hNInspectedTVX", "N inspected TVX;run number;N_{TVX}", kTProfile, {{80000, 520000.5, 600000.5}}, true); } @@ -286,17 +306,19 @@ struct SingleTrackQC { fEMEventCut = EMEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); 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"); @@ -304,17 +326,21 @@ struct SingleTrackQC { // for track fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); 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(0, 16); - fDielectronCut.SetMaxDcaXY(dielectroncuts.cfg_max_dcaxy); - fDielectronCut.SetMaxDcaZ(dielectroncuts.cfg_max_dcaz); + 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.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); @@ -325,22 +351,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 } @@ -348,15 +383,11 @@ 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); 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); fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); @@ -376,8 +407,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) { @@ -392,13 +425,18 @@ struct SingleTrackQC { 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/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()); @@ -421,13 +459,18 @@ struct SingleTrackQC { 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/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()); @@ -487,7 +530,7 @@ struct SingleTrackQC { { for (auto& collision : collisions) { initCCDB(collision); - float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -510,11 +553,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; } } @@ -539,7 +582,7 @@ struct SingleTrackQC { passed_trackIds.reserve(tracks.size()); for (auto& collision : collisions) { initCCDB(collision); - float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -558,11 +601,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; } } @@ -610,17 +653,18 @@ struct SingleTrackQC { 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 && 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_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); 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; + 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 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; void processQC(FilteredMyCollisions const& collisions, Types const&... args) @@ -664,6 +708,51 @@ struct SingleTrackQC { } PROCESS_SWITCH(SingleTrackQC, processQC_TriggeredData, "run single track QC on triggered data", false); + void processNorm(aod::EMEventNormInfos const& collisions) + { + for (auto& collision : collisions) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 1.0); + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 2.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 3.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 4.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 5.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 6.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 7.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 8.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 9.0); + } + if (collision.sel8()) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 10.0); + } + if (abs(collision.posZ()) < 10.0) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 11.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 12.0); + } + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted + } // end of collision loop + } + PROCESS_SWITCH(SingleTrackQC, processNorm, "process normalization info", false); + void processDummy(MyCollisions const&) {} PROCESS_SWITCH(SingleTrackQC, processDummy, "Dummy function", false); }; diff --git a/PWGEM/Dilepton/Core/SingleTrackQCMC.h b/PWGEM/Dilepton/Core/SingleTrackQCMC.h index cd600cf7aed..694d6c5aa74 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,14 +83,16 @@ 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"}; EMEventCut fEMEventCut; struct : ConfigurableGroup { std::string prefix = "eventcut_group"; - Configurable cfgZvtxMax{"cfgZvtxMax", 10.f, "max. Zvtx"}; + Configurable cfgZvtxMin{"cfgZvtxMin", -10.f, "min. Zvtx"}; + 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"}; Configurable cfgRequireNoTFB{"cfgRequireNoTFB", true, "require No time frame border in event cut"}; @@ -98,9 +100,14 @@ 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"}; } eventcuts; DielectronCut fDielectronCut; @@ -109,17 +116,27 @@ struct SingleTrackQCMC { 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"}; 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"}; + 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_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_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"}; Configurable cfg_require_itsib_1st{"cfg_require_itsib_1st", true, "flag to require ITS ib 1st hit"}; - - Configurable cfg_pid_scheme{"cfg_pid_scheme", static_cast(DielectronCut::PIDSchemes::kTPChadrejORTOFreq), "pid scheme [kTOFreq : 0, kTPChadrej : 1, kTPChadrejORTOFreq : 2, kTPConly : 3]"}; + 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_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"}; @@ -134,9 +151,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)"}; @@ -149,6 +170,8 @@ struct SingleTrackQCMC { 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"}; + Configurable cfg_min_phi_track{"cfg_min_phi_track", 0.f, "max phi for single track"}; + Configurable cfg_max_phi_track{"cfg_max_phi_track", 6.3, "max phi for single track"}; Configurable cfg_min_ncluster_mft{"cfg_min_ncluster_mft", 5, "min ncluster MFT"}; Configurable cfg_min_ncluster_mch{"cfg_min_ncluster_mch", 5, "min ncluster MCH"}; Configurable cfg_max_chi2{"cfg_max_chi2", 1e+10, "max chi2"}; @@ -175,12 +198,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() { @@ -193,10 +211,12 @@ 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{{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_axis_title}; + const AxisSpec axis_dca{ConfDCABins, dca_axis_title}; // generated info fRegistry.add("Generated/lf/hs", "gen. single electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_charge_gen}, true); @@ -221,8 +241,11 @@ struct SingleTrackQCMC { fRegistry.add("Track/lf/positive/hChi2TPC", "chi2/number of TPC clusters", kTH1F, {{100, 0, 10}}, false); fRegistry.add("Track/lf/positive/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("Track/lf/positive/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); + 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); @@ -241,7 +264,9 @@ struct SingleTrackQCMC { if (cfgFillQA) { 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}, {160, 0, 16}}, 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); @@ -258,7 +283,7 @@ struct SingleTrackQCMC { const AxisSpec axis_pt{ConfPtlBins, "p_{T,#mu} (GeV/c)"}; const AxisSpec axis_eta{25, -4.5, -2.0, "#eta_{#mu}"}; const AxisSpec axis_phi{36, 0.0, 2 * M_PI, "#varphi_{#mu} (rad.)"}; - const AxisSpec axis_dca{{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_{#mu}^{XY} (#sigma)"}; + const AxisSpec axis_dca{ConfDCABins, "DCA_{#mu}^{XY} (#sigma)"}; const AxisSpec axis_charge_gen{3, -1.5, +1.5, "true charge"}; // generated info @@ -325,6 +350,7 @@ struct SingleTrackQCMC { pdg_lepton = 13; DefineDimuonCut(); } + fRegistry.addClone("Event/before/hCollisionCounter", "Event/norm/hCollisionCounter"); } void DefineEMEventCut() @@ -332,17 +358,19 @@ struct SingleTrackQCMC { fEMEventCut = EMEventCut("fEMEventCut", "fEMEventCut"); fEMEventCut.SetRequireSel8(eventcuts.cfgRequireSel8); fEMEventCut.SetRequireFT0AND(eventcuts.cfgRequireFT0AND); - fEMEventCut.SetZvtxRange(-eventcuts.cfgZvtxMax, +eventcuts.cfgZvtxMax); + fEMEventCut.SetZvtxRange(eventcuts.cfgZvtxMin, eventcuts.cfgZvtxMax); fEMEventCut.SetRequireNoTFB(eventcuts.cfgRequireNoTFB); fEMEventCut.SetRequireNoITSROFB(eventcuts.cfgRequireNoITSROFB); 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"); @@ -350,17 +378,21 @@ struct SingleTrackQCMC { // for track fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); 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(0, 16); - fDielectronCut.SetMaxDcaXY(dielectroncuts.cfg_max_dcaxy); - fDielectronCut.SetMaxDcaZ(dielectroncuts.cfg_max_dcaz); + 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.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); @@ -372,21 +404,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 } @@ -398,6 +439,7 @@ struct SingleTrackQCMC { fDimuonCut.SetTrackType(dimuoncuts.cfg_track_type); fDimuonCut.SetTrackPtRange(dimuoncuts.cfg_min_pt_track, 1e10f); 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); fDimuonCut.SetNClustersMCHMID(dimuoncuts.cfg_min_ncluster_mch, 16); fDimuonCut.SetChi2(0.f, dimuoncuts.cfg_max_chi2); @@ -455,8 +497,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; @@ -478,8 +522,11 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hNcrTPC"), track.tpcNClsCrossedRows()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("positive/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); + 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()); @@ -488,6 +535,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()); @@ -512,8 +561,11 @@ struct SingleTrackQCMC { fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hNcrTPC"), track.tpcNClsCrossedRows()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("Track/") + HIST(lepton_source_types[lepton_source_id]) + HIST("negative/hTPCNcls2Nf"), track.tpcFoundOverFindableCls()); + 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()); @@ -522,6 +574,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()); @@ -591,7 +645,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) { @@ -617,6 +671,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; @@ -628,11 +686,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; } } @@ -687,13 +745,22 @@ struct SingleTrackQCMC { // 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 + std::vector used_mccollisionIds; // used mc collisionIds + used_mccollisionIds.reserve(collisions.size()); + for (auto& collision : collisions) { - float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + 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;"); + continue; + } + used_mccollisionIds.emplace_back(mccollision.globalIndex()); + + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } - auto mccollision = collision.template emmcevent_as(); // LOGF(info, "mccollision.getGeneratorId() = %d", mccollision.getGeneratorId()); // LOGF(info, "mccollision.getSubGeneratorId() = %d", mccollision.getSubGeneratorId()); // LOGF(info, "mccollision.getSourceId() = %d", mccollision.getSourceId()); @@ -777,6 +844,8 @@ struct SingleTrackQCMC { } } // end of collision loop + used_mccollisionIds.clear(); + used_mccollisionIds.shrink_to_fit(); } std::unordered_map map_weight; // map of track global index -> weight @@ -786,7 +855,7 @@ struct SingleTrackQCMC { std::vector passed_trackIds; passed_trackIds.reserve(tracks.size()); for (auto& collision : collisions) { - float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -811,11 +880,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; } } @@ -869,17 +938,18 @@ 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 && 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; + 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- @@ -892,13 +962,13 @@ struct SingleTrackQCMC { 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(); @@ -914,19 +984,64 @@ 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(); } PROCESS_SWITCH(SingleTrackQCMC, processQCMC_Smeared, "run single track QC MC with smearing", false); + void processNorm(aod::EMEventNormInfos const& collisions) + { + for (auto& collision : collisions) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 1.0); + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 2.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 3.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 4.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 5.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 6.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 7.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 8.0); + } + if (collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 9.0); + } + if (collision.sel8()) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 10.0); + } + if (abs(collision.posZ()) < 10.0) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 11.0); + } + if (collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), 12.0); + } + if (!fEMEventCut.IsSelected(collision)) { + continue; + } + fRegistry.fill(HIST("Event/norm/hCollisionCounter"), o2::aod::pwgem::dilepton::utils::eventhistogram::nbin_ev); // accepted + } // end of collision loop + } + PROCESS_SWITCH(SingleTrackQCMC, processNorm, "process normalization info", false); + void processDummy(MyCollisions const&) {} PROCESS_SWITCH(SingleTrackQCMC, processDummy, "Dummy function", false); }; diff --git a/PWGEM/Dilepton/DataModel/dileptonTables.h b/PWGEM/Dilepton/DataModel/dileptonTables.h index 27b99a6e9b3..3add073e6bf 100644 --- a/PWGEM/Dilepton/DataModel/dileptonTables.h +++ b/PWGEM/Dilepton/DataModel/dileptonTables.h @@ -104,7 +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); +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(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; }); @@ -127,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 @@ -141,13 +151,12 @@ DECLARE_SOA_TABLE(EMEventsBz, "AOD", "EMEVENTBZ", emevent::Bz); // joinable to E using EMEventBz = EMEventsBz::iterator; DECLARE_SOA_TABLE(EMEventsMult, "AOD", "EMEVENTMULT", //! event multiplicity table, joinable to EMEvents - mult::MultFT0A, mult::MultFT0C, - mult::MultTPC, mult::MultNTracksPV, mult::MultNTracksPVeta1, mult::MultNTracksPVetaHalf, + mult::MultFT0A, mult::MultFT0C, mult::MultNTracksPV, mult::MultNTracksPVeta1, mult::MultNTracksPVetaHalf, mult::IsInelGt0, mult::IsInelGt1, mult::MultFT0M); using EMEventMult = EMEventsMult::iterator; DECLARE_SOA_TABLE(EMEventsCent, "AOD", "EMEVENTCENT", //! event centrality table, joinable to EMEvents - cent::CentFT0M, cent::CentFT0A, cent::CentFT0C, cent::CentNTPV); + cent::CentFT0M, cent::CentFT0A, cent::CentFT0C); using EMEventCent = EMEventsCent::iterator; DECLARE_SOA_TABLE(EMEventsQvec, "AOD", "EMEVENTQVEC", //! event q vector table, joinable to EMEvents @@ -198,6 +207,14 @@ DECLARE_SOA_TABLE(EMEvSels, "AOD", "EMEVSEL", //! joinable to aod::Collisions emevent::IsSelected); using EMEvSel = EMEvSels::iterator; +DECLARE_SOA_TABLE(EMEoIs, "AOD", "EMEOI", //! joinable to aod::Collisions in createEMEventDilepton.cxx + emevent::IsEoI); +using EMEoI = EMEoIs::iterator; + +DECLARE_SOA_TABLE(EMEventNormInfos, "AOD", "EMEVENTNORMINFO", //! event information for normalization + o2::soa::Index<>, evsel::Alias, evsel::Selection, emevent::PosZint16, emevent::PosZ, emevent::Sel8); +using EMEventNormInfo = EMEventNormInfos::iterator; + namespace emmcevent { DECLARE_SOA_COLUMN(McCollisionId, mcCollisionId, int); @@ -402,11 +419,11 @@ 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, - track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, + 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, @@ -418,6 +435,7 @@ DECLARE_SOA_TABLE(EMPrimaryElectrons, "AOD", "EMPRIMARYEL", //! 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, @@ -429,6 +447,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; 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 c643adad8f1..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 @@ -70,3 +60,8 @@ o2physics_add_dpl_workflow(event-selection PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(filter-eoi + SOURCES filterEoI.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx b/PWGEM/Dilepton/TableProducer/createEMEventDilepton.cxx index 603c97138ff..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" @@ -37,16 +39,16 @@ 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 = soa::Join; +using MyCollisions_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisions_Cent_Qvec = soa::Join; using MyCollisionsWithSWT = soa::Join; -using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. +using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsWithSWT_Cent_Qvec = soa::Join; using MyCollisionsMC = soa::Join; -using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. +using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsMC_Cent_Qvec = soa::Join; struct CreateEMEventDilepton { @@ -56,6 +58,7 @@ struct CreateEMEventDilepton { Produces event_cent; Produces event_qvec; Produces emswtbit; + Produces event_norm_info; enum class EMEventType : int { kEvent = 0, @@ -143,11 +146,14 @@ struct CreateEMEventDilepton { continue; } } + registry.fill(HIST("hEventCounter"), 1); auto bc = collision.template foundBC_as(); initCCDB(bc); - if (!collision.isSelected()) { + event_norm_info(collision.alias_raw(), collision.selection_raw(), static_cast(10.f * collision.posZ())); + + if (!collision.isSelected() || !collision.isEoI()) { continue; } @@ -159,30 +165,28 @@ struct CreateEMEventDilepton { } } - // LOGF(info, "collision.multNTracksPV() = %d, collision.multFT0A() = %f, collision.multFT0C() = %f", collision.multNTracksPV(), collision.multFT0A(), collision.multFT0C()); - - registry.fill(HIST("hEventCounter"), 1); + registry.fill(HIST("hEventCounter"), 2); 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()); - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multTPC(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); + event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); if constexpr (eventype == EMEventType::kEvent) { - event_cent(105.f, 105.f, 105.f, 105.f); + event_cent(105.f, 105.f, 105.f); event_qvec( 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); } else if constexpr (eventype == EMEventType::kEvent_Cent) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); + event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); event_qvec( 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); } else if constexpr (eventype == EMEventType::kEvent_Cent_Qvec) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); + event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); float q2xft0m = 999.f, q2yft0m = 999.f, q2xft0a = 999.f, q2yft0a = 999.f, q2xft0c = 999.f, q2yft0c = 999.f, q2xbpos = 999.f, q2ybpos = 999.f, q2xbneg = 999.f, q2ybneg = 999.f, q2xbtot = 999.f, q2ybtot = 999.f; float q3xft0m = 999.f, q3yft0m = 999.f, q3xft0a = 999.f, q3yft0a = 999.f, q3xft0c = 999.f, q3yft0c = 999.f, q3xbpos = 999.f, q3ybpos = 999.f, q3xbneg = 999.f, q3ybneg = 999.f, q3xbtot = 999.f, q3ybtot = 999.f; @@ -199,7 +203,7 @@ struct CreateEMEventDilepton { q2xft0m, q2yft0m, q2xft0a, q2yft0a, q2xft0c, q2yft0c, q2xbpos, q2ybpos, q2xbneg, q2ybneg, q2xbtot, q2ybtot, q3xft0m, q3yft0m, q3xft0a, q3yft0a, q3xft0c, q3yft0c, q3xbpos, q3ybpos, q3xbneg, q3ybneg, q3xbtot, q3ybtot); } else { - event_cent(105.f, 105.f, 105.f, 105.f); + event_cent(105.f, 105.f, 105.f); event_qvec( 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); 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 0bb64f01019..7e9155c04bc 100644 --- a/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx +++ b/PWGEM/Dilepton/TableProducer/filterDielectronEvent.cxx @@ -136,13 +136,17 @@ struct filterDielectronEvent { fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, 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/Nfindable;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/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {160, 0, 16}}, false); - fRegistry.add("Pair/before/hMvsPt", "m_{ee} vs. p_{T,ee};m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{100, 0, 0.1}, {100, 0, 1}}, false); + fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); + fRegistry.add("Pair/before/hMvsPt", "m_{ee} vs. p_{T,ee};m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)", kTH2F, {{100, 0, 0.1}, {200, 0, 2}}, false); fRegistry.add("Pair/before/hMvsPhiV", "mee vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})", kTH2F, {{90, 0, M_PI}, {100, 0, 0.1}}, false); fRegistry.addClone("Pair/before/", "Pair/after/"); + fRegistry.add("Pair/uls/hM", "m_{ee};m_{ee} (GeV/c^{2})", kTH1F, {{100, 0, 0.1}}, false); + fRegistry.add("Pair/lspp/hM", "m_{ee};m_{ee} (GeV/c^{2})", kTH1F, {{100, 0, 0.1}}, false); + fRegistry.add("Pair/lsmm/hM", "m_{ee};m_{ee} (GeV/c^{2})", kTH1F, {{100, 0, 0.1}}, false); } } @@ -307,11 +311,11 @@ struct filterDielectronEvent { emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), + 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.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( @@ -357,6 +361,7 @@ struct filterDielectronEvent { fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); 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/hChi2ITS"), track.itsChi2NCl()); fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); @@ -431,6 +436,7 @@ struct filterDielectronEvent { float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); if (fillQAHistogram) { + fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); } @@ -446,6 +452,36 @@ struct filterDielectronEvent { } // end of pairing loop + if (fillQAHistogram) { + for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { + if (!checkTrack(collision, pos1) || !checkTrack(collision, pos2)) { + continue; + } + if (!isElectron(pos1) || !isElectron(pos2)) { + 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; + fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); + } // end of pairing loop + + for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { + if (!checkTrack(collision, ele1) || !checkTrack(collision, ele2)) { + continue; + } + if (!isElectron(ele1) || !isElectron(ele2)) { + 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; + fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); + } // end of pairing loop + } + if (nee_uls < 1) { filter(nee_uls, 0, 0); continue; @@ -512,6 +548,7 @@ struct filterDielectronEvent { float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_pos[0], pVec_pos[1], pVec_pos[2], pVec_ele[0], pVec_ele[1], pVec_ele[2], pos.sign(), ele.sign(), d_bz); if (fillQAHistogram) { + fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); } @@ -528,6 +565,50 @@ struct filterDielectronEvent { } // end of negative track loop } // end of postive track loop + if (fillQAHistogram) { + for (auto& pos1 : posTracks_per_coll) { + for (auto& pos2 : posTracks_per_coll) { + if (pos1.globalIndex() == pos2.globalIndex()) { + continue; + } + + auto pos1_prop = propagateTrack(collision, pos1); + auto pos2_prop = propagateTrack(collision, pos2); + + std::array pVec_pos1 = {0, 0, 0}; // px, py, pz + getPxPyPz(pos1_prop, pVec_pos1); + std::array pVec_pos2 = {0, 0, 0}; // px, py, pz + getPxPyPz(pos2_prop, pVec_pos2); + + ROOT::Math::PtEtaPhiMVector v1(pos1_prop.getPt(), pos1_prop.getEta(), pos1_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(pos2_prop.getPt(), pos2_prop.getEta(), pos2_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); + } // end of positive track loop + } // end of postive track loop + + for (auto& ele1 : negTracks_per_coll) { + for (auto& ele2 : negTracks_per_coll) { + if (ele1.globalIndex() == ele2.globalIndex()) { + continue; + } + + auto ele1_prop = propagateTrack(collision, ele1); + auto ele2_prop = propagateTrack(collision, ele2); + + std::array pVec_ele1 = {0, 0, 0}; // px, py, pz + getPxPyPz(ele1_prop, pVec_ele1); + std::array pVec_ele2 = {0, 0, 0}; // px, py, pz + getPxPyPz(ele2_prop, pVec_ele2); + + ROOT::Math::PtEtaPhiMVector v1(ele1_prop.getPt(), ele1_prop.getEta(), ele1_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(ele2_prop.getPt(), ele2_prop.getEta(), ele2_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); + } // end of negative track loop + } // end of negative track loop + } + if (nee_uls < 1) { filter(nee_uls, 0, 0); continue; @@ -586,6 +667,7 @@ struct filterDielectronEvent { float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); if (fillQAHistogram) { + fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); } @@ -601,6 +683,36 @@ struct filterDielectronEvent { } // end of pairing loop + if (fillQAHistogram) { + for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { + if (!checkTrack(collision, pos1) || !checkTrack(collision, pos2)) { + continue; + } + if (!isElectron(pos1) || !isElectron(pos2)) { + 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; + fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); + } // end of pairing loop + + for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { + if (!checkTrack(collision, ele1) || !checkTrack(collision, ele2)) { + continue; + } + if (!isElectron(ele1) || !isElectron(ele2)) { + 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; + fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); + } // end of pairing loop + } + if (nee_uls < 1) { filter(nee_uls, 0, 0); continue; @@ -670,6 +782,7 @@ struct filterDielectronEvent { float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_pos[0], pVec_pos[1], pVec_pos[2], pVec_ele[0], pVec_ele[1], pVec_ele[2], pos.sign(), ele.sign(), d_bz); if (fillQAHistogram) { + fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); } @@ -686,6 +799,50 @@ struct filterDielectronEvent { } // end of negative track loop } // end of postive track loop + if (fillQAHistogram) { + for (auto& pos1 : posTracks_per_coll) { + for (auto& pos2 : posTracks_per_coll) { + if (pos1.globalIndex() == pos2.globalIndex()) { + continue; + } + + auto pos1_prop = propagateTrack(collision, pos1); + auto pos2_prop = propagateTrack(collision, pos2); + + std::array pVec_pos1 = {0, 0, 0}; // px, py, pz + getPxPyPz(pos1_prop, pVec_pos1); + std::array pVec_pos2 = {0, 0, 0}; // px, py, pz + getPxPyPz(pos2_prop, pVec_pos2); + + ROOT::Math::PtEtaPhiMVector v1(pos1_prop.getPt(), pos1_prop.getEta(), pos1_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(pos2_prop.getPt(), pos2_prop.getEta(), pos2_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); + } // end of positive track loop + } // end of postive track loop + + for (auto& ele1 : negTracks_per_coll) { + for (auto& ele2 : negTracks_per_coll) { + if (ele1.globalIndex() == ele2.globalIndex()) { + continue; + } + + auto ele1_prop = propagateTrack(collision, ele1); + auto ele2_prop = propagateTrack(collision, ele2); + + std::array pVec_ele1 = {0, 0, 0}; // px, py, pz + getPxPyPz(ele1_prop, pVec_ele1); + std::array pVec_ele2 = {0, 0, 0}; // px, py, pz + getPxPyPz(ele2_prop, pVec_ele2); + + ROOT::Math::PtEtaPhiMVector v1(ele1_prop.getPt(), ele1_prop.getEta(), ele1_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(ele2_prop.getPt(), ele2_prop.getEta(), ele2_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); + } // end of negative track loop + } // end of negative track loop + } + if (nee_uls < 1) { filter(nee_uls, 0, 0); continue; @@ -745,6 +902,7 @@ struct filterDielectronEvent { ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), ele.px(), ele.py(), ele.pz(), pos.sign(), ele.sign(), d_bz); if (fillQAHistogram) { + fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); } @@ -760,6 +918,36 @@ struct filterDielectronEvent { } // end of pairing loop + if (fillQAHistogram) { + for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_per_coll, posTracks_per_coll))) { + if (!checkTrack(collision, pos1) || !checkTrack(collision, pos2)) { + continue; + } + if (!isElectron(pos1) || !isElectron(pos2)) { + 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; + fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); + } // end of pairing loop + + for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_per_coll, negTracks_per_coll))) { + if (!checkTrack(collision, ele1) || !checkTrack(collision, ele2)) { + continue; + } + if (!isElectron(ele1) || !isElectron(ele2)) { + 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; + fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); + } // end of pairing loop + } + if (nee_uls < 1) { filter(nee_uls, 0, 0); continue; @@ -824,6 +1012,7 @@ struct filterDielectronEvent { ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pVec_pos[0], pVec_pos[1], pVec_pos[2], pVec_ele[0], pVec_ele[1], pVec_ele[2], pos.sign(), ele.sign(), d_bz); if (fillQAHistogram) { + fRegistry.fill(HIST("Pair/uls/hM"), v12.M()); fRegistry.fill(HIST("Pair/before/hMvsPt"), v12.M(), v12.Pt()); fRegistry.fill(HIST("Pair/before/hMvsPhiV"), phiv, v12.M()); } @@ -840,6 +1029,50 @@ struct filterDielectronEvent { } // end of negative track loop } // end of postive track loop + if (fillQAHistogram) { + for (auto& pos1 : posTracks_per_coll) { + for (auto& pos2 : posTracks_per_coll) { + if (pos1.globalIndex() == pos2.globalIndex()) { + continue; + } + + auto pos1_prop = propagateTrack(collision, pos1); + auto pos2_prop = propagateTrack(collision, pos2); + + std::array pVec_pos1 = {0, 0, 0}; // px, py, pz + getPxPyPz(pos1_prop, pVec_pos1); + std::array pVec_pos2 = {0, 0, 0}; // px, py, pz + getPxPyPz(pos2_prop, pVec_pos2); + + ROOT::Math::PtEtaPhiMVector v1(pos1_prop.getPt(), pos1_prop.getEta(), pos1_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(pos2_prop.getPt(), pos2_prop.getEta(), pos2_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + fRegistry.fill(HIST("Pair/lspp/hM"), v12.M()); + } // end of positive track loop + } // end of postive track loop + + for (auto& ele1 : negTracks_per_coll) { + for (auto& ele2 : negTracks_per_coll) { + if (ele1.globalIndex() == ele2.globalIndex()) { + continue; + } + + auto ele1_prop = propagateTrack(collision, ele1); + auto ele2_prop = propagateTrack(collision, ele2); + + std::array pVec_ele1 = {0, 0, 0}; // px, py, pz + getPxPyPz(ele1_prop, pVec_ele1); + std::array pVec_ele2 = {0, 0, 0}; // px, py, pz + getPxPyPz(ele2_prop, pVec_ele2); + + ROOT::Math::PtEtaPhiMVector v1(ele1_prop.getPt(), ele1_prop.getEta(), ele1_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(ele2_prop.getPt(), ele2_prop.getEta(), ele2_prop.getPhi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + fRegistry.fill(HIST("Pair/lsmm/hM"), v12.M()); + } // end of negative track loop + } // end of negative track loop + } + if (nee_uls < 1) { filter(nee_uls, 0, 0); continue; @@ -898,15 +1131,15 @@ struct createEMEvent2VP { using MyQvectors = soa::Join; using MyCollisions = soa::Join; - using MyCollisions_Cent = soa::Join; // centrality table has dependency on multiplicity table. + using MyCollisions_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisions_Cent_Qvec = soa::Join; using MyCollisionsWithSWT = soa::Join; - using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. + using MyCollisionsWithSWT_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsWithSWT_Cent_Qvec = soa::Join; using MyCollisionsMC = soa::Join; - using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. + using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsMC_Cent_Qvec = soa::Join; Produces event; @@ -981,24 +1214,24 @@ 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()); - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multTPC(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); + event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); if constexpr (eventype == EMEventType::kEvent) { - event_cent(105.f, 105.f, 105.f, 105.f); + event_cent(105.f, 105.f, 105.f); event_qvec( 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); } else if constexpr (eventype == EMEventType::kEvent_Cent) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); + event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); event_qvec( 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); } else if constexpr (eventype == EMEventType::kEvent_Cent_Qvec) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); + event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); float q2xft0m = 999.f, q2yft0m = 999.f, q2xft0a = 999.f, q2yft0a = 999.f, q2xft0c = 999.f, q2yft0c = 999.f, q2xbpos = 999.f, q2ybpos = 999.f, q2xbneg = 999.f, q2ybneg = 999.f, q2xbtot = 999.f, q2ybtot = 999.f; float q3xft0m = 999.f, q3yft0m = 999.f, q3xft0a = 999.f, q3yft0a = 999.f, q3xft0c = 999.f, q3yft0c = 999.f, q3xbpos = 999.f, q3ybpos = 999.f, q3xbneg = 999.f, q3ybneg = 999.f, q3xbtot = 999.f, q3ybtot = 999.f; @@ -1015,7 +1248,7 @@ struct createEMEvent2VP { q2xft0m, q2yft0m, q2xft0a, q2yft0a, q2xft0c, q2yft0c, q2xbpos, q2ybpos, q2xbneg, q2ybneg, q2xbtot, q2ybtot, q3xft0m, q3yft0m, q3xft0a, q3yft0a, q3xft0c, q3yft0c, q3xbpos, q3ybpos, q3xbneg, q3ybneg, q3xbtot, q3ybtot); } else { - event_cent(105.f, 105.f, 105.f, 105.f); + event_cent(105.f, 105.f, 105.f); event_qvec( 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f, 999.f); diff --git a/PWGEM/Dilepton/TableProducer/filterEoI.cxx b/PWGEM/Dilepton/TableProducer/filterEoI.cxx new file mode 100644 index 00000000000..ca7b524e19d --- /dev/null +++ b/PWGEM/Dilepton/TableProducer/filterEoI.cxx @@ -0,0 +1,119 @@ +// 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 filters events that are interesting for dilepton analyses. +// Please write to: daiki.sekihata@cern.ch + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; + +struct filterEoI { + enum SubSystem { + kElectron = 0x1, + kFwdMuon = 0x2, + }; + Produces emeoi; + + HistogramRegistry fRegistry{"output"}; + void init(o2::framework::InitContext&) + { + auto hEventCounter = fRegistry.add("hEventCounter", "hEventCounter", kTH1D, {{5, 0.5f, 5.5f}}); + hEventCounter->GetXaxis()->SetBinLabel(1, "all"); + hEventCounter->GetXaxis()->SetBinLabel(2, "event with electron"); + hEventCounter->GetXaxis()->SetBinLabel(3, "event with forward muon"); + hEventCounter->GetXaxis()->SetBinLabel(4, "event with electron or forward muon"); + hEventCounter->GetXaxis()->SetBinLabel(5, "event with electron and forward muon"); + } + + SliceCache cache; + Preslice perCollision_el = aod::emprimaryelectron::collisionId; + Preslice perCollision_mu = aod::emprimarymuon::collisionId; + + template + void selectEoI(TCollisions const& collisions, TElectrons const& electrons, TMuons const& muons) + { + for (auto& collision : collisions) { + bool does_electron_exist = false; + bool does_fwdmuon_exist = false; + fRegistry.fill(HIST("hEventCounter"), 1); + + if constexpr (static_cast(system & kElectron)) { + auto electrons_coll = electrons.sliceBy(perCollision_el, collision.globalIndex()); + if (electrons_coll.size() > 0) { + does_electron_exist = true; + fRegistry.fill(HIST("hEventCounter"), 2); + } + } + if constexpr (static_cast(system & kFwdMuon)) { + auto muons_coll = muons.sliceBy(perCollision_mu, collision.globalIndex()); + if (muons_coll.size() > 0) { + does_fwdmuon_exist = true; + fRegistry.fill(HIST("hEventCounter"), 3); + } + } + + if (does_electron_exist || does_fwdmuon_exist) { + fRegistry.fill(HIST("hEventCounter"), 4); + } + if (does_electron_exist && does_fwdmuon_exist) { + fRegistry.fill(HIST("hEventCounter"), 5); + } + + emeoi(does_electron_exist || does_fwdmuon_exist); + + } // end of collision loop + + } // end of selectEoI + + void process_Electron(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons) + { + const uint8_t sysflag = kElectron; + selectEoI(collisions, electrons, nullptr); + } + + void process_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryMuons const& muons) + { + const uint8_t sysflag = kFwdMuon; + selectEoI(collisions, nullptr, muons); + } + + void process_Electron_FwdMuon(aod::Collisions const& collisions, aod::EMPrimaryElectrons const& electrons, aod::EMPrimaryMuons const& muons) + { + const uint8_t sysflag = kElectron | kFwdMuon; + selectEoI(collisions, electrons, muons); + } + + void processDummy(aod::Collisions const& collisions) + { + for (int i = 0; i < collisions.size(); i++) { + emeoi(true); + } + } + + PROCESS_SWITCH(filterEoI, process_Electron, "create filter bit for Electron", false); + PROCESS_SWITCH(filterEoI, process_FwdMuon, "create filter bit for Forward Muon", false); + PROCESS_SWITCH(filterEoI, process_Electron_FwdMuon, "create filter bit for Electron, FwdMuon", false); + PROCESS_SWITCH(filterEoI, processDummy, "processDummy", true); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"filter-eoi"})}; +} diff --git a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx index 4c3d50f2356..e132db33c06 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerPrimaryElectron.cxx @@ -65,6 +65,7 @@ struct skimmerPrimaryElectron { 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 max_mean_its_cluster_size{"max_mean_its_cluster_size", 16.f, "max. x cos(lambda)"}; // this is to suppress random combination. default 4 + 1 for skimming. + Configurable max_p_for_its_cluster_size{"max_p_for_its_cluster_size", 0.0, "its cluster size cut is applied below this p"}; 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"}; @@ -114,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); @@ -128,10 +130,11 @@ struct skimmerPrimaryElectron { fRegistry.add("Track/hTOFNsigmaPr", "TOF n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, 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/hMeanClusterSizeITS", "mean cluster size ITS; on ITS #times cos(#lambda)", kTH1F, {{32, 0, 16}}, false); + fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda)", kTH2F, {{1000, 0, 10}, {150, 0, 15}}, false); } } @@ -218,7 +221,7 @@ struct skimmerPrimaryElectron { } total_cluster_size += cluster_size_per_layer; } - if (static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl())) > max_mean_its_cluster_size) { + if (static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl())) > max_mean_its_cluster_size && track.p() < max_p_for_its_cluster_size) { return false; } @@ -327,11 +330,11 @@ struct skimmerPrimaryElectron { emprimaryelectrons(collision.globalIndex(), track.globalIndex(), track.sign(), pt_recalc, eta_recalc, phi_recalc, dcaXY, dcaZ, - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), + 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.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( @@ -356,7 +359,7 @@ struct skimmerPrimaryElectron { if (fillQAHistogram) { uint32_t itsClusterSizes = track.itsClusterSizes(); int total_cluster_size = 0, nl = 0; - for (unsigned int layer = 3; layer < 7; layer++) { + for (unsigned int layer = 0; layer < 7; layer++) { int cluster_size_per_layer = (itsClusterSizes >> (layer * 4)) & 0xf; if (cluster_size_per_layer > 0) { nl++; @@ -376,10 +379,12 @@ struct skimmerPrimaryElectron { fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); 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/hChi2ITS"), track.itsChi2NCl()); + fRegistry.fill(HIST("Track/hChi2TOF"), track.tofChi2()); fRegistry.fill(HIST("Track/hITSClusterMap"), track.itsClusterMap()); - fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), static_cast(total_cluster_size) / static_cast(nl) * std::cos(std::atan(track.tgl()))); + 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()); fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); diff --git a/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx b/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx index 889dcfa2dcf..1790c89c052 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerSecondaryElectron.cxx @@ -35,7 +35,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollisionsMC = soa::Join; using MyTracks = soa::Join +#include +#include #include #include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" @@ -37,6 +40,7 @@ #include "CCDB/BasicCCDBManager.h" #include "PWGEM/Dilepton/Utils/MCUtilities.h" #include "PWGEM/Dilepton/Utils/PairUtilities.h" +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" using namespace o2; using namespace o2::framework; @@ -64,10 +68,9 @@ 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::Sel8, mycollision::Bz, - mccollision::GeneratorsID, mycollision::MCPosX, mycollision::MCPosY, mycollision::MCPosZ, - mult::MultTPC, mult::MultFV0A, mult::MultFV0C, mult::MultFT0A, mult::MultFT0C, - mult::MultFDDA, mult::MultFDDC, mult::MultZNA, mult::MultZNC, mult::MultTracklets, mult::MultNTracksPV, mult::MultNTracksPVeta1); + o2::soa::Index<>, bc::GlobalBC, bc::RunNumber, collision::PosX, collision::PosY, collision::PosZ, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::Sel8, mycollision::Bz, + mccollision::GeneratorsID, mycollision::MCPosX, mycollision::MCPosY, mycollision::MCPosZ, mult::MultNTracksPV, + cent::CentFT0M, cent::CentFT0A, cent::CentFT0C); using MyCollision = MyCollisions::iterator; namespace mytrack @@ -89,14 +92,13 @@ DECLARE_SOA_COLUMN(MotherPdgCodes, motherpdgCodes, std::vector); //! eta va // reconstructed track information DECLARE_SOA_TABLE(MyTracks, "AOD", "MYTRACK", //! o2::soa::Index<>, mytrack::MyCollisionId, mytrack::Sign, - track::Pt, track::Eta, track::Phi, + track::Pt, track::Eta, track::Phi, track::Tgl, track::DcaXY, track::DcaZ, mytrack::DCAresXY, mytrack::DCAresZ, track::CZY, track::TPCNClsFindable, mytrack::TPCNClsFound, mytrack::TPCNClsCrossedRows, 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::TOFChi2, track::ITSChi2NCl, track::ITSClusterSizes, - track::TRDSignal, track::TRDPattern, mytrack::MCVx, mytrack::MCVy, mytrack::MCVz, mcparticle::PdgCode, mytrack::IsPhysicalPrimary, mytrack::MotherIds, mytrack::MotherPdgCodes); @@ -132,7 +134,7 @@ DECLARE_SOA_TABLE(MyPairs, "AOD", "MYPAIR", //! mypair::Mass, mypair::Pt, mypair::Eta, mypair::Phi, mypair::PhiV, mypair::PairDCAxy, mypair::PairDCAz, mypair::CosOpAng, mypair::CosPA, mypair::Lxy, mypair::Chi2PCA, mypair::IsSM, mypair::IsHF, mypair::PairType, mypair::IsPrompt, - mcparticle::PdgCode, mcparticle::StatusCode, mcparticle::Flags, + mcparticle::PdgCode, mcparticle::Flags, mcparticle::Vx, mcparticle::Vy, mcparticle::Vz, // dynamic column @@ -163,7 +165,7 @@ struct TreeCreatorElectronML { HistogramRegistry registry{ "registry", { - {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{5, 0.5f, 5.5f}}}}, + {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{2, 0.f, 2.f}}}}, }, }; @@ -180,6 +182,10 @@ struct TreeCreatorElectronML { Configurable d_UseWeightedPCA{"d_UseWeightedPCA", false, "Vertices use cov matrices"}; Configurable useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"}; + // collision + Configurable maxVtxZ{"maxVtxZ", 10.0, "max VtxZ [cm]"}; + Configurable maxOccupancy{"maxOccupancy", 999999, "max occupancy"}; + // track Configurable mincrossedrows{"mincrossedrows", 70, "min. crossed rows"}; Configurable mintpcclusters{"mintpcclusters", 90, "min. tpc clusters"}; @@ -198,6 +204,10 @@ struct TreeCreatorElectronML { Configurable downSampleMu{"downSampleMu", 1.0, "down scaling factor for muons"}; Configurable downSampleNucl{"downSampleNucl", 1.0, "down scaling factor for nuclei"}; + // pid + Configurable maxNSigmaElTPC{"maxNSigmaElTPC", 999, "max nsigma_el for TPC"}; + Configurable maxNSigmaElTOF{"maxNSigmaElTOF", 999, "max nsgima_el for TOF (if available)"}; + // pair Configurable minPairPt{"minPairPt", 0.2, "min. pT,ee"}; Configurable minMass{"minMass", 0.0, "min. pair invariant mass"}; @@ -257,7 +267,8 @@ struct TreeCreatorElectronML { fitter.setMatCorrType(matCorr); } - void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + template + void initCCDB(TBC const& bc) { if (mRunNumber == bc.runNumber()) { return; @@ -306,102 +317,6 @@ struct TreeCreatorElectronML { } } - template - float get_phiv(TTrack const& t1, TTrack 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 - - // float bz = fgFitterTwoProngBarrel.getBz(); - - 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; - } - template int FindCommonMotherFrom2Prongs(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcparticles) { @@ -466,6 +381,15 @@ struct TreeCreatorElectronML { if (track.itsNClsInnerBarrel() < minITSClustersIB) { return false; } + + if (fabs(track.tpcNSigmaEl()) > maxNSigmaElTPC) { + return false; + } + if (track.hasTOF()) { + if (fabs(track.tofNSigmaEl()) > maxNSigmaElTOF) { + return false; + } + } return true; } @@ -516,18 +440,14 @@ struct TreeCreatorElectronML { } template - void doPair(TTrack const& t1, TTrack const& t2, int pairtype, TMCParticles const& mctracks, TCollision const& collision, std::map& fNewLabels, std::vector& fSelected_old_labels, int& fCounter) + void doPair(TTrack const& t1, TTrack const& t2, int mc1_id, int mc2_id, int pairtype, TMCParticles const& mctracks, TCollision const& collision, std::map& fNewLabels, std::vector& fSelected_old_labels, int& fCounter, uint64_t collisionId, std::vector& collisions_old_labels, int& collisions_counter) { if (!IsSelected(t1) || !IsSelected(t2)) { return; } - if (!t1.has_mcParticle() || !t2.has_mcParticle()) { - return; - } - - auto mc1 = mctracks.iteratorAt(t1.mcParticleId()); - auto mc2 = mctracks.iteratorAt(t2.mcParticleId()); + auto mc1 = mctracks.iteratorAt(mc1_id); + auto mc2 = mctracks.iteratorAt(mc2_id); if (abs(mc1.pdgCode()) != 11 || abs(mc2.pdgCode()) != 11) { return; @@ -541,7 +461,7 @@ struct TreeCreatorElectronML { return; } - float phiv = get_phiv(t1, 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 pair_dca_xy = sqrt((pow(t1.dcaXY() / sqrt(t1.cYY()), 2) + pow(t2.dcaXY() / sqrt(t2.cYY()), 2)) / 2.); float pair_dca_z = sqrt((pow(t1.dcaZ() / sqrt(t1.cZZ()), 2) + pow(t2.dcaZ() / sqrt(t2.cZZ()), 2)) / 2.); @@ -557,7 +477,6 @@ struct TreeCreatorElectronML { bool is_prompt = false; int pdgCode = 0; - int statusCode = 0; uint8_t flags = 0; float vx = 0.f; float vy = 0.f; @@ -572,7 +491,6 @@ struct TreeCreatorElectronML { auto mcpair = mctracks.iteratorAt(common_mother_id); is_prompt = true; // only relevant for prompt jpsi pdgCode = mcpair.pdgCode(); - statusCode = mcpair.statusCode(); flags = mcpair.flags(); vx = mcpair.vx(); vy = mcpair.vy(); @@ -617,181 +535,290 @@ struct TreeCreatorElectronML { fSelected_old_labels.push_back(t2.globalIndex()); fCounter++; } - mypair(mycollision.lastIndex(), fNewLabels[t1.globalIndex()], fNewLabels[t2.globalIndex()], + if (find(collisions_old_labels.begin(), collisions_old_labels.end(), collisionId) == collisions_old_labels.end()) { + collisions_counter++; + collisions_old_labels.push_back(collisionId); + } + mypair(collisions_counter, fNewLabels[t1.globalIndex()], fNewLabels[t2.globalIndex()], v12.M(), v12.Pt(), v12.Eta(), v12.Phi(), phiv, pair_dca_xy, pair_dca_z, cosOpAng, cosPA, lxy_proper, pow(pca, 2), - isSM, isHF, pairtype, is_prompt, pdgCode, statusCode, flags, + isSM, isHF, pairtype, is_prompt, pdgCode, flags, vx, vy, vz); } } + template + void doSingleTrack(TTrack& track, TMCParticle& mctrack, TMCParticles& mctracks, uint64_t collisionId, std::vector& collisions_old_labels, int& collisions_counter, bool use_downsample = true) + { + if (!IsSelected(track)) { + return; + } + + if ((!use_downsample) || (downSample(abs(mctrack.pdgCode())))) { + // store all mother relation + std::vector mothers_id; + std::vector mothers_pdg; + if (mctrack.has_mothers()) { + int motherid = mctrack.mothersIds()[0]; // first mother index + while (motherid > -1) { + if (motherid < mctracks.size()) { // protect against bad mother indices. why is this needed? + auto mp = mctracks.iteratorAt(motherid); + mothers_id.emplace_back(motherid); + mothers_pdg.emplace_back(mp.pdgCode()); + + if (mp.has_mothers()) { + motherid = mp.mothersIds()[0]; + } else { + motherid = -999; + } + } else { + LOGF(info, "Mother label(%d) exceeds the McParticles size(%d)", motherid, mctracks.size()); + } + } + } + if (find(collisions_old_labels.begin(), collisions_old_labels.end(), collisionId) == collisions_old_labels.end()) { + collisions_counter++; + collisions_old_labels.push_back(collisionId); + } + mytrack(collisions_counter, + track.sign(), track.pt(), track.eta(), track.phi(), track.tgl(), track.dcaXY(), track.dcaZ(), sqrt(track.cYY()), sqrt(track.cZZ()), track.cZY(), + track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), + 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.tofChi2(), track.itsChi2NCl(), track.itsClusterSizes(), + mctrack.vx(), mctrack.vy(), mctrack.vz(), + mctrack.pdgCode(), mctrack.isPhysicalPrimary(), mothers_id, mothers_pdg); + + mothers_id.shrink_to_fit(); + mothers_pdg.shrink_to_fit(); + } + } + + template + 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, + mccollision.generatorsID(), mccollision.posX(), mccollision.posY(), mccollision.posZ(), + collision.multNTracksPV(), collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); + } + + template + void doCollision(TCollision& collision, TBC& bc, TMCCollision& mccollision) + { + doCollision(collision, mccollision, bc.globalBC(), bc.runNumber()); + } + Filter trackFilter = o2::aod::track::pt > minpt&& nabs(o2::aod::track::eta) < maxeta&& o2::aod::track::itsChi2NCl < maxchi2its&& o2::aod::track::tpcChi2NCl < maxchi2tpc&& nabs(o2::aod::track::dcaXY) < maxDcaXY&& nabs(o2::aod::track::dcaZ) < maxDcaZ; using MyFilteredTracksMC = soa::Filtered; Preslice perCollision = aod::track::collisionId; - void processSingleTrack(soa::Join const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks, aod::McParticles const& mctracks, aod::McCollisions const&) + Filter collisionFilter = nabs(o2::aod::collision::posZ) < maxVtxZ && o2::aod::evsel::trackOccupancyInTimeRange < maxOccupancy; + using MyFilteredCollisions = soa::Filtered>; + + void processSingleTrack(MyFilteredCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks, aod::McParticles const& mctracks, aod::McCollisions const&) { + int collisions_counter = -1; + std::vector collisions_old_labels; + for (auto& collision : collisions) { - // TODO: investigate the collisions without corresponding mcCollision if (!collision.has_mcCollision()) { continue; } - - registry.fill(HIST("hEventCounter"), 1.0); // all - - auto bc = collision.bc_as(); - auto mccollision = collision.mcCollision(); - mycollision(bc.globalBC(), bc.runNumber(), collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.sel8(), d_bz, - mccollision.generatorsID(), mccollision.posX(), mccollision.posY(), mccollision.posZ(), - collision.multTPC(), collision.multFV0A(), collision.multFV0C(), collision.multFT0A(), collision.multFT0C(), - collision.multFDDA(), collision.multFDDC(), collision.multZNA(), collision.multZNC(), collision.multTracklets(), collision.multNTracksPV(), collision.multNTracksPVeta1()); + registry.fill(HIST("hEventCounter"), 0.5); auto tracks_coll = tracks.sliceBy(perCollision, collision.globalIndex()); for (auto& track : tracks_coll) { - - if (!IsSelected(track)) { - continue; - } - if (!track.has_mcParticle()) { - continue; // If no MC particle is found, skip the track + continue; } auto mctrack = track.mcParticle_as(); + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter); + } + } - // store all mother relation - std::vector mothers_id; - std::vector mothers_pdg; - if (mctrack.has_mothers()) { - int motherid = mctrack.mothersIds()[0]; // first mother index - while (motherid > -1) { - if (motherid < mctracks.size()) { // protect against bad mother indices. why is this needed? - auto mp = mctracks.iteratorAt(motherid); - mothers_id.emplace_back(motherid); - mothers_pdg.emplace_back(mp.pdgCode()); - - if (mp.has_mothers()) { - motherid = mp.mothersIds()[0]; - } else { - motherid = -999; - } - } else { - LOGF(info, "Mother label(%d) exceeds the McParticles size(%d)", motherid, mctracks.size()); - } - } - } + for (uint64_t collision_label : collisions_old_labels) { + auto collision = collisions.rawIteratorAt(collision_label); + auto bc = collision.bc_as(); + auto mccollision = collision.mcCollision(); + doCollision(collision, bc, mccollision); + } + } + PROCESS_SWITCH(TreeCreatorElectronML, processSingleTrack, "produce ML input for single track level", false); + + using MyFilteredCollisionsSkimmed = soa::Filtered>; + using MyFilteredTracksMCSkimmed = soa::Filtered>; + Preslice perCollisionSkimmed = aod::emprimaryelectron::emeventId; - if (downSample(abs(mctrack.pdgCode()))) { - mytrack(mycollision.lastIndex(), - track.sign(), track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), sqrt(track.cYY()), sqrt(track.cZZ()), track.cZY(), - track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), - 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.tofChi2(), track.itsChi2NCl(), track.itsClusterSizes(), - track.trdSignal(), track.trdPattern(), - mctrack.vx(), mctrack.vy(), mctrack.vz(), - mctrack.pdgCode(), mctrack.isPhysicalPrimary(), mothers_id, mothers_pdg); + void processSingleTrackSkimmed(MyFilteredCollisionsSkimmed const& collisions, MyFilteredTracksMCSkimmed const& tracks, aod::EMMCParticles const& mctracks, aod::EMMCEvents const&) + { + int collisions_counter = -1; + std::vector collisions_old_labels; + + for (auto& collision : collisions) { + if (!collision.has_emmcevent()) { + continue; + } + registry.fill(HIST("hEventCounter"), 0.5); + + auto tracks_coll = tracks.sliceBy(perCollisionSkimmed, collision.globalIndex()); + for (auto& track : tracks_coll) { + if (!track.has_emmcparticle()) { + continue; } - mothers_id.shrink_to_fit(); - mothers_pdg.shrink_to_fit(); + auto mctrack = track.emmcparticle_as(); + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter); + } + } - } // end of track loop - } // end of collision loop - } // end of process - PROCESS_SWITCH(TreeCreatorElectronML, processSingleTrack, "produce ML input for single track level", false); + for (uint64_t collision_label : collisions_old_labels) { + auto collision = collisions.rawIteratorAt(collision_label); + auto mccollision = collision.emmcevent(); + doCollision(collision, mccollision, collision.globalBC(), collision.runNumber()); + } + } + PROCESS_SWITCH(TreeCreatorElectronML, processSingleTrackSkimmed, "produce ML input for single track level on skimmed data", false); Partition posTracks = o2::aod::track::signed1Pt > 0.f; Partition negTracks = o2::aod::track::signed1Pt < 0.f; - void processPair(soa::Join const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks, aod::McParticles const& mctracks, aod::McCollisions const&) + void processPair(MyFilteredCollisions const& collisions, aod::BCsWithTimestamps const&, MyFilteredTracksMC const& tracks, aod::McParticles const& mctracks, aod::McCollisions const&) { std::map fNewLabels; int fCounter = 0; + std::vector collisions_old_labels; + int collisions_counter = -1; + for (auto& collision : collisions) { - std::vector fSelected_old_labels; - // TODO: investigate the collisions without corresponding mcCollision if (!collision.has_mcCollision()) { continue; } + registry.fill(HIST("hEventCounter"), 0.5); auto bc = collision.bc_as(); - auto mccollision = collision.mcCollision(); initCCDB(bc); - - registry.fill(HIST("hEventCounter"), 1.0); // all - - mycollision(bc.globalBC(), bc.runNumber(), collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), collision.sel8(), d_bz, - mccollision.generatorsID(), mccollision.posX(), mccollision.posY(), mccollision.posZ(), - collision.multTPC(), collision.multFV0A(), collision.multFV0C(), collision.multFT0A(), collision.multFT0C(), - collision.multFDDA(), collision.multFDDC(), collision.multZNA(), collision.multZNC(), collision.multTracklets(), collision.multNTracksPV(), collision.multNTracksPVeta1()); + std::vector fSelected_old_labels; auto negTracks_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); auto posTracks_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache); for (auto& [ele, pos] : combinations(CombinationsFullIndexPolicy(negTracks_coll, posTracks_coll))) { - doPair(pos, ele, EM_EEPairType::kULS, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter); + if (!ele.has_mcParticle() || !pos.has_mcParticle()) { + continue; + } + doPair(pos, ele, pos.mcParticleId(), ele.mcParticleId(), EM_EEPairType::kULS, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter, collision.globalIndex(), collisions_old_labels, collisions_counter); } if (!doLS) { continue; } for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_coll, posTracks_coll))) { - doPair(pos1, pos2, EM_EEPairType::kLSpp, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter); + if (!pos1.has_mcParticle() || !pos2.has_mcParticle()) { + continue; + } + doPair(pos1, pos2, pos1.mcParticleId(), pos2.mcParticleId(), EM_EEPairType::kLSpp, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter, collision.globalIndex(), collisions_old_labels, collisions_counter); } for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_coll, negTracks_coll))) { - doPair(ele1, ele2, EM_EEPairType::kLSnn, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter); + if (!ele1.has_mcParticle() || !ele2.has_mcParticle()) { + continue; + } + doPair(ele1, ele2, ele1.mcParticleId(), ele2.mcParticleId(), EM_EEPairType::kLSnn, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter, collision.globalIndex(), collisions_old_labels, collisions_counter); } // single tracks, only if selected in at least one pair for (uint64_t track_label : fSelected_old_labels) { auto track = tracks.rawIteratorAt(track_label); auto mctrack = track.mcParticle_as(); - // store all mother relation - std::vector mothers_id; - std::vector mothers_pdg; - if (mctrack.has_mothers()) { - int motherid = mctrack.mothersIds()[0]; // first mother index - while (motherid > -1) { - if (motherid < mctracks.size()) { // protect against bad mother indices. why is this needed? - auto mp = mctracks.iteratorAt(motherid); - mothers_id.emplace_back(motherid); - mothers_pdg.emplace_back(mp.pdgCode()); - - if (mp.has_mothers()) { - motherid = mp.mothersIds()[0]; - } else { - motherid = -999; - } - } else { - LOGF(info, "Mother label(%d) exceeds the McParticles size(%d)", motherid, mctracks.size()); - } - } - } - - mytrack(mycollision.lastIndex(), - track.sign(), track.pt(), track.eta(), track.phi(), track.dcaXY(), track.dcaZ(), sqrt(track.cYY()), sqrt(track.cZZ()), track.cZY(), - track.tpcNClsFindable(), track.tpcNClsFound(), track.tpcNClsCrossedRows(), - 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.tofChi2(), track.itsChi2NCl(), track.itsClusterSizes(), - track.trdSignal(), track.trdPattern(), - mctrack.vx(), mctrack.vy(), mctrack.vz(), - mctrack.pdgCode(), mctrack.isPhysicalPrimary(), mothers_id, mothers_pdg); - mothers_id.shrink_to_fit(); - mothers_pdg.shrink_to_fit(); + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels, collisions_counter, false); } // end of track loop } // end of collision loop + + for (uint64_t collision_label : collisions_old_labels) { + auto collision = collisions.rawIteratorAt(collision_label); + auto bc = collision.bc_as(); + auto mccollision = collision.mcCollision(); + doCollision(collision, bc, mccollision); + } + fNewLabels.clear(); fCounter = 0; } // end of process PROCESS_SWITCH(TreeCreatorElectronML, processPair, "produce ML input for pair level", false); - void processDummy(soa::Join const&) {} - PROCESS_SWITCH(TreeCreatorElectronML, processDummy, "process dummy", true); + Partition posTracksSkimmed = o2::aod::emprimaryelectron::sign > static_cast(0); + Partition negTracksSkimmed = o2::aod::emprimaryelectron::sign < static_cast(0); + + void processPairSkimmed(MyFilteredCollisionsSkimmed const& collisions, MyFilteredTracksMCSkimmed const& tracks, aod::EMMCParticles const& mctracks, aod::EMMCEvents const&) + { + std::map fNewLabels; + int fCounter = 0; + + std::vector collisions_old_labels; + int collisions_counter = -1; + std::vector collisions_old_labels_track = {}; + int collisions_counter_track = -1; + + for (auto& collision : collisions) { + if (!collision.has_emmcevent()) { + continue; + } + registry.fill(HIST("hEventCounter"), 0.5); + + initCCDB(collision); + std::vector fSelected_old_labels; + + auto negTracks_coll = negTracksSkimmed->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + auto posTracks_coll = posTracksSkimmed->sliceByCached(o2::aod::emprimaryelectron::emeventId, collision.globalIndex(), cache); + + for (auto& [ele, pos] : combinations(CombinationsFullIndexPolicy(negTracks_coll, posTracks_coll))) { + if (!ele.has_emmcparticle() || !pos.has_emmcparticle()) { + continue; + } + doPair(pos, ele, pos.emmcparticleId(), ele.emmcparticleId(), EM_EEPairType::kULS, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter, collision.globalIndex(), collisions_old_labels, collisions_counter); + } + + if (!doLS) { + continue; + } + for (auto& [pos1, pos2] : combinations(CombinationsStrictlyUpperIndexPolicy(posTracks_coll, posTracks_coll))) { + if (!pos1.has_emmcparticle() || !pos2.has_emmcparticle()) { + continue; + } + doPair(pos1, pos2, pos1.emmcparticleId(), pos2.emmcparticleId(), EM_EEPairType::kLSpp, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter, collision.globalIndex(), collisions_old_labels, collisions_counter); + } + + for (auto& [ele1, ele2] : combinations(CombinationsStrictlyUpperIndexPolicy(negTracks_coll, negTracks_coll))) { + if (!ele1.has_emmcparticle() || !ele2.has_emmcparticle()) { + continue; + } + doPair(ele1, ele2, ele1.emmcparticleId(), ele2.emmcparticleId(), EM_EEPairType::kLSnn, mctracks, collision, fNewLabels, fSelected_old_labels, fCounter, collision.globalIndex(), collisions_old_labels, collisions_counter); + } + + // single tracks, only if selected in at least one pair + for (uint64_t track_label : fSelected_old_labels) { + auto track = tracks.rawIteratorAt(track_label); + auto mctrack = track.emmcparticle_as(); + + doSingleTrack(track, mctrack, mctracks, collision.globalIndex(), collisions_old_labels_track, collisions_counter_track, false); + + } // end of track loop + + } // end of collision loop + + for (uint64_t collision_label : collisions_old_labels) { + auto collision = collisions.rawIteratorAt(collision_label); + auto mccollision = collision.emmcevent(); + doCollision(collision, mccollision, collision.globalBC(), collision.runNumber()); + } + + fNewLabels.clear(); + fCounter = 0; + } // end of process + PROCESS_SWITCH(TreeCreatorElectronML, processPairSkimmed, "produce ML input for pair level on skimmed data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) 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 b7f09e9349d..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.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.multTPC(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); - - 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.multTPC(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); - - 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 f4d49b32ed8..4745a1d175a 100644 --- a/PWGEM/Dilepton/Tasks/CMakeLists.txt +++ b/PWGEM/Dilepton/Tasks/CMakeLists.txt @@ -9,15 +9,16 @@ # 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 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::AnalysisCore O2Physics::PWGDQCore COMPONENT_NAME Analysis) -o2physics_add_executable(lmee-lf-cocktail +o2physics_add_dpl_workflow(lmee-lf-cocktail SOURCES lmeeLFCocktail.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2::SimulationDataFormat O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(lmee-hf-cocktail 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/eventQC.cxx b/PWGEM/Dilepton/Tasks/eventQC.cxx index c7570928c6e..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 cfgFillPID{"cfgFillPID", false, "fill PID histograms"}; Configurable> cfgnMods{"cfgnMods", {2, 3}, "Modulation of interest. Please keep increasing order"}; Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; + Configurable cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2, BTot:3, BPos:4, BNeg:5"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; ConfigurableAxis ConfPtBins{"ConfPtBins", {VARIABLE_WIDTH, 0.00, 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 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.50, 3.00, 3.50, 4.00, 4.50, 5.00, 6.00, 7.00, 8.00, 9.00, 10.00}, "pT bins for output histograms"}; @@ -72,9 +74,14 @@ struct eventQC { 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. 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 { @@ -84,14 +91,22 @@ struct eventQC { 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_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"}; + Configurable cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 999.f, "max fraction of shared clusters in TPC"}; Configurable cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 80, "min ncrossed rows"}; 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_ncluster_itsib{"cfg_min_ncluster_itsib", 1, "min ncluster its"}; 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_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_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_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -1e+10, "min n sigma e in TPC"}; + Configurable cfg_max_TPCNsigmaEl{"cfg_max_TPCNsigmaEl", +1e+10, "max n sigma e in TPC"}; + Configurable cfg_min_TPCNsigmaPi{"cfg_min_TPCNsigmaPi", 0.0, "min n sigma pi in TPC for exclusion"}; + 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_requireTOF{"cfg_requireTOF", false, "require TOF hit"}; } trackcuts; Service ccdb; @@ -143,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); @@ -167,13 +183,6 @@ struct eventQC { fRegistry.add(Form("Event/after/Qvector/hQ%dxBTot_CentFT0C", nmod), Form("hQ%dxBTot_CentFT0C;centrality FT0C (%%);Q_{%d,x}^{BTot}", nmod, nmod), kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); fRegistry.add(Form("Event/after/Qvector/hQ%dyBTot_CentFT0C", nmod), Form("hQ%dyBTot_CentFT0C;centrality FT0C (%%);Q_{%d,y}^{BTot}", nmod, nmod), kTH2F, {{100, 0, 100}, {200, -10, +10}}, false); - fRegistry.add(Form("Event/after/Qvector/hEP%dFT0M_CentFT0C", nmod), Form("event plane FT0M;centrality FT0C (%%);#Psi_{%d}^{FT0M} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - fRegistry.add(Form("Event/after/Qvector/hEP%dFT0A_CentFT0C", nmod), Form("event plane FT0A;centrality FT0C (%%);#Psi_{%d}^{FT0A} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - fRegistry.add(Form("Event/after/Qvector/hEP%dFT0C_CentFT0C", nmod), Form("event plane FT0C;centrality FT0C (%%);#Psi_{%d}^{FT0C} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - fRegistry.add(Form("Event/after/Qvector/hEP%dBPos_CentFT0C", nmod), Form("event plane BPos;centrality FT0C (%%);#Psi_{%d}^{BPos} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - fRegistry.add(Form("Event/after/Qvector/hEP%dBNeg_CentFT0C", nmod), Form("event plane BNeg;centrality FT0C (%%);#Psi_{%d}^{BNeg} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - fRegistry.add(Form("Event/after/Qvector/hEP%dBTot_CentFT0C", nmod), Form("event plane BTot;centrality FT0C (%%);#Psi_{%d}^{BTot} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); - fRegistry.add(Form("Event/after/Qvector/hPrfQ%dFT0MQ%dBPos_CentFT0C", nmod, nmod), Form("Q_{%d}^{FT0M} #upoint Q_{%d}^{BPos};centrality FT0C (%%);Q_{%d}^{FT0M} #upoint Q_{%d}^{BPos}", nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); fRegistry.add(Form("Event/after/Qvector/hPrfQ%dFT0MQ%dBNeg_CentFT0C", nmod, nmod), Form("Q_{%d}^{FT0M} #upoint Q_{%d}^{BNeg};centrality FT0C (%%);Q_{%d}^{FT0M} #upoint Q_{%d}^{BNeg}", nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); fRegistry.add(Form("Event/after/Qvector/hPrfQ%dBPosQ%dBNeg_CentFT0C", nmod, nmod), Form("Q_{%d}^{BPos} #upoint Q_{%d}^{BNeg};centrality FT0C (%%);Q_{%d}^{BPos} #upoint Q_{%d}^{BNeg}", nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); @@ -184,6 +193,24 @@ struct eventQC { fRegistry.add(Form("Event/after/Qvector/hPrfQ%dFT0AQ%dBNeg_CentFT0C", nmod, nmod), Form("Q_{%d}^{FT0A} #upoint Q_{%d}^{BNeg};centrality FT0C (%%);Q_{%d}^{FT0A} #upoint Q_{%d}^{BNeg}", nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); fRegistry.add(Form("Event/after/Qvector/hPrfQ%dFT0AQ%dBTot_CentFT0C", nmod, nmod), Form("Q_{%d}^{FT0A} #upoint Q_{%d}^{BTot};centrality FT0C (%%);Q_{%d}^{FT0A} #upoint Q_{%d}^{BTot}", nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); fRegistry.add(Form("Event/after/Qvector/hPrfQ%dFT0AQ%dFT0C_CentFT0C", nmod, nmod), Form("Q_{%d}^{FT0A} #upoint Q_{%d}^{FT0C};centrality FT0C (%%);Q_{%d}^{FT0A} #upoint Q_{%d}^{FT0C}", nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + + fRegistry.add(Form("Event/after/Qvector/hEP%dFT0M_CentFT0C", nmod), Form("event plane FT0M;centrality FT0C (%%);#Psi_{%d}^{FT0M} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); + fRegistry.add(Form("Event/after/Qvector/hEP%dFT0A_CentFT0C", nmod), Form("event plane FT0A;centrality FT0C (%%);#Psi_{%d}^{FT0A} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); + fRegistry.add(Form("Event/after/Qvector/hEP%dFT0C_CentFT0C", nmod), Form("event plane FT0C;centrality FT0C (%%);#Psi_{%d}^{FT0C} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); + fRegistry.add(Form("Event/after/Qvector/hEP%dBPos_CentFT0C", nmod), Form("event plane BPos;centrality FT0C (%%);#Psi_{%d}^{BPos} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); + fRegistry.add(Form("Event/after/Qvector/hEP%dBNeg_CentFT0C", nmod), Form("event plane BNeg;centrality FT0C (%%);#Psi_{%d}^{BNeg} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); + fRegistry.add(Form("Event/after/Qvector/hEP%dBTot_CentFT0C", nmod), Form("event plane BTot;centrality FT0C (%%);#Psi_{%d}^{BTot} (rad.)", nmod), kTH2F, {{100, 0, 100}, {36, -M_PI_2, +M_PI_2}}, false); + + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0MEP%dBPos_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0M} - #Psi_{%d}^{BPos}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0M} - #Psi_{%d}^{BPos}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0MEP%dBNeg_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0M} - #Psi_{%d}^{BNeg}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0M} - #Psi_{%d}^{BNeg}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dBPosEP%dBNeg_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{BPos} - #Psi_{%d}^{BNeg}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{BPos} - #Psi_{%d}^{BNeg}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0CEP%dBPos_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0C} - #Psi_{%d}^{BPos}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0C} - #Psi_{%d}^{BPos}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0CEP%dBNeg_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0C} - #Psi_{%d}^{BNeg}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0C} - #Psi_{%d}^{BNeg}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0CEP%dBTot_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0C} - #Psi_{%d}^{BTot}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0C} - #Psi_{%d}^{BTot}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0AEP%dBPos_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{BPos}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{BPos}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0AEP%dBNeg_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{BNeg}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{BNeg}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0AEP%dBTot_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{BTot}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{BTot}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); + fRegistry.add(Form("Event/after/Qvector/hPrfCosDiffEP%dFT0AEP%dFT0C_CentFT0C", nmod, nmod), Form("cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{FT0C}));centrality FT0C (%%);cos(%d(#Psi_{%d}^{FT0A} - #Psi_{%d}^{FT0C}))", nmod, nmod, nmod, nmod, nmod, nmod), kTProfile, {{100, 0, 100}}, false); } std::vector tmp_ptbins; @@ -199,9 +226,16 @@ struct eventQC { const AxisSpec axis_eta{cfgNbinsEta, -1.0, +1.0, "#eta"}; const AxisSpec axis_phi{cfgNbinsPhi, 0.0, 2 * M_PI, "#varphi (rad.)"}; const AxisSpec axis_sign{3, -1.5, +1.5, "sign"}; + const AxisSpec axis_cent{20, 0, 100, "centrality FT0C (%)"}; + + for (int i = 0; i < static_cast(cfgnMods->size()); i++) { + int nmod = cfgnMods->at(i); + const AxisSpec axis_sp{100, -5, +5, Form("#vec{u_{%d}} #upoint #vec{Q_{%d}}", nmod, nmod)}; + const AxisSpec axis_cos{200, -1, +1, Form("cos(%d(#varphi - #Psi_{%d}))", nmod, nmod)}; + fRegistry.add(Form("Track/hV%d", nmod), Form("charged particle v_{%d}", nmod), kTHnSparseD, {axis_cent, axis_pt, axis_sp, axis_cos}, false); + } fRegistry.add("Track/hs", "rec. single electron", kTHnSparseD, {axis_pt, axis_eta, axis_phi, axis_sign}, false); fRegistry.add("Track/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); - fRegistry.add("Track/hSigma1Pt", "#sigma_{1/p_{T}} vs. q/p_{T};q/p_{T} (GeV/c)^{-1};#sigma_{1/p_{T}} (GeV/c)^{-1}", kTH2F, {{400, -20, 20}, {200, 0, 0.2}}, false); fRegistry.add("Track/hRelSigma1Pt", "relative p_{T} resolution;p_{T} (GeV/c);#sigma_{1/p_{T}} #times p_{T}", kTH2F, {axis_pt_tmp, {100, 0, 0.1}}, false); fRegistry.add("Track/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/hDCAxyzSigma", "DCA xy vs. z;DCA_{xy} (#sigma);DCA_{z} (#sigma)", kTH2F, {{200, -10.0f, 10.0f}, {200, -10.0f, 10.0f}}, false); @@ -210,21 +244,24 @@ 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_{in} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); + fRegistry.add("Track/hTPCdEdx", "TPC dE/dx;p_{pv} (GeV/c);TPC dE/dx (a.u.)", kTH2F, {{1000, 0, 10}, {200, 0, 200}}, false); fRegistry.add("Track/hTOFbeta", "TOF #beta;p_{pv} (GeV/c);#beta", kTH2F, {{1000, 0, 10}, {240, 0, 1.2}}, false); - fRegistry.add("Track/hMeanClusterSizeITS", "mean cluster size ITS;p_{pv} (GeV/c); on ITS #times cos(#lambda);", kTH2F, {{1000, 0.f, 10.f}, {160, 0, 16}}, 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); - fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{in} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); - fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{in} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/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/hTPCNsigmaEl", "TPC n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTPCNsigmaMu", "TPC n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTPCNsigmaPi", "TPC n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTPCNsigmaKa", "TPC n sigma ka;p_{pv} (GeV/c);n #sigma_{K}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); + fRegistry.add("Track/hTPCNsigmaPr", "TPC n sigma pr;p_{pv} (GeV/c);n #sigma_{p}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaEl", "TOF n sigma el;p_{pv} (GeV/c);n #sigma_{e}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaMu", "TOF n sigma mu;p_{pv} (GeV/c);n #sigma_{#mu}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("Track/hTOFNsigmaPi", "TOF n sigma pi;p_{pv} (GeV/c);n #sigma_{#pi}^{TOF}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); @@ -238,7 +275,6 @@ struct eventQC { { fRegistry.fill(HIST("Track/hs"), track.pt(), track.eta(), track.phi(), track.sign()); fRegistry.fill(HIST("Track/hQoverPt"), track.signed1Pt()); - fRegistry.fill(HIST("Track/hSigma1Pt"), track.signed1Pt(), track.sigma1Pt()); fRegistry.fill(HIST("Track/hRelSigma1Pt"), track.pt(), track.sigma1Pt() * track.pt()); fRegistry.fill(HIST("Track/hDCAxyz"), track.dcaXY(), track.dcaZ()); fRegistry.fill(HIST("Track/hDCAxyzSigma"), track.dcaXY() / sqrt(track.cYY()), track.dcaZ() / sqrt(track.cZZ())); @@ -249,23 +285,26 @@ struct eventQC { fRegistry.fill(HIST("Track/hNcrTPC"), track.tpcNClsCrossedRows()); fRegistry.fill(HIST("Track/hTPCNcr2Nf"), track.tpcCrossedRowsOverFindableCls()); 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; for (int il = 0; il < 7; il++) { nsize += track.itsClsSizeInLayer(il); } - fRegistry.fill(HIST("Track/hTPCdEdx"), track.tpcInnerParam(), track.tpcSignal()); + fRegistry.fill(HIST("Track/hTPCdEdx"), track.p(), track.tpcSignal()); fRegistry.fill(HIST("Track/hTOFbeta"), track.p(), track.beta()); fRegistry.fill(HIST("Track/hMeanClusterSizeITS"), track.p(), static_cast(nsize) / static_cast(track.itsNCls()) * std::cos(std::atan(track.tgl()))); - fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.tpcInnerParam(), track.tpcNSigmaEl()); - fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.tpcInnerParam(), track.tpcNSigmaMu()); - fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.tpcInnerParam(), track.tpcNSigmaPi()); - fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.tpcInnerParam(), track.tpcNSigmaKa()); - fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.tpcInnerParam(), track.tpcNSigmaPr()); + fRegistry.fill(HIST("Track/hTPCNsigmaEl"), track.p(), track.tpcNSigmaEl()); + fRegistry.fill(HIST("Track/hTPCNsigmaMu"), track.p(), track.tpcNSigmaMu()); + fRegistry.fill(HIST("Track/hTPCNsigmaPi"), track.p(), track.tpcNSigmaPi()); + fRegistry.fill(HIST("Track/hTPCNsigmaKa"), track.p(), track.tpcNSigmaKa()); + fRegistry.fill(HIST("Track/hTPCNsigmaPr"), track.p(), track.tpcNSigmaPr()); fRegistry.fill(HIST("Track/hTOFNsigmaEl"), track.p(), track.tofNSigmaEl()); fRegistry.fill(HIST("Track/hTOFNsigmaMu"), track.p(), track.tofNSigmaMu()); fRegistry.fill(HIST("Track/hTOFNsigmaPi"), track.p(), track.tofNSigmaPi()); @@ -319,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); } @@ -372,13 +410,6 @@ struct eventQC { fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ2xBTot_CentFT0C"), collision.centFT0C(), qxbtot); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ2yBTot_CentFT0C"), collision.centFT0C(), qybtot); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2FT0M_CentFT0C"), collision.centFT0C(), getEP(qxft0m, qyft0m, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2FT0A_CentFT0C"), collision.centFT0C(), getEP(qxft0a, qyft0a, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2FT0C_CentFT0C"), collision.centFT0C(), getEP(qxft0c, qyft0c, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2BPos_CentFT0C"), collision.centFT0C(), getEP(qxbpos, qybpos, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2BNeg_CentFT0C"), collision.centFT0C(), getEP(qxbneg, qybneg, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2BTot_CentFT0C"), collision.centFT0C(), getEP(qxbtot, qybtot, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ2FT0MQ2BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0m, qbpos)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ2FT0MQ2BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0m, qbneg)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ2BPosQ2BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qbpos, qbneg)); @@ -389,6 +420,24 @@ struct eventQC { fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ2FT0CQ2BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0c, qbneg)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ2FT0CQ2BTot_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0c, qbtot)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ2FT0AQ2FT0C_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0a, qft0c)); + + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2FT0M_CentFT0C"), collision.centFT0C(), getEP(qxft0m, qyft0m, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2FT0A_CentFT0C"), collision.centFT0C(), getEP(qxft0a, qyft0a, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2FT0C_CentFT0C"), collision.centFT0C(), getEP(qxft0c, qyft0c, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2BPos_CentFT0C"), collision.centFT0C(), getEP(qxbpos, qybpos, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2BNeg_CentFT0C"), collision.centFT0C(), getEP(qxbneg, qybneg, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP2BTot_CentFT0C"), collision.centFT0C(), getEP(qxbtot, qybtot, nmod)); + + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0MEP2BPos_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0m, qyft0m, nmod) - getEP(qxbpos, qybpos, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0MEP2BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0m, qyft0m, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2BPosEP2BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxbpos, qybpos, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0AEP2BPos_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxbpos, qybpos, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0AEP2BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0AEP2BTot_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxbtot, qybtot, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0CEP2BPos_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0c, qyft0c, nmod) - getEP(qxbpos, qybpos, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0CEP2BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0c, qyft0c, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0CEP2BTot_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0c, qyft0c, nmod) - getEP(qxbtot, qybtot, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP2FT0AEP2FT0C_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxft0c, qyft0c, nmod)))); } else if constexpr (nmod == 3) { fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ3xFT0M_CentFT0C"), collision.centFT0C(), qxft0m); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ3yFT0M_CentFT0C"), collision.centFT0C(), qyft0m); @@ -403,13 +452,6 @@ struct eventQC { fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ3xBTot_CentFT0C"), collision.centFT0C(), qxbtot); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ3yBTot_CentFT0C"), collision.centFT0C(), qybtot); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3FT0M_CentFT0C"), collision.centFT0C(), getEP(qxft0m, qyft0m, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3FT0A_CentFT0C"), collision.centFT0C(), getEP(qxft0a, qyft0a, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3FT0C_CentFT0C"), collision.centFT0C(), getEP(qxft0c, qyft0c, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3BPos_CentFT0C"), collision.centFT0C(), getEP(qxbpos, qybpos, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3BNeg_CentFT0C"), collision.centFT0C(), getEP(qxbneg, qybneg, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3BTot_CentFT0C"), collision.centFT0C(), getEP(qxbtot, qybtot, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ3FT0MQ3BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0m, qbpos)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ3FT0MQ3BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0m, qbneg)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ3BPosQ3BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qbpos, qbneg)); @@ -420,37 +462,53 @@ struct eventQC { fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ3FT0CQ3BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0c, qbneg)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ3FT0CQ3BTot_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0c, qbtot)); fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ3FT0AQ3FT0C_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0a, qft0c)); - } else if constexpr (nmod == 4) { - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4xFT0M_CentFT0C"), collision.centFT0C(), qxft0m); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4yFT0M_CentFT0C"), collision.centFT0C(), qyft0m); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4xFT0A_CentFT0C"), collision.centFT0C(), qxft0a); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4yFT0A_CentFT0C"), collision.centFT0C(), qyft0a); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4xFT0C_CentFT0C"), collision.centFT0C(), qxft0c); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4yFT0C_CentFT0C"), collision.centFT0C(), qyft0c); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4xBPos_CentFT0C"), collision.centFT0C(), qxbpos); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4yBPos_CentFT0C"), collision.centFT0C(), qybpos); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4xBNeg_CentFT0C"), collision.centFT0C(), qxbneg); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4yBNeg_CentFT0C"), collision.centFT0C(), qybneg); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4xBTot_CentFT0C"), collision.centFT0C(), qxbtot); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hQ4yBTot_CentFT0C"), collision.centFT0C(), qybtot); - - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP4FT0M_CentFT0C"), collision.centFT0C(), getEP(qxft0m, qyft0m, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP4FT0A_CentFT0C"), collision.centFT0C(), getEP(qxft0a, qyft0a, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP4FT0C_CentFT0C"), collision.centFT0C(), getEP(qxft0c, qyft0c, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP4BPos_CentFT0C"), collision.centFT0C(), getEP(qxbpos, qybpos, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP4BNeg_CentFT0C"), collision.centFT0C(), getEP(qxbneg, qybneg, nmod)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP4BTot_CentFT0C"), collision.centFT0C(), getEP(qxbtot, qybtot, nmod)); - - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0MQ4BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0m, qbpos)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0MQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0m, qbneg)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4BPosQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qbpos, qbneg)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0AQ4BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0a, qbpos)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0AQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0a, qbneg)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0AQ4BTot_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0a, qbtot)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0CQ4BPos_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0c, qbpos)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0CQ4BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0c, qbneg)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0CQ4BTot_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0c, qbtot)); - fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfQ4FT0AQ4FT0C_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(qft0a, qft0c)); + + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3FT0M_CentFT0C"), collision.centFT0C(), getEP(qxft0m, qyft0m, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3FT0A_CentFT0C"), collision.centFT0C(), getEP(qxft0a, qyft0a, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3FT0C_CentFT0C"), collision.centFT0C(), getEP(qxft0c, qyft0c, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3BPos_CentFT0C"), collision.centFT0C(), getEP(qxbpos, qybpos, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3BNeg_CentFT0C"), collision.centFT0C(), getEP(qxbneg, qybneg, nmod)); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hEP3BTot_CentFT0C"), collision.centFT0C(), getEP(qxbtot, qybtot, nmod)); + + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0MEP3BPos_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0m, qyft0m, nmod) - getEP(qxbpos, qybpos, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0MEP3BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0m, qyft0m, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3BPosEP3BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxbpos, qybpos, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0AEP3BPos_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxbpos, qybpos, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0AEP3BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0AEP3BTot_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxbtot, qybtot, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0CEP3BPos_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0c, qyft0c, nmod) - getEP(qxbpos, qybpos, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0CEP3BNeg_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0c, qyft0c, nmod) - getEP(qxbneg, qybneg, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0CEP3BTot_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0c, qyft0c, nmod) - getEP(qxbtot, qybtot, nmod)))); + fRegistry.fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("Qvector/hPrfCosDiffEP3FT0AEP3FT0C_CentFT0C"), collision.centFT0C(), std::cos(nmod * (getEP(qxft0a, qyft0a, nmod) - getEP(qxft0c, qyft0c, nmod)))); + } + } + + template + void fillVn(TCollision const& collision, TTrack const& track) + { + int idx = std::distance(cfgnMods->begin(), std::find(cfgnMods->begin(), cfgnMods->end(), nmod)); + float qxft0m = collision.qvecFT0MReVec()[idx], qxft0a = collision.qvecFT0AReVec()[idx], qxft0c = collision.qvecFT0CReVec()[idx], qxbpos = collision.qvecBPosReVec()[idx], qxbneg = collision.qvecBNegReVec()[idx], qxbtot = collision.qvecBTotReVec()[idx]; + float qyft0m = collision.qvecFT0MImVec()[idx], qyft0a = collision.qvecFT0AImVec()[idx], qyft0c = collision.qvecFT0CImVec()[idx], qybpos = collision.qvecBPosImVec()[idx], qybneg = collision.qvecBNegImVec()[idx], qybtot = collision.qvecBTotImVec()[idx]; + std::array qft0m = {qxft0m, qyft0m}; + std::array qft0a = {qxft0a, qyft0a}; + std::array qft0c = {qxft0c, qyft0c}; + std::array qbpos = {qxbpos, qybpos}; + std::array qbneg = {qxbneg, qybneg}; + std::array qbtot = {qxbtot, qybtot}; + std::vector> qvectors = {qft0m, qft0a, qft0c, qbpos, qbneg, qbtot}; + + if (!isGoodQvector(qvectors)) { + return; + } + + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + + float sp = RecoDecay::dotProd(std::array{static_cast(std::cos(nmod * track.phi())), static_cast(std::sin(nmod * track.phi()))}, qvectors[cfgQvecEstimator]); + float cos = std::cos(nmod * (track.phi() - getEP(qvectors[cfgQvecEstimator][0], qvectors[cfgQvecEstimator][1], nmod))); + if constexpr (nmod == 2) { + fRegistry.fill(HIST("Track/hV2"), centralities[cfgCentEstimator], track.pt(), sp, cos); + } else if constexpr (nmod == 3) { + fRegistry.fill(HIST("Track/hV3"), centralities[cfgCentEstimator], track.pt(), sp, cos); } } @@ -495,6 +553,32 @@ struct eventQC { return false; } + if (track.tpcFractionSharedCls() > trackcuts.cfg_max_frac_shared_clusters_tpc) { + return false; + } + + return true; + } + + template + bool isElectron(TTrack const& track) + { + if (track.tpcNSigmaEl() < trackcuts.cfg_min_TPCNsigmaEl || trackcuts.cfg_max_TPCNsigmaEl < track.tpcNSigmaEl()) { + return false; + } + + if (trackcuts.cfg_min_TPCNsigmaPi < track.tpcNSigmaPi() && track.tpcNSigmaPi() < trackcuts.cfg_max_TPCNsigmaPi) { + return false; + } + + if (trackcuts.cfg_requireTOF && !track.hasTOF()) { + return false; + } + + if (track.hasTOF() && (track.tofNSigmaEl() < trackcuts.cfg_min_TOFNsigmaEl || trackcuts.cfg_max_TOFNsigmaEl < track.tofNSigmaEl())) { + return false; + } + return true; } @@ -533,7 +617,23 @@ struct eventQC { return false; } - if (!(eventcuts.cfgOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgOccupancyMax)) { + if (eventcuts.cfgRequireNoCollInTimeRangeStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStrict)) { + return false; + } + + if (eventcuts.cfgRequirekNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) { + return false; + } + + if (eventcuts.cfgRequirekNoCollInRofStrict && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStrict)) { + return false; + } + + if (!(eventcuts.cfgTrackOccupancyMin <= collision.trackOccupancyInTimeRange() && collision.trackOccupancyInTimeRange() < eventcuts.cfgTrackOccupancyMax)) { + return false; + } + + if (!(eventcuts.cfgFT0COccupancyMin < collision.ft0cOccupancyInTimeRange() && collision.ft0cOccupancyInTimeRange() < eventcuts.cfgFT0COccupancyMax)) { return false; } @@ -542,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; @@ -561,11 +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; - } + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; + if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { + continue; } fillEventInfo<0>(collision); if (!isSelectedEvent(collision)) { @@ -581,10 +678,22 @@ struct eventQC { if (!isSelectedTrack(track)) { continue; } - fillTrackInfo(track); - + if (isElectron(track)) { + fillTrackInfo(track); + } if (fabs(track.eta()) < 0.8) { nGlobalTracks++; + + 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); + } else if (cfgnMods->at(i) == 3) { + fillVn<3>(collision, track); + } + } + } + if (track.isPVContributor()) { nGlobalTracksPV++; } @@ -597,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 f1b9148ab8e..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" @@ -71,7 +74,7 @@ void doSingle(T& p, std::vector> hEta, std::vector cut_pt[i] && abs(eta[i]) < cut_eta[i]) { + if (pt[i] > cut_pt[i] && fabs(eta[i]) < cut_eta[i]) { hEta[i]->Fill(eta[i], weight[i]); hPt[i]->Fill(pt[i], weight[i]); hPtEta[i]->Fill(pt[i], eta[i], weight[i]); @@ -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,8 +103,15 @@ void doPair(T& p1, T& p2, std::vector> hMee, std::vector cut_pt[i] && pt2[i] > cut_pt[i] && abs(eta1[i]) < cut_eta[i] && abs(eta2[i]) < cut_eta[i]) { + if (pt1[i] > 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]); hMeePtee[i]->Fill(mass[i], pt[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 092cdbc7676..d54e1d2f382 100644 --- a/PWGEM/Dilepton/Tasks/lmeeLFCocktail.cxx +++ b/PWGEM/Dilepton/Tasks/lmeeLFCocktail.cxx @@ -10,986 +10,536 @@ // or submit itself to any jurisdiction. // // -// Analysis task for lmee light flavour cocktail +/// \file lmeeLFCocktail.cxx +/// \analysis task for lmee light flavour cocktail +/// \author Daniel Samitz, , SMI Vienna +#include #include -#include "Framework/Task.h" +#include + +#include "Math/Vector4D.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include "Framework/Logger.h" -#include "SimulationDataFormat/MCTrack.h" -#include "PWGEM/Dilepton/Utils/MomentumSmearer.h" -#include "Math/Vector4D.h" -#include "Math/Vector3D.h" -#include "TFile.h" -#include "TF1.h" -#include "TRandom.h" -#include "TDatabasePDG.h" -#include "TGenPhaseSpace.h" -#include "TGrid.h" -#include "TTree.h" -#include +#include "PWGEM/Dilepton/DataModel/dileptonTables.h" +#include "PWGEM/Dilepton/Utils/PairUtilities.h" +using namespace o2; using namespace o2::framework; -using namespace ROOT::Math; - -struct eeTTree { - float fd1DCA; - float fd2DCA; - float fpairDCA; - float fd1origpt; - float fd1origp; - float fd1origeta; - float fd1origphi; - float fd2origpt; - float fd2origp; - float fd2origeta; - float fd2origphi; - float fd1pt; - float fd1p; - float fd1eta; - float fd1phi; - float fd2pt; - float fd2p; - float fd2eta; - float fd2phi; - float feeorigpt; - float feeorigp; - float feeorigm; - float feeorigeta; - float feeorigphi; - float feeorigphiv; - float feept; - float feemt; - float feep; - float feem; - float feeeta; - float feephi; - float feephiv; - float fmotherpt; - float fmothermt; - float fmotherp; - float fmotherm; - float fmothereta; - float fmotherphi; - int fID; - int fdectyp; - int fdau3pdg; - float fweight; - float fwEffpT; - float fwMultpT; - float fwMultmT; - float fwMultpT2; - float fwMultmT2; - bool fpass; - float feeorigrap; // only in histogram, not in tree? - float feerap; // only in histogram, not in tree? -}; - -struct lmeelfcocktail { - OutputObj tree{"eeTTree"}; - - HistogramRegistry registry{"registry", {}}; - Int_t nInputParticles = 17; - std::vector fParticleListNames = {"Pi0", "Eta", "EtaP", "EtaP_dalitz_photon", "EtaP_dalitz_omega", "Rho", "Omega", "Omega_2body", "Omega_dalitz", "Phi", "Phi_2body", "Phi_dalitz_eta", "Phi_dalitz_pi0", "Jpsi", "Jpsi_2body", "Jpsi_radiative", "Virtual_Photon"}; - TH1F* fhwEffpT; - TH1F* fhwMultpT; - TH1F* fhwMultmT; - TH1F* fhwMultpT2; - TH1F* fhwMultmT2; - TH1F* fhKW; - TF1* ffVPHpT; - std::vector> fmee_orig, fmotherpT_orig, fphi_orig, frap_orig, fmee_orig_wALT, fmotherpT_orig_wALT, fmee, fphi, frap, fmee_wALT; - std::vector> fpteevsmee_wALT, fpteevsmee_orig_wALT, fpteevsmee_orig, fpteevsmee; +using McParticlesSmeared = soa::Join; - eeTTree treeWords; +struct lmeelfcocktail { - std::vector DCATemplateEdges; - int nbDCAtemplate; - TH1F** fh_DCAtemplates; + enum recLevel { + kGen = 0, + kRec, + kNRecLevels + }; + + struct mesonInfo { + TString name; + std::vector decayModes; + }; + + std::map decays = { + {-1, "e_e/"}, + {-2, "e_e_e_e/"}, + {22, "gamma_e_e/"}, + {223, "omega_e_e/"}, + {211 * 211, "pi_pi_e_e/"}, + {111, "pi0_e_e/"}, + {221, "eta_e_e/"}}; + + std::map mesons = { + {111, {"pi0/", {22, -2}}}, + {221, {"eta/", {22, 211 * 211, -2}}}, + {331, {"etaP/", {22, 223, 211 * 211}}}, + {113, {"rho/", {-1}}}, + {223, {"omega/", {-1, 111}}}, + {333, {"phi/", {-1, 111, 221}}}}; + + std::map histogramId; + + std::vector stage = {"gen/", "rec/"}; - MomentumSmearer smearer; + HistogramRegistry registry{"registry", {}}; - Double_t eMass; + 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 fCollisionSystem{"cfgCollisionSystem", 200, "set the collision system"}; - Configurable fConfigWriteTTree{"cfgWriteTTree", false, "write tree output"}; - Configurable fConfigDoPairing{"cfgDoPairing", true, "do like and unlike sign pairing"}; Configurable fConfigMaxEta{"cfgMaxEta", 0.8, "maxium |eta|"}; Configurable fConfigMinPt{"cfgMinPt", 0.2, "minium pT"}; Configurable fConfigMaxPt{"cfgMaxPt", 8.0, "maximum pT"}; - Configurable fConfigNBinsMee{"cfgNBinsMee", 1200, "number of bins in invariant mass"}; - Configurable fConfigMinMee{"cfgMinMee", 0.0, "lowest bin in invariant mass"}; - Configurable fConfigMaxMee{"cfgMaxMee", 6.0, "highest bin in invariant mass"}; - Configurable fConfigNBinsPtee{"cfgNBinsPtee", 400, "number of bins in pT"}; - Configurable fConfigMinPtee{"cfgMinPtee", 0.0, "lowest bin in pT"}; - Configurable fConfigMaxPtee{"cfgMaxPtee", 10.0, "hightest bin in pT"}; - Configurable fConfigALTweight{"cfgALTweight", 1, "set alternative weighting type"}; - Configurable fConfigResFileName{"cfgResFileName", "", "name of resolution file"}; - Configurable fConfigEffFileName{"cfgEffFileName", "", "name of efficiency file"}; - Configurable fConfigMinOpAng{"cfgMinOpAng", 0.050, "minimum opening angle"}; - Configurable fConfigNBinsPhi{"cfgNBinsPhi", 240, "number of bins in phi"}; - Configurable fConfigNBinsRap{"cfgNBinsRap", 240, "number of bins in rap"}; - Configurable fConfigMaxAbsRap{"cfgMaxAbsRap", 1.2, "bin range in rap"}; - Configurable fConfigEffHistName{"cfgEffHistName", "fhwEffpT", "hisogram name in efficiency file"}; - Configurable fConfigResPHistName{"cfgResPHistName", "ptSlices", "histogram name for p in resolution file"}; - Configurable fConfigResPtHistName{"cfgResPtHistName", "RelPtResArrCocktail", "histogram name for pt in resolution file"}; - Configurable fConfigResEtaHistName{"cfgResEtaHistName", "EtaResArr", "histogram name for eta in resolution file"}; - Configurable fConfigResPhiPosHistName{"cfgResPhiPosHistName", "PhiPosResArr", "histogram name for phi pos in resolution file"}; - Configurable fConfigResPhiNegHistName{"cfgResPhiNegHistName", "PhiEleResArr", "hisogram for phi neg in resolution file"}; - Configurable fConfigDCAFileName{"cfgDCAFileName", "", "DCA file name"}; - Configurable fConfigDCAHistName{"cfgDCAHistName", "fh_DCAtemplate", "histogram name in DCA file"}; - Configurable fConfigMultFileName{"cfgMultFileName", "", "multiplicity file name"}; - Configurable fConfigMultHistPtName{"cfgMultHistPtName", "fhwMultpT", "hisogram name for pt in multiplicity file"}; - Configurable fConfigMultHistPt2Name{"cfgMultHistPt2Name", "fhwMultpT_upperlimit", "histogram name for pt 2 in multiplicity file"}; - Configurable fConfigMultHistMtName{"cfgMultHistMtName", "fhwMultmT", "histogram name for mt in multiplicity file"}; - Configurable fConfigMultHistMt2Name{"cfgMultHistMt2Name", "fhwMultmT_upperlimit", "histogram name for mt 2 in multiplicity file"}; - Configurable fConfigKWMax{"cfgKWMax", 1.1, "upper bound of Kroll-Wada"}; - Configurable fConfigDoVirtPh{"cfgDoVirtPh", false, "generate one virt. photon for each pion"}; - Configurable fConfigPhotonPtFileName{"cfgPhotonPtFileName", "", "file name for photon pT parametrization"}; - Configurable fConfigPhotonPtDirName{"cfgPhotonPtDirName", "", "directory name for photon pT parametrization"}; - Configurable fConfigPhotonPtFuncName{"cfgPhotonPtFuncName", "111_pt", "function name for photon pT parametrization"}; - - ConfigurableAxis fConfigPtBins{"cfgPtBins", {VARIABLE_WIDTH, 0., 0.5, 1, 1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5., 5.5, 6., 6.5, 7., 7.5, 8.}, "pT bins"}; - ConfigurableAxis fConfigMBins{"cfgMBins", {VARIABLE_WIDTH, 0., 0.08, 0.14, 0.2, 1.1, 2.7, 2.8, 3.2, 5.0}, "mee bins"}; - ConfigurableAxis fConfigDCABins{"cfgDCABins", {VARIABLE_WIDTH, 0., 0.4, 0.8, 1.2, 1.6, 2.0, 2.4, 3., 4., 5., 7., 10.}, "DCA bins"}; - - Configurable> fConfigDCATemplateEdges{"cfgDCATemplateEdges", {0., .3, .4, .6, 1., 2.}, "DCA template edges"}; - - void init(o2::framework::InitContext&) + Configurable fConfigMinOpAng{"cfgMinOpAng", 0, "minimum opening angle"}; + Configurable fConfigMinPtee{"cfgMinPtee", 0, "minimum pair pT"}; + 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"}; + ConfigurableAxis fConfigPhiVBins{"cfgPhiVBins", {200, 0, TMath::Pi()}, "phiV binning"}; + ConfigurableAxis fConfigOpAngBins{"cfgOpAngBins", {200, 0, TMath::Pi()}, "opening angle binning"}; + ConfigurableAxis fConfigDcaBins{"cfgDcaBins", {VARIABLE_WIDTH, 0., 0.4, 0.8, 1.2, 1.6, 2.0, 2.4, 3., 4., 5., 7., 10.}, "dca binning"}; + + std::vector> histograms1D; + std::vector> histograms2D; + std::vector> histogramsND; + + template + bool from_primary(T& p1, U& mcParticles) { - if (fConfigWriteTTree) { - SetTree(); + if (!p1.has_mothers()) { + return false; } - SetHistograms(); - DCATemplateEdges = fConfigDCATemplateEdges; - nbDCAtemplate = DCATemplateEdges.size(); - DCATemplateEdges.push_back(10000000.); - - if ((TString(fConfigEffFileName).BeginsWith("alien://") && TString(fConfigEffFileName).EndsWith(".root")) || (TString(fConfigResFileName).BeginsWith("alien://") && TString(fConfigResFileName).EndsWith(".root")) || (TString(fConfigDCAFileName).BeginsWith("alien://") && TString(fConfigDCAFileName).EndsWith(".root")) || (TString(fConfigMultFileName).BeginsWith("alien://") && TString(fConfigMultFileName).EndsWith(".root")) || (TString(fConfigPhotonPtFileName).BeginsWith("alien://") && TString(fConfigPhotonPtFileName).EndsWith(".root"))) { - LOGP(info, "Connecting to grid via TGrid"); - TGrid::Connect("alien://"); - } - - GetEffHisto(TString(fConfigEffFileName), TString(fConfigEffHistName)); - InitSmearer(TString(fConfigResFileName), TString(fConfigResPtHistName), TString(fConfigResEtaHistName), TString(fConfigResPhiPosHistName), TString(fConfigResPhiNegHistName)); - GetDCATemplates(TString(fConfigDCAFileName), TString(fConfigDCAHistName)); - GetMultHisto(TString(fConfigMultFileName), TString(fConfigMultHistPtName), TString(fConfigMultHistPt2Name), TString(fConfigMultHistMtName), TString(fConfigMultHistMt2Name)); - if (fConfigDoVirtPh) { - GetPhotonPtParametrization(TString(fConfigPhotonPtFileName), TString(fConfigPhotonPtDirName), TString(fConfigPhotonPtFuncName)); + auto mother = mcParticles.iteratorAt(p1.mothersIds()[0]); + if (mother.has_mothers()) { + return false; } - - eMass = (TDatabasePDG::Instance()->GetParticle(11))->Mass(); - - fillKrollWada(); + return true; } - void run(o2::framework::ProcessingContext& pc) + bool isAcceptedSingle(ROOT::Math::PtEtaPhiMVector p1) { - // get number of events per timeframe - auto Nparts = pc.inputs().getNofParts(0); - - for (auto i = 0U; i < Nparts; ++i) { - registry.fill(HIST("NEvents"), 0.5); - // get the tracks - auto mctracks = pc.inputs().get>("mctracks", i); - - std::vector eBuff; - std::vector echBuff; - std::vector eweightBuff; - - bool skipNext = false; - - int trackID = -1; - // Loop over all MC particle - for (auto& mctrack : mctracks) { - trackID++; - if (o2::mcgenstatus::getHepMCStatusCode(mctrack.getStatusCode()) != 1) - continue; - if (abs(mctrack.GetPdgCode()) == 11) { - // get the electron - //--------------- - if (fConfigDoPairing) { - // LS and ULS spectra - PxPyPzEVector e, dielectron; - int8_t ech, dielectron_ch; - Double_t eweight, dielectron_weight; - e.SetPxPyPzE(mctrack.Px(), mctrack.Py(), mctrack.Pz(), - mctrack.GetEnergy()); - if (mctrack.GetPdgCode() > 0) { - ech = 1.; - } else { - ech = -1.; - } - eweight = mctrack.getWeight(); - // put in the buffer - //----------------- - eBuff.push_back(e); - echBuff.push_back(ech); - eweightBuff.push_back(eweight); - // loop the buffer and pair - //------------------------ - for (Int_t jj = eBuff.size() - 2; jj >= 0; jj--) { - dielectron = eBuff.at(jj) + e; - dielectron_ch = (echBuff.at(jj) + ech) / 2; - dielectron_weight = eweightBuff.at(jj) * eweight; - - if (dielectron_ch == 0) - registry.fill(HIST("ULS_orig"), dielectron.M(), dielectron.Pt(), dielectron_weight); - if (dielectron_ch > 0) - registry.fill(HIST("LSpp_orig"), dielectron.M(), dielectron.Pt(), dielectron_weight); - if (dielectron_ch < 0) - registry.fill(HIST("LSmm_orig"), dielectron.M(), dielectron.Pt(), dielectron_weight); - if (e.Pt() > fConfigMinPt && eBuff.at(jj).Pt() > fConfigMinPt && e.Pt() < fConfigMaxPt && eBuff.at(jj).Pt() < fConfigMaxPt && TMath::Abs(e.Eta()) < fConfigMaxEta && TMath::Abs(eBuff.at(jj).Eta()) < fConfigMaxEta && e.Vect().Unit().Dot(eBuff.at(jj).Vect().Unit()) < TMath::Cos(fConfigMinOpAng)) { - if (dielectron_ch == 0) - registry.fill(HIST("ULS"), dielectron.M(), dielectron.Pt(), dielectron_weight); - if (dielectron_ch > 0) - registry.fill(HIST("LSpp"), dielectron.M(), dielectron.Pt(), dielectron_weight); - if (dielectron_ch < 0) - registry.fill(HIST("LSmm"), dielectron.M(), dielectron.Pt(), dielectron_weight); - } - } - } - - if (skipNext) { - skipNext = false; - continue; // skip if marked as second electron - } - - if (!(mctrack.getMotherTrackId() > -1)) - continue; // has no mother - - auto const& mother = mctracks[mctrack.getMotherTrackId()]; - - if (mother.getMotherTrackId() > -1) - continue; // mother is not primary - - if (mctrack.getSecondMotherTrackId() - mctrack.getMotherTrackId() > 0) - continue; // more than one mother - - // skip for the moment other particles rather than pi0, eta, etaprime, - // omega, rho, phi. - switch (mother.GetPdgCode()) { - case 111: - break; - case 221: - break; - case 331: - break; - case 113: - break; - case 223: - break; - case 333: - break; - case 443: - break; - default: - continue; - } - - /* - // Not sure about this cut. From GammaConv group. Harmless a priori. - if (!(fabs(mctrack.GetEnergy() - mctrack.Pz()) > 0.)) - continue; - - // ???? this applied only to first daughter! - Double_t yPre = (mctrack.GetEnergy() + mctrack.Pz()) / (mctrack.GetEnergy() - mctrack.Pz()); - Double_t y = 0.5 * TMath::Log(yPre); - if (fConfigDoRapidityCut) { // Apply rapidity cut on mother consistent with GammaConv group. (??? but it is not applied on mother?) - if (yPre <= 0.) - continue; - if (TMath::Abs(y) > fConfigRapidityCut) - continue; - } else { - if (yPre == 0.) - continue; - }*/ - - treeWords.fdectyp = mother.getLastDaughterTrackId() - mother.getFirstDaughterTrackId() + 1; // fdectyp: decay type (based on number of daughters). - if (treeWords.fdectyp > 4) - continue; // exclude five or more particles decay - - if (trackID == mctracks.size()) - continue; // no particle left in the list - auto mctrack2 = mctracks[trackID + 1]; - if (!(mctrack2.getMotherTrackId() == mctrack.getMotherTrackId())) - continue; // no matching second electron - if (!(mctrack.getSecondMotherTrackId() == -1)) - continue; // second daughter has more than one mother - if (!(abs(mctrack2.GetPdgCode()) == 11)) - continue; // not an electron - - skipNext = true; // is matching electron --> next particle in list will be skipped - - PxPyPzEVector dau1, dau2, ee; - dau1.SetPxPyPzE(mctrack.Px(), mctrack.Py(), mctrack.Pz(), mctrack.GetEnergy()); - dau2.SetPxPyPzE(mctrack2.Px(), mctrack2.Py(), mctrack2.Pz(), mctrack2.GetEnergy()); - - // create dielectron before resolution effects: - ee = dau1 + dau2; - - // get info of the other particles in the decay: - treeWords.fdau3pdg = 0; - for (Int_t jj = mother.getFirstDaughterTrackId(); jj <= mother.getLastDaughterTrackId(); jj++) { - if (jj == trackID || jj == trackID + 1) { - continue; // first or second electron - } - auto mctrack3 = mctracks[jj]; - treeWords.fdau3pdg = abs(mctrack3.GetPdgCode()); - } - - // get index for histograms - Int_t hindex[3]; - for (Int_t jj = 0; jj < 3; jj++) { - hindex[jj] = -1; - } - switch (mother.GetPdgCode()) { - case 111: - hindex[0] = 0; - break; - case 221: - hindex[0] = 1; - break; - case 331: - hindex[0] = 2; - if (treeWords.fdectyp == 3 && treeWords.fdau3pdg == 22) - hindex[1] = 3; - if (treeWords.fdectyp == 3 && treeWords.fdau3pdg == 223) - hindex[1] = 4; - break; - case 113: - hindex[0] = 5; - break; - case 223: - hindex[0] = 6; - if (treeWords.fdectyp == 2) - hindex[1] = 7; - if (treeWords.fdectyp == 3 && treeWords.fdau3pdg == 111) - hindex[1] = 8; - break; - case 333: - hindex[0] = 9; - if (treeWords.fdectyp == 2) - hindex[1] = 10; - if (treeWords.fdectyp == 3 && treeWords.fdau3pdg == 221) - hindex[1] = 11; - if (treeWords.fdectyp == 3 && treeWords.fdau3pdg == 111) - hindex[1] = 12; - break; - case 443: - hindex[0] = 13; - if (treeWords.fdectyp == 2) - hindex[1] = 14; - if (treeWords.fdectyp == 3 && treeWords.fdau3pdg == 22) - hindex[1] = 15; - break; - } - - hindex[2] = nInputParticles; - - if (hindex[0] < 0) { - LOGP(error, "hindex[0]<0"); - continue; - } - - // Fill tree words before resolution/acceptance - treeWords.fd1origpt = dau1.Pt(); - treeWords.fd1origp = dau1.P(); - treeWords.fd1origeta = dau1.Eta(); - treeWords.fd1origphi = dau1.Phi(); - treeWords.fd2origpt = dau2.Pt(); - treeWords.fd2origp = dau2.P(); - treeWords.fd2origeta = dau2.Eta(); - treeWords.fd2origphi = dau2.Phi(); - treeWords.feeorigpt = ee.Pt(); - treeWords.feeorigp = ee.P(); - treeWords.feeorigm = ee.M(); - treeWords.feeorigeta = ee.Eta(); - treeWords.feeorigrap = ee.Rapidity(); - treeWords.feeorigphi = ee.Phi(); - if (mctrack.GetPdgCode() > 0) { - treeWords.feeorigphiv = PhiV(dau1, dau2); - } else { - treeWords.feeorigphiv = PhiV(dau2, dau1); - } - - // get the efficiency weight - Int_t effbin = fhwEffpT->FindBin(treeWords.fd1origpt); - treeWords.fwEffpT = fhwEffpT->GetBinContent(effbin); - effbin = fhwEffpT->FindBin(treeWords.fd2origpt); - treeWords.fwEffpT = treeWords.fwEffpT * fhwEffpT->GetBinContent(effbin); - - // Resolution and acceptance - //------------------------- - int ch1 = 1; - int ch2 = 1; - if (mctrack.GetPdgCode() > 0) { - ch1 = -1; - } - if (mctrack2.GetPdgCode() > 0) { - ch2 = -1; - } - dau1 = applySmearingPxPyPzE(ch1, dau1); - dau2 = applySmearingPxPyPzE(ch2, dau2); - - treeWords.fd1pt = dau1.Pt(); - treeWords.fd1eta = dau1.Eta(); - treeWords.fd2pt = dau2.Pt(); - treeWords.fd2eta = dau2.Eta(); - treeWords.fpass = true; - if (treeWords.fd1pt < fConfigMinPt || treeWords.fd2pt < fConfigMinPt) - treeWords.fpass = false; // leg pT cut - if (treeWords.fd1pt > fConfigMaxPt || treeWords.fd2pt > fConfigMaxPt) - treeWords.fpass = false; // leg pT cut - if (dau1.Vect().Unit().Dot(dau2.Vect().Unit()) > TMath::Cos(fConfigMinOpAng)) - treeWords.fpass = false; // opening angle cut - if (TMath::Abs(treeWords.fd1eta) > fConfigMaxEta || TMath::Abs(treeWords.fd2eta) > fConfigMaxEta) - treeWords.fpass = false; - - // get the pair DCA (based in smeared pT) - for (int jj = 0; jj < nbDCAtemplate; jj++) { // loop over DCA templates - if (dau1.Pt() >= DCATemplateEdges[jj] && dau1.Pt() < DCATemplateEdges[jj + 1]) { - treeWords.fd1DCA = fh_DCAtemplates[jj]->GetRandom(); - } - if (dau2.Pt() >= DCATemplateEdges[jj] && dau2.Pt() < DCATemplateEdges[jj + 1]) { - treeWords.fd2DCA = fh_DCAtemplates[jj]->GetRandom(); - } - } - treeWords.fpairDCA = sqrt((pow(treeWords.fd1DCA, 2) + pow(treeWords.fd2DCA, 2)) / 2); - - // Fill tree words after resolution/acceptance - ee = dau1 + dau2; - treeWords.fd1p = dau1.P(); - treeWords.fd1phi = dau1.Phi(); - treeWords.fd2p = dau2.P(); - treeWords.fd2phi = dau2.Phi(); - treeWords.feept = ee.Pt(); - treeWords.feemt = ee.Mt(); - treeWords.feep = ee.P(); - treeWords.feem = ee.M(); - treeWords.feeeta = ee.Eta(); - treeWords.feerap = ee.Rapidity(); - treeWords.feephi = ee.Phi(); - if (mctrack.GetPdgCode() > 0) { - treeWords.feephiv = PhiV(dau1, dau2); - } else { - treeWords.feephiv = PhiV(dau2, dau1); - } - treeWords.fmotherpt = mother.GetPt(); - treeWords.fmotherm = sqrt(pow(mother.GetEnergy(), 2) + pow(mother.GetP(), 2)); - treeWords.fmothermt = sqrt(pow(treeWords.fmotherm, 2) + pow(treeWords.fmotherpt, 2)); - treeWords.fmotherp = mother.GetP(); - treeWords.fmothereta = mother.GetEta(); - treeWords.fmotherphi = mother.GetPhi(); - treeWords.fID = mother.GetPdgCode(); - treeWords.fweight = mctrack.getWeight(); // get particle weight from generator - - // get multiplicity based weight: - int iwbin = fhwMultpT->FindBin(treeWords.fmotherpt); - treeWords.fwMultpT = fhwMultpT->GetBinContent(iwbin); // pT weight - treeWords.fwMultpT2 = fhwMultpT2->GetBinContent(iwbin); // pT weight - double min_mT = fhwMultmT->GetBinLowEdge(1); // consider as minimum valid mT value the edge of the weight histo. - if (treeWords.fmothermt > min_mT) { - iwbin = fhwMultmT->FindBin(treeWords.fmothermt); - treeWords.fwMultmT = fhwMultmT->GetBinContent(iwbin); // mT weight - treeWords.fwMultmT2 = fhwMultmT2->GetBinContent(iwbin); // mT weight - } else { - LOGP(error, "Generated particle with mT < Pion mass cannot be weighted"); - treeWords.fwMultmT = 0.; - treeWords.fwMultmT2 = 0.; - } - - // Which ALT weight to use?: - Double_t fwALT = treeWords.fwEffpT; // by default use pt efficiency weight - if (fConfigALTweight == 1) - fwALT = treeWords.fwMultmT; // mT multiplicity weight - if (fConfigALTweight == 11) - fwALT = treeWords.fwMultmT2; // mT multiplicity weight, higher mult - if (fConfigALTweight == 2) - fwALT = treeWords.fwMultpT; // pT multiplicity weight - if (fConfigALTweight == 22) - fwALT = treeWords.fwMultpT2; // pT multiplicity weight, higher mult - - // fill the tree - if (fConfigWriteTTree) { - tree->Fill(); - } + if (p1.Pt() < fConfigMinPt) + return false; + if (p1.Pt() > fConfigMaxPt) + return false; + if (fabs(p1.Eta()) > fConfigMaxEta) + return false; + return true; + } - // fill the histograms - if (treeWords.fdectyp < 4) { // why here <4 and before <5 ??? - for (Int_t jj = 0; jj < 3; jj++) { // fill the different hindex -> particles - if (hindex[jj] > -1) { - fmee_orig[hindex[jj]]->Fill(treeWords.feeorigm, treeWords.fweight); - if (fConfigALTweight == 1 || fConfigALTweight == 11) { - fmotherpT_orig[hindex[jj]]->Fill(treeWords.fmothermt, treeWords.fweight); - } else if (fConfigALTweight == 2 || fConfigALTweight == 22 || fConfigALTweight == 0) { - fmotherpT_orig[hindex[jj]]->Fill(treeWords.fmotherpt, treeWords.fweight); - } - fpteevsmee_orig[hindex[jj]]->Fill(treeWords.feeorigm, treeWords.feept, treeWords.fweight); - fphi_orig[hindex[jj]]->Fill(treeWords.feeorigphi, treeWords.fweight); - frap_orig[hindex[jj]]->Fill(treeWords.feeorigrap, treeWords.fweight); - fmee_orig_wALT[hindex[jj]]->Fill(treeWords.feeorigm, treeWords.fweight * fwALT); - fpteevsmee_orig_wALT[hindex[jj]]->Fill(treeWords.feeorigm, treeWords.feept, treeWords.fweight * fwALT); - if (fConfigALTweight == 1 || fConfigALTweight == 11) { - fmotherpT_orig_wALT[hindex[jj]]->Fill(treeWords.fmothermt, treeWords.fweight * fwALT); - } else if (fConfigALTweight == 2 || fConfigALTweight == 22 || fConfigALTweight == 0) { - fmotherpT_orig_wALT[hindex[jj]]->Fill(treeWords.fmotherpt, treeWords.fweight * fwALT); - } - if (treeWords.fpass) { - fmee[hindex[jj]]->Fill(treeWords.feem, treeWords.fweight); - fpteevsmee[hindex[jj]]->Fill(treeWords.feem, treeWords.feept, treeWords.fweight); - fphi[hindex[jj]]->Fill(treeWords.feephi, treeWords.fweight); - frap[hindex[jj]]->Fill(treeWords.feerap, treeWords.fweight); - registry.fill(HIST("DCAeevsmee"), treeWords.feem, treeWords.fpairDCA, treeWords.fweight); - registry.fill(HIST("DCAeevsptee"), treeWords.feept, treeWords.fpairDCA, treeWords.fweight); - fmee_wALT[hindex[jj]]->Fill(treeWords.feem, treeWords.fweight * fwALT); - fpteevsmee_wALT[hindex[jj]]->Fill(treeWords.feem, treeWords.feept, treeWords.fweight * fwALT); - } - } - } - } + bool isAcceptedPair(ROOT::Math::PtEtaPhiMVector p1, ROOT::Math::PtEtaPhiMVector p2) + { + if (!isAcceptedSingle(p1)) { + return false; + } + if (!isAcceptedSingle(p2)) { + return false; + } + ROOT::Math::PtEtaPhiMVector p12 = p1 + p2; + 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) { + return false; + } + if (fabs(p12.Rapidity()) > fConfigMaxRapee) { + return false; + } - if (fConfigDoVirtPh) { - // Virtual photon generation - //------------------------- - // We will generate one virtual photon per histogrammed pion - if (mother.GetPdgCode() == 111) { - // get mass and pt from histos and flat eta and phi - Double_t VPHpT = ffVPHpT->GetRandom(); - Double_t VPHmass = fhKW->GetRandom(); - Double_t VPHeta = -1. + gRandom->Rndm() * 2.; - Double_t VPHphi = 2.0 * TMath::ACos(-1.) * gRandom->Rndm(); - TLorentzVector beam; - beam.SetPtEtaPhiM(VPHpT, VPHeta, VPHphi, VPHmass); - Double_t decaymasses[2] = {(TDatabasePDG::Instance()->GetParticle(11))->Mass(), (TDatabasePDG::Instance()->GetParticle(11))->Mass()}; - TGenPhaseSpace VPHgen; - Bool_t SetDecay; - SetDecay = VPHgen.SetDecay(beam, 2, decaymasses); - if (SetDecay == 0) - LOGP(error, "Decay not permitted by kinematics"); - Double_t VPHweight = VPHgen.Generate(); - // get electrons from the decay - TLorentzVector *decay1, *decay2; - decay1 = VPHgen.GetDecay(0); - decay2 = VPHgen.GetDecay(1); - dau1.SetPxPyPzE(decay1->Px(), decay1->Py(), decay1->Pz(), decay1->E()); - dau2.SetPxPyPzE(decay2->Px(), decay2->Py(), decay2->Pz(), decay2->E()); - - // create dielectron before resolution effects: - ee = dau1 + dau2; - - // get index for histograms - hindex[0] = nInputParticles - 1; - hindex[1] = -1; - hindex[2] = -1; - - // Fill tree words before resolution/acceptance - treeWords.fd1origpt = dau1.Pt(); - treeWords.fd1origp = dau1.P(); - treeWords.fd1origeta = dau1.Eta(); - treeWords.fd1origphi = dau1.Phi(); - treeWords.fd2origpt = dau2.Pt(); - treeWords.fd2origp = dau2.P(); - treeWords.fd2origeta = dau2.Eta(); - treeWords.fd2origphi = dau2.Phi(); - treeWords.feeorigpt = ee.Pt(); - treeWords.feeorigp = ee.P(); - treeWords.feeorigm = ee.M(); - treeWords.feeorigeta = ee.Eta(); - treeWords.feeorigrap = ee.Rapidity(); - treeWords.feeorigphi = ee.Phi(); - treeWords.feeorigphiv = PhiV(dau1, dau2); - - // get the efficiency weight - Int_t effbin = fhwEffpT->FindBin(treeWords.fd1origpt); - treeWords.fwEffpT = fhwEffpT->GetBinContent(effbin); - effbin = fhwEffpT->FindBin(treeWords.fd2origpt); - treeWords.fwEffpT = treeWords.fwEffpT * fhwEffpT->GetBinContent(effbin); - - // Resolution and acceptance - //------------------------- - dau1 = applySmearingPxPyPzE(1, dau1); - dau2 = applySmearingPxPyPzE(-1, dau2); - treeWords.fpass = true; - if (dau1.Pt() < fConfigMinPt || dau2.Pt() < fConfigMinPt) - treeWords.fpass = false; // leg pT cut - if (dau1.Pt() > fConfigMaxPt || dau2.Pt() > fConfigMaxPt) - treeWords.fpass = false; // leg pT cut - if (dau1.Vect().Unit().Dot(dau2.Vect().Unit()) > TMath::Cos(fConfigMinOpAng)) - treeWords.fpass = false; // opening angle cut - if (TMath::Abs(dau1.Eta()) > fConfigMaxEta || TMath::Abs(dau2.Eta()) > fConfigMaxEta) - treeWords.fpass = false; - - treeWords.fpairDCA = 10000.; // ?? - - // Fill tree words after resolution/acceptance - ee = dau1 + dau2; - treeWords.fd1pt = dau1.Pt(); - treeWords.fd1p = dau1.P(); - treeWords.fd1eta = dau1.Eta(); - treeWords.fd1phi = dau1.Phi(); - treeWords.fd2pt = dau2.Pt(); - treeWords.fd2p = dau2.P(); - treeWords.fd2eta = dau2.Eta(); - treeWords.fd2phi = dau2.Phi(); - treeWords.feept = ee.Pt(); - treeWords.feemt = ee.Mt(); - treeWords.feep = ee.P(); - treeWords.feem = ee.M(); - treeWords.feeeta = ee.Eta(); - treeWords.feerap = ee.Rapidity(); - treeWords.feephi = ee.Phi(); - treeWords.feephiv = PhiV(dau1, dau2); - treeWords.fmotherpt = beam.Pt(); - treeWords.fmothermt = sqrt(pow(beam.M(), 2) + pow(beam.Pt(), 2)); - treeWords.fmotherp = beam.P(); - treeWords.fmotherm = beam.M(); - treeWords.fmothereta = beam.Eta(); - treeWords.fmotherphi = beam.Phi(); - treeWords.fID = 0; // set ID to Zero for VPH - treeWords.fweight = VPHweight; - // get multiplicity based weight: - treeWords.fwMultmT = 1; // no weight for photons so far - - // Fill the tree - if (fConfigWriteTTree) { // many parameters not set for photons: d1DCA,fd2DCA, fdectyp,fdau3pdg,fwMultpT,fwMultpT2,fwMultmT2 - tree->Fill(); - } - - // Fill the histograms - for (Int_t jj = 0; jj < 3; jj++) { // fill the different hindex -> particles - if (hindex[jj] > -1) { - fmee_orig[hindex[jj]]->Fill(treeWords.feeorigm, VPHweight); - fpteevsmee_orig[hindex[jj]]->Fill(treeWords.feeorigm, treeWords.feept, VPHweight); - fphi_orig[hindex[jj]]->Fill(treeWords.feeorigphi, VPHweight); - frap_orig[hindex[jj]]->Fill(treeWords.feeorigrap, VPHweight); - fmotherpT_orig[hindex[jj]]->Fill(treeWords.fmotherpt, treeWords.fweight); - if (treeWords.fpass) { - fmee[hindex[jj]]->Fill(treeWords.feem, VPHweight); - fpteevsmee[hindex[jj]]->Fill(treeWords.feem, treeWords.feept, VPHweight); - fphi[hindex[jj]]->Fill(treeWords.feephi, VPHweight); - frap[hindex[jj]]->Fill(treeWords.feerap, VPHweight); - } - } - } - - } // mother.pdgCode()==111 - } // fConfigDoVirtPh - - } // abs(pdgCode())==11 - - } // loop over mctracks - - // Clear buffers - eBuff.clear(); - echBuff.clear(); - eweightBuff.clear(); + 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; } - Double_t PhiV(PxPyPzEVector e1, PxPyPzEVector e2) + template + bool isAcceptedPair(T& p1, T& p2) { - Double_t outPhiV; - XYZVector p1 = e1.Vect(); - XYZVector p2 = e2.Vect(); - XYZVector p12 = p1 + p2; - XYZVector u = p12.Unit(); - XYZVector p1u = p1.Unit(); - XYZVector p2u = p2.Unit(); - XYZVector v = p1u.Cross(p2u); - XYZVector w = u.Cross(v); - XYZVector zu(0, 0, 1); - XYZVector wc = u.Cross(zu); - outPhiV = TMath::ACos(wc.Unit().Dot(w.Unit())); - return outPhiV; + ROOT::Math::PtEtaPhiMVector v1(p1.ptSmeared(), p1.etaSmeared(), p1.phiSmeared(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(p2.ptSmeared(), p2.etaSmeared(), p2.phiSmeared(), o2::constants::physics::MassElectron); + return isAcceptedPair(v1, v2); } - PxPyPzEVector applySmearingPxPyPzE(int ch, PxPyPzEVector vec) + template + bool isAcceptedSingle(T& p1) { - PxPyPzEVector vecsmeared; - float ptsmeared, etasmeared, phismeared; - smearer.applySmearing(ch, vec.Pt(), vec.Eta(), vec.Phi(), ptsmeared, etasmeared, phismeared); - float sPx = ptsmeared * cos(phismeared); - float sPy = ptsmeared * sin(phismeared); - float sPz = ptsmeared * sinh(etasmeared); - float sP = ptsmeared * cosh(etasmeared); - float sE = sqrt(sP * sP + eMass * eMass); - - vecsmeared.SetPxPyPzE(sPx, sPy, sPz, sE); - - return vecsmeared; + ROOT::Math::PtEtaPhiMVector v1(p1.ptSmeared(), p1.etaSmeared(), p1.phiSmeared(), o2::constants::physics::MassElectron); + return isAcceptedSingle(v1); } - void SetHistograms() + void addHistogram1D_stage(TString histname, AxisSpec axis, int& i, TString s) { - - AxisSpec ptAxis = {fConfigNBinsPtee, fConfigMinPtee, fConfigMaxPtee, "#it{p}_{T,ee} (GeV/c)"}; - AxisSpec mAxis = {fConfigNBinsMee, fConfigMinMee, fConfigMaxMee, "#it{m}_{ee} (GeV/c^{2})"}; - AxisSpec phiAxis = {fConfigNBinsPhi, -TMath::TwoPi() / 2, TMath::TwoPi() / 2, "#it{phi}_{ee}"}; - AxisSpec rapAxis = {fConfigNBinsRap, -fConfigMaxAbsRap, fConfigMaxAbsRap, "#it{y}_{ee}"}; - - registry.add("NEvents", "NEvents", HistType::kTH1F, {{1, 0, 1}}, false); - - if (fConfigDoPairing) { - registry.add("ULS", "ULS", HistType::kTH2F, {mAxis, ptAxis}, true); - registry.add("LSpp", "LSpp", HistType::kTH2F, {mAxis, ptAxis}, true); - registry.add("LSmm", "LSmm", HistType::kTH2F, {mAxis, ptAxis}, true); - - registry.add("ULS_orig", "ULS_orig", HistType::kTH2F, {mAxis, ptAxis}, true); - registry.add("LSpp_orig", "LSpp_orig", HistType::kTH2F, {mAxis, ptAxis}, true); - registry.add("LSmm_orig", "LSmm_orig", HistType::kTH2F, {mAxis, ptAxis}, true); + i++; + TString name = s + histname; + histogramId[name] = i; + histograms1D.push_back(registry.add(name, histname, HistType::kTH1F, {axis}, true)); + for (auto const& [pdg, meson] : mesons) { + i++; + name = s + meson.name + histname; + histogramId[name] = i; + histograms1D.push_back(registry.add(name, histname, HistType::kTH1F, {axis}, true)); + for (auto const& mode : meson.decayModes) { + i++; + name = s + meson.name + decays[mode] + histname; + histogramId[name] = i; + histograms1D.push_back(registry.add(name, histname, HistType::kTH1F, {axis}, true)); + } } + } - registry.add("DCAeevsmee", "DCAeevsmee", HistType::kTH2F, {{fConfigMBins, "#it{m}_{ee} (GeV/c^{2})"}, {fConfigDCABins, "DCA_{xy}^{ee} (cm)"}}, true); - registry.add("DCAeevsptee", "DCAeevsptee", HistType::kTH2F, {{fConfigPtBins, "#it{p}_{T,ee} (GeV/c)"}, {fConfigDCABins, "DCA_{xy}^{ee} (cm)"}}, true); - - for (auto& particle : fParticleListNames) { - fmee.push_back(registry.add(Form("mee_%s", particle.Data()), Form("mee_%s", particle.Data()), HistType::kTH1F, {mAxis}, true)); - fmee_orig.push_back(registry.add(Form("mee_orig_%s", particle.Data()), Form("mee_orig_%s", particle.Data()), HistType::kTH1F, {mAxis}, true)); - fmotherpT_orig.push_back(registry.add(Form("motherpT_orig_%s", particle.Data()), Form("motherpT_orig_%s", particle.Data()), HistType::kTH1F, {ptAxis}, true)); - fphi.push_back(registry.add(Form("phi_%s", particle.Data()), Form("phi_%s", particle.Data()), HistType::kTH1F, {phiAxis}, true)); - fphi_orig.push_back(registry.add(Form("phi_orig_%s", particle.Data()), Form("phi_orig_%s", particle.Data()), HistType::kTH1F, {phiAxis}, true)); - frap.push_back(registry.add(Form("rap_%s", particle.Data()), Form("rap_%s", particle.Data()), HistType::kTH1F, {rapAxis}, true)); - frap_orig.push_back(registry.add(Form("rap_orig_%s", particle.Data()), Form("rap_orig_%s", particle.Data()), HistType::kTH1F, {rapAxis}, true)); - fpteevsmee.push_back(registry.add(Form("pteevsmee_%s", particle.Data()), Form("pteevsmee_%s", particle.Data()), HistType::kTH2F, {mAxis, ptAxis}, true)); - fpteevsmee_orig.push_back(registry.add(Form("pteevsmee_orig_%s", particle.Data()), Form("pteevsmee_orig_%s", particle.Data()), HistType::kTH2F, {mAxis, ptAxis}, true)); - fmee_wALT.push_back(registry.add(Form("mee_wALT_%s", particle.Data()), Form("mee_wALT_%s", particle.Data()), HistType::kTH1F, {mAxis}, true)); - fmee_orig_wALT.push_back(registry.add(Form("mee_orig_wALT_%s", particle.Data()), Form("mee_orig_wALT_%s", particle.Data()), HistType::kTH1F, {mAxis}, true)); - fmotherpT_orig_wALT.push_back(registry.add(Form("motherpT_orig_wALT_%s", particle.Data()), Form("motherpT_orig_wALT%s", particle.Data()), HistType::kTH1F, {ptAxis}, true)); - fpteevsmee_wALT.push_back(registry.add(Form("pteevsmee_wALT%s", particle.Data()), Form("pteevsmee_wALT_%s", particle.Data()), HistType::kTH2F, {mAxis, ptAxis}, true)); - fpteevsmee_orig_wALT.push_back(registry.add(Form("pteevsmee_orig_wALT%s", particle.Data()), Form("pteevsmee_orig_wALT_%s", particle.Data()), HistType::kTH2F, {mAxis, ptAxis}, true)); + void addHistogram1D(TString histname, AxisSpec axis, int& i) + { + for (auto s : stage) { + addHistogram1D_stage(histname, axis, i, s); } - - fmee.push_back(registry.add("mee", "mee", HistType::kTH1F, {mAxis}, true)); - fmee_orig.push_back(registry.add("mee_orig", "mee_orig", HistType::kTH1F, {mAxis}, true)); - fmotherpT_orig.push_back(registry.add("motherpT_orig", "motherpT_orig", HistType::kTH1F, {ptAxis}, true)); - fphi.push_back(registry.add("phi", "phi", HistType::kTH1F, {phiAxis}, true)); - fphi_orig.push_back(registry.add("phi_orig", "phi_orig", HistType::kTH1F, {phiAxis}, true)); - frap.push_back(registry.add("rap", "rap", HistType::kTH1F, {rapAxis}, true)); - frap_orig.push_back(registry.add("rap_orig", "rap_orig", HistType::kTH1F, {rapAxis}, true)); - fpteevsmee.push_back(registry.add("pteevsmee", "pteevsmee", HistType::kTH2F, {mAxis, ptAxis}, true)); - fpteevsmee_orig.push_back(registry.add("pteevsmee_orig", "pteevsmee_orig", HistType::kTH2F, {mAxis, ptAxis}, true)); - fmee_wALT.push_back(registry.add("mee_wALT", "mee_wALT", HistType::kTH1F, {mAxis}, true)); - fmee_orig_wALT.push_back(registry.add("mee_orig_wALT", "mee_orig_wALT", HistType::kTH1F, {mAxis}, true)); - fmotherpT_orig_wALT.push_back(registry.add("motherpT_orig_wALT", "motherpT_orig_wALT", HistType::kTH1F, {ptAxis}, true)); - fpteevsmee_wALT.push_back(registry.add("pteevsmee_wALT", "pteevsmee_wALT", HistType::kTH2F, {mAxis, ptAxis}, true)); - fpteevsmee_orig_wALT.push_back(registry.add("pteevsmee_orig_wALT", "pteevsmee_orig_wALT", HistType::kTH2F, {mAxis, ptAxis}, true)); } - void SetTree() + void addHistogram1D_mother(TString histname, AxisSpec axis, int& i) // mother histograms only for gen. level, no decay channels { - tree.setObject(new TTree("eeTTree", "eeTTree")); - - tree->Branch("fd1DCA", &treeWords.fd1DCA, "fd1DCA/F"); - tree->Branch("fd2DCA", &treeWords.fd2DCA, "fd2DCA/F"); - tree->Branch("fpairDCA", &treeWords.fpairDCA, "fpairDCA/F"); - tree->Branch("fd1origpt", &treeWords.fd1origpt, "fd1origpt/F"); - tree->Branch("fd1origp", &treeWords.fd1origp, "fd1origp/F"); - tree->Branch("fd1origeta", &treeWords.fd1origeta, "fd1origeta/F"); - tree->Branch("fd1origphi", &treeWords.fd1origphi, "fd1origphi/F"); - tree->Branch("fd2origpt", &treeWords.fd2origpt, "fd2origpt/F"); - tree->Branch("fd2origp", &treeWords.fd2origp, "fd2origp/F"); - tree->Branch("fd2origeta", &treeWords.fd2origeta, "fd2origeta/F"); - tree->Branch("fd2origphi", &treeWords.fd2origphi, "fd2origphi/F"); - tree->Branch("fd1pt", &treeWords.fd1pt, "fd1pt/F"); - tree->Branch("fd1p", &treeWords.fd1p, "fd1p/F"); - tree->Branch("fd1eta", &treeWords.fd1eta, "fd1eta/F"); - tree->Branch("fd1phi", &treeWords.fd1phi, "fd1phi/F"); - tree->Branch("fd2pt", &treeWords.fd2pt, "fd2pt/F"); - tree->Branch("fd2p", &treeWords.fd2p, "fd2p/F"); - tree->Branch("fd2eta", &treeWords.fd2eta, "fd2eta/F"); - tree->Branch("fd2phi", &treeWords.fd2phi, "fd2phi/F"); - tree->Branch("feeorigpt", &treeWords.feeorigpt, "feeorigpt/F"); - tree->Branch("feeorigp", &treeWords.feeorigp, "feeorigp/F"); - tree->Branch("feeorigm", &treeWords.feeorigm, "feeorigm/F"); - tree->Branch("feeorigeta", &treeWords.feeorigeta, "feeorigeta/F"); - tree->Branch("feeorigphi", &treeWords.feeorigphi, "feeorigphi/F"); - tree->Branch("feeorigphiv", &treeWords.feeorigphiv, "feeorigphiv/F"); - tree->Branch("feept", &treeWords.feept, "feept/F"); - tree->Branch("feemt", &treeWords.feemt, "feemt/F"); - tree->Branch("feep", &treeWords.feep, "feep/F"); - tree->Branch("feem", &treeWords.feem, "feem/F"); - tree->Branch("feeeta", &treeWords.feeeta, "feeeta/F"); - tree->Branch("feephi", &treeWords.feephi, "feephi/F"); - tree->Branch("feephiv", &treeWords.feephiv, "feephiv/F"); - tree->Branch("fmotherpt", &treeWords.fmotherpt, "fmotherpt/F"); - tree->Branch("fmothermt", &treeWords.fmothermt, "fmothermt/F"); - tree->Branch("fmotherp", &treeWords.fmotherp, "fmotherp/F"); - tree->Branch("fmotherm", &treeWords.fmotherm, "fmotherm/F"); - tree->Branch("fmothereta", &treeWords.fmothereta, "fmothereta/F"); - tree->Branch("fmotherphi", &treeWords.fmotherphi, "fmotherphi/F"); - tree->Branch("fID", &treeWords.fID, "fID/I"); - tree->Branch("fdectyp", &treeWords.fdectyp, "fdectyp/I"); - tree->Branch("fdau3pdg", &treeWords.fdau3pdg, "fdau3pdg/I"); - tree->Branch("fweight", &treeWords.fweight, "fweight/F"); - tree->Branch("fwEffpT", &treeWords.fwEffpT, "fwEffpT/F"); - tree->Branch("fwMultpT", &treeWords.fwMultpT, "fwMultpT/F"); - tree->Branch("fwMultmT", &treeWords.fwMultmT, "fwMultmT/F"); - tree->Branch("fwMultpT2", &treeWords.fwMultpT2, "fwMultpT2/F"); - tree->Branch("fwMultmT2", &treeWords.fwMultmT2, "fwMultmT2/F"); - tree->Branch("fpass", &treeWords.fpass, "fpass/B"); + i++; + TString name = stage[0] + histname; + histogramId[name] = i; + histograms1D.push_back(registry.add(name, histname, HistType::kTH1F, {axis}, true)); + for (auto const& [pdg, meson] : mesons) { + i++; + name = stage[0] + meson.name + histname; + histogramId[name] = i; + histograms1D.push_back(registry.add(name, histname, HistType::kTH1F, {axis}, true)); + } } - void GetEffHisto(TString filename, TString histname) + void addHistogram2D_stage(TString histname, AxisSpec axis1, AxisSpec axis2, int& i, TString s) { - // get efficiency histo - LOGP(info, "Set Efficiency histo"); - // Get Efficiency weight file: - TFile* fFile = TFile::Open(filename.Data()); - if (!fFile) { - LOGP(error, "Could not open Efficiency file {}", filename.Data()); - return; - } - if (fFile->GetListOfKeys()->Contains(histname.Data())) { - fhwEffpT = reinterpret_cast(fFile->Get(histname.Data())); // histo: eff weight in function of pT. - fhwEffpT->SetDirectory(nullptr); - } else { - LOGP(error, "Could not open histogram {} from file {}", histname.Data(), filename.Data()); + i++; + TString name = s + histname; + histogramId[name] = i; + histograms2D.push_back(registry.add(name, histname, HistType::kTH2F, {axis1, axis2}, true)); + for (auto const& [pdg, meson] : mesons) { + i++; + name = s + meson.name + histname; + histogramId[name] = i; + histograms2D.push_back(registry.add(name, histname, HistType::kTH2F, {axis1, axis2}, true)); + for (auto const& mode : meson.decayModes) { + i++; + name = s + meson.name + decays[mode] + histname; + histogramId[name] = i; + histograms2D.push_back(registry.add(name, histname, HistType::kTH2F, {axis1, axis2}, true)); + } } - - fFile->Close(); } - void InitSmearer(TString filename, TString ptHistName, TString etaHistName, TString phiPosHistName, TString phiNegHistName) + void addHistogram2D(TString histname, AxisSpec axis1, AxisSpec axis2, int& i) { - smearer.setResFileName(filename); - smearer.setResPtHistName(ptHistName); - smearer.setResEtaHistName(etaHistName); - smearer.setResPhiPosHistName(phiPosHistName); - smearer.setResPhiNegHistName(phiNegHistName); - smearer.init(); + for (auto s : stage) { + addHistogram2D_stage(histname, axis1, axis2, i, s); + } } - void GetDCATemplates(TString filename, TString histname) + template + void addHistogramND_stage(TString histname, TAxes const& axes, int& i, TString s) { - // get dca tamplates - LOGP(info, "Set DCA templates"); - // Get file: - TFile* fFile = TFile::Open(filename.Data()); - if (!fFile) { - LOGP(error, "Could not open DCATemplate file {}", filename.Data()); - return; - } - fh_DCAtemplates = new TH1F*[nbDCAtemplate]; - for (int jj = 0; jj < nbDCAtemplate; jj++) { - if (fFile->GetListOfKeys()->Contains(Form("%s%d", histname.Data(), jj + 1))) { - fh_DCAtemplates[jj] = reinterpret_cast(fFile->Get(Form("%s%d", histname.Data(), jj + 1))); - } else { - LOGP(error, "Could not open {}{} from file {}", histname.Data(), jj + 1, filename.Data()); + 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)); } } - fFile->Close(); } - void GetMultHisto(TString filename, TString histnamept, TString histnamept2, TString histnamemt, TString histnamemt2) + template + void addHistogramND(TString histname, TAxes const& axes, int& i) { - // get multiplicity weights - LOGP(info, "Set Multiplicity weight files"); - TFile* fFile = TFile::Open(filename.Data()); - if (!fFile) { - LOGP(error, "Could not open Multiplicity weight file {}", filename.Data()); - return; + for (auto s : stage) { + addHistogramND_stage(histname, axes, i, s); } + } - if (fFile->GetListOfKeys()->Contains(histnamept.Data())) { - fhwMultpT = reinterpret_cast(fFile->Get(histnamept.Data())); // histo: multiplicity weight in function of pT. - } else { - LOGP(error, "Could not open {} from file {}", histnamept.Data(), filename.Data()); - } + void fillHistogram1D(TString histname, int s, int pdg, int other_daughter_pdg, float value, float weight) + { + histograms1D[histogramId[stage[s] + histname]]->Fill(value, weight); + histograms1D[histogramId[stage[s] + mesons[pdg].name + histname]]->Fill(value, weight); + histograms1D[histogramId[stage[s] + mesons[pdg].name + decays[other_daughter_pdg] + histname]]->Fill(value, weight); + } - if (fFile->GetListOfKeys()->Contains(histnamemt.Data())) { - fhwMultmT = reinterpret_cast(fFile->Get(histnamemt.Data())); // histo: multiplicity weight in function of mT. - } else { - LOGP(error, "Could not open {} from file {}", histnamemt.Data(), filename.Data()); - } + void fillHistogram1D_mother(TString histname, int pdg, float value, float weight) + { + histograms1D[histogramId[stage[0] + histname]]->Fill(value, weight); + histograms1D[histogramId[stage[0] + mesons[pdg].name + histname]]->Fill(value, weight); + } - if (fFile->GetListOfKeys()->Contains(histnamept2.Data())) { - fhwMultpT2 = reinterpret_cast(fFile->Get(histnamept2.Data())); // histo: multiplicity weight in function of pT. - } else { - LOGP(error, "Could not open {} from file {}", histnamept2.Data(), filename.Data()); - } + void fillHistogram2D(TString histname, int s, int pdg, int other_daughter_pdg, float value1, float value2, float weight) + { + histograms2D[histogramId[stage[s] + histname]]->Fill(value1, value2, weight); + histograms2D[histogramId[stage[s] + mesons[pdg].name + histname]]->Fill(value1, value2, weight); + histograms2D[histogramId[stage[s] + mesons[pdg].name + decays[other_daughter_pdg] + histname]]->Fill(value1, value2, weight); + } - if (fFile->GetListOfKeys()->Contains(histnamemt2.Data())) { - fhwMultmT2 = reinterpret_cast(fFile->Get(histnamemt2)); // histo: multiplicity weight in function of mT. - } else { - LOGP(error, "Could not open {} from file {}", histnamemt2.Data(), filename.Data()); - } - fFile->Close(); + 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 GetPhotonPtParametrization(TString filename, TString dirname, TString funcname) + void init(InitContext& context) { - LOGP(info, "Set photon parametrization"); + 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}"}; + AxisSpec phiV_axis = {fConfigPhiVBins, "#it{#varphi}_{V,ee}"}; + AxisSpec opAng_axis = {fConfigOpAngBins, "#it{#omega}_{ee}"}; + AxisSpec eta_axis_mother = {fConfigEtaBins, "#it{#eta}_{mother}"}; + AxisSpec pt_axis_mother = {fConfigPtBins, "#it{p}_{T,mother} (GeV/#it{c})"}; + AxisSpec phi_axis_mother = {fConfigPhiBins, "#it{#varphi}_{mother}"}; + AxisSpec dca_axis = {fConfigDcaBins, "DCA_{e}"}; + AxisSpec dcaee_axis = {fConfigDcaBins, "DCA_{ee}"}; + + if (context.mOptions.get("processPairing")) { + registry.add("gen/ULS", "ULS gen.", HistType::kTH2F, {mass_axis, ptee_axis}, true); + registry.add("gen/LSpp", "LS++ gen.", HistType::kTH2F, {mass_axis, ptee_axis}, true); + registry.add("gen/LSmm", "LS-- gen.", HistType::kTH2F, {mass_axis, ptee_axis}, true); + registry.add("rec/ULS", "ULS rec.", HistType::kTH2F, {mass_axis, ptee_axis}, true); + registry.add("rec/LSpp", "LS++ rec.", HistType::kTH2F, {mass_axis, ptee_axis}, true); + registry.add("rec/LSmm", "LS-- rec.", HistType::kTH2F, {mass_axis, ptee_axis}, true); + } + if (context.mOptions.get("processCocktail")) { + int i = -1; + addHistogram1D("Pt", pt_axis, i); + addHistogram1D("Eta", eta_axis, i); + addHistogram1D("Phi", phi_axis, i); + addHistogram1D_mother("Mother_Pt", pt_axis_mother, i); + addHistogram1D_mother("Mother_Eta", eta_axis_mother, i); + addHistogram1D_mother("Mother_Phi", phi_axis_mother, i); + addHistogram1D("PhiV", phiV_axis, i); + addHistogram1D("OpAng", opAng_axis, i); + addHistogram1D("Mee", mass_axis, i); + addHistogram1D("Ptee", ptee_axis, i); + addHistogram1D_stage("Dca", dca_axis, i, "rec/"); + addHistogram1D_stage("Dcaee", dcaee_axis, i, "rec/"); + i = -1; + 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); + } + } - if (filename.EndsWith(".root")) { // read from ROOT file - TFile* fFile = TFile::Open(filename.Data()); - if (!fFile) { - LOGP(error, "Could not open photon parametrization from file {}", filename.Data()); - return; + void processCocktail(McParticlesSmeared const& mcParticles) + { + for (auto const& particle : mcParticles) { + if (particle.has_mothers()) { + continue; + } + int pdg = abs(particle.pdgCode()); + if (mesons.find(pdg) == mesons.end()) { + LOG(error) << "Found mother particle with pdg = " << pdg << " that is not in list of mesons"; + } + if (!particle.has_daughters()) { + LOG(error) << "Found meson with pdg = " << pdg << "that has no daughters"; } - bool good = false; - if (fFile->GetListOfKeys()->Contains(dirname.Data())) { - TDirectory* dir = fFile->GetDirectory(dirname.Data()); - if (dir->GetListOfKeys()->Contains(funcname.Data())) { - ffVPHpT = reinterpret_cast(dir->Get(funcname.Data())); - ffVPHpT->SetNpx(10000); - good = true; + + int other_daughter_pdg = -1; + int nEle = 0; + int nPos = 0; + + ROOT::Math::PtEtaPhiMVector pEleGen, pPosGen, pEleRec, pPosRec; + float weight(1.), effEle(1.), effPos(1.), dcaEle(0.), dcaPos(0.); + for (const auto& daughter : particle.daughters_as()) { + int temp_pdg = daughter.pdgCode(); + if (temp_pdg == 11) { + ROOT::Math::PtEtaPhiMVector temp_p_gen(daughter.pt(), daughter.eta(), daughter.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector temp_p(daughter.ptSmeared(), daughter.etaSmeared(), daughter.phiSmeared(), o2::constants::physics::MassElectron); + pEleGen = temp_p_gen; + pEleRec = temp_p; + weight = daughter.weight(); + effEle = daughter.efficiency(); + dcaEle = daughter.dca(); + nEle++; + continue; + } + if (temp_pdg == -11) { + ROOT::Math::PtEtaPhiMVector temp_p_gen(daughter.pt(), daughter.eta(), daughter.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector temp_p(daughter.ptSmeared(), daughter.etaSmeared(), daughter.phiSmeared(), o2::constants::physics::MassElectron); + pPosGen = temp_p_gen; + pPosRec = temp_p; + effPos = daughter.efficiency(); + dcaPos = daughter.dca(); + nPos++; + continue; } + other_daughter_pdg = abs(other_daughter_pdg * temp_pdg); + } + if (!(((nEle == 1) && (nPos == 1)) || ((nEle == 2) && (nPos == 2)))) { + LOG(error) << "Found decay with wrong number of electrons in decay of meson with pdg " << pdg << ": nElectrons = " << nEle << ", nPositrons = " << nPos; + continue; } - if (!good) { - LOGP(error, "Could not open photon parametrization {}/{} from file {}", dirname.Data(), funcname.Data(), filename.Data()); + if ((nEle == 2) && (nPos == 2) && (other_daughter_pdg == -1)) { + other_daughter_pdg = -2; + weight = 2 * weight; } - fFile->Close(); - } else if (filename.EndsWith(".json")) { // read from JSON file - std::ifstream fFile(filename.Data()); - if (!fFile) { - LOGP(error, "Could not open photon parametrization from file {}", filename.Data()); - return; + auto this_meson_decays = mesons[pdg].decayModes; + if (std::find(this_meson_decays.begin(), this_meson_decays.end(), other_daughter_pdg) == this_meson_decays.end()) { + LOG(error) << "Found decay with code = " << other_daughter_pdg << " that is not in list of decays of meson with pdg " << pdg; + continue; } - nlohmann::json paramfile = nlohmann::json::parse(fFile); - if (paramfile.contains(dirname.Data())) { - nlohmann::json dir = paramfile[dirname.Data()]; - if (dir.contains(funcname.Data())) { - std::string formula = dir[funcname.Data()]; - ffVPHpT = new TF1(TString(funcname.Data()), TString(formula), 0, 100); - if (ffVPHpT) { - ffVPHpT->SetNpx(10000); - return; + + for (int s = 0; s < kNRecLevels; s++) { // s=0: gen, s=1: rec + + ROOT::Math::PtEtaPhiMVector pEle, pPos; + float pairWeight(1.), weightEle(1.), weightPos(1.); + bool acceptedEle(true), acceptedPos(true), acceptedPair(true); + + if (s == kGen) { + pEle = pEleGen; + pPos = pPosGen; + pairWeight = weight; + weightEle = weight; + weightPos = weight; + acceptedEle = true; + acceptedPos = true; + acceptedPair = true; + } else if (s == kRec) { + pEle = pEleRec; + pPos = pPosRec; + pairWeight = weight * effEle * effPos; + weightEle = weight * effEle; + weightPos = weight * effPos; + acceptedEle = isAcceptedSingle(pEle); + acceptedPos = isAcceptedSingle(pPos); + acceptedPair = isAcceptedPair(pEle, pPos); + } + + // single track histograms + if (acceptedEle) + fillHistogram1D("Pt", s, pdg, other_daughter_pdg, pEle.Pt(), weightEle); + if (acceptedPos) + fillHistogram1D("Pt", s, pdg, other_daughter_pdg, pPos.Pt(), weightPos); + + if (acceptedEle) + fillHistogram1D("Eta", s, pdg, other_daughter_pdg, pEle.Eta(), weightEle); + if (acceptedPos) + fillHistogram1D("Eta", s, pdg, other_daughter_pdg, pPos.Eta(), weightPos); + + if (acceptedEle) + fillHistogram1D("Phi", s, pdg, other_daughter_pdg, pEle.Phi(), weightEle); + if (acceptedPos) + fillHistogram1D("Phi", s, pdg, other_daughter_pdg, pPos.Phi(), weightPos); + + if (s == kRec) { // dca only at rec. level + if (acceptedEle) { + fillHistogram1D("Dca", s, pdg, other_daughter_pdg, dcaEle, weightEle); + fillHistogram2D("DcaVsPt", s, pdg, other_daughter_pdg, dcaEle, pEle.Pt(), weightEle); + } + if (acceptedPos) { + fillHistogram1D("Dca", s, pdg, other_daughter_pdg, dcaPos, weightPos); + fillHistogram2D("DcaVsPt", s, pdg, other_daughter_pdg, dcaPos, pPos.Pt(), weightPos); + } + } + + // mother histograms + if (s == kGen) { // only at gen. level + fillHistogram1D_mother("Mother_Pt", pdg, particle.pt(), weight); + fillHistogram1D_mother("Mother_Eta", pdg, particle.eta(), weight); + fillHistogram1D_mother("Mother_Phi", pdg, particle.phi(), weight); + } + + // pair historams + if (acceptedPair) { + ROOT::Math::PtEtaPhiMVector p12 = pEle + pPos; + float mee = p12.M(); + float ptee = p12.Pt(); + 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); + 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); + fillHistogram1D("OpAng", s, pdg, other_daughter_pdg, opAng, pairWeight); + if (s == kRec) { // dca only at rec. level + fillHistogram1D("Dcaee", s, pdg, other_daughter_pdg, dcaee, pairWeight); + fillHistogram2D("DcaeeVsPtee", s, pdg, other_daughter_pdg, dcaee, ptee, pairWeight); + fillHistogram2D("DcaeeVsMee", s, pdg, other_daughter_pdg, dcaee, mee, pairWeight); } } } - LOGP(error, "Could not open photon parametrization {}/{} from file {}", dirname.Data(), funcname.Data(), filename.Data()); - return; - } else { // neither ROOT nor JSON - LOGP(error, "Not compatible file format for {}", filename.Data()); - } + + } // end particle loop } + PROCESS_SWITCH(lmeelfcocktail, processCocktail, "Process cocktail", true); + + // ULS and LS spectra + Preslice perCollision = aod::mcparticle::mcCollisionId; + Partition Electrons = (aod::mcparticle::pdgCode == 11); + Partition Positrons = (aod::mcparticle::pdgCode == -11); - void fillKrollWada() + void processPairing(aod::McCollisions const& mcCollisions, McParticlesSmeared const& mcParticles) { - // Build Kroll-wada for virtual photon mass parametrization: - Double_t KWmass = 0.; - Int_t KWnbins = 10000; - Float_t KWmin = 2. * eMass; - Double_t KWbinwidth = (fConfigKWMax - KWmin) / (Double_t)KWnbins; - fhKW = new TH1F("fhKW", "fhKW", KWnbins, KWmin, fConfigKWMax); - for (Int_t ibin = 1; ibin <= KWnbins; ibin++) { - KWmass = KWmin + (Double_t)(ibin - 1) * KWbinwidth + KWbinwidth / 2.0; - fhKW->AddBinContent(ibin, 2. * (1. / 137.03599911) / 3. / 3.14159265359 / KWmass * sqrt(1. - 4. * eMass * eMass / KWmass / KWmass) * (1. + 2. * eMass * eMass / KWmass / KWmass)); + + for (auto const& mcCollision : mcCollisions) { + auto const electronsGrouped = Electrons->sliceBy(perCollision, mcCollision.globalIndex()); + auto const positronsGrouped = Positrons->sliceBy(perCollision, mcCollision.globalIndex()); + + // ULS spectrum + for (auto const& [p1, p2] : combinations(o2::soa::CombinationsFullIndexPolicy(electronsGrouped, positronsGrouped))) { + if (!(from_primary(p1, mcParticles) && from_primary(p2, mcParticles))) { + continue; + } + ROOT::Math::PtEtaPhiMVector v1_gen(p1.pt(), p1.eta(), p1.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2_gen(p2.pt(), p2.eta(), p2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12_gen = v1_gen + v2_gen; + registry.fill(HIST("gen/ULS"), v12_gen.M(), v12_gen.Pt(), p1.weight() * p2.weight()); + if (isAcceptedPair(p1, p2)) { + ROOT::Math::PtEtaPhiMVector v1(p1.ptSmeared(), p1.etaSmeared(), p1.phiSmeared(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(p2.ptSmeared(), p2.etaSmeared(), p2.phiSmeared(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + registry.fill(HIST("rec/ULS"), v12.M(), v12.Pt(), p1.weight() * p2.weight() * p1.efficiency() * p2.efficiency()); + } + } + // LS spectra + for (auto& [p1, p2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(electronsGrouped, electronsGrouped))) { + if (!(from_primary(p1, mcParticles) && from_primary(p2, mcParticles))) { + continue; + } + ROOT::Math::PtEtaPhiMVector v1_gen(p1.pt(), p1.eta(), p1.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2_gen(p2.pt(), p2.eta(), p2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12_gen = v1_gen + v2_gen; + registry.fill(HIST("gen/LSmm"), v12_gen.M(), v12_gen.Pt(), p1.weight() * p2.weight()); + if (isAcceptedPair(p1, p2)) { + ROOT::Math::PtEtaPhiMVector v1(p1.ptSmeared(), p1.etaSmeared(), p1.phiSmeared(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(p2.ptSmeared(), p2.etaSmeared(), p2.phiSmeared(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + registry.fill(HIST("rec/LSmm"), v12.M(), v12.Pt(), p1.weight() * p2.weight() * p1.efficiency() * p2.efficiency()); + } + } + for (auto& [p1, p2] : combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(positronsGrouped, positronsGrouped))) { + if (!(from_primary(p1, mcParticles) && from_primary(p2, mcParticles))) { + continue; + } + ROOT::Math::PtEtaPhiMVector v1_gen(p1.pt(), p1.eta(), p1.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2_gen(p2.pt(), p2.eta(), p2.phi(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12_gen = v1_gen + v2_gen; + registry.fill(HIST("gen/LSpp"), v12_gen.M(), v12_gen.Pt(), p1.weight() * p2.weight()); + if (isAcceptedPair(p1, p2)) { + ROOT::Math::PtEtaPhiMVector v1(p1.ptSmeared(), p1.etaSmeared(), p1.phiSmeared(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v2(p2.ptSmeared(), p2.etaSmeared(), p2.phiSmeared(), o2::constants::physics::MassElectron); + ROOT::Math::PtEtaPhiMVector v12 = v1 + v2; + registry.fill(HIST("rec/LSpp"), v12.M(), v12.Pt(), p1.weight() * p2.weight() * p1.efficiency() * p2.efficiency()); + } + } } } + PROCESS_SWITCH(lmeelfcocktail, processPairing, "Process ULS and LS pairing", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - WorkflowSpec specs; - std::vector inputs; - inputs.emplace_back("mctracks", "MC", "MCTRACKS", 0., Lifetime::Timeframe); - DataProcessorSpec dSpec = adaptAnalysisTask(cfgc, TaskName{"em-lmee-lf-cocktail"}); - dSpec.inputs = inputs; - specs.emplace_back(dSpec); - return specs; + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName("em-lmee-lf-cocktail"))}; } 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..7c960add267 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,7 +857,7 @@ 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; @@ -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 6f6f23bb45b..f39f89bed10 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; @@ -58,7 +63,6 @@ struct vpPairQC { Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; - Configurable maxY{"maxY", 0.9, "maximum rapidity for reconstructed particles"}; ConfigurableAxis ConfPtlBins{"ConfPtlBins", {VARIABLE_WIDTH, 0.00, 0.10, 0.11, 0.12, 0.13, 0.14, 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"}; EMEventCut fEMEventCut; @@ -72,9 +76,14 @@ 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"}; } eventcuts; DielectronCut fDielectronCut; @@ -94,20 +103,29 @@ 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", 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.1, "min 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"}; 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_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"}; @@ -125,9 +143,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)"}; @@ -195,12 +217,7 @@ struct vpPairQC { mRunNumber = collision.runNumber(); } - ~vpPairQC() - { - if (eid_bdt) { - delete eid_bdt; - } - } + ~vpPairQC() {} void addhistograms() { @@ -215,8 +232,9 @@ struct vpPairQC { fRegistry.add("Track/positive/hQoverPt", "q/pT;q/p_{T} (GeV/c)^{-1}", kTH1F, {{400, -20, 20}}, false); fRegistry.add("Track/positive/hPResolution", "p resolution;p (GeV/c);#Deltap/p", kTH2F, {{1000, 0.0f, 10.0f}, {100, 0.0f, 0.1f}}, false); fRegistry.add("Track/positive/hPtResolution", "p_{T} resolution;p (GeV/c);#Deltap_{T}/p_{T}", kTH2F, {{1000, 0.0f, 10.0f}, {100, 0.0f, 0.1f}}, false); - fRegistry.add("Track/positive/hThetaResolution", "#theta resolution;p (GeV/c);#Delta#theta (rad.)", kTH2F, {{1000, 0.0f, 10.0f}, {200, 0.0f, 0.02f}}, false); - fRegistry.add("Track/positive/hPhiResolution", "#varphi resolution;p (GeV/c);#Delta#varphi (rad.)", kTH2F, {{1000, 0.0f, 10.0f}, {200, 0.0f, 0.02f}}, false); + fRegistry.add("Track/positive/hThetaResolution", "#theta resolution;p (GeV/c);#Delta#theta (rad.)", kTH2F, {{1000, 0.0f, 10.0f}, {100, 0.0f, 0.01f}}, false); + fRegistry.add("Track/positive/hEtaResolution", "#eta resolution;p (GeV/c);#Delta#eta", kTH2F, {{1000, 0.0f, 10.0f}, {100, 0.0f, 0.01f}}, false); + fRegistry.add("Track/positive/hPhiResolution", "#varphi resolution;p (GeV/c);#Delta#varphi (rad.)", kTH2F, {{1000, 0.0f, 10.0f}, {100, 0.0f, 0.01f}}, 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, {{200, 0, 10}, {200, 0., 400}}, false); @@ -245,7 +263,7 @@ struct vpPairQC { fRegistry.addClone("Track/positive/", "Track/negative/"); const AxisSpec axis_mass{50, 0, 0.05, "m_{ee} (GeV/c^{2})"}; - const AxisSpec axis_pair_pt{500, 0, 5, "p_{T,ee} (GeV/c)"}; + const AxisSpec axis_pair_pt{200, 0, 2, "p_{T,ee} (GeV/c)"}; const AxisSpec axis_pair_dca_3d{100, 0, 10, "DCA_{ee}^{3D} (#sigma)"}; const AxisSpec axis_pair_dca_xy{100, 0, 10, "DCA_{ee}^{XY} (#sigma)"}; const AxisSpec axis_phiv{90, 0, M_PI, "#varphi_{V} (rad.)"}; @@ -267,11 +285,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"); @@ -281,7 +301,11 @@ 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 - fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + if (dielectroncuts.cfg_apply_phiv_meedep) { + fDielectronCut.SetMaxPhivPairMeeDep([&](float mll) { return (mll - dielectroncuts.cfg_phiv_intercept) / dielectroncuts.cfg_phiv_slope; }); + } else { + fDielectronCut.SetPhivPairRange(dielectroncuts.cfg_min_phiv, dielectroncuts.cfg_max_phiv, dielectroncuts.cfg_min_mee_for_phiv, dielectroncuts.cfg_max_mee_for_phiv); + } fDielectronCut.ApplyPhiV(dielectroncuts.cfg_apply_phiv); fDielectronCut.ApplyPrefilter(dielectroncuts.cfg_apply_pf); fDielectronCut.RequireITSibAny(dielectroncuts.cfg_require_itsib_any); @@ -290,6 +314,7 @@ struct vpPairQC { // for track fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); 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); fDielectronCut.SetMinNCrossedRowsTPC(dielectroncuts.cfg_min_ncrossedrows); fDielectronCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); @@ -297,8 +322,10 @@ struct vpPairQC { 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_max_p_its_cluster_size); - fDielectronCut.SetMaxDcaXY(dielectroncuts.cfg_max_dcaxy); - fDielectronCut.SetMaxDcaZ(dielectroncuts.cfg_max_dcaz); + 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); @@ -311,21 +338,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 } @@ -347,9 +383,6 @@ struct vpPairQC { 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; - if (abs(v12.Rapidity()) > maxY) { - return false; - } 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 dca_t1 = dca3DinSigma(t1); @@ -384,7 +417,8 @@ struct vpPairQC { fRegistry.fill(HIST("Track/positive/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/positive/hPResolution"), track.p(), sigmaP(track) / track.p()); fRegistry.fill(HIST("Track/positive/hPtResolution"), track.p(), sigmaPt(track) / track.pt()); - fRegistry.fill(HIST("Track/positive/hThetaResolution"), track.p(), sigmaLambda(track)); + fRegistry.fill(HIST("Track/positive/hThetaResolution"), track.p(), sigmaTheta(track)); + fRegistry.fill(HIST("Track/positive/hEtaResolution"), track.p(), sigmaEta(track)); fRegistry.fill(HIST("Track/positive/hPhiResolution"), track.p(), sigmaPhi(track)); 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())); @@ -417,7 +451,8 @@ struct vpPairQC { fRegistry.fill(HIST("Track/negative/hQoverPt"), track.sign() / track.pt()); fRegistry.fill(HIST("Track/negative/hPResolution"), track.p(), sigmaP(track) / track.p()); fRegistry.fill(HIST("Track/negative/hPtResolution"), track.p(), sigmaPt(track) / track.pt()); - fRegistry.fill(HIST("Track/negative/hThetaResolution"), track.p(), sigmaLambda(track)); + fRegistry.fill(HIST("Track/negative/hThetaResolution"), track.p(), sigmaTheta(track)); + fRegistry.fill(HIST("Track/negative/hEtaResolution"), track.p(), sigmaEta(track)); fRegistry.fill(HIST("Track/negative/hPhiResolution"), track.p(), sigmaPhi(track)); 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())); @@ -448,6 +483,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 add2cb33b2b..bfe6e1f3429 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,14 @@ 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"}; } eventcuts; DielectronCut fDielectronCut; @@ -98,13 +108,20 @@ struct vpPairQCMC { 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", -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"}; 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_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"}; @@ -122,9 +139,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)"}; @@ -270,11 +291,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"); @@ -293,15 +316,18 @@ struct vpPairQCMC { // for track fDielectronCut.SetTrackPtRange(dielectroncuts.cfg_min_pt_track, 1e+10f); 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); fDielectronCut.SetMinNCrossedRowsTPC(dielectroncuts.cfg_min_ncrossedrows); fDielectronCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); 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.SetMaxDcaXY(dielectroncuts.cfg_max_dcaxy); - fDielectronCut.SetMaxDcaZ(dielectroncuts.cfg_max_dcaz); + 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); @@ -313,23 +339,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 } @@ -492,6 +526,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 1609f2f5823..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(); @@ -69,16 +81,22 @@ float sigmaPhi(T const& track) } //_______________________________________________________________________ template -float sigmaLambda(T const& track) +float sigmaTheta(T const& track) { return std::sqrt(track.cTglTgl()) / (1.f + std::pow(track.tgl(), 2)); // theta resolution = lambda resolution. // lambda = pi/2 - theta. theta is polar angle. } //_______________________________________________________________________ template +float sigmaEta(T const& track) +{ + return std::sqrt(track.cTglTgl()) / std::sqrt(1.f + std::pow(track.tgl(), 2)); +} +//_______________________________________________________________________ +template float sigmaP(T const& track) { - // p = pT x cosh(eta); - return std::sqrt(std::pow(std::cosh(track.eta()) * sigmaPt(track), 2) + std::pow(track.pt() * std::sinh(track.eta()) * std::cosh(track.eta()) * sigmaLambda(track), 2)); + // p = 1/1/pT x 1/cos(lambda); + return std::sqrt(std::pow(1.f / track.signed1Pt(), 4) * ((1.f + std::pow(track.tgl(), 2)) * track.c1Pt21Pt2() + 1.f / (1.f + std::pow(track.tgl(), 2)) * std::pow(track.signed1Pt() * track.tgl(), 2) * track.cTglTgl() - 2.f * track.signed1Pt() * track.tgl() * track.c1PtTgl())); } //_______________________________________________________________________ } // namespace o2::aod::pwgem::dilepton::utils::emtrackutil diff --git a/PWGEM/Dilepton/Utils/EventHistograms.h b/PWGEM/Dilepton/Utils/EventHistograms.h index 410cf65120e..89609c336f8 100644 --- a/PWGEM/Dilepton/Utils/EventHistograms.h +++ b/PWGEM/Dilepton/Utils/EventHistograms.h @@ -23,7 +23,7 @@ template void addEventHistograms(HistogramRegistry* fRegistry) { // event info - auto hCollisionCounter = fRegistry->add("Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1F, {{nbin_ev, 0.5, nbin_ev + 0.5}}, false); + auto hCollisionCounter = fRegistry->add("Event/before/hCollisionCounter", "collision counter;;Number of events", kTH1D, {{nbin_ev, 0.5, nbin_ev + 0.5}}, false); hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); hCollisionCounter->GetXaxis()->SetBinLabel(2, "FT0AND"); hCollisionCounter->GetXaxis()->SetBinLabel(3, "No TF border"); @@ -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()}; @@ -283,47 +252,7 @@ void fillEventInfo(HistogramRegistry* fRegistry, TCollision const& collision, co fRegistry->fill(HIST("Event/") + HIST(event_types[ev_id]) + HIST("hPrfQ3FT0CQ3BNeg_CentFT0C"), collision.centFT0C(), RecoDecay::dotProd(q3ft0c, q3bneg)); 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..c50b3c74495 100644 --- a/PWGEM/Dilepton/Utils/PairUtilities.h +++ b/PWGEM/Dilepton/Utils/PairUtilities.h @@ -316,5 +316,10 @@ inline float getOpeningAngle(float pxpos, float pypos, float pzpos, float pxneg, return std::acos(clipToPM1(argcos)); } //_______________________________________________________________________ +inline float pairDCAQuadSum(const float dca1, const float dca2) +{ + return 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 502e5b283a1..4fea46fe3cd 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.cxx @@ -61,6 +61,11 @@ void EMCPhotonCut::SetUseExoticCut(bool flag) mUseExoticCut = flag; LOG(info) << "EMCal Photon Cut, set usage of exotic cluster cut to: " << mUseExoticCut; } +void EMCPhotonCut::SetUseTM(bool flag) +{ + mUseTM = flag; + LOG(info) << "EM Photon Cluster Cut, using TM cut is set to : " << mUseTM; +} void EMCPhotonCut::print() const { diff --git a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h index 533beffa524..2ce3d91173c 100644 --- a/PWGEM/PhotonMeson/Core/EMCPhotonCut.h +++ b/PWGEM/PhotonMeson/Core/EMCPhotonCut.h @@ -61,7 +61,7 @@ class EMCPhotonCut : public TNamed if (!IsSelectedEMCal(EMCPhotonCuts::kTiming, cluster)) { return false; } - if (!IsSelectedEMCal(EMCPhotonCuts::kTM, cluster)) { + if (mUseTM && (!IsSelectedEMCal(EMCPhotonCuts::kTM, cluster))) { return false; } if (!IsSelectedEMCal(EMCPhotonCuts::kExotic, cluster)) { @@ -121,6 +121,7 @@ class EMCPhotonCut : public TNamed void SetTrackMatchingPhi(std::function funcTM); void SetMinEoverP(float min = 0.7f); void SetUseExoticCut(bool flag = true); + void SetUseTM(bool flag = true); /// @brief Print the cluster selection void print() const; @@ -135,6 +136,7 @@ class EMCPhotonCut : public TNamed float mMaxTime{25.f}; ///< maximum cluster timing float mMinEoverP{1.75f}; ///< minimum cluster energy over track momentum ratio needed for the pair to be considered matched bool mUseExoticCut{true}; ///< flag to decide if the exotic cluster cut is to be checked or not + bool mUseTM{true}; ///< flag to decide if track matching cut is to be checek or not std::function mTrackMatchingEta{}; ///< function to get check if a pre matched track and cluster pair is considered an actual match for eta std::function mTrackMatchingPhi{}; ///< function to get check if a pre matched track and cluster pair is considered an actual match for phi diff --git a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h index 454d264aa88..32f9ed1149d 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h @@ -67,7 +67,7 @@ using namespace o2::aod::pwgem::photon; using namespace o2::aod::pwgem::dilepton::utils::emtrackutil; using namespace o2::aod::pwgem::dilepton::utils; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyV0Photons = soa::Join; @@ -117,6 +117,7 @@ struct Pi0EtaToGammaGamma { 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 onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; } eventcuts; V0PhotonCut fV0PhotonCut; @@ -320,7 +321,6 @@ struct Pi0EtaToGammaGamma { fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefinePCMCut() @@ -416,13 +416,15 @@ struct Pi0EtaToGammaGamma { 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 = EMCPhotonCut("fEMCCut", "fEMCCut"); + 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 + pow(pT + b, c); }); + fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); fEMCCut.SetMinEoverP(emccuts.EMC_Eoverp); fEMCCut.SetUseExoticCut(emccuts.EMC_UseExoticCut); @@ -435,7 +437,7 @@ struct Pi0EtaToGammaGamma { /// \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) + 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) { // if less than 3 clusters are present skip event since we need at least 3 clusters if (photons_coll.size() < 3) { @@ -475,10 +477,10 @@ struct Pi0EtaToGammaGamma { } if (openingAngle1 > emccuts.minOpenAngle && abs(mother1.Rapidity()) < maxY && iCellID_photon1 > 0) { - fRegistry.fill(HIST("Pair/rotation/hs"), mother1.M(), mother1.Pt()); + fRegistry.fill(HIST("Pair/rotation/hs"), mother1.M(), mother1.Pt(), eventWeight); } if (openingAngle2 > emccuts.minOpenAngle && abs(mother2.Rapidity()) < maxY && iCellID_photon2 > 0) { - fRegistry.fill(HIST("Pair/rotation/hs"), mother2.M(), mother2.Pt()); + fRegistry.fill(HIST("Pair/rotation/hs"), mother2.M(), mother2.Pt(), eventWeight); } } } @@ -512,6 +514,10 @@ struct Pi0EtaToGammaGamma { continue; } + if (eventcuts.onlyKeepWeightedEvents && fabs(collision.weight() - 1.) < 1E-10) { + continue; + } + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -576,10 +582,10 @@ struct Pi0EtaToGammaGamma { continue; } - fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), collision.weight()); if constexpr (pairtype == PairType::kEMCEMC) { - RotationBackground(v12, v1, v2, photons2_per_collision, g1.globalIndex(), g2.globalIndex()); + RotationBackground(v12, v1, v2, photons2_per_collision, g1.globalIndex(), g2.globalIndex(), collision.weight()); } std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); @@ -633,7 +639,7 @@ struct Pi0EtaToGammaGamma { continue; } - fRegistry.fill(HIST("Pair/same/hs"), veeg.M(), veeg.Pt()); + fRegistry.fill(HIST("Pair/same/hs"), veeg.M(), veeg.Pt(), collision.weight()); std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::tuple tuple_tmp_id2 = std::make_tuple(ndf, collision.globalIndex(), pos2.trackId(), ele2.trackId()); @@ -646,8 +652,8 @@ struct Pi0EtaToGammaGamma { used_dileptonIds.emplace_back(tuple_tmp_id2); } ndiphoton++; - } // end of dielectron loop - } // end of g1 loop + } // end of dielectron loop + } // end of g1 loop } else { // PCM-EMC, PCM-PHOS. Nightmare. don't run these pairs. auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); @@ -663,7 +669,7 @@ struct Pi0EtaToGammaGamma { continue; } - fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), collision.weight()); std::pair pair_tmp_id1 = std::make_pair(ndf, g1.globalIndex()); std::pair pair_tmp_id2 = std::make_pair(ndf, g2.globalIndex()); @@ -678,7 +684,7 @@ struct Pi0EtaToGammaGamma { } ndiphoton++; } // end of pairing loop - } // end of pairing in same event + } // end of pairing in same event // event mixing if (!cfgDoMix || !(ndiphoton > 0)) { @@ -713,7 +719,7 @@ struct Pi0EtaToGammaGamma { continue; } - fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); } } } // end of loop over mixed event pool @@ -741,7 +747,7 @@ struct Pi0EtaToGammaGamma { if (abs(v12.Rapidity()) > maxY) { continue; } - fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); } } } // end of loop over mixed event pool @@ -767,7 +773,7 @@ struct Pi0EtaToGammaGamma { if (abs(v12.Rapidity()) > maxY) { continue; } - fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt()); + fRegistry.fill(HIST("Pair/mix/hs"), v12.M(), v12.Pt(), collision.weight()); } } } // end of loop over mixed event pool @@ -781,6 +787,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 be80a774247..c342423eff9 100644 --- a/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h +++ b/PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h @@ -56,7 +56,7 @@ using namespace o2::aod::pwgem::photonmeson::photonpair; using namespace o2::aod::pwgem::photonmeson::utils::mcutil; using namespace o2::aod::pwgem::dilepton::utils::mcutil; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyMCCollisions = soa::Join; @@ -107,6 +107,7 @@ struct Pi0EtaToGammaGammaMC { 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 onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; } eventcuts; V0PhotonCut fV0PhotonCut; @@ -288,7 +289,6 @@ struct Pi0EtaToGammaGammaMC { fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefinePCMCut() @@ -383,13 +383,15 @@ struct Pi0EtaToGammaGammaMC { 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 = EMCPhotonCut("fEMCCut", "fEMCCut"); + 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 + pow(pT + b, c); }); + fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); fEMCCut.SetMinEoverP(emccuts.EMC_Eoverp); fEMCCut.SetUseExoticCut(emccuts.EMC_UseExoticCut); @@ -428,6 +430,10 @@ struct Pi0EtaToGammaGammaMC { continue; } + if (eventcuts.onlyKeepWeightedEvents && fabs(collision.weight() - 1.) < 1E-10) { + continue; + } + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; @@ -503,10 +509,10 @@ struct Pi0EtaToGammaGammaMC { if (pi0id > 0) { auto pi0mc = mcparticles.iteratorAt(pi0id); - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); } else if (etaid > 0) { auto etamc = mcparticles.iteratorAt(etaid); - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); } } // end of pairing loop } else if constexpr (pairtype == PairType::kPCMDalitzEE) { @@ -563,13 +569,13 @@ struct Pi0EtaToGammaGammaMC { } if (pi0id > 0) { auto pi0mc = mcparticles.iteratorAt(pi0id); - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); } else if (etaid > 0) { auto etamc = mcparticles.iteratorAt(etaid); - o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0); + o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); } - } // end of dielectron loop - } // end of pcm loop + } // end of dielectron loop + } // end of pcm loop } else { // PCM-EMC, PCM-PHOS. Nightmare. don't run these pairs. auto photons1_per_collision = photons1.sliceBy(perCollision1, collision.globalIndex()); auto photons2_per_collision = photons2.sliceBy(perCollision2, collision.globalIndex()); @@ -586,14 +592,14 @@ struct Pi0EtaToGammaGammaMC { } // if (pi0id > 0) { // auto pi0mc = mcparticles.iteratorAt(pi0id); - // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0); + // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); // } else if (etaid > 0) { // auto etamc = mcparticles.iteratorAt(etaid); - // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0); + // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision.weight()); // } } // end of pairing loop - } // end of pairing in same event - } // end of collision loop + } // end of pairing in same event + } // end of collision loop } template @@ -651,11 +657,12 @@ struct Pi0EtaToGammaGammaMC { auto mccollision = collision.template emmcevent_as(); auto binned_data_pi0_gen = mccollision.generatedPi0(); auto binned_data_eta_gen = mccollision.generatedEta(); - fillBinnedData<0>(binned_data_pi0_gen, 1.f); - fillBinnedData<1>(binned_data_eta_gen, 1.f); + fillBinnedData<0>(binned_data_pi0_gen, collision.weight()); + fillBinnedData<1>(binned_data_eta_gen, collision.weight()); } // 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/V0PhotonCut.cxx b/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx index bceee717d76..9c369df9514 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.cxx @@ -18,8 +18,6 @@ ClassImp(V0PhotonCut); -const char* V0PhotonCut::mCutNames[static_cast(V0PhotonCut::V0PhotonCuts::kNCuts)] = {"Mee", "V0PtRange", "V0EtaRange", "AP", " PsiPair", "PhivPair", "Rxy", "CosPA", "PCA", "RZLine", "OnWwireIB", "OnWwireOB", "TrackPtRange", "TrackEtaRange", "TPCNCls", "TPCCrossedRows", "TPCCrossedRowsOverNCls", "TPCChi2NDF", "TPCNsigmaEl", "TPCNsigmaPi", "DCAxy", "DCAz", "ITSNCls", "ITSChi2NDF", "IsWithinBeamPipe", "RequireITSTPC", "RequireITSonly", "RequireTPConly", "RequireTPCTRD", "RequireTPCTOF", "RequireTPCTRDTOF"}; - const std::pair> V0PhotonCut::its_ib_Requirement = {0, {0, 1, 2}}; // no hit on 3 ITS ib layers. const std::pair> V0PhotonCut::its_ob_Requirement = {4, {3, 4, 5, 6}}; // all hits on 4 ITS ob layers. const std::pair> V0PhotonCut::its_ob_Requirement_ITSTPC = {2, {3, 4, 5, 6}}; // at least 2 hits on 4 ITS ob layers. @@ -140,6 +138,11 @@ void V0PhotonCut::SetMinNCrossedRowsOverFindableClustersTPC(float minNCrossedRow mMinNCrossedRowsOverFindableClustersTPC = minNCrossedRowsOverFindableClustersTPC; LOG(info) << "V0 Photon Cut, set min N crossed rows over findable clusters TPC: " << mMinNCrossedRowsOverFindableClustersTPC; } +void V0PhotonCut::SetMaxFracSharedClustersTPC(float max) +{ + mMaxFracSharedClustersTPC = max; + LOG(info) << "V0 Photon Cut, set max fraction of shared clusters in TPC: " << mMaxFracSharedClustersTPC; +} void V0PhotonCut::SetChi2PerClusterTPC(float min, float max) { mMinChi2PerClusterTPC = min; @@ -229,38 +232,3 @@ void V0PhotonCut::SetDisableITSonly(bool flag) mDisableITSonly = flag; LOG(info) << "V0 Photon Cut, disable ITS only track: " << mDisableITSonly; } - -void V0PhotonCut::print() const -{ - LOG(info) << "V0 Photon Cut:"; - for (int i = 0; i < static_cast(V0PhotonCuts::kNCuts); i++) { - switch (static_cast(i)) { - case V0PhotonCuts::kTrackPtRange: - LOG(info) << mCutNames[i] << " in [" << mMinTrackPt << ", " << mMaxTrackPt << "]"; - break; - case V0PhotonCuts::kTrackEtaRange: - LOG(info) << mCutNames[i] << " in [" << mMinTrackEta << ", " << mMaxTrackEta << "]"; - break; - case V0PhotonCuts::kTPCNCls: - LOG(info) << mCutNames[i] << " > " << mMinNClustersTPC; - break; - case V0PhotonCuts::kTPCCrossedRows: - LOG(info) << mCutNames[i] << " > " << mMinNCrossedRowsTPC; - break; - case V0PhotonCuts::kTPCCrossedRowsOverNCls: - LOG(info) << mCutNames[i] << " > " << mMinNCrossedRowsOverFindableClustersTPC; - break; - case V0PhotonCuts::kTPCChi2NDF: - LOG(info) << mCutNames[i] << " < " << mMaxChi2PerClusterTPC; - break; - case V0PhotonCuts::kDCAxy: - LOG(info) << mCutNames[i] << " < " << mMaxDcaXY; - break; - case V0PhotonCuts::kDCAz: - LOG(info) << mCutNames[i] << " < " << mMaxDcaZ; - break; - default: - LOG(fatal) << "Cut unknown!"; - } - } -} diff --git a/PWGEM/PhotonMeson/Core/V0PhotonCut.h b/PWGEM/PhotonMeson/Core/V0PhotonCut.h index 55e9718e156..2acd533d14f 100644 --- a/PWGEM/PhotonMeson/Core/V0PhotonCut.h +++ b/PWGEM/PhotonMeson/Core/V0PhotonCut.h @@ -54,6 +54,7 @@ class V0PhotonCut : public TNamed kTPCNCls, kTPCCrossedRows, kTPCCrossedRowsOverNCls, + kTPCFracSharedClusters, kTPCChi2NDF, kTPCNsigmaEl, kTPCNsigmaPi, @@ -72,8 +73,6 @@ class V0PhotonCut : public TNamed kNCuts }; - static const char* mCutNames[static_cast(V0PhotonCuts::kNCuts)]; - template bool IsSelected(TV0 const& v0) const { @@ -226,6 +225,9 @@ class V0PhotonCut : public TNamed if (!IsSelectedTrack(track, V0PhotonCuts::kTPCCrossedRowsOverNCls)) { return false; } + if (!IsSelectedTrack(track, V0PhotonCuts::kTPCFracSharedClusters)) { + return false; + } if (!IsSelectedTrack(track, V0PhotonCuts::kTPCChi2NDF)) { return false; } @@ -238,31 +240,6 @@ class V0PhotonCut : public TNamed return true; } - template - uint32_t IsSelectedMask(T const& track) const - { - uint32_t flag = 0; - - auto setFlag = [&](const V0PhotonCuts& cut) { - if (IsSelectedTrack(track, cut)) { - flag |= 1UL << static_cast(cut); - } - }; - - setFlag(V0PhotonCuts::kV0PtRange); - setFlag(V0PhotonCuts::kV0EtaRange); - setFlag(V0PhotonCuts::kTrackPtRange); - setFlag(V0PhotonCuts::kTrackEtaRange); - setFlag(V0PhotonCuts::kTPCNCls); - setFlag(V0PhotonCuts::kTPCCrossedRows); - setFlag(V0PhotonCuts::kTPCCrossedRowsOverNCls); - setFlag(V0PhotonCuts::kTPCChi2NDF); - setFlag(V0PhotonCuts::kDCAxy); - setFlag(V0PhotonCuts::kDCAz); - - return flag; - } - template bool IsSelectedV0(T const& v0, const V0PhotonCuts& cut) const { @@ -374,6 +351,9 @@ class V0PhotonCut : public TNamed case V0PhotonCuts::kTPCCrossedRowsOverNCls: return track.tpcCrossedRowsOverFindableCls() >= mMinNCrossedRowsOverFindableClustersTPC; + case V0PhotonCuts::kTPCFracSharedClusters: + return track.tpcFractionSharedCls() <= mMaxFracSharedClustersTPC; + case V0PhotonCuts::kTPCChi2NDF: return mMinChi2PerClusterTPC < track.tpcChi2NCl() && track.tpcChi2NCl() < mMaxChi2PerClusterTPC; @@ -468,6 +448,7 @@ class V0PhotonCut : public TNamed void SetMinNClustersTPC(int minNClustersTPC); void SetMinNCrossedRowsTPC(int minNCrossedRowsTPC); void SetMinNCrossedRowsOverFindableClustersTPC(float minNCrossedRowsOverFindableClustersTPC); + void SetMaxFracSharedClustersTPC(float max); void SetChi2PerClusterTPC(float min, float max); void SetNClustersITS(int min, int max); void SetChi2PerClusterITS(float min, float max); @@ -488,9 +469,6 @@ class V0PhotonCut : public TNamed void SetRequireTPCTRDTOF(bool flag); void SetDisableITSonly(bool flag); - /// @brief Print the track selection - void print() const; - private: static const std::pair> its_ib_Requirement; static const std::pair> its_ob_Requirement; @@ -524,6 +502,7 @@ class V0PhotonCut : public TNamed int mMinNCrossedRowsTPC{0}; // min number of crossed rows in TPC 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 int mMinNClustersITS{0}, mMaxNClustersITS{7}; // range in number of ITS clusters float mMinChi2PerClusterITS{-1e10f}, mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster float mMinMeanClusterSizeITS{-1e10f}, mMaxMeanClusterSizeITS{1e10f}; // max x cos(Lmabda) diff --git a/PWGEM/PhotonMeson/DataModel/gammaTables.h b/PWGEM/PhotonMeson/DataModel/gammaTables.h index fb6d9a7839b..9b91eb0864f 100644 --- a/PWGEM/PhotonMeson/DataModel/gammaTables.h +++ b/PWGEM/PhotonMeson/DataModel/gammaTables.h @@ -170,7 +170,7 @@ DECLARE_SOA_TABLE(V0Legs, "AOD", "V0LEG", //! o2::soa::Index<>, v0leg::CollisionId, v0leg::TrackId, v0leg::Sign, v0leg::Px, v0leg::Py, v0leg::Pz, track::DcaXY, track::DcaZ, - track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, + track::TPCNClsFindable, track::TPCNClsFindableMinusFound, track::TPCNClsFindableMinusCrossedRows, track::TPCNClsShared, track::TPCChi2NCl, track::TPCInnerParam, track::TPCSignal, pidtpc::TPCNSigmaEl, pidtpc::TPCNSigmaPi, track::ITSClusterSizes, track::ITSChi2NCl, track::DetectorMap, @@ -185,6 +185,7 @@ DECLARE_SOA_TABLE(V0Legs, "AOD", "V0LEG", //! 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, @@ -198,15 +199,21 @@ using V0Leg = V0Legs::iterator; namespace emevent { DECLARE_SOA_COLUMN(NgPCM, ngpcm, int); +DECLARE_SOA_COLUMN(Weight, weight, float); //! Weight of the event (e.g. for JJ MCs). Set to 1 for data and non-weighted MCs. } // namespace emevent DECLARE_SOA_TABLE(EMEventsNgPCM, "AOD", "EMEVENTNGPCM", emevent::NgPCM); // joinable to EMEvents or aod::Collisions using EMEventNgPCM = EMEventsNgPCM::iterator; +DECLARE_SOA_TABLE(EMEventsWeight, "AOD", "EMEVENTWEIGHT", //! table contanint the weight for eache event (for JJ MCs), joinable to EMEvents + emevent::Weight); +using EMEventWeight = EMEventsWeight::iterator; + namespace v0photonkf { DECLARE_SOA_INDEX_COLUMN(EMEvent, emevent); //! DECLARE_SOA_COLUMN(CollisionId, collisionId, int); //! +DECLARE_SOA_COLUMN(V0Id, v0Id, int); //! DECLARE_SOA_INDEX_COLUMN_FULL(PosTrack, posTrack, int, V0Legs, "_Pos"); //! DECLARE_SOA_INDEX_COLUMN_FULL(NegTrack, negTrack, int, V0Legs, "_Neg"); //! DECLARE_SOA_COLUMN(Vx, vx, float); //! secondary vertex x @@ -223,6 +230,12 @@ DECLARE_SOA_COLUMN(PCA, pca, float); //! DECLARE_SOA_COLUMN(Alpha, alpha, float); //! DECLARE_SOA_COLUMN(QtArm, qtarm, float); //! DECLARE_SOA_COLUMN(ChiSquareNDF, chiSquareNDF, float); // Chi2 / NDF of the reconstructed V0 +DECLARE_SOA_COLUMN(SigmaPx2, sigmaPx2, float); //! error^2 of px in covariant matrix +DECLARE_SOA_COLUMN(SigmaPy2, sigmaPy2, float); //! error^2 of py in covariant matrix +DECLARE_SOA_COLUMN(SigmaPz2, sigmaPz2, float); //! error^2 of pz in covariant matrix +DECLARE_SOA_COLUMN(SigmaPxPy, sigmaPxPy, float); //! error of px x py in covariant matrix +DECLARE_SOA_COLUMN(SigmaPyPz, sigmaPyPz, float); //! error of py x pz in covariant matrix +DECLARE_SOA_COLUMN(SigmaPzPx, sigmaPzPx, float); //! error of pz x px in covariant matrix DECLARE_SOA_DYNAMIC_COLUMN(E, e, [](float px, float py, float pz, float m = 0) -> float { return RecoDecay::sqrtSumOfSquares(px, py, pz, m); }); //! energy of v0 photn, mass to be given as argument when getter is called! DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return RecoDecay::sqrtSumOfSquares(px, py); }); @@ -232,7 +245,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float px, float py, float pz) -> float { ret DECLARE_SOA_DYNAMIC_COLUMN(V0Radius, v0radius, [](float vx, float vy) -> float { return RecoDecay::sqrtSumOfSquares(vx, vy); }); } // namespace v0photonkf DECLARE_SOA_TABLE(V0PhotonsKF, "AOD", "V0PHOTONKF", //! - o2::soa::Index<>, v0photonkf::CollisionId, v0photonkf::PosTrackId, v0photonkf::NegTrackId, + o2::soa::Index<>, v0photonkf::CollisionId, v0photonkf::V0Id, v0photonkf::PosTrackId, v0photonkf::NegTrackId, v0photonkf::Vx, v0photonkf::Vy, v0photonkf::Vz, v0photonkf::Px, v0photonkf::Py, v0photonkf::Pz, v0photonkf::MGamma, @@ -255,6 +268,11 @@ DECLARE_SOA_TABLE(V0KFEMEventIds, "AOD", "V0KFEMEVENTID", v0photonkf::EMEventId) // iterators using V0KFEMEventId = V0KFEMEventIds::iterator; +DECLARE_SOA_TABLE(V0PhotonsKFCov, "AOD", "V0PHOTONKFCOV", //! To be joined with V0PhotonsKF table at analysis level. + v0photonkf::SigmaPx2, v0photonkf::SigmaPy2, v0photonkf::SigmaPz2, v0photonkf::SigmaPxPy, v0photonkf::SigmaPyPz, v0photonkf::SigmaPzPx); +// iterators +using V0PhotonKFCov = V0PhotonsKFCov::iterator; + DECLARE_SOA_TABLE(EMPrimaryElectronsFromDalitz, "AOD", "EMPRIMARYELDA", //! o2::soa::Index<>, emprimaryelectron::CollisionId, emprimaryelectron::TrackId, emprimaryelectron::Sign, diff --git a/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx b/PWGEM/PhotonMeson/TableProducer/createEMEventPhoton.cxx index 102388dceec..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" @@ -36,11 +40,11 @@ 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 = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisions_Cent_Qvec = soa::Join; using MyCollisionsMC = soa::Join; -using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. +using MyCollisionsMC_Cent = soa::Join; // centrality table has dependency on multiplicity table. using MyCollisionsMC_Cent_Qvec = soa::Join; struct CreateEMEvent { @@ -49,11 +53,13 @@ struct CreateEMEvent { Produces event_mult; Produces event_cent; Produces event_qvec; + Produces event_weights; enum class EMEventType : int { kEvent = 0, kEvent_Cent = 1, kEvent_Cent_Qvec = 2, + kEvent_JJ = 3, }; // CCDB options @@ -63,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&) @@ -141,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); @@ -152,25 +166,29 @@ 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()); - event_mult(collision.multFT0A(), collision.multFT0C(), collision.multTPC(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); + event_mult(collision.multFT0A(), collision.multFT0C(), collision.multNTracksPV(), collision.multNTracksPVeta1(), collision.multNTracksPVetaHalf()); + + if constexpr (eventype != EMEventType::kEvent_JJ) { + event_weights(1.f); + } float q2xft0m = 999.f, q2yft0m = 999.f, q2xft0a = 999.f, q2yft0a = 999.f, q2xft0c = 999.f, q2yft0c = 999.f, q2xbpos = 999.f, q2ybpos = 999.f, q2xbneg = 999.f, q2ybneg = 999.f, q2xbtot = 999.f, q2ybtot = 999.f; float q3xft0m = 999.f, q3yft0m = 999.f, q3xft0a = 999.f, q3yft0a = 999.f, q3xft0c = 999.f, q3yft0c = 999.f, q3xbpos = 999.f, q3ybpos = 999.f, q3xbneg = 999.f, q3ybneg = 999.f, q3xbtot = 999.f, q3ybtot = 999.f; if constexpr (eventype == EMEventType::kEvent) { - event_cent(105.f, 105.f, 105.f, 105.f); + event_cent(105.f, 105.f, 105.f); event_qvec(q2xft0m, q2yft0m, q2xft0a, q2yft0a, q2xft0c, q2yft0c, q2xbpos, q2ybpos, q2xbneg, q2ybneg, q2xbtot, q2ybtot, q3xft0m, q3yft0m, q3xft0a, q3yft0a, q3xft0c, q3yft0c, q3xbpos, q3ybpos, q3xbneg, q3ybneg, q3xbtot, q3ybtot); } else if constexpr (eventype == EMEventType::kEvent_Cent) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); + event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); event_qvec(q2xft0m, q2yft0m, q2xft0a, q2yft0a, q2xft0c, q2yft0c, q2xbpos, q2ybpos, q2xbneg, q2ybneg, q2xbtot, q2ybtot, q3xft0m, q3yft0m, q3xft0a, q3yft0a, q3xft0c, q3yft0c, q3xbpos, q3ybpos, q3xbneg, q3ybneg, q3xbtot, q3ybtot); } else if constexpr (eventype == EMEventType::kEvent_Cent_Qvec) { - event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()); + event_cent(collision.centFT0M(), collision.centFT0A(), collision.centFT0C()); if (collision.qvecFT0CReVec().size() >= 2) { // harmonics 2,3 q2xft0m = collision.qvecFT0MReVec()[0], q2xft0a = collision.qvecFT0AReVec()[0], q2xft0c = collision.qvecFT0CReVec()[0], q2xbpos = collision.qvecBPosReVec()[0], q2xbneg = collision.qvecBNegReVec()[0], q2xbtot = collision.qvecBTotReVec()[0]; @@ -184,7 +202,7 @@ struct CreateEMEvent { event_qvec(q2xft0m, q2yft0m, q2xft0a, q2yft0a, q2xft0c, q2yft0c, q2xbpos, q2ybpos, q2xbneg, q2ybneg, q2xbtot, q2ybtot, q3xft0m, q3yft0m, q3xft0a, q3yft0a, q3xft0c, q3yft0c, q3xbpos, q3ybpos, q3xbneg, q3ybneg, q3xbtot, q3ybtot); } else { - event_cent(105.f, 105.f, 105.f, 105.f); + event_cent(105.f, 105.f, 105.f); event_qvec(q2xft0m, q2yft0m, q2xft0a, q2yft0a, q2xft0c, q2yft0c, q2xbpos, q2ybpos, q2xbneg, q2ybneg, q2xbtot, q2ybtot, q3xft0m, q3yft0m, q3xft0a, q3yft0a, q3xft0c, q3yft0c, q3xbpos, q3ybpos, q3xbneg, q3ybneg, q3xbtot, q3ybtot); } @@ -192,6 +210,24 @@ struct CreateEMEvent { map_ncolls_per_bc.clear(); } // end of skimEvent + void fillEventWeights(MyCollisionsMC const& collisions, aod::McCollisions const&, MyBCs const&) + { + for (auto& collision : collisions) { + if (!collision.has_mcCollision()) { + continue; + } + + auto bc = collision.template foundBC_as(); + initCCDB(bc); + + 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; + } + auto mcCollision = collision.mcCollision(); + event_weights(mcCollision.weight()); + } + } + void processEvent(MyCollisions const& collisions, MyBCs const& bcs) { skimEvent(collisions, bcs); @@ -204,6 +240,13 @@ struct CreateEMEvent { } PROCESS_SWITCH(CreateEMEvent, processEventMC, "process event info", false); + void processEventJJMC(MyCollisionsMC const& collisions, aod::McCollisions const& mcCollisions, MyBCs const& bcs) + { + skimEvent(collisions, bcs); + fillEventWeights(collisions, mcCollisions, bcs); + } + PROCESS_SWITCH(CreateEMEvent, processEventJJMC, "process event info", false); + void processEvent_Cent(MyCollisions_Cent const& collisions, MyBCs const& bcs) { skimEvent(collisions, bcs); @@ -255,7 +298,7 @@ struct AssociatePhotonToEMEvent { for (int ig = 0; ig < ng; ig++) { eventIds(collision.globalIndex()); } // end of photon loop - } // end of collision loop + } // end of collision loop } // This struct is for both data and MC. diff --git a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx index 226801fcc61..9786329b601 100644 --- a/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx +++ b/PWGEM/PhotonMeson/TableProducer/photonconversionbuilder.cxx @@ -65,6 +65,7 @@ using MyTracksIUMC = soa::Join; struct PhotonConversionBuilder { Produces v0photonskf; + Produces v0photonskfcov; Produces v0legs; Produces events_ngpcm; @@ -370,7 +371,7 @@ struct PhotonConversionBuilder { { v0legs(track.collisionId(), track.globalIndex(), track.sign(), kfp.GetPx(), kfp.GetPy(), kfp.GetPz(), dcaXY, dcaZ, - track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), + track.tpcNClsFindable(), track.tpcNClsFindableMinusFound(), track.tpcNClsFindableMinusCrossedRows(), track.tpcNClsShared(), track.tpcChi2NCl(), track.tpcInnerParam(), track.tpcSignal(), track.tpcNSigmaEl(), track.tpcNSigmaPi(), track.itsClusterSizes(), track.itsChi2NCl(), track.detectorMap(), @@ -660,12 +661,14 @@ struct PhotonConversionBuilder { ROOT::Math::PxPyPzMVector v0_sv = vpos_sv + vele_sv; registry.fill(HIST("V0/hMeeSV_Rxy"), rxy, v0_sv.M()); - v0photonskf(collision.globalIndex(), v0legs.lastIndex() + 1, v0legs.lastIndex() + 2, + v0photonskf(collision.globalIndex(), v0.globalIndex(), v0legs.lastIndex() + 1, v0legs.lastIndex() + 2, gammaKF_DecayVtx.GetX(), gammaKF_DecayVtx.GetY(), gammaKF_DecayVtx.GetZ(), gammaKF_PV.GetPx(), gammaKF_PV.GetPy(), gammaKF_PV.GetPz(), v0_sv.M(), dca_xy_v0_to_pv, dca_z_v0_to_pv, cospa_kf, pca_kf, alpha, qt, chi2kf); + v0photonskfcov(gammaKF_PV.GetCovariance(9), gammaKF_PV.GetCovariance(14), gammaKF_PV.GetCovariance(20), gammaKF_PV.GetCovariance(13), gammaKF_PV.GetCovariance(19), gammaKF_PV.GetCovariance(18)); + fillTrackTable(pos, pTrack, kfp_pos_DecayVtx, posdcaXY, posdcaZ); // positive leg first fillTrackTable(ele, nTrack, kfp_ele_DecayVtx, eledcaXY, eledcaZ); // negative leg second } // end of fill table diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx index 68e6d26ddfb..aff407a83f3 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaCalo.cxx @@ -13,6 +13,8 @@ /// dependencies: emcal-correction-task /// \author marvin.hemmer@cern.ch +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -47,7 +49,8 @@ struct skimmerGammaCalo { Configurable minM02{"minM02", 0.0, "Minimum M02 for M02 cut"}; Configurable maxM02{"maxM02", 1.0, "Maximum M02 for M02 cut"}; Configurable minE{"minE", 0.5, "Minimum energy for energy cut"}; - Configurable hasPropagatedTracks{"hasPropagatedTracks", false, "temporary flag, only set to true when running over data which has the tracks propagated to EMCal/PHOS!"}; + Configurable maxdEta{"maxdEta", 0.1, "Set a maximum difference in eta for tracks and cluster to still count as matched"}; + Configurable maxdPhi{"maxdPhi", 0.1, "Set a maximum difference in phi for tracks and cluster to still count as matched"}; Configurable applyEveSel_at_skimming{"applyEveSel_at_skimming", false, "flag to apply minimal event selection at the skimming level"}; Configurable inherit_from_emevent_photon{"inherit_from_emevent_photon", false, "flag to inherit task options from emevent-photon"}; @@ -118,25 +121,17 @@ struct skimmerGammaCalo { vP.reserve(groupedMTs.size()); vPt.reserve(groupedMTs.size()); for (const auto& emcmatchedtrack : groupedMTs) { - if (hasPropagatedTracks) { // only temporarily while not every data has the tracks propagated to EMCal/PHOS - historeg.fill(HIST("hMTEtaPhi"), emccluster.eta() - emcmatchedtrack.track_as().trackEtaEmcal(), emccluster.phi() - emcmatchedtrack.track_as().trackPhiEmcal()); - vTrackIds.emplace_back(emcmatchedtrack.trackId()); - vEta.emplace_back(emcmatchedtrack.track_as().trackEtaEmcal()); - vPhi.emplace_back(emcmatchedtrack.track_as().trackPhiEmcal()); - vP.emplace_back(emcmatchedtrack.track_as().p()); - vPt.emplace_back(emcmatchedtrack.track_as().pt()); - tableTrackEMCReco(emcmatchedtrack.emcalclusterId(), emcmatchedtrack.track_as().trackEtaEmcal(), emcmatchedtrack.track_as().trackPhiEmcal(), - emcmatchedtrack.track_as().p(), emcmatchedtrack.track_as().pt()); - } else { - historeg.fill(HIST("hMTEtaPhi"), emccluster.eta() - emcmatchedtrack.track_as().eta(), emccluster.phi() - emcmatchedtrack.track_as().phi()); - vTrackIds.emplace_back(emcmatchedtrack.trackId()); - vEta.emplace_back(emcmatchedtrack.track_as().eta()); - vPhi.emplace_back(emcmatchedtrack.track_as().phi()); - vP.emplace_back(emcmatchedtrack.track_as().p()); - vPt.emplace_back(emcmatchedtrack.track_as().pt()); - tableTrackEMCReco(emcmatchedtrack.emcalclusterId(), emcmatchedtrack.track_as().eta(), emcmatchedtrack.track_as().phi(), - emcmatchedtrack.track_as().p(), emcmatchedtrack.track_as().pt()); + if (std::abs(emccluster.eta() - emcmatchedtrack.track_as().trackEtaEmcal()) >= maxdEta || std::abs(emccluster.phi() - emcmatchedtrack.track_as().trackPhiEmcal()) >= maxdPhi) { + continue; } + historeg.fill(HIST("hMTEtaPhi"), emccluster.eta() - emcmatchedtrack.track_as().trackEtaEmcal(), emccluster.phi() - emcmatchedtrack.track_as().trackPhiEmcal()); + vTrackIds.emplace_back(emcmatchedtrack.trackId()); + vEta.emplace_back(emcmatchedtrack.track_as().trackEtaEmcal()); + vPhi.emplace_back(emcmatchedtrack.track_as().trackPhiEmcal()); + vP.emplace_back(emcmatchedtrack.track_as().p()); + vPt.emplace_back(emcmatchedtrack.track_as().pt()); + tableTrackEMCReco(emcmatchedtrack.emcalclusterId(), emcmatchedtrack.track_as().trackEtaEmcal(), emcmatchedtrack.track_as().trackPhiEmcal(), + emcmatchedtrack.track_as().p(), emcmatchedtrack.track_as().pt()); } historeg.fill(HIST("hCaloClusterEOut"), emccluster.energy()); @@ -152,8 +147,6 @@ struct skimmerGammaCalo { return; } for (const auto& emccluster : emcclusters) { - historeg.fill(HIST("hCaloClusterEIn"), emccluster.energy()); - historeg.fill(HIST("hCaloClusterFilter"), 0); // Energy cut if (emccluster.energy() < minE) { diff --git a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx index 40334a036c0..bed52425fb5 100644 --- a/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx +++ b/PWGEM/PhotonMeson/TableProducer/skimmerGammaConversion.cxx @@ -181,7 +181,7 @@ struct skimmerGammaConversion { v0legs(theTrack.collisionId(), theTrack.globalIndex(), theTrack.sign(), kfp.GetPx(), kfp.GetPy(), kfp.GetPz(), theTrack.dcaXY(), theTrack.dcaZ(), - theTrack.tpcNClsFindable(), theTrack.tpcNClsFindableMinusFound(), theTrack.tpcNClsFindableMinusCrossedRows(), + theTrack.tpcNClsFindable(), theTrack.tpcNClsFindableMinusFound(), theTrack.tpcNClsFindableMinusCrossedRows(), theTrack.tpcNClsShared(), theTrack.tpcChi2NCl(), theTrack.tpcInnerParam(), theTrack.tpcSignal(), theTrack.tpcNSigmaEl(), theTrack.tpcNSigmaPi(), theTrack.itsClusterSizes(), theTrack.itsChi2NCl(), theTrack.detectorMap(), @@ -304,7 +304,7 @@ struct skimmerGammaConversion { float sign_tmp = dca_y_v0_to_pv > 0 ? +1 : -1; float dca_xy_v0_to_pv = RecoDecay::sqrtSumOfSquares(dca_x_v0_to_pv, dca_y_v0_to_pv) * sign_tmp; - v0photonskf(collision.globalIndex(), v0legs.lastIndex() + 1, v0legs.lastIndex() + 2, + v0photonskf(collision.globalIndex(), v0.globalIndex(), v0legs.lastIndex() + 1, v0legs.lastIndex() + 2, gammaKF_DecayVtx.GetX(), gammaKF_DecayVtx.GetY(), gammaKF_DecayVtx.GetZ(), gammaKF_DecayVtx.GetPx(), gammaKF_DecayVtx.GetPy(), gammaKF_DecayVtx.GetPz(), v0_sv.M(), dca_xy_v0_to_pv, dca_z_v0_to_pv, @@ -342,7 +342,7 @@ struct skimmerGammaConversion { fillV0KF(collision, v0); } // end of v0 loop - } // end of collision loop + } // end of collision loop } PROCESS_SWITCH(skimmerGammaConversion, processRec, "process reconstructed info only", true); diff --git a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt index 187e3a1bc36..82dd5775d75 100644 --- a/PWGEM/PhotonMeson/Tasks/CMakeLists.txt +++ b/PWGEM/PhotonMeson/Tasks/CMakeLists.txt @@ -124,3 +124,7 @@ o2physics_add_dpl_workflow(check-mc-v0 PUBLIC_LINK_LIBRARIES O2::Framework O2::DCAFitter O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(pi0-flow-emc + SOURCES taskPi0FlowEMC.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::EMCALBase O2::EMCALCalib O2Physics::AnalysisCore O2Physics::PWGEMPhotonMesonCore + COMPONENT_NAME Analysis) diff --git a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx index ddf61e9765e..9c82fa7b09a 100644 --- a/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx +++ b/PWGEM/PhotonMeson/Tasks/SinglePhoton.cxx @@ -228,10 +228,10 @@ struct SinglePhoton { custom_cut->SetM02Range(EMC_minM02, EMC_maxM02); custom_cut->SetTimeRange(EMC_minTime, EMC_maxTime); - custom_cut->SetTrackMatchingEta([&a, &b, &c](float pT) { + custom_cut->SetTrackMatchingEta([a, b, c](float pT) { return a + pow(pT + b, c); }); - custom_cut->SetTrackMatchingPhi([&d, &e, &f](float pT) { + custom_cut->SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); @@ -331,8 +331,8 @@ struct SinglePhoton { reinterpret_cast(list_photon_det_cut->FindObject("hY"))->Fill(photon.eta()); reinterpret_cast(list_photon_det_cut->FindObject("hPhi"))->Fill(photon.phi()); } // end of photon loop - } // end of cut loop - } // end of collision loop + } // end of cut loop + } // end of collision loop } Partition grouped_collisions = (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); // this goes to same event. diff --git a/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx b/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx index f12cf270290..4d00ddb1a21 100644 --- a/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx +++ b/PWGEM/PhotonMeson/Tasks/TaggingPi0.cxx @@ -313,10 +313,10 @@ struct TaggingPi0 { custom_cut->SetM02Range(EMC_minM02, EMC_maxM02); custom_cut->SetTimeRange(EMC_minTime, EMC_maxTime); - custom_cut->SetTrackMatchingEta([&a, &b, &c](float pT) { + custom_cut->SetTrackMatchingEta([a, b, c](float pT) { return a + pow(pT + b, c); }); - custom_cut->SetTrackMatchingPhi([&d, &e, &f](float pT) { + custom_cut->SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); diff --git a/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx b/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx index 3cf8a46a2b0..335e8195d8b 100644 --- a/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx +++ b/PWGEM/PhotonMeson/Tasks/TaggingPi0MC.cxx @@ -330,10 +330,10 @@ struct TaggingPi0MC { custom_cut->SetM02Range(EMC_minM02, EMC_maxM02); custom_cut->SetTimeRange(EMC_minTime, EMC_maxTime); - custom_cut->SetTrackMatchingEta([&a, &b, &c](float pT) { + custom_cut->SetTrackMatchingEta([a, b, c](float pT) { return a + pow(pT + b, c); }); - custom_cut->SetTrackMatchingPhi([&d, &e, &f](float pT) { + custom_cut->SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); 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 28c99367450..dc5590fd795 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" @@ -42,7 +44,7 @@ using namespace o2::framework::expressions; using namespace o2::soa; using namespace o2::aod::pwgem::photon; -using MyCollisions = soa::Join; +using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; using MyEMCClusters = soa::Join; @@ -68,6 +70,7 @@ struct emcalQC { 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 onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"}; } eventcuts; EMCPhotonCut fEMCCut; @@ -99,7 +102,6 @@ struct emcalQC { fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); - fEMEventCut.SetOccupancyRange(eventcuts.cfgOccupancyMin, eventcuts.cfgOccupancyMax); } void DefineEMCCut() @@ -118,8 +120,8 @@ struct emcalQC { 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 + pow(pT + b, c); }); + fEMCCut.SetTrackMatchingPhi([d, e, f](float pT) { return d + pow(pT + e, f); }); fEMCCut.SetMinEoverP(emccuts.EMC_Eoverp); fEMCCut.SetUseExoticCut(emccuts.EMC_UseExoticCut); @@ -137,6 +139,14 @@ struct emcalQC { DefineEMEventCut(); o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(&fRegistry); + auto hEMCCollisionCounter = fRegistry.add("Event/hEMCCollisionCounter", "Number of collisions after event cuts", HistType::kTH1F, {{7, 0.5, 7.5}}, false); + hEMCCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); + hEMCCollisionCounter->GetXaxis()->SetBinLabel(2, "+TVX"); // TVX + hEMCCollisionCounter->GetXaxis()->SetBinLabel(3, "+|z|<10cm"); // TVX with z < 10cm + hEMCCollisionCounter->GetXaxis()->SetBinLabel(4, "+Sel8"); // TVX with z < 10cm and Sel8 + hEMCCollisionCounter->GetXaxis()->SetBinLabel(5, "+Good z vtx"); // TVX with z < 10cm and Sel8 and good z xertex + hEMCCollisionCounter->GetXaxis()->SetBinLabel(6, "+unique"); // TVX with z < 10cm and Sel8 and good z xertex and unique (only collision in the BC) + hEMCCollisionCounter->GetXaxis()->SetBinLabel(7, "+EMC readout"); // TVX with z < 10cm and Sel8 and good z xertex and unique (only collision in the BC) and kTVXinEMC o2::aod::pwgem::photonmeson::utils::clusterhistogram::addClusterHistograms(&fRegistry, cfgDo2DQA); } @@ -146,24 +156,50 @@ struct emcalQC { { for (auto& collision : collisions) { + if (eventcuts.onlyKeepWeightedEvents && fabs(collision.weight() - 1.) < 1E-10) { + continue; + } + + fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 1); + if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 2); + if (abs(collision.posZ()) < eventcuts.cfgZvtxMax) { + fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 3); + if (collision.sel8()) { + fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 4); + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 5); + if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 6); + if (collision.alias_bit(kTVXinEMC)) + fRegistry.fill(HIST("Event/hEMCCollisionCounter"), 7); + } + } + } + } + } + o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0>(&fRegistry, collision); 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 auto clusters_per_coll = clusters.sliceBy(perCollision, collision.collisionId()); - fRegistry.fill(HIST("Cluster/before/hNgamma"), clusters_per_coll.size()); + fRegistry.fill(HIST("Cluster/before/hNgamma"), clusters_per_coll.size(), collision.weight()); int ng = 0; for (auto& cluster : clusters_per_coll) { // Fill the cluster properties before applying any cuts - o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<0>(&fRegistry, cluster, cfgDo2DQA); + o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<0>(&fRegistry, cluster, cfgDo2DQA, collision.weight()); // Apply cuts one by one and fill in hClusterQualityCuts histogram - fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), 0., cluster.e()); + fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), 0., cluster.e(), collision.weight()); // Define two boleans to see, whether the cluster "survives" the EMC cluster cuts to later check, whether the cuts in this task align with the ones in EMCPhotonCut.h: bool survivesIsSelectedEMCalCuts = true; // Survives "manual" cuts listed in this task @@ -172,7 +208,7 @@ struct emcalQC { for (int icut = 0; icut < static_cast(EMCPhotonCut::EMCPhotonCuts::kNCuts); icut++) { // Loop through different cut observables 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()); + fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), icut + 1, cluster.e(), collision.weight()); survivesIsSelectedEMCalCuts = false; } } @@ -182,14 +218,14 @@ struct emcalQC { } if (survivesIsSelectedCuts) { - o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<1>(&fRegistry, cluster, cfgDo2DQA); - fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), 7., cluster.e()); + o2::aod::pwgem::photonmeson::utils::clusterhistogram::fillClusterHistograms<1>(&fRegistry, cluster, cfgDo2DQA, collision.weight()); + fRegistry.fill(HIST("Cluster/hClusterQualityCuts"), 7., cluster.e(), collision.weight()); ng++; } } - fRegistry.fill(HIST("Cluster/after/hNgamma"), ng); + fRegistry.fill(HIST("Cluster/after/hNgamma"), ng, collision.weight()); } // end of collision loop - } // end of process + } // end of process void processDummy(MyCollisions const&) {} diff --git a/PWGEM/PhotonMeson/Tasks/pcmQC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQC.cxx index 49f734c1a9d..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" @@ -34,7 +37,7 @@ using namespace o2::aod::pwgem::photon; using MyCollisions = soa::Join; using MyCollision = MyCollisions::iterator; -using MyV0Photons = soa::Join; +using MyV0Photons = soa::Join; using MyV0Photon = MyV0Photons::iterator; struct PCMQC { @@ -66,7 +69,8 @@ struct PCMQC { Configurable cfg_require_v0_with_tpconly{"cfg_require_v0_with_tpconly", false, "flag to select V0s with TPConly tracks"}; Configurable cfg_require_v0_on_wwire_ib{"cfg_require_v0_on_wwire_ib", false, "flag to select V0s on W wires ITSib"}; Configurable cfg_min_pt_v0{"cfg_min_pt_v0", 0.1, "min pT for v0 photons at PV"}; - Configurable cfg_max_eta_v0{"cfg_max_eta_v0", 0.8, "max eta for v0 photons at PV"}; + Configurable cfg_min_eta_v0{"cfg_min_eta_v0", -0.8, "min eta for v0 photons at PV"}; + Configurable cfg_max_eta_v0{"cfg_max_eta_v0", +0.8, "max eta for v0 photons at PV"}; Configurable cfg_min_v0radius{"cfg_min_v0radius", 4.0, "min v0 radius"}; Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; @@ -77,6 +81,7 @@ struct PCMQC { Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "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_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; @@ -138,6 +143,11 @@ struct PCMQC { fRegistry.add("V0/hKFChi2vsX", "KF chi2 vs. conversion point in X;X (cm);KF chi2/NDF", kTH2F, {{200, -100.0f, 100.0f}, {100, 0.f, 100.0f}}, false); fRegistry.add("V0/hKFChi2vsY", "KF chi2 vs. conversion point in Y;Y (cm);KF chi2/NDF", kTH2F, {{200, -100.0f, 100.0f}, {100, 0.f, 100.0f}}, false); fRegistry.add("V0/hKFChi2vsZ", "KF chi2 vs. conversion point in Z;Z (cm);KF chi2/NDF", kTH2F, {{200, -100.0f, 100.0f}, {100, 0.f, 100.0f}}, false); + fRegistry.add("V0/hPResolution", "p resolution;p_{#gamma} (GeV/c);#Deltap/p", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.1}}, false); + fRegistry.add("V0/hPtResolution", "p_{T} resolution;p_{#gamma} (GeV/c);#Deltap_{T}/p_{T}", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.1}}, false); + fRegistry.add("V0/hEtaResolution", "#eta resolution;p_{#gamma} (GeV/c);#Delta#eta", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.01}}, false); + fRegistry.add("V0/hThetaResolution", "#theta resolution;p_{#gamma} (GeV/c);#Delta#theta (rad.)", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.01}}, false); + fRegistry.add("V0/hPhiResolution", "#varphi resolution;p_{#gamma} (GeV/c);#Delta#varphi (rad.)", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.01}}, false); fRegistry.add("V0/hNgamma", "Number of #gamma candidates per collision", kTH1F, {{101, -0.5f, 100.5f}}); // v0leg info @@ -153,6 +163,7 @@ struct PCMQC { fRegistry.add("V0Leg/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("V0Leg/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("V0Leg/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); + fRegistry.add("V0Leg/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("V0Leg/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); fRegistry.add("V0Leg/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); fRegistry.add("V0Leg/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); @@ -173,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); } @@ -183,7 +193,7 @@ struct PCMQC { // for v0 fV0PhotonCut.SetV0PtRange(pcmcuts.cfg_min_pt_v0, 1e10f); - fV0PhotonCut.SetV0EtaRange(-pcmcuts.cfg_max_eta_v0, +pcmcuts.cfg_max_eta_v0); + fV0PhotonCut.SetV0EtaRange(pcmcuts.cfg_min_eta_v0, pcmcuts.cfg_max_eta_v0); fV0PhotonCut.SetMinCosPA(pcmcuts.cfg_min_cospa); fV0PhotonCut.SetMaxPCA(pcmcuts.cfg_max_pca); fV0PhotonCut.SetRxyRange(pcmcuts.cfg_min_v0radius, pcmcuts.cfg_max_v0radius); @@ -192,10 +202,11 @@ struct PCMQC { // for track fV0PhotonCut.SetTrackPtRange(pcmcuts.cfg_min_pt_v0 * 0.4, 1e+10f); - fV0PhotonCut.SetTrackEtaRange(-pcmcuts.cfg_max_eta_v0, +pcmcuts.cfg_max_eta_v0); + fV0PhotonCut.SetTrackEtaRange(pcmcuts.cfg_min_eta_v0, pcmcuts.cfg_max_eta_v0); fV0PhotonCut.SetMinNClustersTPC(pcmcuts.cfg_min_ncluster_tpc); fV0PhotonCut.SetMinNCrossedRowsTPC(pcmcuts.cfg_min_ncrossedrows); fV0PhotonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fV0PhotonCut.SetMaxFracSharedClustersTPC(pcmcuts.cfg_max_frac_shared_clusters_tpc); fV0PhotonCut.SetChi2PerClusterTPC(0.0, pcmcuts.cfg_max_chi2tpc); fV0PhotonCut.SetTPCNsigmaElRange(pcmcuts.cfg_min_TPCNsigmaEl, pcmcuts.cfg_max_TPCNsigmaEl); fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); @@ -292,6 +303,11 @@ struct PCMQC { fRegistry.fill(HIST("V0/hKFChi2vsX"), v0.vx(), v0.chiSquareNDF()); fRegistry.fill(HIST("V0/hKFChi2vsY"), v0.vy(), v0.chiSquareNDF()); fRegistry.fill(HIST("V0/hKFChi2vsZ"), v0.vz(), v0.chiSquareNDF()); + fRegistry.fill(HIST("V0/hPResolution"), v0.p(), getPResolution(v0) / v0.p()); + fRegistry.fill(HIST("V0/hPtResolution"), v0.p(), getPtResolution(v0) / v0.pt()); + fRegistry.fill(HIST("V0/hEtaResolution"), v0.p(), getEtaResolution(v0)); + fRegistry.fill(HIST("V0/hThetaResolution"), v0.p(), getThetaResolution(v0)); + fRegistry.fill(HIST("V0/hPhiResolution"), v0.p(), getPhiResolution(v0)); } template @@ -306,6 +322,7 @@ struct PCMQC { fRegistry.fill(HIST("V0Leg/hNcrTPC"), leg.tpcNClsCrossedRows()); fRegistry.fill(HIST("V0Leg/hTPCNcr2Nf"), leg.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("V0Leg/hTPCNcls2Nf"), leg.tpcFoundOverFindableCls()); + fRegistry.fill(HIST("V0Leg/hTPCNclsShared"), leg.pt(), leg.tpcFractionSharedCls()); fRegistry.fill(HIST("V0Leg/hChi2TPC"), leg.tpcChi2NCl()); fRegistry.fill(HIST("V0Leg/hChi2ITS"), leg.itsChi2NCl()); fRegistry.fill(HIST("V0Leg/hITSClusterMap"), leg.itsClusterMap()); diff --git a/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx b/PWGEM/PhotonMeson/Tasks/pcmQCMC.cxx index 279c0a57c80..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" @@ -41,7 +44,7 @@ using MyCollision = MyCollisions::iterator; using MyMCCollisions = soa::Join; using MyMCCollision = MyMCCollisions::iterator; -using MyV0Photons = soa::Join; +using MyV0Photons = soa::Join; using MyV0Photon = MyV0Photons::iterator; using MyMCV0Legs = soa::Join; @@ -49,7 +52,7 @@ using MyMCV0Leg = MyMCV0Legs::iterator; struct PCMQCMC { - Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2, NTPV:3"}; + Configurable cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"}; Configurable cfgCentMin{"cfgCentMin", 0, "min. centrality"}; Configurable cfgCentMax{"cfgCentMax", 999.f, "max. centrality"}; @@ -80,7 +83,8 @@ struct PCMQCMC { Configurable cfg_require_v0_with_tpconly{"cfg_require_v0_with_tpconly", false, "flag to select V0s with TPConly tracks"}; Configurable cfg_require_v0_on_wwire_ib{"cfg_require_v0_on_wwire_ib", false, "flag to select V0s on W wires ITSib"}; Configurable cfg_min_pt_v0{"cfg_min_pt_v0", 0.1, "min pT for v0 photons at PV"}; - Configurable cfg_max_eta_v0{"cfg_max_eta_v0", 0.8, "max eta for v0 photons at PV"}; + Configurable cfg_min_eta_v0{"cfg_min_eta_v0", -0.8, "min eta for v0 photons at PV"}; + Configurable cfg_max_eta_v0{"cfg_max_eta_v0", +0.8, "max eta for v0 photons at PV"}; Configurable cfg_min_v0radius{"cfg_min_v0radius", 4.0, "min v0 radius"}; Configurable cfg_max_v0radius{"cfg_max_v0radius", 90.0, "max v0 radius"}; Configurable cfg_max_alpha_ap{"cfg_max_alpha_ap", 0.95, "max alpha for AP cut"}; @@ -91,6 +95,7 @@ struct PCMQCMC { Configurable cfg_reject_v0_on_itsib{"cfg_reject_v0_on_itsib", true, "flag to reject V0s on ITSib"}; Configurable cfg_min_ncluster_tpc{"cfg_min_ncluster_tpc", 0, "min ncluster tpc"}; Configurable cfg_min_ncrossedrows{"cfg_min_ncrossedrows", 40, "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_min_TPCNsigmaEl{"cfg_min_TPCNsigmaEl", -3.0, "min. TPC n sigma for electron"}; @@ -180,6 +185,11 @@ struct PCMQCMC { fRegistry.add("V0/primary/hKFChi2vsX", "KF chi2 vs. conversion point in X;X (cm);KF chi2/NDF", kTH2F, {{200, -100.0f, 100.0f}, {100, 0.f, 100.0f}}, false); fRegistry.add("V0/primary/hKFChi2vsY", "KF chi2 vs. conversion point in Y;Y (cm);KF chi2/NDF", kTH2F, {{200, -100.0f, 100.0f}, {100, 0.f, 100.0f}}, false); fRegistry.add("V0/primary/hKFChi2vsZ", "KF chi2 vs. conversion point in Z;Z (cm);KF chi2/NDF", kTH2F, {{200, -100.0f, 100.0f}, {100, 0.f, 100.0f}}, false); + fRegistry.add("V0/primary/hPResolution", "p resolution;p_{#gamma} (GeV/c);#Deltap/p", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.1}}, false); + fRegistry.add("V0/primary/hPtResolution", "p_{T} resolution;p_{#gamma} (GeV/c);#Deltap_{T}/p_{T}", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.1}}, false); + fRegistry.add("V0/primary/hEtaResolution", "#eta resolution;p_{#gamma} (GeV/c);#Delta#eta", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.01}}, false); + fRegistry.add("V0/primary/hThetaResolution", "#theta resolution;p_{#gamma} (GeV/c);#Delta#theta (rad.)", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.01}}, false); + fRegistry.add("V0/primary/hPhiResolution", "#varphi resolution;p_{#gamma} (GeV/c);#Delta#varphi (rad.)", kTH2F, {{1000, 0.0f, 10}, {100, 0, 0.01}}, false); fRegistry.add("V0/primary/hNgamma", "Number of true #gamma per collision", kTH1F, {{101, -0.5f, 100.5f}}); fRegistry.add("V0/primary/hConvPoint_diffX", "conversion point diff X MC;X_{MC} (cm);X_{rec} - X_{MC} (cm)", kTH2F, {{200, -100, +100}, {100, -50.0f, 50.0f}}, true); fRegistry.add("V0/primary/hConvPoint_diffY", "conversion point diff Y MC;Y_{MC} (cm);Y_{rec} - Y_{MC} (cm)", kTH2F, {{200, -100, +100}, {100, -50.0f, 50.0f}}, true); @@ -205,6 +215,7 @@ struct PCMQCMC { fRegistry.add("V0Leg/primary/hTPCNsigmaPi", "TPC n sigma pi;p_{in} (GeV/c);n #sigma_{#pi}^{TPC}", kTH2F, {{1000, 0, 10}, {100, -5, +5}}, false); fRegistry.add("V0Leg/primary/hTPCNcr2Nf", "TPC Ncr/Nfindable", kTH1F, {{200, 0, 2}}, false); fRegistry.add("V0Leg/primary/hTPCNcls2Nf", "TPC Ncls/Nfindable", kTH1F, {{200, 0, 2}}, false); + fRegistry.add("V0Leg/primary/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("V0Leg/primary/hNclsITS", "number of ITS clusters", kTH1F, {{8, -0.5, 7.5}}, false); fRegistry.add("V0Leg/primary/hChi2ITS", "chi2/number of ITS clusters", kTH1F, {{100, 0, 10}}, false); fRegistry.add("V0Leg/primary/hITSClusterMap", "ITS cluster map", kTH1F, {{128, -0.5, 127.5}}, false); @@ -230,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); } @@ -240,7 +250,7 @@ struct PCMQCMC { // for v0 fV0PhotonCut.SetV0PtRange(pcmcuts.cfg_min_pt_v0, 1e10f); - fV0PhotonCut.SetV0EtaRange(-pcmcuts.cfg_max_eta_v0, +pcmcuts.cfg_max_eta_v0); + fV0PhotonCut.SetV0EtaRange(pcmcuts.cfg_min_eta_v0, pcmcuts.cfg_max_eta_v0); fV0PhotonCut.SetMinCosPA(pcmcuts.cfg_min_cospa); fV0PhotonCut.SetMaxPCA(pcmcuts.cfg_max_pca); fV0PhotonCut.SetRxyRange(pcmcuts.cfg_min_v0radius, pcmcuts.cfg_max_v0radius); @@ -249,10 +259,11 @@ struct PCMQCMC { // for track fV0PhotonCut.SetTrackPtRange(pcmcuts.cfg_min_pt_v0 * 0.4, 1e+10f); - fV0PhotonCut.SetTrackEtaRange(-pcmcuts.cfg_max_eta_v0, +pcmcuts.cfg_max_eta_v0); + fV0PhotonCut.SetTrackEtaRange(pcmcuts.cfg_min_eta_v0, pcmcuts.cfg_max_eta_v0); fV0PhotonCut.SetMinNClustersTPC(pcmcuts.cfg_min_ncluster_tpc); fV0PhotonCut.SetMinNCrossedRowsTPC(pcmcuts.cfg_min_ncrossedrows); fV0PhotonCut.SetMinNCrossedRowsOverFindableClustersTPC(0.8); + fV0PhotonCut.SetMaxFracSharedClustersTPC(pcmcuts.cfg_max_frac_shared_clusters_tpc); fV0PhotonCut.SetChi2PerClusterTPC(0.0, pcmcuts.cfg_max_chi2tpc); fV0PhotonCut.SetTPCNsigmaElRange(pcmcuts.cfg_min_TPCNsigmaEl, pcmcuts.cfg_max_TPCNsigmaEl); fV0PhotonCut.SetChi2PerClusterITS(-1e+10, pcmcuts.cfg_max_chi2its); @@ -349,6 +360,11 @@ struct PCMQCMC { fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsX"), v0.vx(), v0.chiSquareNDF()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsY"), v0.vy(), v0.chiSquareNDF()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hKFChi2vsZ"), v0.vz(), v0.chiSquareNDF()); + fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hPResolution"), v0.p(), getPResolution(v0) / v0.p()); + fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hPtResolution"), v0.p(), getPtResolution(v0) / v0.pt()); + fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hEtaResolution"), v0.p(), getEtaResolution(v0)); + fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hThetaResolution"), v0.p(), getThetaResolution(v0)); + fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hPhiResolution"), v0.p(), getPhiResolution(v0)); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaPtOverPtGen"), mcphoton.pt(), (v0.pt() - mcphoton.pt()) / mcphoton.pt()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaEta"), mcphoton.pt(), v0.eta() - mcphoton.eta()); fRegistry.fill(HIST("V0/") + HIST(mcphoton_types[mctype]) + HIST("hPtGen_DeltaPhi"), mcphoton.pt(), v0.phi() - mcphoton.phi()); @@ -371,6 +387,7 @@ struct PCMQCMC { fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hNcrTPC"), leg.tpcNClsCrossedRows()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hTPCNcr2Nf"), leg.tpcCrossedRowsOverFindableCls()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hTPCNcls2Nf"), leg.tpcFoundOverFindableCls()); + fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hTPCNclsShared"), leg.pt(), leg.tpcFractionSharedCls()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hChi2TPC"), leg.tpcChi2NCl()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hChi2ITS"), leg.itsChi2NCl()); fRegistry.fill(HIST("V0Leg/") + HIST(mcphoton_types[mctype]) + HIST("hITSClusterMap"), leg.itsClusterMap()); @@ -397,7 +414,7 @@ struct PCMQCMC { void processQCMC(FilteredMyCollisions const& collisions, MyV0Photons const& v0photons, MyMCV0Legs const&, aod::EMMCParticles const& mcparticles, aod::EMMCEvents const&) { for (auto& collision : collisions) { - const float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } @@ -487,7 +504,7 @@ struct PCMQCMC { // all MC tracks which belong to the MC event corresponding to the current reconstructed event for (auto& collision : collisions) { - const float centralities[4] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C(), collision.centNTPV()}; + const float centralities[3] = {collision.centFT0M(), collision.centFT0A(), collision.centFT0C()}; if (centralities[cfgCentEstimator] < cfgCentMin || cfgCentMax < centralities[cfgCentEstimator]) { continue; } diff --git a/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx new file mode 100644 index 00000000000..489e0bd7008 --- /dev/null +++ b/PWGEM/PhotonMeson/Tasks/taskPi0FlowEMC.cxx @@ -0,0 +1,852 @@ +// 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 taskPi0FlowEMC.cxx +/// \brief Analysis task for neutral pion flow with EMCal +/// +/// \author M. Hemmer, marvin.hemmer@cern.ch + +#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 "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" +#include "PWGEM/PhotonMeson/Core/EMPhotonEventCut.h" +#include "PWGEM/PhotonMeson/DataModel/gammaTables.h" +#include "PWGEM/PhotonMeson/Utils/emcalHistoDefinitions.h" +#include "PWGEM/PhotonMeson/Utils/PairUtilities.h" +#include "PWGEM/PhotonMeson/Utils/EventHistograms.h" +#include "PWGEM/PhotonMeson/Utils/NMHistograms.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::photonmeson::photonpair; +using namespace o2::aod::pwgem::photon; +using namespace o2::aod::pwgem::dilepton::utils; + +enum QvecEstimator { FT0M = 0, + FT0A = 1, + FT0C, + TPCPos, + TPCNeg, + TPCTot }; + +enum CentralityEstimator { None = 0, + CFT0A = 1, + CFT0C, + CFT0M, + NCentralityEstimators +}; + +struct EMfTaskPi0Flow { + // 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 axis + ConfigurableAxis thnConfigAxisInvMass{"thnConfigAxisInvMass", {200, 0.0, 0.4}, ""}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0., 20.}, ""}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {20, 0., 100.}, ""}; + ConfigurableAxis thnConfigAxisCosNPhi{"thnConfigAxisCosNPhi", {100, -1., 1.}, ""}; + ConfigurableAxis thnConfigAxisCosDeltaPhi{"thnConfigAxisCosDeltaPhi", {100, -1., 1.}, ""}; + ConfigurableAxis thnConfigAxisScalarProd{"thnConfigAxisScalarProd", {100, -5., 5.}, ""}; + + EMPhotonEventCut fEMEventCut; + struct : ConfigurableGroup { + std::string prefix = "eventcut_group"; + 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"}; + 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 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 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 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 enableQA{"enableQA", false, "flag to turn QA plots on/off"}; + } eventcuts; + + EMCPhotonCut fEMCCut; + struct : ConfigurableGroup { + std::string prefix = "emccut_group"; + 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"}; + Configurable enableQA{"enableQA", false, "flag to turn QA plots on/off"}; + } emccuts; + + struct : ConfigurableGroup { + std::string prefix = "meson"; + Configurable minOpenAngle{"minOpenAngle", 0.0202, "apply min opening angle. Default value one EMCal cell"}; + 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 enableQA{"enableQA", false, "flag to turn QA plots on/off"}; + ConfigurableAxis thConfigAxisTanThetaPhi{"thConfigAxisTanThetaPhi", {180, -90.f, 90.f}, ""}; + } mesonConfig; + + struct : ConfigurableGroup { + std::string prefix = "event-mixing"; + 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 ConfCentBins{"ConfCentBins", {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 ConfEPBins{"ConfEPBins", {8, -M_PI / 2, +M_PI / 2}, "Mixing bins - event plane angle"}; + ConfigurableAxis ConfOccupancyBins{"ConfOccupancyBins", {VARIABLE_WIDTH, 0, 100, 500, 1000, 2000}, "Mixing bins - occupancy"}; + Configurable ConfMixingDepth{"ConfMixingDepth", 2, "Mixing depth"}; + } mixingConfig; + + SliceCache cache; + EventPlaneHelper epHelper; + o2::framework::Service ccdb; + + Filter clusterFilter = aod::skimmedcluster::time >= emccuts.EMC_minTime && aod::skimmedcluster::time <= emccuts.EMC_maxTime && aod::skimmedcluster::m02 >= emccuts.EMC_minM02 && aod::skimmedcluster::m02 <= emccuts.EMC_maxM02 && skimmedcluster::e >= emccuts.EMC_minE; + 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 perCollision_emc = aod::emccluster::emeventId; + Preslice perCollision_emc_filtered = aod::emccluster::emeventId; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + void DefineEMEventCut() + { + fEMEventCut = EMPhotonEventCut("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.SetRequireVertexITSTPC(eventcuts.cfgRequireVertexITSTPC); + fEMEventCut.SetRequireGoodZvtxFT0vsPV(eventcuts.cfgRequireGoodZvtxFT0vsPV); + fEMEventCut.SetRequireEMCReadoutInMB(eventcuts.cfgRequireEMCReadoutInMB); + fEMEventCut.SetRequireEMCHardwareTriggered(eventcuts.cfgRequireEMCHardwareTriggered); + } + + 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 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); + 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); + } + + void init(InitContext&) + { + if (harmonic != 2 && harmonic != 3) { + LOG(info) << "Harmonic was set to " << harmonic << " but can only be 2 or 3!"; + } + + DefineEMEventCut(); + DefineEMCCut(); + fEMCCut.SetUseTM(emccuts.EMC_UseTM); // disables TM + o2::aod::pwgem::photonmeson::utils::eventhistogram::addEventHistograms(®istry); + + // Load EMCal geometry + 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{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, 0.f, 2. / harmonic * M_PI, Form("#Psi_{%d}", harmonic.value)}; + + 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"); + + if (saveSPResoHist) { + registry.add("spReso/hSpResoFT0cFT0a", "hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0cTPCpos", "hSpResoFT0cTPCpos; centrality; Q_{FT0c} #bullet Q_{TPCpos}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0cTPCneg", "hSpResoFT0cTPCneg; centrality; Q_{FT0c} #bullet Q_{TPCneg}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0cTPCtot", "hSpResoFT0cTPCtot; centrality; Q_{FT0c} #bullet Q_{TPCtot}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0aTPCpos", "hSpResoFT0aTPCpos; centrality; Q_{FT0a} #bullet Q_{TPCpos}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0aTPCneg", "hSpResoFT0aTPCneg; centrality; Q_{FT0a} #bullet Q_{TPCneg}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0aTPCtot", "hSpResoFT0aTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0mTPCpos", "hSpResoFT0mTPCpos; centrality; Q_{FT0m} #bullet Q_{TPCpos}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0mTPCneg", "hSpResoFT0mTPCneg; centrality; Q_{FT0m} #bullet Q_{TPCneg}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoFT0mTPCtot", "hSpResoFT0mTPCtot; centrality; Q_{FT0m} #bullet Q_{TPCtot}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("spReso/hSpResoTPCposTPCneg", "hSpResoTPCposTPCneg; centrality; Q_{TPCpos} #bullet Q_{TPCneg}", {HistType::kTProfile, {thnAxisCent}}); + } + + if (saveEpResoHisto) { + 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::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0cTPCpos", "hEpResoFT0cTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0cTPCneg", "hEpResoFT0cTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0cTPCtot", "hEpResoFT0cTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0aTPCpos", "hEpResoFT0aTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0aTPCneg", "hEpResoFT0aTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0aTPCtot", "hEpResoFT0aTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0mTPCpos", "hEpResoFT0mTPCpos; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0mTPCneg", "hEpResoFT0mTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoFT0mTPCtot", "hEpResoFT0mTPCtot; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + registry.add("epReso/hEpResoTPCposTPCneg", "hEpResoTPCposTPCneg; centrality; #Delta#Psi_{sub}", {HistType::kTProfile, {thnAxisCent}}); + } + if (eventcuts.enableQA) { + 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.enableQA) { + 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.enableQA) { + 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(); + + 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 + + /// Change radians to degree + /// \param angle in radians + /// \return angle in degree + float getAngleDegree(float angle) + { + return angle * 180.f * std::numbers::inv_pi_v; + } + + /// Compute the delta psi in the range [0, pi/harmonic] + /// \param psi1 is the first angle + /// \param psi2 is the second angle + float getDeltaPsiInRange(float psi1, float psi2) + { + float deltaPsi = psi1 - psi2; + if (std::abs(deltaPsi) > constants::math::PI / harmonic) { + if (deltaPsi > 0.) + deltaPsi -= constants::math::TwoPI / harmonic; + else + deltaPsi += constants::math::TwoPI / harmonic; + } + return deltaPsi; + } + + /// Fill THnSparse + /// \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 sp is the scalar product + void fillThn(float& mass, + float& pt, + float& cent, + float& sp) + { + registry.fill(HIST("hSparsePi0Flow"), mass, pt, cent, sp); + } + + /// Get the centrality + /// \param collision is the collision with the centrality information + float getCentrality(CollsWithQvecs::iterator const& collision) + { + float cent = -999.; + switch (centEstimator) { + case CentralityEstimator::CFT0M: + cent = collision.centFT0M(); + break; + case CentralityEstimator::CFT0A: + cent = collision.centFT0A(); + break; + case CentralityEstimator::CFT0C: + cent = collision.centFT0C(); + break; + default: + LOG(warning) << "Centrality estimator not valid. Possible values are T0M, T0A, T0C. Fallback to T0C"; + cent = collision.centFT0C(); + break; + } + 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::pair getQvec(CollsWithQvecs::iterator const& collision, int detector) + { + float xQVec = -999.f; + float yQVec = -999.f; + + switch (detector) { + case QvecEstimator::FT0M: + if (harmonic == 2) { + xQVec = collision.q2xft0m(); + yQVec = collision.q2yft0m(); + } else if (harmonic == 3) { + xQVec = collision.q3xft0m(); + yQVec = collision.q3yft0m(); + } + break; + case QvecEstimator::FT0A: + if (harmonic == 2) { + xQVec = collision.q2xft0a(); + yQVec = collision.q2yft0a(); + } else if (harmonic == 3) { + xQVec = collision.q3xft0a(); + yQVec = collision.q3yft0a(); + } + break; + case QvecEstimator::FT0C: + if (harmonic == 2) { + xQVec = collision.q2xft0c(); + yQVec = collision.q2yft0c(); + } else if (harmonic == 3) { + xQVec = collision.q3xft0c(); + yQVec = collision.q3yft0c(); + } + break; + case QvecEstimator::TPCPos: + if (harmonic == 2) { + xQVec = collision.q2xbpos(); + yQVec = collision.q2ybpos(); + } else if (harmonic == 3) { + xQVec = collision.q3xbpos(); + yQVec = collision.q3ybpos(); + } + break; + case QvecEstimator::TPCNeg: + if (harmonic == 2) { + xQVec = collision.q2xbneg(); + yQVec = collision.q2ybneg(); + } else if (harmonic == 3) { + xQVec = collision.q3xbneg(); + yQVec = collision.q3ybneg(); + } + break; + case QvecEstimator::TPCTot: + if (harmonic == 2) { + xQVec = collision.q2xbtot(); + yQVec = collision.q2ybtot(); + } else if (harmonic == 3) { + xQVec = collision.q3xbtot(); + yQVec = collision.q3ybtot(); + } + break; + default: + LOG(warning) << "Q vector estimator not valid. Falling back to FT0M"; + if (harmonic == 2) { + xQVec = collision.q2xft0m(); + yQVec = collision.q2yft0m(); + } else if (harmonic == 3) { + xQVec = collision.q3xft0m(); + yQVec = collision.q3yft0m(); + } + break; + } + 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 (auto& QVec : QVecs) { + if (std::fabs(QVec) > 20.f) { + isgood = false; + break; + } + } + return isgood; + } + + /// \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); + + const float rotationAngle = M_PI / 2.0; // rotaion angle 90 degree + ROOT::Math::AxisAngle rotationAxis(meson.Vect(), rotationAngle); + ROOT::Math::Rotation3D rotationMatrix(rotationAxis); + photon1 = rotationMatrix * photon1; + photon2 = rotationMatrix * photon2; + + for (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; + ROOT::Math::PtEtaPhiMVector mother2 = photon2 + photon3; + + 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; + + float cosNPhi1 = std::cos(harmonic * mother1.Phi()); + float sinNPhi1 = std::sin(harmonic * mother1.Phi()); + float scalprodCand1 = cosNPhi1 * xQVec + sinNPhi1 * yQVec; + + float cosNPhi2 = std::cos(harmonic * mother2.Phi()); + float sinNPhi2 = std::sin(harmonic * mother2.Phi()); + float scalprodCand2 = cosNPhi2 * xQVec + sinNPhi2 * yQVec; + + 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 > mesonConfig.minOpenAngle && iCellID_photon1 > 0 && thnConfigAxisInvMass.value[1] <= mother1.M() && thnConfigAxisInvMass.value.back() >= mother1.M() && thnConfigAxisPt.value[1] > mother1.Pt() && thnConfigAxisPt.value.back() < mother1.Pt()) { + registry.fill(HIST("hSparseBkgFlow"), mother1.M(), mother1.Pt(), cent, scalprodCand1); + } + if (openingAngle2 > mesonConfig.minOpenAngle && iCellID_photon2 > 0 && thnConfigAxisInvMass.value[1] <= mother2.M() && thnConfigAxisInvMass.value.back() >= mother2.M() && thnConfigAxisPt.value[1] > mother2.Pt() && thnConfigAxisPt.value.back() < mother2.Pt()) { + registry.fill(HIST("hSparseBkgFlow"), mother2.M(), mother2.Pt(), cent, scalprodCand2); + } + } + } + + /// 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) + { + auto [xQVec, yQVec] = getQvec(collision, qvecDetector); + float cent = getCentrality(collision); + + float massCand = meson.M(); + float ptCand = meson.Pt(); + float phiCand = meson.Phi(); + + float cosNPhi = std::cos(harmonic * phiCand); + float sinNPhi = std::sin(harmonic * phiCand); + float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec; + + fillThn(massCand, ptCand, cent, scalprodCand); + return; + } + + // Pi0 from EMCal + void processEMCal(CollsWithQvecs const& collisions, EMCalPhotons const& clusters) + { + for (auto& collision : collisions) { + auto photons_per_collision = clusters.sliceBy(perCollision_emc, collision.globalIndex()); + + if (eventcuts.enableQA) { + // 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 (photons_per_collision.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 (photons_per_collision.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 (auto& photon : photons_per_collision) { + 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))) { + // general event selection + continue; + 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; + } + 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 + + if (emccuts.enableQA) { + for (auto& photon : photons_per_collision) { + registry.fill(HIST("hEClusterBefore"), photon.e()); // before cuts + if (!(fEMCCut.IsSelected(photon))) { + continue; + } + registry.fill(HIST("hEClusterAfter"), photon.e()); // accepted after cuts + } + } + for (auto& [g1, g2] : combinations(CombinationsStrictlyUpperIndexPolicy(photons_per_collision, photons_per_collision))) { + 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; + + RotationBackground(vMeson, v1, v2, photons_per_collision, g1.globalIndex(), g2.globalIndex(), collision); + + 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.enableQA) { + registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCuts"), 5); + continue; + } + registry.fill(HIST("hClusterCuts"), 6); + runFlowAnalysis(collision, vMeson); + } + } + } + PROCESS_SWITCH(EMfTaskPi0Flow, 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.ConfVtxBins, mixingConfig.ConfCentBins, mixingConfig.ConfEPBins}, true}; + + auto clustersTuple = std::make_tuple(clusters); + SameKindPair pair{binningWithLambda, mixingConfig.ConfMixingDepth, -1, collisions, clustersTuple, &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored + + for (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; + } + for (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.enableQA) { + registry.fill(HIST("hInvMassPt"), vMeson.M(), vMeson.Pt()); + registry.fill(HIST("hTanThetaPhi"), vMeson.M(), getAngleDegree(atan(dTheta / dPhi))); + registry.fill(HIST("hAlphaPt"), (v1.E() - v2.E()) / (v1.E() + v2.E()), vMeson.Pt()); + } + if (mesonConfig.minTanThetadPhi > std::fabs(getAngleDegree(atan(dTheta / dPhi)))) { + registry.fill(HIST("hClusterCuts"), 5); + continue; + } + registry.fill(HIST("hClusterCuts"), 6); + runFlowAnalysis(c1, vMeson); + } + } + } + PROCESS_SWITCH(EMfTaskPi0Flow, processEMCalMixed, "Process EMCal Pi0 mixed event candidates", false); + + // Resolution + void processResolution(CollsWithQvecs::iterator const& collision) + { + 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 + + float centrality = getCentrality(collision); // centrality not updated in the rejection mask function + float xQVecFT0a = -999.f; + float yQVecFT0a = -999.f; + float xQVecFT0c = -999.f; + float yQVecFT0c = -999.f; + float xQVecFT0m = -999.f; + float yQVecFT0m = -999.f; + float xQVecBPos = -999.f; + float yQVecBPos = -999.f; + float xQVecBNeg = -999.f; + float yQVecBNeg = -999.f; + float xQVecBTot = -999.f; + float yQVecBTot = -999.f; + if (harmonic == 2) { + xQVecFT0a = collision.q2xft0a(); + yQVecFT0a = collision.q2yft0a(); + xQVecFT0c = collision.q2xft0c(); + yQVecFT0c = collision.q2yft0c(); + xQVecFT0m = collision.q2xft0m(); + yQVecFT0m = collision.q2yft0m(); + xQVecBPos = collision.q2xbpos(); + yQVecBPos = collision.q2ybpos(); + xQVecBNeg = collision.q2xbneg(); + yQVecBNeg = collision.q2ybneg(); + xQVecBTot = collision.q2xbtot(); + yQVecBTot = collision.q2ybtot(); + } else if (harmonic == 3) { + xQVecFT0a = collision.q3xft0a(); + yQVecFT0a = collision.q3yft0a(); + xQVecFT0c = collision.q3xft0c(); + yQVecFT0c = collision.q3yft0c(); + xQVecFT0m = collision.q3xft0m(); + yQVecFT0m = collision.q3yft0m(); + xQVecBPos = collision.q3xbpos(); + yQVecBPos = collision.q3ybpos(); + xQVecBNeg = collision.q3xbneg(); + yQVecBNeg = collision.q3ybneg(); + xQVecBTot = collision.q3xbtot(); + yQVecBTot = collision.q3ybtot(); + } + + if (saveSPResoHist) { + registry.fill(HIST("spReso/hSpResoFT0cFT0a"), centrality, xQVecFT0c * xQVecFT0a + yQVecFT0c * yQVecFT0a); + registry.fill(HIST("spReso/hSpResoFT0cTPCpos"), centrality, xQVecFT0c * xQVecBPos + yQVecFT0c * yQVecBPos); + registry.fill(HIST("spReso/hSpResoFT0cTPCneg"), centrality, xQVecFT0c * xQVecBNeg + yQVecFT0c * yQVecBNeg); + registry.fill(HIST("spReso/hSpResoFT0cTPCtot"), centrality, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot); + registry.fill(HIST("spReso/hSpResoFT0aTPCpos"), centrality, xQVecFT0a * xQVecBPos + yQVecFT0a * yQVecBPos); + registry.fill(HIST("spReso/hSpResoFT0aTPCneg"), centrality, xQVecFT0a * xQVecBNeg + yQVecFT0a * yQVecBNeg); + registry.fill(HIST("spReso/hSpResoFT0aTPCtot"), centrality, xQVecFT0a * xQVecBTot + yQVecFT0a * yQVecBTot); + registry.fill(HIST("spReso/hSpResoFT0mTPCpos"), centrality, xQVecFT0m * xQVecBPos + yQVecFT0m * yQVecBPos); + registry.fill(HIST("spReso/hSpResoFT0mTPCneg"), centrality, xQVecFT0m * xQVecBNeg + yQVecFT0m * yQVecBNeg); + registry.fill(HIST("spReso/hSpResoFT0mTPCtot"), centrality, xQVecFT0m * xQVecBTot + yQVecFT0m * yQVecBTot); + registry.fill(HIST("spReso/hSpResoTPCposTPCneg"), centrality, xQVecBPos * xQVecBNeg + yQVecBPos * yQVecBNeg); + } + + if (saveEpResoHisto) { + float epFT0a = epHelper.GetEventPlane(xQVecFT0a, yQVecFT0a, harmonic); + float epFT0c = epHelper.GetEventPlane(xQVecFT0c, yQVecFT0c, harmonic); + float epFT0m = epHelper.GetEventPlane(xQVecFT0m, yQVecFT0m, harmonic); + float epBPoss = epHelper.GetEventPlane(xQVecBPos, yQVecBPos, harmonic); + 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))); + registry.fill(HIST("epReso/hEpResoFT0cTPCtot"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0c, epBTots))); + registry.fill(HIST("epReso/hEpResoFT0aTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0a, epBPoss))); + registry.fill(HIST("epReso/hEpResoFT0aTPCneg"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0a, epBNegs))); + registry.fill(HIST("epReso/hEpResoFT0aTPCtot"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0a, epBTots))); + registry.fill(HIST("epReso/hEpResoFT0mTPCpos"), centrality, std::cos(harmonic * getDeltaPsiInRange(epFT0m, epBPoss))); + 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))); + } + } + PROCESS_SWITCH(EMfTaskPi0Flow, processResolution, "Process resolution", false); + +}; // End struct EMfTaskPi0Flow + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h index 8e7524b1664..5df8ca93de1 100644 --- a/PWGEM/PhotonMeson/Utils/ClusterHistograms.h +++ b/PWGEM/PhotonMeson/Utils/ClusterHistograms.h @@ -21,22 +21,25 @@ namespace o2::aod::pwgem::photonmeson::utils::clusterhistogram { void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) { - fRegistry->add("Cluster/before/hE", "E_{cluster};#it{E}_{cluster} (GeV);#it{N}_{cluster}", kTH1F, {{500, 0, 50}}, true); - fRegistry->add("Cluster/before/hPt", "Transverse momenta of clusters;#it{p}_{T} (GeV/c);#it{N}_{cluster}", kTH1F, {{1000, 0.0f, 20}}, true); - fRegistry->add("Cluster/before/hNgamma", "Number of #gamma candidates per collision;#it{N}_{#gamma} per collision;#it{N}_{collisions}", kTH1F, {{101, -0.5f, 100.5f}}, true); - fRegistry->add("Cluster/before/hEtaPhi", "#eta vs #varphi;#eta;#varphi (rad.)", kTH2F, {{200, -1.0f, 1.0f}, {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, {{100, -0.5, 0.5}, {100, -0.5, 0.5}}, true); + fRegistry->add("Cluster/before/hE", "E_{cluster};#it{E}_{cluster} (GeV);#it{N}_{cluster}", kTH1F, {{500, 0.0f, 50}}, true); + 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/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, {{51, -0.5, 50.5}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{E}_{cluster} (GeV)", kTH2F, {{500, 0, 5}, {200, 0, 20}}, true); - fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{E}_{cluster} (GeV)", kTH2F, {{100, -250, 250}, {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/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/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, {{51, -0.5, 50.5}}, true); - fRegistry->add("Cluster/before/hM02", "Long ellipse axis;#it{M}_{02} (cm);#it{N}_{cluster}", kTH1F, {{500, 0, 5}}, true); - fRegistry->add("Cluster/before/hTime", "Cluster time;#it{t}_{cls} (ns);#it{N}_{cluster}", kTH1F, {{500, -250, 250}}, true); - fRegistry->add("Cluster/before/hCellTime", "Cluster time;#it{t}_{cell} (ns);#it{N}_{cluster}", kTH1F, {{500, -250, 250}}, true); + 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/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); @@ -53,23 +56,32 @@ void addClusterHistograms(HistogramRegistry* fRegistry, bool do2DQA) } template -void fillClusterHistograms(HistogramRegistry* fRegistry, SkimEMCCluster cluster, bool do2DQA) +void fillClusterHistograms(HistogramRegistry* fRegistry, SkimEMCCluster cluster, bool do2DQA, float weight = 1.f) { static constexpr std::string_view cluster_types[2] = {"before/", "after/"}; - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hE"), cluster.e()); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hPt"), cluster.pt()); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hEtaPhi"), cluster.eta(), cluster.phi()); + 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()); + 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()); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02(), cluster.e()); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time(), cluster.e()); + 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()); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hM02"), cluster.m02()); - fRegistry->fill(HIST("Cluster/") + HIST(cluster_types[cls_id]) + HIST("hTime"), cluster.time()); + 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/PhotonMeson/Utils/NMHistograms.h b/PWGEM/PhotonMeson/Utils/NMHistograms.h index 0bd205d3bd8..95abaf92292 100644 --- a/PWGEM/PhotonMeson/Utils/NMHistograms.h +++ b/PWGEM/PhotonMeson/Utils/NMHistograms.h @@ -68,30 +68,29 @@ void addNMHistograms(HistogramRegistry* fRegistry, bool isMC, const char* pairna } template -void fillTruePairInfo(HistogramRegistry* fRegistry, TDiphoton const& v12, TMCParitlce const& mcparticle, TMCParticles const& mcparticles, TMCCollisions const&, const TF1* f1fd_k0s_to_pi0 = nullptr) +void fillTruePairInfo(HistogramRegistry* fRegistry, TDiphoton const& v12, TMCParitlce const& mcparticle, TMCParticles const& mcparticles, TMCCollisions const&, const TF1* f1fd_k0s_to_pi0 = nullptr, float eventWeight = 1.f) { int pdg = abs(mcparticle.pdgCode()); + float weight = eventWeight; switch (pdg) { case 111: { int motherid_strhad = IsFromWD(mcparticle.template emmcevent_as(), mcparticle, mcparticles); if (mcparticle.isPhysicalPrimary() || mcparticle.producedByGenerator()) { - fRegistry->fill(HIST("Pair/Pi0/hs_Primary"), v12.M(), v12.Pt()); + fRegistry->fill(HIST("Pair/Pi0/hs_Primary"), v12.M(), v12.Pt(), weight); } else if (motherid_strhad > 0) { - float weight = 1.f; auto str_had = mcparticles.iteratorAt(motherid_strhad); if (abs(str_had.pdgCode()) == 310 && f1fd_k0s_to_pi0 != nullptr) { - weight = f1fd_k0s_to_pi0->Eval(str_had.pt()); + weight *= f1fd_k0s_to_pi0->Eval(str_had.pt()); } fRegistry->fill(HIST("Pair/Pi0/hs_FromWD"), v12.M(), v12.Pt(), weight); } else { - float weight = 1.f; fRegistry->fill(HIST("Pair/Pi0/hs_FromHS"), v12.M(), v12.Pt(), weight); } break; } case 221: { if (mcparticle.isPhysicalPrimary() || mcparticle.producedByGenerator()) { - fRegistry->fill(HIST("Pair/Eta/hs_Primary"), v12.M(), v12.Pt()); + fRegistry->fill(HIST("Pair/Eta/hs_Primary"), v12.M(), v12.Pt(), weight); } break; } diff --git a/PWGEM/PhotonMeson/Utils/PCMUtilities.h b/PWGEM/PhotonMeson/Utils/PCMUtilities.h index 9530fa03c4f..63101c41418 100644 --- a/PWGEM/PhotonMeson/Utils/PCMUtilities.h +++ b/PWGEM/PhotonMeson/Utils/PCMUtilities.h @@ -104,4 +104,80 @@ inline void Vtx_recalculation(o2::base::Propagator* prop, T1 lTrackPos, T2 lTrac Vtx_recalculationParCov(prop, trackPosInformation, trackNegInformation, xyz, matCorr); } +//_______________________________________________________________________ +template +float getPtResolution(TV0 const& v0) +{ + float px = v0.px(); + float py = v0.py(); + float pt = v0.pt(); + float px_err = std::sqrt(fabs(v0.sigmaPx2())); + float py_err = std::sqrt(fabs(v0.sigmaPy2())); + float pxy_err = v0.sigmaPxPy(); + return std::sqrt(std::pow(px / pt * px_err, 2) + std::pow(py / pt * py_err, 2) + 2.f * px / pt * py / pt * pxy_err); +} +//_______________________________________________________________________ +template +float getPhiResolution(TV0 const& v0) +{ + float px = v0.px(); + float py = v0.py(); + float pt = v0.pt(); + float px_err = std::sqrt(fabs(v0.sigmaPx2())); + float py_err = std::sqrt(fabs(v0.sigmaPy2())); + float pxy_err = v0.sigmaPxPy(); + return std::sqrt(std::pow(px / pt / pt * py_err, 2) + std::pow(py / pt / pt * px_err, 2) - 2.f * px / pt / pt * py / pt / pt * pxy_err); +} +//_______________________________________________________________________ +template +float getThetaResolution(TV0 const& v0) +{ + float px = v0.px(); + float py = v0.py(); + float pz = v0.pz(); + float pt = v0.pt(); + float p = v0.p(); + float px_err = std::sqrt(fabs(v0.sigmaPx2())); + float py_err = std::sqrt(fabs(v0.sigmaPy2())); + float pz_err = std::sqrt(fabs(v0.sigmaPz2())); + float pxy_err = v0.sigmaPxPy(); + float pyz_err = v0.sigmaPyPz(); + float pzx_err = v0.sigmaPzPx(); + return std::sqrt(std::pow(pz * pz / p / p, 2) * (std::pow(px / pz / pt * px_err, 2) + std::pow(py / pz / pt * py_err, 2) + std::pow(pt / pz / pz * pz_err, 2) + 2.f * (px * py / pz / pz / pt / pt * pxy_err - py / pz / pz / pz * pyz_err - px / pz / pz / pz * pzx_err))); +} +//_______________________________________________________________________ +template +float getEtaResolution(TV0 const& v0) +{ + float px = v0.px(); + float py = v0.py(); + float pz = v0.pz(); + float pt = v0.pt(); + float p = v0.p(); + float px_err = std::sqrt(fabs(v0.sigmaPx2())); + float py_err = std::sqrt(fabs(v0.sigmaPy2())); + float pz_err = std::sqrt(fabs(v0.sigmaPz2())); + float pxy_err = v0.sigmaPxPy(); + float pyz_err = v0.sigmaPyPz(); + float pzx_err = v0.sigmaPzPx(); + return std::sqrt(std::pow(1.f / p / pt / pt, 2) * (std::pow(pz * px * px_err, 2) + std::pow(pz * py * py_err, 2) + std::pow(pt * pt * pz_err, 2) + 2.f * (pz * pz * px * py * pxy_err - pt * pt * py * pz * pyz_err - pt * pt * pz * px * pzx_err))); +} +//_______________________________________________________________________ +template +float getPResolution(TV0 const& v0) +{ + float px = v0.px(); + float py = v0.py(); + float pz = v0.pz(); + float p = v0.p(); + float px_err = std::sqrt(fabs(v0.sigmaPx2())); + float py_err = std::sqrt(fabs(v0.sigmaPy2())); + float pz_err = std::sqrt(fabs(v0.sigmaPz2())); + float pxy_err = v0.sigmaPxPy(); + float pyz_err = v0.sigmaPyPz(); + float pzx_err = v0.sigmaPzPx(); + return std::sqrt(std::pow(1.f / p, 2) * (std::pow(px * px_err, 2) + std::pow(py * py_err, 2) + std::pow(pz * pz_err, 2) + 2.f * (px * py * pxy_err + py * pz * pyz_err + pz * px * pzx_err))); +} +//_______________________________________________________________________ +//_______________________________________________________________________ #endif // PWGEM_PHOTONMESON_UTILS_PCMUTILITIES_H_ diff --git a/PWGHF/Core/HfMlResponseB0ToDPi.h b/PWGHF/Core/HfMlResponseB0ToDPi.h index 08853a21eac..18584ae5258 100644 --- a/PWGHF/Core/HfMlResponseB0ToDPi.h +++ b/PWGHF/Core/HfMlResponseB0ToDPi.h @@ -21,6 +21,7 @@ #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) @@ -58,31 +59,6 @@ break; \ } -namespace o2::pid_tpc_tof_utils -{ -template -float getTpcTofNSigmaPi1(const T1& prong1) -{ - float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h - - bool hasTpc = prong1.hasTPC(); - bool hasTof = prong1.hasTOF(); - - if (hasTpc && hasTof) { - float tpcNSigma = prong1.tpcNSigmaPi(); - float tofNSigma = prong1.tofNSigmaPi(); - return sqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma); - } - if (hasTpc) { - return abs(prong1.tpcNSigmaPi()); - } - if (hasTof) { - return abs(prong1.tofNSigmaPi()); - } - return defaultNSigma; -} -} // namespace o2::pid_tpc_tof_utils - namespace o2::analysis { diff --git a/PWGHF/Core/HfMlResponseBplusToD0Pi.h b/PWGHF/Core/HfMlResponseBplusToD0Pi.h index 8d47d4ade89..8a3b3875dae 100644 --- a/PWGHF/Core/HfMlResponseBplusToD0Pi.h +++ b/PWGHF/Core/HfMlResponseBplusToD0Pi.h @@ -21,6 +21,7 @@ #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) @@ -58,31 +59,6 @@ break; \ } -namespace o2::pid_tpc_tof_utils -{ -template -float getTpcTofNSigmaPi1(const T1& prong1) -{ - float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h - - bool hasTpc = prong1.hasTPC(); - bool hasTof = prong1.hasTOF(); - - if (hasTpc && hasTof) { - float tpcNSigma = prong1.tpcNSigmaPi(); - float tofNSigma = prong1.tofNSigmaPi(); - return sqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma); - } - if (hasTpc) { - return abs(prong1.tpcNSigmaPi()); - } - if (hasTof) { - return abs(prong1.tofNSigmaPi()); - } - return defaultNSigma; -} -} // namespace o2::pid_tpc_tof_utils - namespace o2::analysis { diff --git a/PWGHF/Core/HfMlResponseBsToDsPi.h b/PWGHF/Core/HfMlResponseBsToDsPi.h new file mode 100644 index 00000000000..821463e0ec8 --- /dev/null +++ b/PWGHF/Core/HfMlResponseBsToDsPi.h @@ -0,0 +1,191 @@ +// 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 HfMlResponsBsToDsPi.h +/// \brief Class to compute the ML response for Bs → Ds∓ π± analysis selections +/// \author Fabio Catalano , CERN + +#ifndef PWGHF_CORE_HFMLRESPONSEBSTODSPI_H_ +#define PWGHF_CORE_HFMLRESPONSEBSTODSPI_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_BS(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesBsToDsPi::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_BS_FULL(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBsToDsPi::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_BS_FUNC(OBJECT, FEATURE, GETTER) \ + case static_cast(InputFeaturesBsToDsPi::FEATURE): { \ + inputFeatures.emplace_back(GETTER(OBJECT)); \ + break; \ + } + +// Specific case of CHECK_AND_FILL_VEC_BS_FULL(OBJECT, FEATURE, GETTER) +// where OBJECT is named candidate and FEATURE = GETTER +#define CHECK_AND_FILL_VEC_BS(GETTER) \ + case static_cast(InputFeaturesBsToDsPi::GETTER): { \ + inputFeatures.emplace_back(candidate.GETTER()); \ + break; \ + } + +namespace o2::analysis +{ + +enum class InputFeaturesBsToDsPi : uint8_t { + ptProng0 = 0, + ptProng1, + impactParameter0, + impactParameter1, + impactParameterProduct, + chi2PCA, + decayLength, + decayLengthXY, + decayLengthNormalised, + decayLengthXYNormalised, + cpa, + cpaXY, + maxNormalisedDeltaIP, + prong0MlScoreBkg, + prong0MlScorePrompt, + prong0MlScoreNonprompt, + tpcNSigmaPi1, + tofNSigmaPi1, + tpcTofNSigmaPi1 +}; + +template +class HfMlResponseBsToDsPi : public HfMlResponse +{ + public: + /// Default constructor + HfMlResponseBsToDsPi() = default; + /// Default destructor + virtual ~HfMlResponseBsToDsPi() = default; + + /// Method to get the input features vector needed for ML inference + /// \param candidate is the Bs 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_BS(ptProng0); + CHECK_AND_FILL_VEC_BS(ptProng1); + CHECK_AND_FILL_VEC_BS(impactParameter0); + CHECK_AND_FILL_VEC_BS(impactParameter1); + CHECK_AND_FILL_VEC_BS(impactParameterProduct); + CHECK_AND_FILL_VEC_BS(chi2PCA); + CHECK_AND_FILL_VEC_BS(decayLength); + CHECK_AND_FILL_VEC_BS(decayLengthXY); + CHECK_AND_FILL_VEC_BS(decayLengthNormalised); + CHECK_AND_FILL_VEC_BS(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_BS(cpa); + CHECK_AND_FILL_VEC_BS(cpaXY); + CHECK_AND_FILL_VEC_BS(maxNormalisedDeltaIP); + CHECK_AND_FILL_VEC_BS(prong0MlScoreBkg); + CHECK_AND_FILL_VEC_BS(prong0MlScorePrompt); + CHECK_AND_FILL_VEC_BS(prong0MlScoreNonprompt); + // Pion PID variables + CHECK_AND_FILL_VEC_BS_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi); + CHECK_AND_FILL_VEC_BS_FULL(prong1, tofNSigmaPi1, tofNSigmaPi); + CHECK_AND_FILL_VEC_BS_FUNC(prong1, tpcTofNSigmaPi1, o2::pid_tpc_tof_utils::getTpcTofNSigmaPi1); + } + } else { + switch (idx) { + CHECK_AND_FILL_VEC_BS(ptProng0); + CHECK_AND_FILL_VEC_BS(ptProng1); + CHECK_AND_FILL_VEC_BS(impactParameter0); + CHECK_AND_FILL_VEC_BS(impactParameter1); + CHECK_AND_FILL_VEC_BS(impactParameterProduct); + CHECK_AND_FILL_VEC_BS(chi2PCA); + CHECK_AND_FILL_VEC_BS(decayLength); + CHECK_AND_FILL_VEC_BS(decayLengthXY); + CHECK_AND_FILL_VEC_BS(decayLengthNormalised); + CHECK_AND_FILL_VEC_BS(decayLengthXYNormalised); + CHECK_AND_FILL_VEC_BS(cpa); + CHECK_AND_FILL_VEC_BS(cpaXY); + CHECK_AND_FILL_VEC_BS(maxNormalisedDeltaIP); + // Pion PID variables + CHECK_AND_FILL_VEC_BS_FULL(prong1, tpcNSigmaPi1, tpcNSigmaPi); + CHECK_AND_FILL_VEC_BS_FULL(prong1, tofNSigmaPi1, tofNSigmaPi); + CHECK_AND_FILL_VEC_BS_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_BS(ptProng0), + FILL_MAP_BS(ptProng1), + FILL_MAP_BS(impactParameter0), + FILL_MAP_BS(impactParameter1), + FILL_MAP_BS(impactParameterProduct), + FILL_MAP_BS(chi2PCA), + FILL_MAP_BS(decayLength), + FILL_MAP_BS(decayLengthXY), + FILL_MAP_BS(decayLengthNormalised), + FILL_MAP_BS(decayLengthXYNormalised), + FILL_MAP_BS(cpa), + FILL_MAP_BS(cpaXY), + FILL_MAP_BS(maxNormalisedDeltaIP), + FILL_MAP_BS(prong0MlScoreBkg), + FILL_MAP_BS(prong0MlScorePrompt), + FILL_MAP_BS(prong0MlScoreNonprompt), + // Pion PID variables + FILL_MAP_BS(tpcNSigmaPi1), + FILL_MAP_BS(tofNSigmaPi1), + FILL_MAP_BS(tpcTofNSigmaPi1)}; + } +}; + +} // namespace o2::analysis + +#undef FILL_MAP_BS +#undef CHECK_AND_FILL_VEC_BS_FULL +#undef CHECK_AND_FILL_VEC_BS_FUNC +#undef CHECK_AND_FILL_VEC_BS + +#endif // PWGHF_CORE_HFMLRESPONSEBSTODSPI_H_ diff --git a/PWGHF/Core/HfMlResponseD0ToKPi.h b/PWGHF/Core/HfMlResponseD0ToKPi.h index b520a946e38..71ed542b269 100644 --- a/PWGHF/Core/HfMlResponseD0ToKPi.h +++ b/PWGHF/Core/HfMlResponseD0ToKPi.h @@ -29,9 +29,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_D0(FEATURE) \ - { \ -#FEATURE, static_cast < uint8_t>(InputFeaturesD0ToKPi::FEATURE) \ +#define FILL_MAP_D0(FEATURE) \ + { \ + #FEATURE, static_cast(InputFeaturesD0ToKPi::FEATURE) \ } // Check if the index of mCachedIndices (index associated to a FEATURE) @@ -86,6 +86,19 @@ break; \ } +// Variation of CHECK_AND_FILL_VEC_D0_HFHELPER_SIGNED(OBJECT, FEATURE, GETTER1, GETTER2) +// where GETTER1 and GETTER2 are methods of the OBJECT, and the variable +// is filled depending on whether it is a D0 or a D0bar +#define CHECK_AND_FILL_VEC_D0_SIGNED(OBJECT, FEATURE, GETTER1, GETTER2) \ + case static_cast(InputFeaturesD0ToKPi::FEATURE): { \ + if (pdgCode == o2::constants::physics::kD0) { \ + inputFeatures.emplace_back(OBJECT.GETTER1()); \ + } else { \ + inputFeatures.emplace_back(OBJECT.GETTER2()); \ + } \ + break; \ + } + namespace o2::analysis { enum class InputFeaturesD0ToKPi : uint8_t { @@ -146,12 +159,9 @@ class HfMlResponseD0ToKPi : public HfMlResponse /// Method to get the input features vector needed for ML inference /// \param candidate is the D0 candidate - /// \param prong0 is the candidate's prong0 - /// \param prong1 is the candidate's prong1 /// \return inputFeatures vector - template - std::vector getInputFeatures(T1 const& candidate, - T2 const& prong0, T2 const& prong1, int const& pdgCode) + template + std::vector getInputFeatures(T1 const& candidate, int const& pdgCode) { std::vector inputFeatures; @@ -169,32 +179,44 @@ class HfMlResponseD0ToKPi : public HfMlResponse CHECK_AND_FILL_VEC_D0(impactParameterZ0); CHECK_AND_FILL_VEC_D0(impactParameterZ1); // TPC PID variables - CHECK_AND_FILL_VEC_D0_FULL(prong0, nSigTpcPi0, tpcNSigmaPi); - CHECK_AND_FILL_VEC_D0_FULL(prong0, nSigTpcKa0, tpcNSigmaKa); - CHECK_AND_FILL_VEC_D0_FULL(prong1, nSigTpcPi1, tpcNSigmaPi); - CHECK_AND_FILL_VEC_D0_FULL(prong1, nSigTpcKa1, tpcNSigmaKa); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcPiExpPi, tpcNSigmaPi); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcKaExpPi, tpcNSigmaKa); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcPiExpKa, tpcNSigmaPi); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcKaExpKa, tpcNSigmaKa); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcPi0, /*getter*/ nSigTpcPi0); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcKa0, /*getter*/ nSigTpcKa0); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcPi1, /*getter*/ nSigTpcPi1); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcKa1, /*getter*/ nSigTpcKa1); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcPiExpPi, tpcNSigmaPi); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcKaExpPi, tpcNSigmaKa); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcPiExpKa, tpcNSigmaPi); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcKaExpKa, tpcNSigmaKa); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcPiExpPi, nSigTpcPi0, nSigTpcPi1); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcKaExpPi, nSigTpcKa0, nSigTpcKa1); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcPiExpKa, nSigTpcPi1, nSigTpcPi0); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcKaExpKa, nSigTpcKa1, nSigTpcKa0); // TOF PID variables - CHECK_AND_FILL_VEC_D0_FULL(prong0, nSigTofPi0, tofNSigmaPi); - CHECK_AND_FILL_VEC_D0_FULL(prong0, nSigTofKa0, tofNSigmaKa); - CHECK_AND_FILL_VEC_D0_FULL(prong1, nSigTofPi1, tofNSigmaPi); - CHECK_AND_FILL_VEC_D0_FULL(prong1, nSigTofKa1, tofNSigmaKa); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTofPiExpPi, tofNSigmaPi); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTofKaExpPi, tofNSigmaKa); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTofPiExpKa, tofNSigmaPi); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTofKaExpKa, tofNSigmaKa); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTofPi0, /*getter*/ nSigTofPi0); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTofKa0, /*getter*/ nSigTofKa0); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTofPi1, /*getter*/ nSigTofPi1); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTofKa1, /*getter*/ nSigTofKa1); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTofPiExpPi, tofNSigmaPi); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTofKaExpPi, tofNSigmaKa); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTofPiExpKa, tofNSigmaPi); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTofKaExpKa, tofNSigmaKa); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTofPiExpPi, nSigTofPi0, nSigTofPi1); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTofKaExpPi, nSigTofKa0, nSigTofKa1); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTofPiExpKa, nSigTofPi1, nSigTofPi0); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTofKaExpKa, nSigTofKa1, nSigTofKa0); // Combined PID variables - CHECK_AND_FILL_VEC_D0_FULL(prong0, nSigTpcTofPi0, tpcTofNSigmaPi); - CHECK_AND_FILL_VEC_D0_FULL(prong0, nSigTpcTofKa0, tpcTofNSigmaKa); - CHECK_AND_FILL_VEC_D0_FULL(prong1, nSigTpcTofPi1, tpcTofNSigmaPi); - CHECK_AND_FILL_VEC_D0_FULL(prong1, nSigTpcTofKa1, tpcTofNSigmaKa); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcTofPiExpPi, tpcTofNSigmaPi); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcTofKaExpPi, tpcTofNSigmaKa); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcTofPiExpKa, tpcTofNSigmaPi); - CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcTofKaExpKa, tpcTofNSigmaKa); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcTofPi0, tpcTofNSigmaPi0); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcTofKa0, tpcTofNSigmaKa0); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcTofPi1, tpcTofNSigmaPi1); + CHECK_AND_FILL_VEC_D0_FULL(candidate, nSigTpcTofKa1, tpcTofNSigmaKa1); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcTofPiExpPi, tpcTofNSigmaPi); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong0, prong1, nSigTpcTofKaExpPi, tpcTofNSigmaKa); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcTofPiExpKa, tpcTofNSigmaPi); + // CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED(prong1, prong0, nSigTpcTofKaExpKa, tpcTofNSigmaKa); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcTofPiExpPi, tpcTofNSigmaPi0, tpcTofNSigmaPi1); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcTofKaExpPi, tpcTofNSigmaKa0, tpcTofNSigmaKa1); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcTofPiExpKa, tpcTofNSigmaPi1, tpcTofNSigmaPi0); + CHECK_AND_FILL_VEC_D0_SIGNED(candidate, nSigTpcTofKaExpKa, tpcTofNSigmaKa1, tpcTofNSigmaKa0); CHECK_AND_FILL_VEC_D0(maxNormalisedDeltaIP); CHECK_AND_FILL_VEC_D0_FULL(candidate, impactParameterProduct, impactParameterProduct); diff --git a/PWGHF/Core/HfMlResponseDsToKKPi.h b/PWGHF/Core/HfMlResponseDsToKKPi.h index 62e93882ddf..1b27d52adde 100644 --- a/PWGHF/Core/HfMlResponseDsToKKPi.h +++ b/PWGHF/Core/HfMlResponseDsToKKPi.h @@ -68,6 +68,19 @@ break; \ } +// Variation of CHECK_AND_FILL_VEC_DS_HFHELPER(OBJECT, FEATURE, GETTER) +// where OBJECT1 and OBJECT2 are the objects from which we call the GETTER method, and the variable +// is filled depending on whether it is a DsToKKPi or a DsToPiKK +#define CHECK_AND_FILL_VEC_DS_OBJECT_SIGNED(OBJECT1, OBJECT2, FEATURE, GETTER) \ + case static_cast(InputFeaturesDsToKKPi::FEATURE): { \ + if (caseDsToKKPi) { \ + inputFeatures.emplace_back(OBJECT1.GETTER()); \ + } else { \ + inputFeatures.emplace_back(OBJECT2.GETTER()); \ + } \ + break; \ + } + namespace o2::analysis { enum class InputFeaturesDsToKKPi : uint8_t { @@ -95,12 +108,24 @@ enum class InputFeaturesDsToKKPi : uint8_t { nSigTpcKa0, nSigTpcKa1, nSigTpcKa2, + nSigTofPi0, + nSigTofPi1, + nSigTofPi2, + nSigTofKa0, + nSigTofKa1, + nSigTofKa2, nSigTpcTofPi0, nSigTpcTofPi1, nSigTpcTofPi2, nSigTpcTofKa0, nSigTpcTofKa1, nSigTpcTofKa2, + nSigTpcKaExpKa0, + nSigTpcPiExpPi2, + nSigTofKaExpKa0, + nSigTofPiExpPi2, + nSigTpcTofKaExpKa0, + nSigTpcTofPiExpPi2, absCos3PiK, deltaMassPhi }; @@ -156,6 +181,17 @@ class HfMlResponseDsToKKPi : public HfMlResponse CHECK_AND_FILL_VEC_DS_FULL(prong0, nSigTpcKa0, tpcNSigmaKa); CHECK_AND_FILL_VEC_DS_FULL(prong1, nSigTpcKa1, tpcNSigmaKa); CHECK_AND_FILL_VEC_DS_FULL(prong2, nSigTpcKa2, tpcNSigmaKa); + CHECK_AND_FILL_VEC_DS_FULL(prong0, nSigTofPi0, tofNSigmaPi); + CHECK_AND_FILL_VEC_DS_FULL(prong1, nSigTofPi1, tofNSigmaPi); + CHECK_AND_FILL_VEC_DS_FULL(prong2, nSigTofPi2, tofNSigmaPi); + CHECK_AND_FILL_VEC_DS_FULL(prong0, nSigTofKa0, tofNSigmaKa); + CHECK_AND_FILL_VEC_DS_FULL(prong1, nSigTofKa1, tofNSigmaKa); + CHECK_AND_FILL_VEC_DS_FULL(prong2, nSigTofKa2, tofNSigmaKa); + CHECK_AND_FILL_VEC_DS_OBJECT_SIGNED(prong0, prong2, nSigTpcKaExpKa0, tpcNSigmaKa); + CHECK_AND_FILL_VEC_DS_OBJECT_SIGNED(prong2, prong0, nSigTpcPiExpPi2, tpcNSigmaPi); + CHECK_AND_FILL_VEC_DS_OBJECT_SIGNED(prong0, prong2, nSigTofKaExpKa0, tofNSigmaKa); + CHECK_AND_FILL_VEC_DS_OBJECT_SIGNED(prong2, prong0, nSigTofPiExpPi2, tofNSigmaPi); + // Combined PID variables CHECK_AND_FILL_VEC_DS_FULL(prong0, nSigTpcTofPi0, tpcTofNSigmaPi); CHECK_AND_FILL_VEC_DS_FULL(prong1, nSigTpcTofPi1, tpcTofNSigmaPi); @@ -163,6 +199,8 @@ class HfMlResponseDsToKKPi : public HfMlResponse CHECK_AND_FILL_VEC_DS_FULL(prong0, nSigTpcTofKa0, tpcTofNSigmaKa); CHECK_AND_FILL_VEC_DS_FULL(prong1, nSigTpcTofKa1, tpcTofNSigmaKa); CHECK_AND_FILL_VEC_DS_FULL(prong2, nSigTpcTofKa2, tpcTofNSigmaKa); + CHECK_AND_FILL_VEC_DS_OBJECT_SIGNED(prong0, prong2, nSigTpcTofKaExpKa0, tpcTofNSigmaKa); + CHECK_AND_FILL_VEC_DS_OBJECT_SIGNED(prong2, prong0, nSigTpcTofPiExpPi2, tpcTofNSigmaPi); // Ds specific variables CHECK_AND_FILL_VEC_DS_HFHELPER_SIGNED(candidate, absCos3PiK, absCos3PiKDsToKKPi, absCos3PiKDsToPiKK); @@ -193,6 +231,9 @@ class HfMlResponseDsToKKPi : public HfMlResponse FILL_MAP_DS(impactParameterXY0), FILL_MAP_DS(impactParameterXY1), FILL_MAP_DS(impactParameterXY2), + FILL_MAP_DS(impactParameterZ0), + FILL_MAP_DS(impactParameterZ1), + FILL_MAP_DS(impactParameterZ2), // TPC PID variables FILL_MAP_DS(nSigTpcPi0), FILL_MAP_DS(nSigTpcPi1), @@ -200,6 +241,16 @@ class HfMlResponseDsToKKPi : public HfMlResponse FILL_MAP_DS(nSigTpcKa0), FILL_MAP_DS(nSigTpcKa1), FILL_MAP_DS(nSigTpcKa2), + FILL_MAP_DS(nSigTofPi0), + FILL_MAP_DS(nSigTofPi1), + FILL_MAP_DS(nSigTofPi2), + FILL_MAP_DS(nSigTofKa0), + FILL_MAP_DS(nSigTofKa1), + FILL_MAP_DS(nSigTofKa2), + FILL_MAP_DS(nSigTpcKaExpKa0), + FILL_MAP_DS(nSigTpcPiExpPi2), + FILL_MAP_DS(nSigTofKaExpKa0), + FILL_MAP_DS(nSigTofPiExpPi2), // Combined PID variables FILL_MAP_DS(nSigTpcTofPi0), FILL_MAP_DS(nSigTpcTofPi1), @@ -207,6 +258,8 @@ class HfMlResponseDsToKKPi : public HfMlResponse FILL_MAP_DS(nSigTpcTofKa0), FILL_MAP_DS(nSigTpcTofKa1), FILL_MAP_DS(nSigTpcTofKa2), + FILL_MAP_DS(nSigTpcTofKaExpKa0), + FILL_MAP_DS(nSigTpcTofPiExpPi2), // Ds specific variables FILL_MAP_DS(absCos3PiK), @@ -221,5 +274,6 @@ class HfMlResponseDsToKKPi : public HfMlResponse #undef CHECK_AND_FILL_VEC_DS #undef CHECK_AND_FILL_VEC_DS_HFHELPER #undef CHECK_AND_FILL_VEC_DS_HFHELPER_SIGNED +#undef CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED #endif // PWGHF_CORE_HFMLRESPONSEDSTOKKPI_H_ diff --git a/PWGHF/Core/HfMlResponseLcToPKPi.h b/PWGHF/Core/HfMlResponseLcToPKPi.h index e011567c4d6..ea4767b85c6 100644 --- a/PWGHF/Core/HfMlResponseLcToPKPi.h +++ b/PWGHF/Core/HfMlResponseLcToPKPi.h @@ -54,6 +54,19 @@ break; \ } +// Variation of CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(OBJECT1, OBJECT2, FEATURE, GETTER) +// where OBJECT1 and OBJECT2 are the objects from which we call the GETTER method, and the variable +// is filled depending on whether it is a LcToPKPi or a LcToPiKP +#define CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(OBJECT1, OBJECT2, FEATURE, GETTER) \ + case static_cast(InputFeaturesLcToPKPi::FEATURE): { \ + if (caseLcToPKPi) { \ + inputFeatures.emplace_back(OBJECT1.GETTER()); \ + } else { \ + inputFeatures.emplace_back(OBJECT2.GETTER()); \ + } \ + break; \ + } + namespace o2::analysis { enum class InputFeaturesLcToPKPi : uint8_t { @@ -98,7 +111,13 @@ enum class InputFeaturesLcToPKPi : uint8_t { tpcTofNSigmaKa2, tpcTofNSigmaPr0, tpcTofNSigmaPr1, - tpcTofNSigmaPr2 + tpcTofNSigmaPr2, + tpcNSigmaPrExpPr0, + tpcNSigmaPiExpPi2, + tofNSigmaPrExpPr0, + tofNSigmaPiExpPi2, + tpcTofNSigmaPrExpPr0, + tpcTofNSigmaPiExpPi2 }; template @@ -118,7 +137,7 @@ class HfMlResponseLcToPKPi : public HfMlResponse /// \return inputFeatures vector template std::vector getInputFeatures(T1 const& candidate, - T2 const& prong0, T2 const& prong1, T2 const& prong2) + T2 const& prong0, T2 const& prong1, T2 const& prong2, bool const& caseLcToPKPi) { std::vector inputFeatures; @@ -149,6 +168,8 @@ class HfMlResponseLcToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong2, tpcNSigmaP2, tpcNSigmaPr); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong2, tpcNSigmaKa2, tpcNSigmaKa); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong2, tpcNSigmaPi2, tpcNSigmaPi); + CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong0, prong2, tpcNSigmaPrExpPr0, tpcNSigmaPr); + CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong2, prong0, tpcNSigmaPiExpPi2, tpcNSigmaPi); // TOF PID variables CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong0, tofNSigmaP0, tofNSigmaPr); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong0, tofNSigmaKa0, tofNSigmaKa); @@ -159,6 +180,8 @@ class HfMlResponseLcToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong2, tofNSigmaP2, tofNSigmaPr); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong2, tofNSigmaKa2, tofNSigmaKa); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong2, tofNSigmaPi2, tofNSigmaPi); + CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong0, prong2, tofNSigmaPrExpPr0, tofNSigmaPr); + CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong2, prong0, tofNSigmaPiExpPi2, tofNSigmaPi); // Combined PID variables CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong0, tpcTofNSigmaPi0, tpcTofNSigmaPi); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong1, tpcTofNSigmaPi1, tpcTofNSigmaPi); @@ -169,6 +192,8 @@ class HfMlResponseLcToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong0, tpcTofNSigmaPr0, tpcTofNSigmaPr); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong1, tpcTofNSigmaPr1, tpcTofNSigmaPr); CHECK_AND_FILL_VEC_LCTOPKPI_FULL(prong2, tpcTofNSigmaPr2, tpcTofNSigmaPr); + CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong0, prong2, tpcTofNSigmaPrExpPr0, tpcTofNSigmaPr); + CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED(prong2, prong0, tpcTofNSigmaPiExpPi2, tpcTofNSigmaPi); } } @@ -205,6 +230,8 @@ class HfMlResponseLcToPKPi : public HfMlResponse FILL_MAP_LCTOPKPI(tpcNSigmaP2), FILL_MAP_LCTOPKPI(tpcNSigmaKa2), FILL_MAP_LCTOPKPI(tpcNSigmaPi2), + FILL_MAP_LCTOPKPI(tpcNSigmaPrExpPr0), + FILL_MAP_LCTOPKPI(tpcNSigmaPiExpPi2), // TOF PID variables FILL_MAP_LCTOPKPI(tofNSigmaP0), FILL_MAP_LCTOPKPI(tofNSigmaKa0), @@ -215,6 +242,8 @@ class HfMlResponseLcToPKPi : public HfMlResponse FILL_MAP_LCTOPKPI(tofNSigmaP2), FILL_MAP_LCTOPKPI(tofNSigmaKa2), FILL_MAP_LCTOPKPI(tofNSigmaPi2), + FILL_MAP_LCTOPKPI(tofNSigmaPrExpPr0), + FILL_MAP_LCTOPKPI(tofNSigmaPiExpPi2), // Combined PID variables FILL_MAP_LCTOPKPI(tpcTofNSigmaPi0), FILL_MAP_LCTOPKPI(tpcTofNSigmaPi1), @@ -224,7 +253,9 @@ class HfMlResponseLcToPKPi : public HfMlResponse FILL_MAP_LCTOPKPI(tpcTofNSigmaKa2), FILL_MAP_LCTOPKPI(tpcTofNSigmaPr0), FILL_MAP_LCTOPKPI(tpcTofNSigmaPr1), - FILL_MAP_LCTOPKPI(tpcTofNSigmaPr2)}; + FILL_MAP_LCTOPKPI(tpcTofNSigmaPr2), + FILL_MAP_LCTOPKPI(tpcTofNSigmaPrExpPr0), + FILL_MAP_LCTOPKPI(tpcTofNSigmaPiExpPi2)}; } }; @@ -234,5 +265,6 @@ class HfMlResponseLcToPKPi : public HfMlResponse #undef CHECK_AND_FILL_VEC_LCTOPKPI_FULL #undef CHECK_AND_FILL_VEC_LCTOPKPI #undef CHECK_AND_FILL_VEC_LCTOPKPI_HFHELPER +#undef CHECK_AND_FILL_VEC_LCTOPKPI_OBJECT_SIGNED #endif // PWGHF_CORE_HFMLRESPONSELCTOPKPI_H_ diff --git a/PWGHF/Core/HfMlResponseXicToPKPi.h b/PWGHF/Core/HfMlResponseXicToPKPi.h index 398357a66d6..94542745772 100644 --- a/PWGHF/Core/HfMlResponseXicToPKPi.h +++ b/PWGHF/Core/HfMlResponseXicToPKPi.h @@ -48,6 +48,19 @@ break; \ } +// Variation of CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(OBJECT1, OBJECT2, FEATURE, GETTER) +// where OBJECT1 and OBJECT2 are the objects from which we call the GETTER method, and the variable +// is filled depending on whether it is a XicToPKPi or a XicToPiKP +#define CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(OBJECT1, OBJECT2, FEATURE, GETTER) \ + case static_cast(InputFeaturesXicToPKPi::FEATURE): { \ + if (caseXicToPKPi) { \ + inputFeatures.emplace_back(OBJECT1.GETTER()); \ + } else { \ + inputFeatures.emplace_back(OBJECT2.GETTER()); \ + } \ + break; \ + } + namespace o2::analysis { enum class InputFeaturesXicToPKPi : uint8_t { @@ -92,8 +105,13 @@ enum class InputFeaturesXicToPKPi : uint8_t { tpcTofNSigmaKa2, tpcTofNSigmaPr0, tpcTofNSigmaPr1, - tpcTofNSigmaPr2 - + tpcTofNSigmaPr2, + tpcNSigmaPrExpPr0, + tpcNSigmaPiExpPi2, + tofNSigmaPrExpPr0, + tofNSigmaPiExpPi2, + tpcTofNSigmaPrExpPr0, + tpcTofNSigmaPiExpPi2 }; template @@ -113,7 +131,7 @@ class HfMlResponseXicToPKPi : public HfMlResponse /// \return inputFeatures vector template std::vector getInputFeatures(T1 const& candidate, - T2 const& prong0, T2 const& prong1, T2 const& prong2) + T2 const& prong0, T2 const& prong1, T2 const& prong2, bool const& caseXicToPKPi) { std::vector inputFeatures; @@ -144,6 +162,8 @@ class HfMlResponseXicToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_XIC_FULL(prong2, tpcNSigmaP2, tpcNSigmaPr); CHECK_AND_FILL_VEC_XIC_FULL(prong2, tpcNSigmaKa2, tpcNSigmaKa); CHECK_AND_FILL_VEC_XIC_FULL(prong2, tpcNSigmaPi2, tpcNSigmaPi); + CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(prong0, prong2, tpcNSigmaPrExpPr0, tpcNSigmaPr); + CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(prong2, prong0, tpcNSigmaPiExpPi2, tpcNSigmaPi); // TOF PID variables CHECK_AND_FILL_VEC_XIC_FULL(prong0, tofNSigmaP0, tofNSigmaPr); CHECK_AND_FILL_VEC_XIC_FULL(prong0, tofNSigmaKa0, tofNSigmaKa); @@ -154,6 +174,8 @@ class HfMlResponseXicToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_XIC_FULL(prong2, tofNSigmaP2, tofNSigmaPr); CHECK_AND_FILL_VEC_XIC_FULL(prong2, tofNSigmaKa2, tofNSigmaKa); CHECK_AND_FILL_VEC_XIC_FULL(prong2, tofNSigmaPi2, tofNSigmaPi); + CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(prong0, prong2, tofNSigmaPrExpPr0, tofNSigmaPr); + CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(prong2, prong0, tofNSigmaPiExpPi2, tofNSigmaPi); // Combined PID variables CHECK_AND_FILL_VEC_XIC_FULL(prong0, tpcTofNSigmaPi0, tpcTofNSigmaPi); CHECK_AND_FILL_VEC_XIC_FULL(prong1, tpcTofNSigmaPi1, tpcTofNSigmaPi); @@ -164,6 +186,8 @@ class HfMlResponseXicToPKPi : public HfMlResponse CHECK_AND_FILL_VEC_XIC_FULL(prong0, tpcTofNSigmaPr0, tpcTofNSigmaPr); CHECK_AND_FILL_VEC_XIC_FULL(prong1, tpcTofNSigmaPr1, tpcTofNSigmaPr); CHECK_AND_FILL_VEC_XIC_FULL(prong2, tpcTofNSigmaPr2, tpcTofNSigmaPr); + CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(prong0, prong2, tpcTofNSigmaPrExpPr0, tpcTofNSigmaPr); + CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED(prong2, prong0, tpcTofNSigmaPiExpPi2, tpcTofNSigmaPi); } } @@ -200,6 +224,8 @@ class HfMlResponseXicToPKPi : public HfMlResponse FILL_MAP_XIC(tpcNSigmaP2), FILL_MAP_XIC(tpcNSigmaKa2), FILL_MAP_XIC(tpcNSigmaPi2), + FILL_MAP_XIC(tpcNSigmaPrExpPr0), + FILL_MAP_XIC(tpcNSigmaPiExpPi2), // TOF PID variables FILL_MAP_XIC(tofNSigmaP0), FILL_MAP_XIC(tofNSigmaKa0), @@ -210,6 +236,8 @@ class HfMlResponseXicToPKPi : public HfMlResponse FILL_MAP_XIC(tofNSigmaP2), FILL_MAP_XIC(tofNSigmaKa2), FILL_MAP_XIC(tofNSigmaPi2), + FILL_MAP_XIC(tofNSigmaPrExpPr0), + FILL_MAP_XIC(tofNSigmaPiExpPi2), // Combined PID variables FILL_MAP_XIC(tpcTofNSigmaPi0), FILL_MAP_XIC(tpcTofNSigmaPi1), @@ -219,7 +247,9 @@ class HfMlResponseXicToPKPi : public HfMlResponse FILL_MAP_XIC(tpcTofNSigmaKa2), FILL_MAP_XIC(tpcTofNSigmaPr0), FILL_MAP_XIC(tpcTofNSigmaPr1), - FILL_MAP_XIC(tpcTofNSigmaPr2)}; + FILL_MAP_XIC(tpcTofNSigmaPr2), + FILL_MAP_XIC(tpcTofNSigmaPrExpPr0), + FILL_MAP_XIC(tpcTofNSigmaPiExpPi2)}; } }; @@ -228,5 +258,6 @@ class HfMlResponseXicToPKPi : public HfMlResponse #undef FILL_MAP_XIC #undef CHECK_AND_FILL_VEC_XIC_FULL #undef CHECK_AND_FILL_VEC_XIC +#undef CHECK_AND_FILL_VEC_XIC_OBJECT_SIGNED #endif // PWGHF_CORE_HFMLRESPONSEXICTOPKPI_H_ diff --git a/PWGHF/Core/SelectorCuts.h b/PWGHF/Core/SelectorCuts.h index 92f62d72cca..014547d927d 100644 --- a/PWGHF/Core/SelectorCuts.h +++ b/PWGHF/Core/SelectorCuts.h @@ -462,7 +462,7 @@ constexpr double cuts[nBinsPt][nCutVars] = {{0.05, 0.2, 0.1, 1000.0, 0.2, 300.0, namespace hf_cuts_lc_to_p_k_pi { static constexpr int nBinsPt = 10; -static constexpr int nCutVars = 8; +static constexpr int nCutVars = 11; // default values for the pT bin edges (can be used to configure histogram axis) // offset by 1 from the bin numbers in cuts array constexpr double binsPt[nBinsPt + 1] = { @@ -479,17 +479,17 @@ constexpr double binsPt[nBinsPt + 1] = { 36.}; auto vecBinsPt = std::vector{binsPt, binsPt + nBinsPt + 1}; -// default values for the cuts -constexpr double cuts[nBinsPt][nCutVars] = {{0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 0 < pT < 1 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 1 < pT < 2 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 2 < pT < 3 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 3 < pT < 4 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 4 < pT < 5 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 5 < pT < 6 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 6 < pT < 8 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 8 < pT < 12 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}, /* 12 < pT < 24 */ - {0.400, 0.4, 0.4, 0.4, 0., 0.005, 0., -1.}}; /* 24 < pT < 36 */ +// default values for the cuts m, ptP, ptK, ptPi, chi2PCA, dL, cosp, dLXY, NdLXY, ImpParXY, mass(Kpi) +constexpr double cuts[nBinsPt][nCutVars] = {{0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 0 < pT < 1 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 1 < pT < 2 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 2 < pT < 3 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 3 < pT < 4 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 4 < pT < 5 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 5 < pT < 6 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 6 < pT < 8 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 8 < pT < 12 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}, /* 12 < pT < 24 */ + {0.4, 0.4, 0.4, 0.4, 0., 0.005, 0., 0., 0., 1e+10, -1.}}; /* 24 < pT < 36 */ // row labels static const std::vector labelsPt = { @@ -505,7 +505,7 @@ static const std::vector labelsPt = { "pT bin 9"}; // column labels -static const std::vector labelsCutVar = {"m", "pT p", "pT K", "pT Pi", "Chi2PCA", "decay length", "cos pointing angle", "mass (Kpi)"}; +static const std::vector labelsCutVar = {"m", "pT p", "pT K", "pT Pi", "Chi2PCA", "decay length", "cos pointing angle", "decLengthXY", "normDecLXY", "impParXY", "mass (Kpi)"}; } // namespace hf_cuts_lc_to_p_k_pi namespace hf_cuts_lc_to_k0s_p @@ -903,25 +903,50 @@ static const std::vector labelsCutVar = {"m", "CPA", "Chi2PCA", "d0 namespace hf_cuts_bs_to_ds_pi { -static constexpr int nBinsPt = 2; +static constexpr int nBinsPt = 10; static constexpr int nCutVars = 10; // default values for the pT bin edges (can be used to configure histogram axis) // offset by 1 from the bin numbers in cuts array constexpr double binsPt[nBinsPt + 1] = { 0, 1.0, - 2.0}; + 2.0, + 3.0, + 4.0, + 5.0, + 8.0, + 10.0, + 12.0, + 16.0, + 24.0}; auto vecBinsPt = std::vector{binsPt, binsPt + nBinsPt + 1}; // default values for the cuts // DeltaM CPA chi2PCA d0Ds d0Pi pTDs pTPi BsDecayLength BsDecayLengthXY IPProd constexpr double cuts[nBinsPt][nCutVars] = {{1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 0 < pt < 1 */ - {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}}; /* 1 < pt < 2 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 1 < pt < 2 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 2 < pt < 3 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 3 < pt < 4 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 4 < pt < 5 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 5 < pt < 6 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 8 < pt < 10 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 10 < pt < 12 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}, /* 12 < pt < 16 */ + {1., 0.8, 1., 0.01, 0.01, 1.0, 0.15, 0.05, 0.05, 0.}}; /* 16 < pt < 24 */ + // row labels static const std::vector labelsPt = { "pT bin 0", - "pT bin 1"}; + "pT bin 1", + "pT bin 2", + "pT bin 3", + "pT bin 4", + "pT bin 5", + "pT bin 6", + "pT bin 7", + "pT bin 8", + "pT bin 9"}; // column labels static const std::vector labelsCutVar = {"m", "CPA", "Chi2PCA", "d0 Ds", "d0 Pi", "pT Ds", "pT Pi", "Bs decLen", "Bs decLenXY", "Imp. Par. Product"}; diff --git a/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h b/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h index a698b8152a6..daa642f1601 100644 --- a/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h +++ b/PWGHF/D2H/Core/SelectorCutsRedDataFormat.h @@ -22,9 +22,11 @@ #include // std::string #include // std::vector +namespace o2::analysis +{ namespace hf_cuts_d_daughter { -const int nBinsPt = 7; +static constexpr int nBinsPt = 7; static constexpr int nCutVars = 6; constexpr double binsPt[nBinsPt + 1] = { 1., @@ -45,7 +47,14 @@ constexpr double cuts[nBinsPt][nCutVars] = {{1.84, 1.89, 1.77, 1.81, 1.92, 1.96} {1.84, 1.89, 1.77, 1.81, 1.92, 1.96}, /* 12 < pt < 24 */ {1.84, 1.89, 1.77, 1.81, 1.92, 1.96}}; /* 24 < pt < 1000 */ // row labels -static const std::vector labelsPt{}; +static const std::vector labelsPt{ + "pT bin 0", + "pT bin 1", + "pT bin 2", + "pT bin 3", + "pT bin 4", + "pT bin 5", + "pT bin 6"}; // column labels static const std::vector labelsCutVar = {"invMassSignalLow", "invMassSignalHigh", "invMassLeftSBLow", "invMassLeftSBHigh", "invMassRightSBLow", "invMassRightSBHigh"}; } // namespace hf_cuts_d_daughter @@ -53,7 +62,7 @@ static const std::vector labelsCutVar = {"invMassSignalLow", "invMa // namespace with v0 selections for reduced charmed-resonances analysis namespace hf_cuts_v0_daughter { -const int nBinsPt = 7; +static constexpr int nBinsPt = 7; static constexpr int nCutVars = 5; constexpr double binsPt[nBinsPt + 1] = { 0., @@ -78,4 +87,5 @@ static const std::vector labelsPt{}; // column labels static const std::vector labelsCutVar = {"invMassLow", "invMassHigh", "cpaMin", "dcaMax", "radiusMin"}; } // namespace hf_cuts_v0_daughter +} // namespace o2::analysis #endif // PWGHF_D2H_CORE_SELECTORCUTSREDDATAFORMAT_H_ diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 07fe57f18bc..590b536f61a 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -16,6 +16,9 @@ /// /// \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_ @@ -29,6 +32,7 @@ #include "Common/DataModel/PIDResponse.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/Utils/utilsPid.h" namespace o2 { @@ -129,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 @@ -140,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, @@ -152,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); @@ -164,9 +250,8 @@ using HfRedTracks = HfRedTracksExt; namespace hf_charm_cand_reduced { -DECLARE_SOA_COLUMN(InvMass, invMass, float); //! Invariant mass of 2prong candidate in GeV/c2 -DECLARE_SOA_COLUMN(InvMassD0, invMassD0, float); //! Invariant mass of 2prong candidate in GeV/c2 -DECLARE_SOA_COLUMN(InvMassD0Bar, invMassD0Bar, float); //! Invariant mass of 2prong candidate in GeV/c2 +DECLARE_SOA_COLUMN(InvMassHypo0, invMassHypo0, float); //! Invariant mass of candidate in GeV/c2 (mass hypothesis 0) +DECLARE_SOA_COLUMN(InvMassHypo1, invMassHypo1, float); //! Invariant mass of candidate in GeV/c2 (mass hypothesis 1) DECLARE_SOA_COLUMN(MlScoreBkgMassHypo0, mlScoreBkgMassHypo0, float); //! ML score for background class (mass hypothesis 0) DECLARE_SOA_COLUMN(MlScorePromptMassHypo0, mlScorePromptMassHypo0, float); //! ML score for prompt class (mass hypothesis 0) DECLARE_SOA_COLUMN(MlScoreNonpromptMassHypo0, mlScoreNonpromptMassHypo0, float); //! ML score for non-prompt class (mass hypothesis 0) @@ -183,7 +268,9 @@ DECLARE_SOA_TABLE(HfRed2Prongs, "AOD", "HFRED2PRONG", //! Table with 2prong cand hf_track_index_reduced::HfRedCollisionId, HFTRACKPAR_COLUMNS, hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, - hf_charm_cand_reduced::InvMassD0, hf_charm_cand_reduced::InvMassD0Bar, + 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, @@ -210,7 +297,9 @@ DECLARE_SOA_TABLE(HfRed3Prongs, "AOD", "HFRED3PRONG", //! Table with 3prong cand hf_track_index_reduced::HfRedCollisionId, HFTRACKPAR_COLUMNS, hf_cand::XSecondaryVertex, hf_cand::YSecondaryVertex, hf_cand::ZSecondaryVertex, - hf_charm_cand_reduced::InvMass, + 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, @@ -221,11 +310,52 @@ DECLARE_SOA_TABLE(HfRed3ProngsCov, "AOD", "HFRED3PRONGSCOV", //! Table with 3pro HFTRACKPARCOV_COLUMNS, o2::soa::Marker<2>); -DECLARE_SOA_TABLE(HfRed3ProngsMl, "AOD", "HFRED3PRONGML", //! Table with 3prong candidate ML scores +DECLARE_SOA_TABLE(HfRed3ProngsMl_000, "AOD", "HFRED3PRONGML", //! Table with 3prong candidate ML scores hf_charm_cand_reduced::MlScoreBkgMassHypo0, hf_charm_cand_reduced::MlScorePromptMassHypo0, hf_charm_cand_reduced::MlScoreNonpromptMassHypo0); +DECLARE_SOA_TABLE_VERSIONED(HfRed3ProngsMl_001, "AOD", "HFRED3PRONGML", 1, //! Table with 3prong candidate ML scores (format for 2 mass hypotheses needed for Ds and Lc) + hf_charm_cand_reduced::MlScoreBkgMassHypo0, + hf_charm_cand_reduced::MlScorePromptMassHypo0, + hf_charm_cand_reduced::MlScoreNonpromptMassHypo0, + hf_charm_cand_reduced::MlScoreBkgMassHypo1, + hf_charm_cand_reduced::MlScorePromptMassHypo1, + hf_charm_cand_reduced::MlScoreNonpromptMassHypo1, + o2::soa::Marker<1>); + +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::TPCTOFNSigmaPiProng0, + hf_track_pid_reduced::TPCTOFNSigmaKaProng0); + +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 { @@ -259,7 +389,7 @@ DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! N DECLARE_SOA_TABLE(HfRedBplusProngs, "AOD", "HFREDBPPRONG", hf_cand_bplus_reduced::Prong0Id, hf_cand_bplus_reduced::Prong1Id); -DECLARE_SOA_TABLE(HfRedBplusD0Mls, "AOD", "HFREDBPLUSD0ML", //! Table with ML scores for the D+ daughter +DECLARE_SOA_TABLE(HfRedBplusD0Mls, "AOD", "HFREDBPLUSD0ML", //! Table with ML scores for the D0 daughter hf_cand_bplus_reduced::Prong0MlScoreBkg, hf_cand_bplus_reduced::Prong0MlScorePrompt, hf_cand_bplus_reduced::Prong0MlScoreNonprompt, @@ -267,6 +397,26 @@ DECLARE_SOA_TABLE(HfRedBplusD0Mls, "AOD", "HFREDBPLUSD0ML", //! Table with ML sc using HfRedCandBplus = soa::Join; +namespace hf_cand_bs_reduced +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3Prongs, "_0"); //! Prong0 index +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! Prong1 index +DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter +DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter +DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter +} // namespace hf_cand_bs_reduced + +DECLARE_SOA_TABLE(HfRedBsProngs, "AOD", "HFREDBSPRONG", //! Table with Bs daughter indices + hf_cand_bs_reduced::Prong0Id, hf_cand_bs_reduced::Prong1Id); + +DECLARE_SOA_TABLE(HfRedBsDsMls, "AOD", "HFREDBSDSML", //! Table with ML scores for the Ds daughter + hf_cand_bs_reduced::Prong0MlScoreBkg, + hf_cand_bs_reduced::Prong0MlScorePrompt, + hf_cand_bs_reduced::Prong0MlScoreNonprompt, + o2::soa::Marker<1>); + +using HfRedCandBs = soa::Join; + namespace hf_b0_mc { // MC Rec @@ -295,6 +445,7 @@ DECLARE_SOA_TABLE(HfMcRecRedDpPis, "AOD", "HFMCRECREDDPPI", //! Table with recon hf_cand_b0_reduced::Prong0Id, hf_cand_b0_reduced::Prong1Id, hf_cand_b0::FlagMcMatchRec, + hf_cand_b0::FlagWrongCollision, hf_cand_b0::DebugMcRec, hf_b0_mc::PtMother); @@ -312,6 +463,7 @@ DECLARE_SOA_TABLE(HfMcCheckDpPis, "AOD", "HFMCCHECKDPPI", //! Table with reconst // Table with same size as HFCANDB0 DECLARE_SOA_TABLE(HfMcRecRedB0s, "AOD", "HFMCRECREDB0", //! Reconstruction-level MC information on B0 candidates for reduced workflow hf_cand_b0::FlagMcMatchRec, + hf_cand_b0::FlagWrongCollision, hf_cand_b0::DebugMcRec, hf_b0_mc::PtMother); @@ -374,6 +526,7 @@ DECLARE_SOA_TABLE(HfMcRecRedD0Pis, "AOD", "HFMCRECREDD0PI", //! Table with recon hf_cand_bplus_reduced::Prong0Id, hf_cand_bplus_reduced::Prong1Id, hf_cand_bplus::FlagMcMatchRec, + hf_cand_bplus::FlagWrongCollision, hf_cand_bplus::DebugMcRec, hf_bplus_mc::PtMother); @@ -388,6 +541,7 @@ DECLARE_SOA_TABLE(HfMcCheckD0Pis, "AOD", "HFMCCHECKD0PI", //! Table with reconst // Table with same size as HFCANDBPLUS DECLARE_SOA_TABLE(HfMcRecRedBps, "AOD", "HFMCRECREDBP", //! Reconstruction-level MC information on B+ candidates for reduced workflow hf_cand_bplus::FlagMcMatchRec, + hf_cand_bplus::FlagWrongCollision, hf_cand_bplus::DebugMcRec, hf_bplus_mc::PtMother); @@ -424,30 +578,90 @@ DECLARE_SOA_TABLE(HfCandBpConfigs, "AOD", "HFCANDBPCONFIG", //! Table with confi hf_cand_bplus_config::MySelectionFlagD0bar, hf_cand_bplus_config::MyInvMassWindowD0Pi); -// Charm resonances analysis -namespace hf_reso_cand_reduced +namespace hf_bs_mc { -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(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 +// MC Rec +DECLARE_SOA_COLUMN(PtMother, ptMother, float); //! Transverse momentum of the mother in GeV/c +// MC Gen +DECLARE_SOA_COLUMN(PtTrack, ptTrack, float); //! Transverse momentum of the track in GeV/c +DECLARE_SOA_COLUMN(YTrack, yTrack, float); //! Rapidity of the track +DECLARE_SOA_COLUMN(EtaTrack, etaTrack, float); //! Pseudorapidity of the track +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); //! Transverse momentum of the track's prong0 in GeV/c +DECLARE_SOA_COLUMN(YProng0, yProng0, float); //! Rapidity of the track's prong0 +DECLARE_SOA_COLUMN(EtaProng0, etaProng0, float); //! Pseudorapidity of the track's prong0 +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); //! Transverse momentum of the track's prong1 in GeV/c +DECLARE_SOA_COLUMN(YProng1, yProng1, float); //! Rapidity of the track's prong1 +DECLARE_SOA_COLUMN(EtaProng1, etaProng1, float); //! Pseudorapidity of the track's prong1 -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)); }); -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(CosThetaStarDs1, cosThetaStarDs1, //! costhetastar under Ds1 hypothesis - [](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0}, invMass, 1); }); -DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarDs2Star, cosThetaStarDs2Star, //! costhetastar under Ds2Star hypothesis - [](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0}, invMass, 1); }); -DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarXiC3055, cosThetaStarXiC3055, //! costhetastar under XiC3055 hypothesis - [](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}, invMass, 1); }); -} // namespace hf_reso_cand_reduced +DECLARE_SOA_COLUMN(PdgCodeBeautyMother, pdgCodeBeautyMother, int); //! Pdg code of beauty mother +DECLARE_SOA_COLUMN(PdgCodeCharmMother, pdgCodeCharmMother, int); //! Pdg code of charm mother +DECLARE_SOA_COLUMN(PdgCodeProng0, pdgCodeProng0, int); //! Pdg code of prong0 +DECLARE_SOA_COLUMN(PdgCodeProng1, pdgCodeProng1, int); //! Pdg code of prong1 +DECLARE_SOA_COLUMN(PdgCodeProng2, pdgCodeProng2, int); //! Pdg code of prong2 +DECLARE_SOA_COLUMN(PdgCodeProng3, pdgCodeProng3, int); //! Pdg code of prong3 +} // namespace hf_bs_mc + +// table with results of reconstruction level MC matching +DECLARE_SOA_TABLE(HfMcRecRedDsPis, "AOD", "HFMCRECREDDSPI", //! Table with reconstructed MC information on DsPi(<-Bs) pairs for reduced workflow + hf_cand_bs_reduced::Prong0Id, + hf_cand_bs_reduced::Prong1Id, + hf_cand_bs::FlagMcMatchRec, + hf_cand_bs::FlagWrongCollision, + hf_cand_bs::DebugMcRec, + hf_bs_mc::PtMother); +// try with extended table ? +// DECLARE_SOA_EXTENDED_TABLE_USER(ExTable, Tracks, "EXTABLE", +DECLARE_SOA_TABLE(HfMcCheckDsPis, "AOD", "HFMCCHECKDSPI", //! Table with reconstructed MC information on DsPi(<-Bs) pairs for MC checks in reduced workflow + hf_bs_mc::PdgCodeBeautyMother, + hf_bs_mc::PdgCodeCharmMother, + hf_bs_mc::PdgCodeProng0, + hf_bs_mc::PdgCodeProng1, + hf_bs_mc::PdgCodeProng2, + hf_bs_mc::PdgCodeProng3, + o2::soa::Marker<1>); + +// Table with same size as HFCANDBS +DECLARE_SOA_TABLE(HfMcRecRedBss, "AOD", "HFMCRECREDBS", //! Reconstruction-level MC information on Bs candidates for reduced workflow + hf_cand_bs::FlagMcMatchRec, + hf_cand_bs::FlagWrongCollision, + hf_cand_bs::DebugMcRec, + hf_bs_mc::PtMother); + +DECLARE_SOA_TABLE(HfMcCheckBss, "AOD", "HFMCCHECKBS", //! Table with reconstructed MC information on Bs candidates for MC checks in reduced workflow + hf_bs_mc::PdgCodeBeautyMother, + hf_bs_mc::PdgCodeCharmMother, + hf_bs_mc::PdgCodeProng0, + hf_bs_mc::PdgCodeProng1, + hf_bs_mc::PdgCodeProng2, + hf_bs_mc::PdgCodeProng3, + o2::soa::Marker<2>); + +DECLARE_SOA_TABLE(HfMcGenRedBss, "AOD", "HFMCGENREDBS", //! Generation-level MC information on Bs candidates for reduced workflow + hf_cand_bs::FlagMcMatchGen, + hf_bs_mc::PtTrack, + hf_bs_mc::YTrack, + hf_bs_mc::EtaTrack, + hf_bs_mc::PtProng0, + hf_bs_mc::YProng0, + hf_bs_mc::EtaProng0, + hf_bs_mc::PtProng1, + hf_bs_mc::YProng1, + hf_bs_mc::EtaProng1); + +// store all configurables values used in the first part of the workflow +// so we can use them in the Bs part +namespace hf_cand_bs_config +{ +DECLARE_SOA_COLUMN(MySelectionFlagD, mySelectionFlagD, int8_t); //! Flag to filter selected Ds mesons +DECLARE_SOA_COLUMN(MyInvMassWindowDPi, myInvMassWindowDPi, float); //! Half-width of the Bs invariant-mass window in GeV/c2 +} // namespace hf_cand_bs_config + +DECLARE_SOA_TABLE(HfCandBsConfigs, "AOD", "HFCANDBSCONFIG", //! Table with configurables information for reduced workflow + hf_cand_bs_config::MySelectionFlagD, + hf_cand_bs_config::MyInvMassWindowDPi); + +// Charm resonances analysis namespace hf_reso_3_prong { DECLARE_SOA_COLUMN(DType, dType, int8_t); //! Integer with selected D candidate type: 1 = Dplus, -1 = Dminus, 2 = DstarPlus, -2 = DstarMinus @@ -462,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 @@ -476,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, //! @@ -492,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 @@ -525,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<>, @@ -569,20 +774,64 @@ 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 + +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed3PrNoTrks, "_0"); //! Prong0 index (D daughter) +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedVzeros, "_1"); //! Prong1 index (V0 daughter) +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // flag for decay channel classification reconstruction level +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)); }); +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(CosThetaStarDs1, cosThetaStarDs1, //! costhetastar under Ds1 hypothesis + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDStar, o2::constants::physics::MassK0}, invMass, 1); }); +DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarDs2Star, cosThetaStarDs2Star, //! costhetastar under Ds2Star hypothesis + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassK0}, invMass, 1); }); +DECLARE_SOA_DYNAMIC_COLUMN(CosThetaStarXiC3055, cosThetaStarXiC3055, //! costhetastar under XiC3055 hypothesis + [](float px0, float py0, float pz0, float px1, float py1, float pz1, float invMass) -> float { return RecoDecay::cosThetaStar(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, std::array{o2::constants::physics::MassDPlus, o2::constants::physics::MassLambda0}, invMass, 1); }); +} // namespace hf_reso_cand_reduced DECLARE_SOA_TABLE(HfCandCharmReso, "AOD", "HFCANDCHARMRESO", //! Table with Resonance candidate information for resonances reduced workflow o2::soa::Index<>, - // Indices - hf_track_index_reduced::HfRedCollisionId, // Static hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, @@ -592,21 +841,73 @@ 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, hf_reso_cand_reduced::MlScoreNonpromptProng0, o2::soa::Marker<1>); + +// Tables for MC Resonance analysis +// table with results of reconstruction level MC matching +DECLARE_SOA_TABLE(HfMcRecRedDV0s, "AOD", "HFMCRECREDDV0", //! Table with reconstructed MC information on DV0(<-Ds*) pairs for reduced workflow + hf_reso_cand_reduced::Prong0Id, + hf_reso_cand_reduced::Prong1Id, + 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>); + +DECLARE_SOA_TABLE(HfMcGenRedResos, "AOD", "HFMCGENREDRESO", //! Generation-level MC information on Ds-Resonances candidates for reduced workflow + hf_cand_b0::FlagMcMatchGen, + hf_reso_cand_reduced::Origin, + hf_b0_mc::PtTrack, + hf_b0_mc::YTrack, + hf_b0_mc::EtaTrack, + hf_b0_mc::PtProng0, + hf_b0_mc::YProng0, + hf_b0_mc::EtaProng0, + hf_b0_mc::PtProng1, + hf_b0_mc::YProng1, + hf_b0_mc::EtaProng1, + o2::soa::Marker<1>); + +DECLARE_SOA_TABLE(HfCandChaResTr, "AOD", "HFCANDCHARESTR", //! Table with Resonance candidate information for resonances plus tracks reduced workflow + // Static + hf_cand::PxProng0, hf_cand::PyProng0, hf_cand::PzProng0, + hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, + hf_reso_cand_reduced::InvMass, + hf_reso_cand_reduced::InvMassProng0, + // Dynamic + hf_reso_cand_reduced::PtProng0); + +// Table with same size as HfCandCharmReso +DECLARE_SOA_TABLE(HfMcRecRedResos, "AOD", "HFMCRECREDRESO", //! Reconstruction-level MC information on Ds-Resonances candidates for reduced workflow + hf_reso_cand_reduced::FlagMcMatchRec, + hf_reso_cand_reduced::DebugMcRec, + hf_reso_cand_reduced::Origin, + hf_b0_mc::PtMother, + o2::soa::Marker<1>); } // namespace aod namespace soa diff --git a/PWGHF/D2H/TableProducer/CMakeLists.txt b/PWGHF/D2H/TableProducer/CMakeLists.txt index 3579b44cc6e..92eeda51051 100644 --- a/PWGHF/D2H/TableProducer/CMakeLists.txt +++ b/PWGHF/D2H/TableProducer/CMakeLists.txt @@ -21,6 +21,11 @@ o2physics_add_dpl_workflow(candidate-creator-bplus-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(candidate-creator-bs-reduced + SOURCES candidateCreatorBsReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(candidate-creator-charm-reso-reduced SOURCES candidateCreatorCharmResoReduced.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -38,6 +43,11 @@ o2physics_add_dpl_workflow(candidate-selector-bplus-to-d0-pi-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(candidate-selector-bs-to-ds-pi-reduced + SOURCES candidateSelectorBsToDsPiReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore + COMPONENT_NAME Analysis) + # Data creators o2physics_add_dpl_workflow(data-creator-charm-had-pi-reduced @@ -50,3 +60,9 @@ o2physics_add_dpl_workflow(data-creator-charm-reso-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) +# Converters + +o2physics_add_dpl_workflow(converter-reduced-3-prongs-ml + SOURCES converterReduced3ProngsMl.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx index 383ca9c42b1..3e354c266ea 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorB0Reduced.cxx @@ -293,7 +293,7 @@ struct HfCandidateCreatorB0ReducedExpressions { if ((rowDPiMcRec.prong0Id() != candB0.prong0Id()) || (rowDPiMcRec.prong1Id() != candB0.prong1Id())) { continue; } - rowB0McRec(rowDPiMcRec.flagMcMatchRec(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); + rowB0McRec(rowDPiMcRec.flagMcMatchRec(), rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); filledMcInfo = true; if constexpr (checkDecayTypeMc) { rowB0McCheck(rowDPiMcRec.pdgCodeBeautyMother(), @@ -306,7 +306,7 @@ struct HfCandidateCreatorB0ReducedExpressions { break; } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D-Pi creator - rowB0McRec(0, -1, -1.f); + rowB0McRec(0, -1, -1, -1.f); if constexpr (checkDecayTypeMc) { rowB0McCheck(-1, -1, -1, -1, -1, -1); } diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx index d47ac5f3d4d..34edf46cba4 100644 --- a/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateCreatorBplusReduced.cxx @@ -291,7 +291,7 @@ struct HfCandidateCreatorBplusReducedExpressions { if ((rowD0PiMcRec.prong0Id() != candBplus.prong0Id()) || (rowD0PiMcRec.prong1Id() != candBplus.prong1Id())) { continue; } - rowBplusMcRec(rowD0PiMcRec.flagMcMatchRec(), rowD0PiMcRec.debugMcRec(), rowD0PiMcRec.ptMother()); + rowBplusMcRec(rowD0PiMcRec.flagMcMatchRec(), rowD0PiMcRec.flagWrongCollision(), rowD0PiMcRec.debugMcRec(), rowD0PiMcRec.ptMother()); filledMcInfo = true; if constexpr (checkDecayTypeMc) { rowBplusMcCheck(rowD0PiMcRec.pdgCodeBeautyMother(), @@ -302,7 +302,7 @@ struct HfCandidateCreatorBplusReducedExpressions { break; } if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D0-Pi creator - rowBplusMcRec(0, -1, -1.f); + rowBplusMcRec(0, -1, -1, -1.f); if constexpr (checkDecayTypeMc) { rowBplusMcCheck(-1, -1, -1, -1); } diff --git a/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx new file mode 100644 index 00000000000..f75b5608ca1 --- /dev/null +++ b/PWGHF/D2H/TableProducer/candidateCreatorBsReduced.cxx @@ -0,0 +1,331 @@ +// 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 candidateCreatorBsReduced.cxx +/// \brief Reconstruction of Bs candidates +/// +/// \author Fabio Catalano , CERN + +#include "CommonConstants/PhysicsConstants.h" +#include "DCAFitter/DCAFitterN.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/DCA.h" + +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/CollisionAssociationTables.h" + +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" +#include "PWGHF/Utils/utilsTrkCandHf.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::hf_trkcandsel; + +/// Reconstruction of Bs candidates +struct HfCandidateCreatorBsReduced { + Produces rowCandidateBase; // table defined in CandidateReconstructionTables.h + Produces rowCandidateProngs; // table defined in ReducedDataModel.h + Produces rowCandidateDmesMlScores; // table defined in ReducedDataModel.h + + // vertexing + Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; + Configurable useAbsDCA{"useAbsDCA", true, "Minimise abs. distance rather than chi2"}; + Configurable useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"}; + Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; + Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; + Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any B0 is smaller than this"}; + Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"}; + // selection + Configurable invMassWindowDPiTolerance{"invMassWindowDPiTolerance", 0.01, "invariant-mass window tolerance for DsPi pair preselections (GeV/c2)"}; + + float myInvMassWindowDPi{1.}; // variable that will store the value of invMassWindowCharmHadPi (defined in dataCreatorCharmHadPiReduced.cxx) + float massPi{o2::constants::physics::MassPiPlus}; + float massD{o2::constants::physics::MassDS}; + float massB{o2::constants::physics::MassBS}; + float bz{0.}; + + o2::vertexing::DCAFitterN<2> df2; // fitter for B vertex (2-prong vertex fitter) + + using HfRedCollisionsWithExtras = soa::Join; + + Preslice> candsDPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> candsDWithMlPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice> tracksPionPerCollision = hf_track_index_reduced::hfRedCollisionId; + + std::shared_ptr hCandidates; + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + std::array doprocess{doprocessData, doprocessDataWithDmesMl}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { + LOGP(fatal, "Only one process function for data should be enabled at a time."); + } + + // Initialize fitter + df2.setPropagateToPCA(propagateToPCA); + df2.setMaxR(maxR); + df2.setMaxDZIni(maxDZIni); + df2.setMinParamChange(minParamChange); + df2.setMinRelChi2Change(minRelChi2Change); + df2.setUseAbsDCA(useAbsDCA); + df2.setWeightedFinalPCA(useWeightedFinalPCA); + + // histograms + registry.add("hMassBsToDsPi", "2-prong candidates;inv. mass (B^{0}_{s} #rightarrow D_{s}^{#minus}#pi^{#plus} #rightarrow #K^{#minus}K^{#plus}#pi^{#minus}#pi^{#plus}) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 3., 8.}}}); + registry.add("hCovPVXX", "2-prong candidates;XX element of cov. matrix of prim. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 1.e-4}}}); + registry.add("hCovSVXX", "2-prong candidates;XX element of cov. matrix of sec. vtx. position (cm^{2});entries", {HistType::kTH1F, {{100, 0., 0.2}}}); + registry.add("hEvents", "Events;;entries", HistType::kTH1F, {{1, 0.5, 1.5}}); + + /// candidate monitoring + hCandidates = registry.add("hCandidates", "candidates counter", {HistType::kTH1D, {axisCands}}); + setLabelHistoCands(hCandidates); + } + + /// Main function to perform Bs candidate creation + /// \param withDmesMl is the flag to use the table with ML scores for the Ds- daughter (only possible if present in the derived data) + /// \param collision the collision + /// \param candsDThisColl Bs candidates in this collision + /// \param tracksPionThisCollision pion tracks in this collision + /// \param invMass2DPiMin minimum Bs invariant-mass + /// \param invMass2DPiMax maximum Bs invariant-mass + template + void runCandidateCreation(Coll const& collision, + Cands const& candsDThisColl, + Pions const& tracksPionThisCollision, + const float& invMass2DPiMin, + const float& invMass2DPiMax) + { + auto primaryVertex = getPrimaryVertex(collision); + auto covMatrixPV = primaryVertex.getCov(); + + // Set the magnetic field from ccdb + bz = collision.bz(); + df2.setBz(bz); + + for (const auto& candD : candsDThisColl) { + auto trackParCovD = getTrackParCov(candD); + std::array pVecD = candD.pVector(); + + for (const auto& trackPion : tracksPionThisCollision) { + // this track is among daughters + if (trackPion.trackId() == candD.prong0Id() || trackPion.trackId() == candD.prong1Id() || trackPion.trackId() == candD.prong2Id()) { + continue; + } + + auto trackParCovPi = getTrackParCov(trackPion); + std::array pVecPion = trackPion.pVector(); + + // compute invariant mass square and apply selection + auto invMass2DPi = RecoDecay::m2(std::array{pVecD, pVecPion}, std::array{massD, massPi}); + if ((invMass2DPi < invMass2DPiMin) || (invMass2DPi > invMass2DPiMax)) { + continue; + } + // --------------------------------- + // reconstruct the 2-prong Bs vertex + hCandidates->Fill(SVFitting::BeforeFit); + try { + if (df2.process(trackParCovD, trackParCovPi) == 0) { + continue; + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + hCandidates->Fill(SVFitting::Fail); + continue; + } + hCandidates->Fill(SVFitting::FitOk); // DsPi passed Bs reconstruction + + // calculate relevant properties + const auto& secondaryVertexB = df2.getPCACandidate(); + auto chi2PCA = df2.getChi2AtPCACandidate(); + auto covMatrixPCA = df2.calcPCACovMatrixFlat(); + registry.fill(HIST("hCovSVXX"), covMatrixPCA[0]); + registry.fill(HIST("hCovPVXX"), covMatrixPV[0]); + + // propagate Ds and Pi to the Bs vertex + df2.propagateTracksToVertex(); + // track.getPxPyPzGlo(pVec) modifies pVec of track + df2.getTrack(0).getPxPyPzGlo(pVecD); // momentum of Ds at the Bs vertex + df2.getTrack(1).getPxPyPzGlo(pVecPion); // momentum of Pi at the Bs vertex + + registry.fill(HIST("hMassBsToDsPi"), std::sqrt(invMass2DPi)); + + // compute impact parameters of Ds and Pi + o2::dataformats::DCA dcaD; + o2::dataformats::DCA dcaPion; + trackParCovD.propagateToDCA(primaryVertex, bz, &dcaD); + trackParCovPi.propagateToDCA(primaryVertex, bz, &dcaPion); + + // get uncertainty of the decay length + float phi, theta; + // getPointDirection modifies phi and theta + getPointDirection(std::array{collision.posX(), collision.posY(), collision.posZ()}, secondaryVertexB, phi, theta); + auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixPCA, phi, theta)); + auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); + + // fill the candidate table for the Bs here: + rowCandidateBase(collision.globalIndex(), + collision.posX(), collision.posY(), collision.posZ(), + secondaryVertexB[0], secondaryVertexB[1], secondaryVertexB[2], + errorDecayLength, errorDecayLengthXY, + chi2PCA, + pVecD[0], pVecD[1], pVecD[2], + pVecPion[0], pVecPion[1], pVecPion[2], + dcaD.getY(), dcaPion.getY(), + std::sqrt(dcaD.getSigmaY2()), std::sqrt(dcaPion.getSigmaY2())); + + rowCandidateProngs(candD.globalIndex(), trackPion.globalIndex()); + + if constexpr (withDmesMl) { + if (candD.invMassHypo0() > 0) { + rowCandidateDmesMlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); + } else { + rowCandidateDmesMlScores(candD.mlScoreBkgMassHypo1(), candD.mlScorePromptMassHypo1(), candD.mlScoreNonpromptMassHypo1()); + } + // TODO: here we are assuming that only one of the two hypotheses is filled, to be checked + } + } // pi loop + } // D loop + } + + void processData(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsD, + soa::Join const& tracksPion, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCandBsConfigs const& configs) + { + // DsPi invariant-mass window cut + for (const auto& config : configs) { + myInvMassWindowDPi = config.myInvMassWindowDPi(); + } + // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DsPi pair preselection + // to avoid accepting DsPi pairs that were not formed in DsPi pair creator + float invMass2DPiMin = (massB - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB - myInvMassWindowDPi + invMassWindowDPiTolerance); + float invMass2DPiMax = (massB + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB + myInvMassWindowDPi - invMassWindowDPiTolerance); + + for (const auto& collisionCounter : collisionsCounter) { + registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); + } + + static int ncol = 0; + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto tracksPionThisCollision = tracksPion.sliceBy(tracksPionPerCollision, thisCollId); + runCandidateCreation(collision, candsDThisColl, tracksPionThisCollision, invMass2DPiMin, invMass2DPiMax); + if (ncol % 10000 == 0) { + LOGP(debug, "collisions parsed {}", ncol); + } + ncol++; + } + } // processData + + PROCESS_SWITCH(HfCandidateCreatorBsReduced, processData, "Process data without any ML score", true); + + void processDataWithDmesMl(HfRedCollisionsWithExtras const& collisions, + soa::Join const& candsD, + soa::Join const& tracksPion, + aod::HfOrigColCounts const& collisionsCounter, + aod::HfCandBsConfigs const& configs) + { + // DPi invariant-mass window cut + for (const auto& config : configs) { + myInvMassWindowDPi = config.myInvMassWindowDPi(); + } + // invMassWindowDPiTolerance is used to apply a slightly tighter cut than in DsPi pair preselection + // to avoid accepting DPi pairs that were not formed in DsPi pair creator + float invMass2DPiMin = (massB - myInvMassWindowDPi + invMassWindowDPiTolerance) * (massB - myInvMassWindowDPi + invMassWindowDPiTolerance); + float invMass2DPiMax = (massB + myInvMassWindowDPi - invMassWindowDPiTolerance) * (massB + myInvMassWindowDPi - invMassWindowDPiTolerance); + + for (const auto& collisionCounter : collisionsCounter) { + registry.fill(HIST("hEvents"), 1, collisionCounter.originalCollisionCount()); + } + + static int ncol = 0; + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto tracksPionThisCollision = tracksPion.sliceBy(tracksPionPerCollision, thisCollId); + runCandidateCreation(collision, candsDThisColl, tracksPionThisCollision, invMass2DPiMin, invMass2DPiMax); + if (ncol % 10000 == 0) { + LOGP(debug, "collisions parsed {}", ncol); + } + ncol++; + } + } // processDataWithDmesMl + + PROCESS_SWITCH(HfCandidateCreatorBsReduced, processDataWithDmesMl, "Process data with ML scores of D mesons", false); +}; // struct + +/// Extends the table base with expression columns and performs MC matching. +struct HfCandidateCreatorBsReducedExpressions { + Spawns rowCandidateBs; + Spawns rowTracksExt; + Produces rowBsMcRec; + Produces rowBsMcCheck; + + /// Fill candidate information at MC reconstruction level + /// \param checkDecayTypeMc + /// \param rowsDPiMcRec MC reco information on DsPi pairs + /// \param candsB prong global indices of Bs candidates + template + void fillBsMcRec(McRec const& rowsDPiMcRec, HfRedBsProngs const& candsB) + { + for (const auto& candB : candsB) { + bool filledMcInfo{false}; + for (const auto& rowDPiMcRec : rowsDPiMcRec) { + if ((rowDPiMcRec.prong0Id() != candB.prong0Id()) || (rowDPiMcRec.prong1Id() != candB.prong1Id())) { + continue; + } + rowBsMcRec(rowDPiMcRec.flagMcMatchRec(), rowDPiMcRec.flagWrongCollision(), rowDPiMcRec.debugMcRec(), rowDPiMcRec.ptMother()); + filledMcInfo = true; + if constexpr (checkDecayTypeMc) { + rowBsMcCheck(rowDPiMcRec.pdgCodeBeautyMother(), + rowDPiMcRec.pdgCodeCharmMother(), + rowDPiMcRec.pdgCodeProng0(), + rowDPiMcRec.pdgCodeProng1(), + rowDPiMcRec.pdgCodeProng2(), + rowDPiMcRec.pdgCodeProng3()); + } + break; + } + if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the DsPi creator + rowBsMcRec(0, -1, -1, -1.f); + if constexpr (checkDecayTypeMc) { + rowBsMcCheck(-1, -1, -1, -1, -1, -1); + } + } + } + } + + void processMc(HfMcRecRedDsPis const& rowsDPiMcRec, HfRedBsProngs const& candsB) + { + fillBsMcRec(rowsDPiMcRec, candsB); + } + PROCESS_SWITCH(HfCandidateCreatorBsReducedExpressions, processMc, "Process MC", false); + + void processMcWithDecayTypeCheck(soa::Join const& rowsDPiMcRec, HfRedBsProngs const& candsB) + { + fillBsMcRec(rowsDPiMcRec, candsB); + } + PROCESS_SWITCH(HfCandidateCreatorBsReducedExpressions, processMcWithDecayTypeCheck, "Process MC with decay type checks", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/candidateCreatorCharmResoReduced.cxx index c3f3af5086b..58ed7639b99 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" @@ -38,20 +40,33 @@ enum Selections : uint8_t { NoSel = 0, DSel, V0Sel, + TrackSel, NSelSteps }; enum DecayChannel : uint8_t { Ds1ToDstarK0s = 0, Ds2StarToDplusK0s, XcToDplusLambda, - LambdaDminus + LambdaDminus, + DstarTrack }; + enum V0Type : uint8_t { K0s = 0, Lambda, AntiLambda }; +enum DecayTypeMc : uint8_t { + Ds1ToDStarK0ToD0PiK0s = 1, + Ds2StarToDplusK0sToPiKaPiPiPi, + Ds1ToDStarK0ToDPlusPi0K0s, + Ds1ToDStarK0ToD0PiK0sPart, + Ds1ToDStarK0ToD0NoPiK0sPart, + Ds1ToDStarK0ToD0PiK0sOneMu, + Ds2StarToDplusK0sOneMu +}; + const int nBinsPt = 7; constexpr double binsPt[nBinsPt + 1] = { 1., @@ -67,8 +82,11 @@ auto vecBinsPt = std::vector{binsPt, binsPt + nBinsPt + 1}; struct HfCandidateCreatorCharmResoReduced { // Produces: Tables with resonance info Produces rowCandidateReso; + 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"}; @@ -82,18 +100,28 @@ struct HfCandidateCreatorCharmResoReduced { 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 candsDPerCollision = hf_track_index_reduced::hfRedCollisionId; + Preslice candsDPerCollisionWithMl = 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.}; @@ -103,22 +131,30 @@ struct HfCandidateCreatorCharmResoReduced { void init(InitContext const&) { // check that only one process function is enabled - std::array doprocess{doprocessDs2StarToDplusK0s, doprocessDs2StarToDplusK0sWithMl, doprocessDs1ToDstarK0s, doprocessDs1ToDstarK0sWithMl, doprocessXcToDplusLambda, doprocessXcToDplusLambdaWithMl, doprocessLambdaDminus, doprocessLambdaDminusWithMl}; + 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, {{100, 2.4, 2.7}, {(std::vector)binsPt, "#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})"}}}); + 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; std::string labels[kNBinsSelections]; labels[Selections::NoSel] = "No selection"; labels[Selections::DSel] = "D Candidates Selection"; labels[Selections::V0Sel] = "D & V0 candidate Selection"; + labels[Selections::TrackSel] = "D & Track candidate Selection"; static const AxisSpec axisSelections = {kNBinsSelections, 0.5, kNBinsSelections + 0.5, ""}; registry.add("hSelections", "Selections", {HistType::kTH1F, {axisSelections}}); for (int iBin = 0; iBin < kNBinsSelections; ++iBin) { @@ -128,10 +164,12 @@ struct HfCandidateCreatorCharmResoReduced { // 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 @@ -144,14 +182,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) { + } 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) { @@ -169,7 +206,7 @@ struct HfCandidateCreatorCharmResoReduced { return true; } - /// Basic selection of V0 candidates + /// Basic selection of V0 and track candidates /// \param candV0 is the reduced V0 candidate /// \param candD is the reduced D meson candidate /// \return true if selections are passed @@ -215,10 +252,10 @@ struct HfCandidateCreatorCharmResoReduced { return true; } - template + template void runCandidateCreation(Coll const& collision, DRedTable const& candsD, - V0RedTable const& candsV0) + V0TrRedTable const& candsV0Tr) { // loop on D candidates for (const auto& candD : candsD) { @@ -233,85 +270,206 @@ 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 candidates + + // loop on V0 or track candidates bool alreadyCounted{false}; - for (const auto& candV0 : candsV0) { + for (const auto& candV0Tr : candsV0Tr) { if (rejectDV0PairsWithCommonDaughter) { const std::array dDaughtersIDs = {candD.prong0Id(), candD.prong1Id(), candD.prong2Id()}; - if (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0.prong0Id()) != dDaughtersIDs.end() || std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0.prong1Id()) != dDaughtersIDs.end()) { + if constexpr (channel == DecayChannel::DstarTrack) { + if (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.globalIndex()) != dDaughtersIDs.end()) { + continue; + } + } else { + if (std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong0Id()) != dDaughtersIDs.end() || std::find(dDaughtersIDs.begin(), dDaughtersIDs.end(), candV0Tr.prong1Id()) != dDaughtersIDs.end()) { + continue; + } + } + } + if constexpr (channel != DecayChannel::DstarTrack) { + if (!isV0Selected(candV0Tr, candD)) { continue; } + if (activateQA && !alreadyCounted) { + registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); + alreadyCounted = true; + } } - if (!isV0Selected(candV0, candD)) { + float invMassReso{0.}; + float invMassV0{0.}; + std::array pVecV0Tr = {candV0Tr.px(), candV0Tr.py(), candV0Tr.pz()}; + 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); + } else { + switch (channel) { + case DecayChannel::Ds1ToDstarK0s: + invMassV0 = candV0Tr.invMassK0s(); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDstar, massK0}); + registry.fill(HIST("hMassDs1"), invMassReso, ptReso); + break; + case DecayChannel::Ds2StarToDplusK0s: + invMassV0 = candV0Tr.invMassK0s(); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massK0}); + registry.fill(HIST("hMassDs2Star"), invMassReso, ptReso); + break; + case DecayChannel::XcToDplusLambda: + if (candD.dType() > 0) { + invMassV0 = candV0Tr.invMassLambda(); + } else { + invMassV0 = candV0Tr.invMassAntiLambda(); + } + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassXcRes"), invMassReso, ptReso); + break; + case DecayChannel::LambdaDminus: + if (candD.dType() < 0) { + invMassV0 = candV0Tr.invMassLambda(); + } else { + invMassV0 = candV0Tr.invMassAntiLambda(); + } + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massLambda}); + registry.fill(HIST("hMassLambdaDminus"), invMassReso, ptReso); + break; + default: + break; + } + } + // Filling Output table + if constexpr (channel == DecayChannel::DstarTrack) { + rowCandidateResoTrack(pVecD[0], pVecD[1], pVecD[2], + candV0Tr.px(), candV0Tr.py(), candV0Tr.pz(), + invMassReso, + invMassD - invMassD0); + } else { + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], + pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], + invMassReso, + invMassD, + invMassV0, + candV0Tr.cpa(), + candV0Tr.dca(), + candV0Tr.v0Radius(), + invMassD0); + rowCandidateResoIndices(collision.globalIndex(), + candD.globalIndex(), + candV0Tr.globalIndex()); + } + if constexpr (fillMl) { + mlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); + } + } + } + } // 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; } - if (activateQA && !alreadyCounted) { - registry.fill(HIST("hSelections"), 1 + Selections::V0Sel); - alreadyCounted = true; + // 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 pVecV0 = {candV0.px(), candV0.py(), candV0.pz()}; - float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0, pVecD)); + std::array pVecV0Tr = {bachV0Tr.px(), bachV0Tr.py(), bachV0Tr.pz()}; + float ptReso = RecoDecay::pt(RecoDecay::sumOfVec(pVecV0Tr, pVecD)); switch (channel) { case DecayChannel::Ds1ToDstarK0s: - invMassV0 = candV0.invMassK0s(); - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDstar, massK0}); + invMassV0 = bachV0Tr.invMassK0s(); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDstar, massK0}); registry.fill(HIST("hMassDs1"), invMassReso, ptReso); break; case DecayChannel::Ds2StarToDplusK0s: - invMassV0 = candV0.invMassK0s(); - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDplus, massK0}); + invMassV0 = bachV0Tr.invMassK0s(); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massK0}); registry.fill(HIST("hMassDs2Star"), invMassReso, ptReso); break; case DecayChannel::XcToDplusLambda: - if (candD.dType() > 0) { - invMassV0 = candV0.invMassLambda(); + if (bachD.dType() > 0) { + invMassV0 = bachV0Tr.invMassLambda(); } else { - invMassV0 = candV0.invMassAntiLambda(); + invMassV0 = bachV0Tr.invMassAntiLambda(); } - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massLambda}); registry.fill(HIST("hMassXcRes"), invMassReso, ptReso); break; case DecayChannel::LambdaDminus: - if (candD.dType() < 0) { - invMassV0 = candV0.invMassLambda(); + if (bachD.dType() < 0) { + invMassV0 = bachV0Tr.invMassLambda(); } else { - invMassV0 = candV0.invMassAntiLambda(); + invMassV0 = bachV0Tr.invMassAntiLambda(); } - invMassReso = RecoDecay::m(std::array{pVecD, pVecV0}, std::array{massDplus, massLambda}); + invMassReso = RecoDecay::m(std::array{pVecD, pVecV0Tr}, std::array{massDplus, massLambda}); registry.fill(HIST("hMassLambdaDminus"), invMassReso, ptReso); break; default: break; } - // Filling Output table - rowCandidateReso(collision.globalIndex(), - pVecD[0], pVecD[1], pVecD[2], - pVecV0[0], pVecV0[1], pVecV0[2], + // Fill output table + rowCandidateReso(pVecD[0], pVecD[1], pVecD[2], + pVecV0Tr[0], pVecV0Tr[1], pVecV0Tr[2], invMassReso, invMassD, invMassV0, - candV0.cpa(), - candV0.dca(), - candV0.v0Radius()); + bachV0Tr.cpa(), + bachV0Tr.dca(), + bachV0Tr.v0Radius(), + invMassD0); + rowCandidateResoIndices(collision1.globalIndex(), + bachD.globalIndex(), + bachV0Tr.globalIndex()); if constexpr (fillMl) { - mlScores(candD.mlScoreBkgMassHypo0(), candD.mlScorePromptMassHypo0(), candD.mlScoreNonpromptMassHypo0()); + mlScores(bachD.mlScoreBkgMassHypo0(), bachD.mlScorePromptMassHypo0(), bachD.mlScoreNonpromptMassHypo0()); } } } - } // main function + } // runCandidateCreationMixedEvent + // List of Process Functions void processDs2StarToDplusK0s(aod::HfRedCollisions const& collisions, aod::HfRed3PrNoTrks const& candsD, aod::HfRedVzeros const&) @@ -331,13 +489,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&) @@ -352,18 +526,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&) @@ -378,12 +568,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); } @@ -404,21 +594,130 @@ 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); } } PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processLambdaDminusWithMl, "Process LambdaDminus candidates with Ml info", false); + void processDstarTrack(aod::HfRedCollisions const& collisions, + aod::HfRed3PrNoTrks const& candsD, + aod::HfRedTrkNoParams const& candidatesTrack) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsD.sliceBy(candsDPerCollision, thisCollId); + auto trackThisColl = candidatesTrack.sliceBy(candsTrackPerCollision, thisCollId); + runCandidateCreation(collision, candsDThisColl, trackThisColl); + } + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDstarTrack, "Process DStar candidates without Ml info", false); + + void processDstarTrackWithMl(aod::HfRedCollisions const& collisions, + HfRed3PrNoTrksWithMl const& candsD, + aod::HfRedTrkNoParams const& candidatesTrack) + { + for (const auto& collision : collisions) { + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsD.sliceBy(candsDPerCollisionWithMl, thisCollId); + auto trackThisColl = candidatesTrack.sliceBy(candsTrackPerCollision, thisCollId); + runCandidateCreation(collision, candsDThisColl, trackThisColl); + } + } + PROCESS_SWITCH(HfCandidateCreatorCharmResoReduced, processDstarTrackWithMl, "Process DStar candidates with Ml info", false); + +}; // struct HfCandidateCreatorCharmResoReduced + +struct HfCandidateCreatorCharmResoReducedExpressions { + + Produces rowResoMcRec; -}; // struct + 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", {200, 2.5, 2.7}, "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&) + { + 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, CandResoWithIndices const& candsReso) + { + for (const auto& candReso : candsReso) { + bool filledMcInfo{false}; + for (const auto& rowDV0McRec : rowsDV0McRec) { + if ((rowDV0McRec.prong0Id() != candReso.prong0Id()) || (rowDV0McRec.prong1Id() != candReso.prong1Id())) { + continue; + } + rowResoMcRec(rowDV0McRec.flagMcMatchRec(), rowDV0McRec.debugMcRec(), rowDV0McRec.origin(), rowDV0McRec.ptMother()); + filledMcInfo = true; + 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()); + 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; + } + if (!filledMcInfo) { // protection to get same size tables in case something went wrong: we created a candidate that was not preselected in the D-Pi creator + // rowResoMcRec(0, -1, -1, -1.f); + registry.fill(HIST("hMassMcNoEntry"), candReso.invMass(), candReso.pt()); + } + } + } + + 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)}; + return WorkflowSpec{adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; } diff --git a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx index 5bf352517e4..02db4418680 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorB0ToDPiReduced.cxx @@ -114,6 +114,7 @@ struct HfCandidateSelectorB0ToDPiReduced { 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) { diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx index b10dfe22752..5a45f7c3fab 100644 --- a/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx +++ b/PWGHF/D2H/TableProducer/candidateSelectorBplusToD0PiReduced.cxx @@ -114,6 +114,7 @@ struct HfCandidateSelectorBplusToD0PiReduced { 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) { diff --git a/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.cxx new file mode 100644 index 00000000000..6161e31774d --- /dev/null +++ b/PWGHF/D2H/TableProducer/candidateSelectorBsToDsPiReduced.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. + +/// \file candidateSelectorBsToDsPiReduced.cxx +/// \brief Bs → Ds- π+ candidate selector +/// +/// \author Fabio Catalano , CERN + +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "Common/Core/TrackSelectorPID.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/HfMlResponseBsToDsPi.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::analysis; + +struct HfCandidateSelectorBsToDsPiReduced { + Produces hfSelBsToDsPiCandidate; // table defined in CandidateSelectionTables.h + Produces hfMlBsToDsPiCandidate; // table defined in CandidateSelectionTables.h + + Configurable ptCandMin{"ptCandMin", 0., "Lower bound of candidate pT"}; + Configurable ptCandMax{"ptCandMax", 50., "Upper bound of candidate pT"}; + // Enable PID + 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", 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", 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"}; + // topological cuts + Configurable> binsPt{"binsPt", std::vector{hf_cuts_bs_to_ds_pi::vecBinsPt}, "pT bin limits"}; + Configurable> cuts{"cuts", {hf_cuts_bs_to_ds_pi::cuts[0], hf_cuts_bs_to_ds_pi::nBinsPt, hf_cuts_bs_to_ds_pi::nCutVars, hf_cuts_bs_to_ds_pi::labelsPt, hf_cuts_bs_to_ds_pi::labelsCutVar}, "Bs candidate selection per pT bin"}; + // D-meson ML cuts + Configurable> binsPtDmesMl{"binsPtDmesMl", std::vector{hf_cuts_ml::vecBinsPt}, "D-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}, "D-meson ML cuts per pT bin"}; + // QA switch + Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; + // B0 ML inference + Configurable applyBsMl{"applyBsMl", false, "Flag to apply ML selections"}; + 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> 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_Bs/"}, "Paths of models on CCDB"}; + Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_BsToDsPi.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::HfMlResponseBsToDsPi hfMlResponse; + std::vector outputMl = {}; + o2::ccdb::CcdbApi ccdbApi; + + TrackSelectorPi selectorPion; + HfHelper hfHelper; + + using TracksPion = soa::Join; + + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + 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) { + selectorPion.setRangePtTpc(ptPidTpcMin, ptPidTpcMax); + selectorPion.setRangeNSigmaTpc(-nSigmaTpcMax, nSigmaTpcMax); + selectorPion.setRangeNSigmaTpcCondTof(-nSigmaTpcCombinedMax, nSigmaTpcCombinedMax); + selectorPion.setRangePtTof(ptPidTofMin, ptPidTofMax); + selectorPion.setRangeNSigmaTof(-nSigmaTofMax, nSigmaTofMax); + selectorPion.setRangeNSigmaTofCondTpc(-nSigmaTofCombinedMax, nSigmaTofCombinedMax); + } + + if (activateQA) { + constexpr int kNBinsSelections = 1 + SelectionStep::NSelectionSteps; + std::string labels[kNBinsSelections]; + labels[0] = "No selection"; + 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) { + registry.get(HIST("hSelections"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + } + } + + if (applyBsMl) { + hfMlResponse.configure(binsPtBsMl, cutsBsMl, cutDirBsMl, nClassesBsMl); + if (loadModelsFromCCDB) { + ccdbApi.init(ccdbUrl); + hfMlResponse.setModelPathsCCDB(onnxFileNames, ccdbApi, modelPathsCCDB, timestampCCDB); + } else { + hfMlResponse.setModelPathsLocal(onnxFileNames); + } + hfMlResponse.cacheInputFeaturesIndices(namesInputFeatures); + hfMlResponse.init(); + } + } + + /// Main function to perform Bs candidate selection + /// \param withDmesMl is the flag to use the table with ML scores for the Ds- daughter (only possible if present in the derived data) + /// \param hfCandsBs Bs candidates + /// \param pionTracks pion tracks + /// \param configs config inherited from the charm-hadron data creator + template + void runSelection(Cands const& hfCandsBs, + TracksPion const&, + HfCandBsConfigs const&) + { + for (const auto& hfCandBs : hfCandsBs) { + int statusBsToDsPi = 0; + outputMl.clear(); + auto ptCandBs = hfCandBs.pt(); + + SETBIT(statusBsToDsPi, SelectionStep::RecoSkims); // RecoSkims = 0 --> statusBsToDsPi = 1 + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoSkims, ptCandBs); + } + + // topological cuts + if (!hfHelper.selectionBsToDsPiTopol(hfCandBs, cuts, binsPt)) { + hfSelBsToDsPiCandidate(statusBsToDsPi); + if (applyBsMl) { + hfMlBsToDsPiCandidate(outputMl); + } + continue; + } + + if constexpr (withDmesMl) { // we include it in the topological selections + if (!hfHelper.selectionDmesMlScoresForB(hfCandBs, cutsDmesMl, binsPtDmesMl)) { + hfSelBsToDsPiCandidate(statusBsToDsPi); + if (applyBsMl) { + hfMlBsToDsPiCandidate(outputMl); + } + continue; + } + } + + SETBIT(statusBsToDsPi, SelectionStep::RecoTopol); // RecoTopol = 1 --> statusBsToDsPi = 3 + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoTopol, ptCandBs); + } + + // track-level PID selection + auto trackPi = hfCandBs.template prong1_as(); + if (pionPidMethod) { + int pidTrackPi{TrackSelectorPID::Status::NotApplicable}; + if (pionPidMethod == 1) { + pidTrackPi = selectorPion.statusTpcOrTof(trackPi); + } else { + pidTrackPi = selectorPion.statusTpcAndTof(trackPi); + } + if (!hfHelper.selectionBsToDsPiPid(pidTrackPi, acceptPIDNotApplicable.value)) { + hfSelBsToDsPiCandidate(statusBsToDsPi); + if (applyBsMl) { + hfMlBsToDsPiCandidate(outputMl); + } + continue; + } + SETBIT(statusBsToDsPi, SelectionStep::RecoPID); // RecoPID = 2 --> statusBsToDsPi = 7 + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoPID, ptCandBs); + } + } + + if (applyBsMl) { + // Bs ML selections + std::vector inputFeatures = hfMlResponse.getInputFeatures(hfCandBs, trackPi); + bool isSelectedMl = hfMlResponse.isSelectedMl(inputFeatures, ptCandBs, outputMl); + hfMlBsToDsPiCandidate(outputMl); + + if (!isSelectedMl) { + hfSelBsToDsPiCandidate(statusBsToDsPi); + continue; + } + SETBIT(statusBsToDsPi, SelectionStep::RecoMl); // RecoML = 3 --> statusBsToDsPi = 15 if pionPidMethod, 11 otherwise + if (activateQA) { + registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoMl, ptCandBs); + } + } + + hfSelBsToDsPiCandidate(statusBsToDsPi); + } + } + + void processSelection(HfRedCandBs const& hfCandsBs, + TracksPion const& pionTracks, + HfCandBsConfigs const& configs) + { + runSelection(hfCandsBs, pionTracks, configs); + } // processSelection + + PROCESS_SWITCH(HfCandidateSelectorBsToDsPiReduced, processSelection, "Process selection without ML scores of D mesons", true); + + void processSelectionWithDmesMl(soa::Join const& hfCandsBs, + TracksPion const& pionTracks, + HfCandBsConfigs const& configs) + { + runSelection(hfCandsBs, pionTracks, configs); + } // processSelectionWithDmesMl + + PROCESS_SWITCH(HfCandidateSelectorBsToDsPiReduced, processSelectionWithDmesMl, "Process selection with ML scores of D mesons", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/TableProducer/converterReduced3ProngsMl.cxx b/PWGHF/D2H/TableProducer/converterReduced3ProngsMl.cxx new file mode 100644 index 00000000000..ea9450eca08 --- /dev/null +++ b/PWGHF/D2H/TableProducer/converterReduced3ProngsMl.cxx @@ -0,0 +1,41 @@ +// 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 converterReduced3ProngsMl.cxx +/// \brief Task for conversion of HfRed3ProngsMl to version 001 +/// +/// \author Fabrizio Grosa , CERN + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" + +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" + +using namespace o2; +using namespace o2::framework; + +// Swaps covariance matrix elements if the data is known to be bogus (collision_000 is bogus) +struct HfConverterReduced3ProngsMl { + Produces ml3Prongs; + + void process(aod::HfRed3ProngsMl_000::iterator const& mlScoreTable) + { + ml3Prongs(mlScoreTable.mlScoreBkgMassHypo0(), mlScoreTable.mlScorePromptMassHypo0(), mlScoreTable.mlScoreNonpromptMassHypo0(), -1.f, -1.f, -1.f); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index bb8f606c402..3a52b39387f 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -15,6 +15,7 @@ /// \author Alexandre Bigot , IPHC Strasbourg /// \author Antonio Palasciano , Università degli Studi di Bari /// \author Fabrizio Grosa , CERN +/// \author Fabio Catalano , CERN #include @@ -55,6 +56,13 @@ enum Event : uint8_t { enum DecayChannel : uint8_t { B0ToDminusPi = 0, BplusToD0barPi, + BsToDsminusPi +}; + +enum WrongCollisionType : uint8_t { + None = 0, + WrongAssociation, + SplitCollision, }; /// Creation of CharmHad-Pi pairs for Beauty hadrons @@ -75,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; @@ -86,6 +99,11 @@ struct HfDataCreatorCharmHadPiReduced { Produces rowHfD0PiMcCheckReduced; Produces rowHfBpMcGenReduced; + Produces rowCandidateConfigBs; + Produces rowHfDsPiMcRecReduced; + Produces rowHfDsPiMcCheckReduced; + Produces rowHfBsMcGenReduced; + // vertexing // Configurable bz{"bz", 5., "magnetic field"}; Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; @@ -102,6 +120,7 @@ struct HfDataCreatorCharmHadPiReduced { Configurable> cutsTrackPionDCA{"cutsTrackPionDCA", {hf_cuts_single_track::cutsTrack[0], hf_cuts_single_track::nBinsPtTrack, hf_cuts_single_track::nCutVarsTrack, hf_cuts_single_track::labelsPtTrack, hf_cuts_single_track::labelsCutVarTrack}, "Single-track selections per pT bin for pions"}; Configurable invMassWindowCharmHadPi{"invMassWindowCharmHadPi", 0.3, "invariant-mass window for CharmHad-Pi pair preselections (GeV/c2)"}; Configurable selectionFlagDplus{"selectionFlagDplus", 7, "Selection Flag for D+"}; + Configurable selectionFlagDs{"selectionFlagDs", 7, "Selection Flag for Ds"}; Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; @@ -136,30 +155,43 @@ 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 CandsD0Filtered = soa::Filtered>; - using CandsD0FilteredWithMl = soa::Filtered>; + using CandsDsFiltered = soa::Filtered>; + using CandsDsFilteredWithMl = soa::Filtered>; + using CandsD0Filtered = soa::Filtered>; + using CandsD0FilteredWithMl = soa::Filtered>; + + using CollisionsWMcLabels = soa::Join; Filter filterSelectDplusCandidates = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus); + Filter filterSelectDsCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlagDs); Filter filterSelectDzeroCandidates = (aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar); Preslice candsDplusPerCollision = aod::track_association::collisionId; Preslice candsDplusPerCollisionWithMl = aod::track_association::collisionId; + Preslice candsDsPerCollision = aod::track_association::collisionId; + Preslice candsDsPerCollisionWithMl = aod::track_association::collisionId; Preslice candsD0PerCollision = aod::track_association::collisionId; Preslice candsD0PerCollisionWithMl = aod::track_association::collisionId; Preslice trackIndicesPerCollision = aod::track_association::collisionId; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - std::shared_ptr hCandidatesD0, hCandidatesDPlus; + std::shared_ptr hCandidatesD0, hCandidatesDPlus, hCandidatesDs; HistogramRegistry registry{"registry"}; + std::array arrPDGResonantDsPhiPi = {kPhi, kPiPlus}; // Ds± → Phi π± + std::array arrPDGResonantDKstarK = {kK0Star892, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K± + void init(InitContext const&) { - std::array doProcess = {doprocessDplusPiData, doprocessDplusPiDataWithMl, doprocessDplusPiMc, doprocessDplusPiMcWithMl, doprocessD0PiData, doprocessD0PiDataWithMl, doprocessD0PiMc, doprocessD0PiMcWithMl}; + std::array doProcess = {doprocessDplusPiData, doprocessDplusPiDataWithMl, doprocessDplusPiMc, doprocessDplusPiMcWithMl, + doprocessDsPiData, doprocessDsPiDataWithMl, doprocessDsPiMc, doprocessDsPiMcWithMl, + doprocessD0PiData, doprocessD0PiDataWithMl, doprocessD0PiMc, doprocessD0PiMcWithMl}; if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { LOGP(fatal, "One and only one process function can be enabled at a time, please fix your configuration!"); } @@ -169,6 +201,9 @@ struct HfDataCreatorCharmHadPiReduced { if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { massC = MassDMinus; massB = MassB0; + } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl) { + massC = MassDS; + massB = MassBS; } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { massC = MassD0; massB = MassBPlus; @@ -177,7 +212,8 @@ struct HfDataCreatorCharmHadPiReduced { invMass2ChHadPiMax = (massB + invMassWindowCharmHadPi) * (massB + invMassWindowCharmHadPi); // Initialize fitter - if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { + if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl || + doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl) { df3.setPropagateToPCA(propagateToPCA); df3.setMaxR(maxR); df3.setMaxDZIni(maxDZIni); @@ -215,36 +251,35 @@ struct HfDataCreatorCharmHadPiReduced { registry.get(HIST("hEvents"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } - std::string charmHadInvMassTitle = ""; - std::string charmHadTitle0 = ""; - std::string charmHadTitle1 = ""; - std::string histMassTitle0 = ""; - std::string histMassTitle1 = ""; + std::string charmHadTitle = ""; + std::string histMassTitle = ""; if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { - charmHadTitle0 = "D^{#plus}"; - histMassTitle0 = "Dplus"; - charmHadInvMassTitle = "#it{M}(K#pi#pi)"; + charmHadTitle = "D^{#plus}"; + histMassTitle = "Dplus"; + registry.add("hMassDplus", "D^{#plus} candidates; #it{M}(K#pi#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}); + } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl) { + charmHadTitle = "D_{s}^{#plus}"; + histMassTitle = "Ds"; + registry.add("hMassDsToKKPi", "D_{s}^{#plus} to KKpi candidates; #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}); + registry.add("hMassDsToPiKK", "D_{s}^{#plus} to piKK candidates; #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}); } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { - charmHadTitle0 = "D^{0}"; - charmHadTitle1 = "#overline{D}^{0}"; - histMassTitle0 = "D0"; - histMassTitle1 = "D0bar"; - charmHadInvMassTitle = "#it{M}(K#pi)"; + charmHadTitle = "D^{0}"; + histMassTitle = "D0"; + registry.add("hMassD0", "D^{0} candidates; #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}); + registry.add("hMassD0bar", "#overline{D}^{0} candidates; #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}); } - registry.add(Form("hMass%s", histMassTitle0.data()), Form("%s candidates; %s (GeV/#it{c}^{2});entries", charmHadTitle0.data(), charmHadInvMassTitle.data()), {HistType::kTH1F, {{500, 0., 5.}}}); - if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { - registry.add(Form("hMass%s", histMassTitle1.data()), Form("%s candidates; %s (GeV/#it{c}^{2});entries", charmHadTitle1.data(), charmHadInvMassTitle.data()), {HistType::kTH1F, {{500, 0., 5.}}}); - } - registry.add(Form("hPt%s", histMassTitle0.data()), Form("%s candidates candidates;%s candidate #it{p}_{T} (GeV/#it{c});entries", charmHadTitle0.data(), charmHadTitle0.data()), {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add(Form("hPt%s", histMassTitle.data()), Form("%s candidates candidates;%s candidate #it{p}_{T} (GeV/#it{c});entries", charmHadTitle.data(), charmHadTitle.data()), {HistType::kTH1F, {{100, 0., 10.}}}); registry.add("hPtPion", "#pi^{#plus} candidates;#pi^{#plus} candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}); - registry.add(Form("hCpa%s", histMassTitle0.data()), Form("%s candidates;%s cosine of pointing angle;entries", charmHadTitle0.data(), charmHadTitle0.data()), {HistType::kTH1F, {{110, -1.1, 1.1}}}); + registry.add(Form("hCpa%s", histMassTitle.data()), Form("%s candidates;%s cosine of pointing angle;entries", charmHadTitle.data(), charmHadTitle.data()), {HistType::kTH1F, {{110, -1.1, 1.1}}}); /// candidate monitoring - hCandidatesD0 = registry.add("hCandidatesD0", "D candidate counter", {HistType::kTH1D, {axisCands}}); - hCandidatesDPlus = registry.add("hCandidatesDPlus", "B candidate counter", {HistType::kTH1D, {axisCands}}); + hCandidatesD0 = registry.add("hCandidatesD0", "D0 candidate counter", {HistType::kTH1D, {axisCands}}); + hCandidatesDPlus = registry.add("hCandidatesDPlus", "Dplus candidate counter", {HistType::kTH1D, {axisCands}}); + hCandidatesDs = registry.add("hCandidatesDs", "Ds candidate counter", {HistType::kTH1D, {axisCands}}); setLabelHistoCands(hCandidatesD0); setLabelHistoCands(hCandidatesDPlus); + setLabelHistoCands(hCandidatesDs); } /// Pion selection (D Pi <-- B0) @@ -295,21 +330,62 @@ struct HfDataCreatorCharmHadPiReduced { return true; } + /// Calculates the index of the collision with the maximum number of contributions. + ///\param collisions are the collisions to search through. + ///\return The index of the collision with the maximum number of contributions. + template + int64_t getIndexCollisionMaxNumContrib(const CColl& collisions) + { + unsigned maxNumContrib = 0; + int64_t indexCollisionMaxNumContrib = -1; + for (const auto& collision : collisions) { + if (collision.numContrib() > maxNumContrib) { + maxNumContrib = collision.numContrib(); + indexCollisionMaxNumContrib = collision.globalIndex(); + } + } + return indexCollisionMaxNumContrib; + } + + /// Checks if the B meson is associated with a different collision than the one it was generated in + /// \param particleMother is the mother particle + /// \param collision is the reconstructed collision + /// \param indexCollisionMaxNumContrib is the index of the collision associated with a given MC collision with the largest number of contributors. + /// \param flagWrongCollision is the flag indicating if whether the associated collision is incorrect. + template + void checkWrongCollision(const PParticle& particleMother, + const CColl& collision, + const int64_t& indexCollisionMaxNumContrib, + int8_t& flagWrongCollision) + { + + if (particleMother.mcCollision().globalIndex() != collision.mcCollisionId()) { + flagWrongCollision = WrongCollisionType::WrongAssociation; + } else { + if (collision.globalIndex() != indexCollisionMaxNumContrib) { + flagWrongCollision = WrongCollisionType::SplitCollision; + } + } + } + /// Function for filling MC reco information in the tables /// \param particlesMc is the table with MC particles /// \param vecDaughtersB is the vector with all daughter tracks (bachelor pion in last position) /// \param indexHfCandCharm is the index of the charm-hadron candidate /// \param selectedTracksPion is the map with the indices of selected bachelor pion tracks - template - void fillMcRecoInfo(const PParticles& particlesMc, + template + void fillMcRecoInfo(const CColl& collision, + const PParticles& particlesMc, const std::vector& vecDaughtersB, int& indexHfCandCharm, - std::map selectedTracksPion) + std::map selectedTracksPion, + const int64_t indexCollisionMaxNumContrib) { // we check the MC matching to be stored int8_t sign{0}; int8_t flag{0}; + int8_t flagWrongCollision{WrongCollisionType::None}; int8_t debug{0}; int pdgCodeBeautyMother{-1}; int pdgCodeCharmMother{-1}; @@ -337,6 +413,7 @@ struct HfDataCreatorCharmHadPiReduced { if (indexMother >= 0) { auto particleMother = particlesMc.rawIteratorAt(indexMother); motherPt = particleMother.pt(); + checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); } } @@ -353,6 +430,17 @@ struct HfDataCreatorCharmHadPiReduced { } } } + // Bs → Ds- π+ → (K- K+ π-) π+ + if (!flag) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); + if (indexRec > -1) { + // Ds- → K- K+ π- + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); + if (indexRec > -1) { + flag = sign * BIT(hf_cand_b0::DecayTypeMc::BsToDsPiToKKPiPi); + } + } + } // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor // convention: final state particles are prong0,1,2,3 if (!flag) { @@ -363,7 +451,7 @@ struct HfDataCreatorCharmHadPiReduced { // b-hadron hypothesis std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; // c-hadron hypothesis - std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar}; + std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kLambdaCPlus}; for (const auto& bHadronMotherHypo : bHadronMotherHypos) { int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); @@ -397,6 +485,7 @@ struct HfDataCreatorCharmHadPiReduced { // Pdg::kDPlus + Pdg::kDStar (if D+ is the mother and D*+ -> D+ π0/γ) // Pdg::kDStar (if D*+ is the mother and D*+ -> D0 π+) // Pdg::kDS (if Ds is the mother) + // Pdg::kLambdaCPlus (if Λc+ is the mother) pdgCodeCharmMother += std::abs(particlesMc.rawIteratorAt(index0CharmMother).pdgCode()); } } @@ -408,12 +497,132 @@ struct HfDataCreatorCharmHadPiReduced { } rowHfDPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); } - rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, debug, motherPt); + rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + // Bs → Ds- π+ → (K- K+ π-) π+ + auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); + if (indexRec > -1) { + // Ds- → K- K+ π- + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); + if (indexRec > -1) { + std::vector arrDaughDsIndex; + std::array arrPDGDaughDs; + RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); + if (arrDaughDsIndex.size() == 2) { + for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { + auto daughI = particlesMc.rawIteratorAt(arrDaughDsIndex[iProng]); + arrPDGDaughDs[iProng] = std::abs(daughI.pdgCode()); + } + // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- + if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); + } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToK0starKPiToKKPiPi); + } + } + } else { + debug = 1; + LOGF(debug, "Bs decays in the expected final state but the condition on the intermediate state is not fulfilled"); + } + + auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kBS, true); + if (indexMother >= 0) { + auto particleMother = particlesMc.rawIteratorAt(indexMother); + motherPt = particleMother.pt(); + checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); + } + } + + // additional checks for correlated backgrounds + if (checkDecayTypeMc) { + // B0 → Ds- π+ → (K- K+ π-) π+ + if (!flag) { + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); + if (indexRec > -1) { + // Ds- → K- K+ π- + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, -Pdg::kDS, std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2); + if (indexRec > -1) { + std::vector arrDaughDsIndex; + std::array arrPDGDaughDs; + RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDsIndex, std::array{0}, 1); + if (arrDaughDsIndex.size() == 2) { + for (auto iProng = 0u; iProng < arrDaughDsIndex.size(); ++iProng) { + auto daughI = particlesMc.rawIteratorAt(arrDaughDsIndex[iProng]); + arrPDGDaughDs[iProng] = std::abs(daughI.pdgCode()); + } + // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- + if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi); + } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToK0starKPiToKKPiPi); + } + } + } + } + } + // Partly reconstructed decays, i.e. the 4 prongs have a common b-hadron ancestor + // convention: final state particles are prong0,1,2,3 + if (!flag) { + auto particleProng0 = vecDaughtersB[0].mcParticle(); + auto particleProng1 = vecDaughtersB[1].mcParticle(); + auto particleProng2 = vecDaughtersB[2].mcParticle(); + auto particleProng3 = vecDaughtersB[3].mcParticle(); + // b-hadron hypothesis + std::array bHadronMotherHypos = {Pdg::kB0, Pdg::kBS, Pdg::kLambdaB0}; + // c-hadron hypothesis + std::array cHadronMotherHypos = {Pdg::kDPlus, Pdg::kDS, Pdg::kDStar, Pdg::kDSStar, Pdg::kLambdaCPlus}; + + for (const auto& bHadronMotherHypo : bHadronMotherHypos) { + int index0Mother = RecoDecay::getMother(particlesMc, particleProng0, bHadronMotherHypo, true); + int index1Mother = RecoDecay::getMother(particlesMc, particleProng1, bHadronMotherHypo, true); + int index2Mother = RecoDecay::getMother(particlesMc, particleProng2, bHadronMotherHypo, true); + int index3Mother = RecoDecay::getMother(particlesMc, particleProng3, bHadronMotherHypo, true); + + // look for common b-hadron ancestor + if (index0Mother > -1 && index1Mother > -1 && index2Mother > -1 && index3Mother > -1) { + if (index0Mother == index1Mother && index1Mother == index2Mother && index2Mother == index3Mother) { + flag = BIT(hf_cand_bs::DecayTypeMc::PartlyRecoDecay); + pdgCodeBeautyMother = particlesMc.rawIteratorAt(index0Mother).pdgCode(); + pdgCodeCharmMother = 0; + pdgCodeProng0 = particleProng0.pdgCode(); + pdgCodeProng1 = particleProng1.pdgCode(); + pdgCodeProng2 = particleProng2.pdgCode(); + pdgCodeProng3 = particleProng3.pdgCode(); + // look for common c-hadron mother among prongs 0, 1 and 2 + for (const auto& cHadronMotherHypo : cHadronMotherHypos) { + int8_t depthMax = 2; + if (cHadronMotherHypo == Pdg::kDStar || cHadronMotherHypo == Pdg::kDSStar) { // to include D* -> D π0/γ, D* -> D0 π, and Ds* -> Ds π0/γ + depthMax += 1; + } + int index0CharmMother = RecoDecay::getMother(particlesMc, particleProng0, cHadronMotherHypo, true, &sign, depthMax); + int index1CharmMother = RecoDecay::getMother(particlesMc, particleProng1, cHadronMotherHypo, true, &sign, depthMax); + int index2CharmMother = RecoDecay::getMother(particlesMc, particleProng2, cHadronMotherHypo, true, &sign, depthMax); + if (index0CharmMother > -1 && index1CharmMother > -1 && index2CharmMother > -1) { + if (index0CharmMother == index1CharmMother && index1CharmMother == index2CharmMother) { + // pdgCodeCharmMother = + // Pdg::kDPlus (if D+ is the mother and does not come from D*+) + // Pdg::kDPlus + Pdg::kDStar (if D+ is the mother and D*+ -> D+ π0/γ) + // Pdg::kDStar (if D*+ is the mother and D*+ -> D0 π+) + // Pdg::kDS (if Ds is the mother and does not come from Ds*) + // Pdg::kDS + Pdg::kDSStar (if Ds is the mother and Ds* -> Ds π0/γ) + // Pdg::kLambdaCPlus (if Λc+ is the mother) + pdgCodeCharmMother += std::abs(particlesMc.rawIteratorAt(index0CharmMother).pdgCode()); + } + } + } + break; + } + } + } + } + rowHfDsPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); + } + rowHfDsPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // B+ → D0(bar) π+ → (K+ π-) π+ auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kBPlus, std::array{+kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); if (indexRec > -1) { - // Printf("Checking D0bar → K+ π-"); + // D0(bar) → K+ π-; indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1]}, Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign, 1); if (indexRec > -1) { flag = sign * BIT(hf_cand_bplus::DecayType::BplusToD0Pi); @@ -426,10 +635,9 @@ struct HfDataCreatorCharmHadPiReduced { if (indexMother >= 0) { auto particleMother = particlesMc.rawIteratorAt(indexMother); motherPt = particleMother.pt(); + checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); } } - rowHfD0PiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, debug, motherPt); - // additional checks for correlated backgrounds if (checkDecayTypeMc) { // Partly reconstructed decays, i.e. the 3 prongs have a common b-hadron ancestor @@ -462,6 +670,7 @@ struct HfDataCreatorCharmHadPiReduced { } rowHfD0PiMcCheckReduced(pdgCodeBeautyMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2); } + rowHfD0PiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } } @@ -471,6 +680,7 @@ struct HfDataCreatorCharmHadPiReduced { aod::TrackAssoc const& trackIndices, TTracks const&, PParticles const& particlesMc, + uint64_t const& indexCollisionMaxNumContrib, aod::BCsWithTimestamps const&) { // helpers for ReducedTables filling @@ -509,6 +719,18 @@ struct HfDataCreatorCharmHadPiReduced { registry.fill(HIST("hMassDplus"), invMassC0); registry.fill(HIST("hPtDplus"), candC.pt()); registry.fill(HIST("hCpaDplus"), candC.cpa()); + } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { + indexHfCandCharm = hfCand3Prong.lastIndex() + 1; + if (candC.isSelDsToKKPi() >= selectionFlagDs) { + invMassC0 = hfHelper.invMassDsToKKPi(candC); + registry.fill(HIST("hMassDsToKKPi"), invMassC0); + } + if (candC.isSelDsToPiKK() >= selectionFlagDs) { + invMassC1 = hfHelper.invMassDsToPiKK(candC); + registry.fill(HIST("hMassDsToPiKK"), invMassC1); + } + registry.fill(HIST("hPtDs"), candC.pt()); + registry.fill(HIST("hCpaDs"), candC.cpa()); } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { indexHfCandCharm = hfCand2Prong.lastIndex() + 1; if (candC.isSelD0() >= selectionFlagD0) { @@ -547,7 +769,7 @@ struct HfDataCreatorCharmHadPiReduced { } // third track, if it's a 3-prong - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi) { charmHadDauTracks.push_back(candC.template prong2_as()); trackParCov2 = getTrackParCov(charmHadDauTracks[2]); pVec2 = charmHadDauTracks[2].pVector(); @@ -562,19 +784,32 @@ struct HfDataCreatorCharmHadPiReduced { // reconstruct charm candidate secondary vertex o2::track::TrackParCov trackParCovCharmHad{}; std::array pVecCharm{}; - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { // D∓ → π∓ K± π∓ + if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ + + if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + hCandidatesDPlus->Fill(SVFitting::BeforeFit); + } else { + hCandidatesDs->Fill(SVFitting::BeforeFit); + } - hCandidatesDPlus->Fill(SVFitting::BeforeFit); try { if (df3.process(trackParCov0, trackParCov1, trackParCov2) == 0) { continue; } } catch (const std::runtime_error& error) { LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; - hCandidatesDPlus->Fill(SVFitting::Fail); + if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + hCandidatesDPlus->Fill(SVFitting::Fail); + } else { + hCandidatesDs->Fill(SVFitting::Fail); + } continue; } - hCandidatesDPlus->Fill(SVFitting::FitOk); + if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + hCandidatesDPlus->Fill(SVFitting::FitOk); + } else { + hCandidatesDs->Fill(SVFitting::FitOk); + } auto secondaryVertexCharm = df3.getPCACandidate(); trackParCov0.propagateTo(secondaryVertexCharm[0], bz); @@ -610,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(); @@ -623,7 +878,7 @@ struct HfDataCreatorCharmHadPiReduced { } // reject pi D with same sign as D - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { // D∓ → π∓ K± π∓ + if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ if (trackPion.sign() * charmHadDauTracks[0].sign() > 0) { continue; } @@ -651,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(), @@ -672,26 +928,41 @@ struct HfDataCreatorCharmHadPiReduced { beautyHadDauTracks.push_back(track); } beautyHadDauTracks.push_back(trackPion); - fillMcRecoInfo(particlesMc, beautyHadDauTracks, indexHfCandCharm, selectedTracksPion); + fillMcRecoInfo(collision, particlesMc, beautyHadDauTracks, indexHfCandCharm, selectedTracksPion, indexCollisionMaxNumContrib); } fillHfCandCharm = true; } // pion loop if (fillHfCandCharm) { // fill candCplus table only once per D candidate - if constexpr (decChannel == DecayChannel::B0ToDminusPi) { // D∓ → π∓ K± π∓ + if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ hfCand3Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), charmHadDauTracks[2].globalIndex(), indexHfReducedCollision, trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), - candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0); + 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) { - hfCand3ProngMl(candC.mlProbDplusToPiKPi()[0], candC.mlProbDplusToPiKPi()[1], candC.mlProbDplusToPiKPi()[2]); + if constexpr (decChannel == DecayChannel::B0ToDminusPi) { + hfCand3ProngMl(candC.mlProbDplusToPiKPi()[0], candC.mlProbDplusToPiKPi()[1], candC.mlProbDplusToPiKPi()[2], -1., -1., -1.); + } else { + std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; + if (candC.mlProbDsToKKPi().size() == 3) { + std::copy(candC.mlProbDsToKKPi().begin(), candC.mlProbDsToKKPi().end(), mlScores.begin()); + } + if (candC.mlProbDsToPiKK().size() == 3) { + std::copy(candC.mlProbDsToPiKK().begin(), candC.mlProbDsToPiKK().end(), mlScores.begin() + 3); + } + hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); + } } } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), @@ -699,23 +970,25 @@ 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 bdtScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; + std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if (candC.mlProbD0().size() == 3) { - std::copy(candC.mlProbD0().begin(), candC.mlProbD0().end(), bdtScores.begin()); + std::copy(candC.mlProbD0().begin(), candC.mlProbD0().end(), mlScores.begin()); } if (candC.mlProbD0bar().size() == 3) { - std::copy(candC.mlProbD0bar().begin(), candC.mlProbD0bar().end(), bdtScores.begin() + 3); + std::copy(candC.mlProbD0bar().begin(), candC.mlProbD0bar().end(), mlScores.begin() + 3); } - - hfCand2ProngMl(bdtScores[0], bdtScores[1], bdtScores[2], bdtScores[3], bdtScores[4], bdtScores[5]); + hfCand2ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } } fillHfReducedCollision = true; @@ -776,9 +1049,84 @@ struct HfDataCreatorCharmHadPiReduced { rowHfB0McGenReduced(flag, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1]); + } else if constexpr (decayChannel == DecayChannel::BsToDsminusPi) { + // Bs → Ds- π+ + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBS, std::array{-static_cast(Pdg::kDS), +kPiPlus}, true)) { + // Match Ds- -> π- K+ π- + auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, -static_cast(Pdg::kDS), std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2)) { + std::vector arrDaughDsIndex; + std::array arrPDGDaughDs; + RecoDecay::getDaughters(candCMC, &arrDaughDsIndex, std::array{0}, 1); + if (arrDaughDsIndex.size() == 2) { + for (auto jProng = 0u; jProng < arrDaughDsIndex.size(); ++jProng) { + auto daughJ = particlesMc.rawIteratorAt(arrDaughDsIndex[jProng]); + arrPDGDaughDs[jProng] = std::abs(daughJ.pdgCode()); + } + // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- + if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); + } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToK0starKPiToKKPiPi); + } + } + } + } + + // additional checks for correlated backgrounds + if (checkDecayTypeMc) { + // B0 → Ds- π+ + if (!flag) { + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{-static_cast(Pdg::kDS), +kPiPlus}, true)) { + // Match Ds- -> π- K+ π- + auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, -static_cast(Pdg::kDS), std::array{-kKPlus, +kKPlus, -kPiPlus}, true, &sign, 2)) { + std::vector arrDaughDsIndex; + std::array arrPDGDaughDs; + RecoDecay::getDaughters(candCMC, &arrDaughDsIndex, std::array{0}, 1); + if (arrDaughDsIndex.size() == 2) { + for (auto jProng = 0u; jProng < arrDaughDsIndex.size(); ++jProng) { + auto daughJ = particlesMc.rawIteratorAt(arrDaughDsIndex[jProng]); + arrPDGDaughDs[jProng] = std::abs(daughJ.pdgCode()); + } + // Ds- → Phi π- → K- K+ π- and Ds- → K0* K- → K- K+ π- + if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi); + } else if ((arrPDGDaughDs[0] == arrPDGResonantDKstarK[0] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[1]) || (arrPDGDaughDs[0] == arrPDGResonantDKstarK[1] && arrPDGDaughDs[1] == arrPDGResonantDKstarK[0])) { + flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToK0starKPiToKKPiPi); + } + } + } + } + } + } + + // save information for Bs task + if (!TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi) && !TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::BsToDsPiToK0starKPiToKKPiPi) && + !TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi) && !TESTBIT(std::abs(flag), hf_cand_bs::DecayTypeMc::B0ToDsPiToK0starKPiToKKPiPi)) { + continue; + } + + auto ptParticle = particle.pt(); + auto yParticle = RecoDecay::y(particle.pVector(), massB); + auto etaParticle = particle.eta(); + + std::array ptProngs; + std::array yProngs; + std::array etaProngs; + int counter = 0; + 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())); + counter++; + } + rowHfBsMcGenReduced(flag, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1]); } else if constexpr (decayChannel == DecayChannel::BplusToD0barPi) { // B+ → D0bar π+ - if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBPlus, std::array{static_cast(Pdg::kD0), +kPiPlus}, true)) { + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBPlus, std::array{-static_cast(Pdg::kD0), +kPiPlus}, true)) { // Match D0bar -> π- K+ auto candD0MC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); // Printf("Checking D0bar -> π- K+"); @@ -839,7 +1187,7 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, bcs); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); @@ -869,13 +1217,73 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, bcs); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithMl, "Process DplusPi without MC info and with ML info", false); + void processDsPiData(soa::Join const& collisions, + CandsDsFiltered const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs) + { + // store configurables needed for Bs workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBs(selectionFlagDs.value, invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiData, "Process DsPi without MC info and without ML info", true); + + void processDsPiDataWithMl(soa::Join const& collisions, + CandsDsFilteredWithMl const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs) + { + // store configurables needed for Bs workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBs(selectionFlagDs.value, invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithMl, "Process DsPi without MC info and with ML info", false); + void processD0PiData(soa::Join const& collisions, CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, @@ -899,7 +1307,7 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, bcs); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); @@ -929,7 +1337,7 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, bcs); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); @@ -939,12 +1347,13 @@ struct HfDataCreatorCharmHadPiReduced { //////////////////////////////////////////////////////////////////////////////////////////////////// // PROCESS FUNCTIONS FOR MC - void processDplusPiMc(soa::Join const& collisions, + void processDplusPiMc(CollisionsWMcLabels const& collisions, CandsDplusFiltered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + aod::BCsWithTimestamps const& bcs, + McCollisions const&) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -963,7 +1372,9 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, bcs); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); @@ -971,12 +1382,13 @@ struct HfDataCreatorCharmHadPiReduced { } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiMc, "Process DplusPi with MC info and without ML info", false); - void processDplusPiMcWithMl(soa::Join const& collisions, + void processDplusPiMcWithMl(CollisionsWMcLabels const& collisions, CandsDplusFilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + aod::BCsWithTimestamps const& bcs, + McCollisions const&) { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { @@ -995,7 +1407,9 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, bcs); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); @@ -1003,12 +1417,83 @@ struct HfDataCreatorCharmHadPiReduced { } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiMcWithMl, "Process DplusPi with MC info and with ML info", false); - void processD0PiMc(soa::Join const& collisions, + void processDsPiMc(CollisionsWMcLabels const& collisions, + CandsDsFiltered const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSelAndMc const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs, + McCollisions const&) + { + // store configurables needed for Bs workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBs(selectionFlagDs.value, invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + runMcGen(particlesMc); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiMc, "Process DsPi with MC info and without ML info", false); + + void processDsPiMcWithMl(CollisionsWMcLabels const& collisions, + CandsDsFilteredWithMl const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSelAndMc const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs, + McCollisions const&) + { + // store configurables needed for Bs workflow + if (!isHfCandBhadConfigFilled) { + rowCandidateConfigBs(selectionFlagDs.value, invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + } + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + runMcGen(particlesMc); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiMcWithMl, "Process DsPi with MC info and with ML info", false); + + void processD0PiMc(CollisionsWMcLabels const& collisions, CandsD0Filtered const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + aod::BCsWithTimestamps const& bcs, + McCollisions const&) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1027,7 +1512,9 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, bcs); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); @@ -1035,12 +1522,13 @@ struct HfDataCreatorCharmHadPiReduced { } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiMc, "Process D0Pi with MC info and without ML info", false); - void processD0PiMcWithMl(soa::Join const& collisions, + void processD0PiMcWithMl(CollisionsWMcLabels const& collisions, CandsD0FilteredWithMl const& candsC, aod::TrackAssoc const& trackIndices, TracksPidWithSelAndMc const& tracks, aod::McParticles const& particlesMc, - aod::BCsWithTimestamps const& bcs) + aod::BCsWithTimestamps const& bcs, + McCollisions const&) { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { @@ -1059,7 +1547,9 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, bcs); + auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index 39f647b6b94..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" @@ -73,10 +76,29 @@ enum DType : uint8_t { Dstar }; +enum DecayTypeMc : uint8_t { + Ds1ToDStarK0ToD0PiK0s = 1, + Ds2StarToDplusK0sToPiKaPiPiPi, + Ds1ToDStarK0ToDPlusPi0K0s, + Ds1ToDStarK0ToD0PiK0sPart, + Ds1ToDStarK0ToD0NoPiK0sPart, + Ds1ToDStarK0ToD0PiK0sOneMu, + Ds2StarToDplusK0sOneMu +}; + +enum PartialMatchMc : uint8_t { + K0Matched = 0, + D0Matched, + DStarMatched, + DPlusMatched, + K0MuMatched, + DStarMuMatched +}; + /// Creation of D-V0 pairs struct HfDataCreatorCharmResoReduced { - // Produces AOD tables to store track information + // Produces AOD tables to store collision information Produces hfReducedCollision; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h Produces hfCollisionCounter; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h // tracks, V0 and D candidates reduced tables @@ -85,6 +107,9 @@ struct HfDataCreatorCharmResoReduced { Produces hfCandD; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h // ML optional Tables Produces hfCandDMl; // Defined in PWGHF/D2H/DataModel/ReducedDataModel.h + // MC Tables + Produces rowHfDV0McRecReduced; + Produces rowHfResoMcGenReduced; // CCDB configuration o2::ccdb::CcdbApi ccdbApi; @@ -92,6 +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"}; + 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 @@ -141,8 +167,9 @@ struct HfDataCreatorCharmResoReduced { o2::hf_evsel::HfEventSelection hfEvSel; o2::vertexing::DCAFitterN<2> fitter; double bz{0.}; + Service pdg; - bool isHfCandResoConfigFilled = false; + // bool isHfCandResoConfigFilled = false; // Helper struct to pass V0 informations struct { @@ -162,12 +189,20 @@ 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>; using CandDstarFilteredWithMl = soa::Filtered>; using TracksWithPID = soa::Join; using TracksIUWithPID = soa::Join; + using TracksIUWithPIDAndMC = soa::Join; Filter filterSelectDplus = (aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= cfgDmesCuts.selectionFlagDplus); Filter filterSelectedCandDstar = (aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == cfgDmesCuts.selectionFlagDstarToD0Pi); @@ -202,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}}); @@ -212,12 +248,41 @@ 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}}}); + registry.add("hMCRecCounter", "Number of Reconstructed MC Matched candidates per channel", {HistType::kTH1F, {{17, -8.5, 8.5}}}); + registry.add("hMCRecDebug", "Debug of MC Reco", {HistType::kTH1F, {{16, -0.5, 15.5}}}); + registry.add("hMCRecOrigin", "Origin of Matched particles", {HistType::kTH1F, {{3, -0.5, 2.5}}}); + + registry.add("hMCGenCounter", "Number of Generated particles; Decay Channel Flag; pT [GeV/c]", {HistType::kTH2F, {{17, -8.5, 8.5}, {100, 0, 50}}}); + registry.add("hMCSignCounter", "Sign of Generated particles", {HistType::kTH1F, {{3, -1.5, 1.5}}}); + 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); @@ -460,11 +525,222 @@ struct HfDataCreatorCharmResoReduced { return true; } - template + /// Function for filling MC reco information in the tables + /// \param particlesMc is the table with MC particles + /// \param vecDaughtersReso is the vector with all daughter tracks (bachelor pion in last position) + /// \param indexHfCandCharm is the index of the charm-hadron bachelor in the reduced table + /// \param indexCandV0 is the index of the v0 bachelor in the reduced table + template + void fillMcRecoInfo(const PParticles& particlesMc, + const std::vector& vecDaughtersReso, + int& indexHfCandCharm, + int& indexCandV0) + { + + // we check the MC matching to be stored + int8_t sign{0}; + int8_t signDStar{0}; + int8_t signDPlus{0}; + int8_t signD0{0}; + int8_t signV0{0}; + 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-π+) π+)(π+π-) + 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; + } + } + + // 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) { + 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(); + } + 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); + } + } + 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); + } + } + 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; + } + } + } + } + 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 (indexRecK0 > -1) { + SETBIT(debug, PartialMatchMc::K0Matched); + } + if (indexRecD0 > -1) { + SETBIT(debug, PartialMatchMc::D0Matched); + } + if (indexRecDstar > -1) { + SETBIT(debug, PartialMatchMc::DStarMatched); + } + if (indexRecDplus > -1) { + SETBIT(debug, PartialMatchMc::DPlusMatched); + } + registry.fill(HIST("hMCRecDebug"), debug); + } + rowHfDV0McRecReduced(indexHfCandCharm, indexCandV0, flag, debug, origin, signD0, motherPt); + } + + template void runDataCreation(Coll const& collision, CCands const& candsD, BBach const& bachelors, Tr const&, + PParticles const& particlesMc, aod::BCsWithTimestamps const&) { // helpers for ReducedTables filling @@ -486,20 +762,21 @@ 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; std::array prongIdsD; 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(); @@ -509,15 +786,17 @@ struct HfDataCreatorCharmResoReduced { prongIdsD[1] = candD.prong1Id(); prongIdsD[2] = candD.prongPiId(); pVecProng2 = candD.pVecSoftPi(); - + charmHadDauTracks.push_back(candD.template prong0_as()); + charmHadDauTracks.push_back(candD.template prong1_as()); + charmHadDauTracks.push_back(candD.template prongPi_as()); dtype = candD.signSoftPi() * DType::Dstar; 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(); @@ -527,21 +806,53 @@ struct HfDataCreatorCharmResoReduced { prongIdsD[2] = candD.prong2Id(); pVecProng2 = candD.pVectorProng2(); dtype = static_cast(prong0.sign() * DType::Dplus); + charmHadDauTracks.push_back(candD.template prong0_as()); + charmHadDauTracks.push_back(candD.template prong1_as()); + charmHadDauTracks.push_back(candD.template prong2_as()); if constexpr (withMl) { - std::copy(candD.mlProbDplusToPiKPi().begin(), candD.mlProbDplusToPiKPi().end(), bdtScores.begin()); + registry.fill(HIST("hMassVsPtDplusAll"), candD.pt(), varUtils.invMassD); } - registry.fill(HIST("hMassVsPtDplusAll"), candD.pt(), 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]}; @@ -552,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 @@ -600,10 +911,23 @@ 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(); } fillHfCandD = true; + // Optional filling of MC Rec table + if constexpr (doMc) { + std::vector charmResoDauTracks{}; + for (const auto& track : charmHadDauTracks) { + charmResoDauTracks.push_back(track); + } + charmResoDauTracks.push_back(trackPos); + charmResoDauTracks.push_back(trackNeg); + int indexHfCandCharm = hfCandD.lastIndex() + 1; + int indexHfCandV0 = hfCandV0.lastIndex(); + fillMcRecoInfo(particlesMc, charmResoDauTracks, indexHfCandCharm, indexHfCandV0); + } } // V0 loop } else if constexpr (DecayChannel == DecayChannel::DstarTrack) { for (const auto& trackIndex : bachelors) { @@ -628,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; @@ -648,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]); + 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); } @@ -673,6 +997,139 @@ struct HfDataCreatorCharmResoReduced { hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // run data creation + template + void runMcGen(aod::McParticles const& particlesMc) + { + // Match generated particles. + for (const auto& particle : particlesMc) { + int8_t sign{0}; + int8_t flag{0}; + int8_t signDStar{0}; + int8_t signDPlus{0}; + int8_t signV0{0}; + int8_t origin = 0; + std::vector idxBhadMothers{}; + + if constexpr (decayChannel == DecayChannel::DstarV0) { + // Ds1 → D* K0 + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kDS1, std::array{static_cast(Pdg::kDStar), +kK0}, true, &sign, 1)) { + registry.fill(HIST("hMCSignCounter"), sign); + 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)) { + // 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 * 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 * 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) || + RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), static_cast(kPi0)}, true, &signDStar, 1) || + 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 * DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s; + } + } + } else { + if (std::abs(particle.pdgCode()) == Pdg::kDS1) { + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); + registry.fill(HIST("hMCOriginCounterWrongDecay"), origin); + } + } + // save information for task + if (flag == 0) { + continue; + } + + auto ptParticle = particle.pt(); + auto yParticle = RecoDecay::y(particle.pVector(), MassDS1); + auto etaParticle = particle.eta(); + + std::array ptProngs; + std::array yProngs; + std::array etaProngs; + int counter = 0; + 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())); + counter++; + } + registry.fill(HIST("hMCGenCounter"), flag, ptParticle); + rowHfResoMcGenReduced(flag, origin, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1]); + } else if constexpr (decayChannel == DecayChannel::DplusV0) { // Ds2Star → D+ K0 + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kDS2Star, std::array{static_cast(Pdg::kDPlus), +kK0}, true, &sign, 1)) { + registry.fill(HIST("hMCSignCounter"), sign); + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); + registry.fill(HIST("hMCGenOrigin"), origin); + auto candV0MC = particlesMc.rawIteratorAt(particle.daughtersIds().back()); + auto candDPlusMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + // K0 -> K0s -> π+π- + 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 * DecayTypeMc::Ds2StarToDplusK0sToPiKaPiPiPi; + } + } + } else if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kDS1, std::array{static_cast(Pdg::kDStar), +kK0}, true, &sign, 1)) { + auto candV0MC = particlesMc.rawIteratorAt(particle.daughtersIds().back()); + // K0 -> K0s -> π+π- + if (RecoDecay::isMatchedMCGen(particlesMc, candV0MC, kK0, std::array{+kPiPlus, -kPiPlus}, true, &signV0, 2)) { + auto candDStarMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + // D* -> D+ π0/γ ->π+K-π+ π0/γ + 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) || + RecoDecay::isMatchedMCGen(particlesMc, candDStarMC, Pdg::kDStar, std::array{static_cast(Pdg::kDPlus), static_cast(kPi0)}, true, &signDStar, 1) || + 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 * DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s; + } + } + } else { + if (std::abs(particle.pdgCode()) == Pdg::kDS2Star) { + origin = RecoDecay::getCharmHadronOrigin(particlesMc, particle, false, &idxBhadMothers); + // LOGF(info, "Found DS2Star that decays into %d, %d", particlesMc.rawIteratorAt(particle.daughtersIds().front()).pdgCode(),particlesMc.rawIteratorAt(particle.daughtersIds().back()).pdgCode()); + registry.fill(HIST("hMCOriginCounterWrongDecay"), origin); + } + } + // save information for task + if (flag == 0) { + continue; + } + + auto ptParticle = particle.pt(); + auto yParticle = RecoDecay::y(particle.pVector(), MassDS2Star); + auto etaParticle = particle.eta(); + + std::array ptProngs; + std::array yProngs; + std::array etaProngs; + int counter = 0; + 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())); + counter++; + } + registry.fill(HIST("hMCGenCounter"), flag, ptParticle); + rowHfResoMcGenReduced(flag, origin, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1]); + } // Dplus V0 + } // for loop + } // gen + void processDplusV0(soa::Join const& collisions, CandsDplusFiltered const& candsDplus, aod::V0s const& V0s, @@ -689,13 +1146,38 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0, "Process Dplus candidates paired with V0s without MC info and without ML info", true); + void processDplusV0MC(soa::Join const& collisions, + CandsDplusFiltered const& candsDplus, + aod::V0s const& V0s, + TracksIUWithPIDAndMC const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) + { + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); + auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, particlesMc, bcs); + } + runMcGen(particlesMc); + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0MC, "Process DPlus candidates paired with V0s with MC matching and without ML info", false); + void processDplusV0WithMl(soa::Join const& collisions, CandsDplusFilteredWithMl const& candsDplus, aod::V0s const& V0s, @@ -712,13 +1194,38 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollisionWithMl, thisCollId); auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0WithMl, "Process Dplus candidates paired with V0s with ML info", false); + void processDplusV0MCWithMl(soa::Join const& collisions, + CandsDplusFilteredWithMl const& candsDplus, + aod::V0s const& V0s, + TracksIUWithPIDAndMC const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) + { + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsDplus.sliceBy(candsDplusPerCollision, thisCollId); + auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, particlesMc, bcs); + } + runMcGen(particlesMc); + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDplusV0MCWithMl, "Process DPlus candidates paired with V0s with MC matching and with ML info", false); + void processDstarV0(soa::Join const& collisions, CandDstarFiltered const& candsDstar, aod::V0s const& V0s, @@ -735,13 +1242,38 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0, "Process DStar candidates paired with V0s without MC info and without ML info", false); + void processDstarV0MC(soa::Join const& collisions, + CandDstarFiltered const& candsDstar, + aod::V0s const& V0s, + TracksIUWithPIDAndMC const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) + { + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); + auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, particlesMc, bcs); + } + runMcGen(particlesMc); + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0MC, "Process DStar candidates paired with V0s with MC matching and without ML info", false); + void processDstarV0WithMl(soa::Join const& collisions, CandDstarFilteredWithMl const& candsDstar, aod::V0s const& V0s, @@ -759,13 +1291,38 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0WithMl, "Process DStar candidates paired with V0s with ML info", false); + void processDstarV0MCWithMl(soa::Join const& collisions, + CandDstarFilteredWithMl const& candsDstar, + aod::V0s const& V0s, + TracksIUWithPIDAndMC const& tracks, + aod::McParticles const& particlesMc, + aod::BCsWithTimestamps const& bcs) + { + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + auto thisCollId = collision.globalIndex(); + auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); + auto V0sThisColl = V0s.sliceBy(candsV0PerCollision, thisCollId); + runDataCreation(collision, candsDThisColl, V0sThisColl, tracks, particlesMc, bcs); + } + runMcGen(particlesMc); + // handle normalization by the right number of collisions + hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmResoReduced, processDstarV0MCWithMl, "Process MC DStar candidates paired with V0s with ML info", false); + void processDstarTrack(soa::Join const& collisions, CandDstarFiltered const& candsDstar, aod::TrackAssoc const& trackIndices, @@ -782,7 +1339,7 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollision, thisCollId); auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, trackIdsThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); @@ -806,7 +1363,7 @@ struct HfDataCreatorCharmResoReduced { auto thisCollId = collision.globalIndex(); auto candsDThisColl = candsDstar.sliceBy(candsDstarPerCollisionWithMl, thisCollId); auto trackIdsThisColl = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - runDataCreation(collision, candsDThisColl, trackIdsThisColl, tracks, bcs); + runDataCreation(collision, candsDThisColl, trackIdsThisColl, tracks, tracks, bcs); } // handle normalization by the right number of collisions hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); diff --git a/PWGHF/D2H/Tasks/CMakeLists.txt b/PWGHF/D2H/Tasks/CMakeLists.txt index 70837975a00..b2f78f68334 100644 --- a/PWGHF/D2H/Tasks/CMakeLists.txt +++ b/PWGHF/D2H/Tasks/CMakeLists.txt @@ -29,6 +29,11 @@ o2physics_add_dpl_workflow(task-bplus-reduced PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(task-bs-reduced + SOURCES taskBsReduced.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(task-bs SOURCES taskBs.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -49,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 5e38055f589..a0f5b14e5cc 100644 --- a/PWGHF/D2H/Tasks/taskB0Reduced.cxx +++ b/PWGHF/D2H/Tasks/taskB0Reduced.cxx @@ -58,6 +58,7 @@ DECLARE_SOA_COLUMN(Cpa, cpa, float); //! 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 @@ -89,10 +90,12 @@ DECLARE_SOA_TABLE(HfRedCandB0Lites, "AOD", "HFREDCANDB0LITE", //! Table with som hf_cand_b0_lite::Y, hf_cand_3prong::FlagMcMatchRec, hf_cand_3prong::OriginMcRec, + hf_cand_b0_lite::FlagWrongCollision, hf_cand_b0_lite::PtGen); 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::M, @@ -137,16 +140,11 @@ struct HfTaskB0Reduced { if ((std::accumulate(processFuncData.begin(), processFuncData.end(), 0)) > 1) { LOGP(fatal, "Only one process function for data can be enabled at a time."); } - std::array processFuncMc{doprocessMc, doprocessMcWithDecayTypeCheck, doprocessMcWithDmesMl, doprocessMcWithB0Ml, doprocessMcWithB0MlAndDecayTypeCheck}; + std::array processFuncMc{doprocessMc, doprocessMcWithDecayTypeCheck, doprocessMcWithDmesMl, doprocessMcWithDmesMlAndDecayTypeCheck, doprocessMcWithB0Ml, doprocessMcWithB0MlAndDecayTypeCheck}; if ((std::accumulate(processFuncMc.begin(), processFuncMc.end(), 0)) > 1) { LOGP(fatal, "Only one process function for MC can be enabled at a time."); } - if (((doprocessData || doprocessDataWithDmesMl) && fillTree && downSampleBkgFactor >= 1.) || - ((doprocessMc || doprocessMcWithDmesMl) && fillTree && fillBackground && downSampleBkgFactor >= 1.)) { - LOGP(fatal, "Set downSampleBkgFactor below unity when filling tree with background."); - } - const AxisSpec axisMlScore{100, 0.f, 1.f}; const AxisSpec axisMassB0{300, 4.5f, 6.0f}; const AxisSpec axisMassDminus{300, 1.75f, 2.05f}; @@ -203,7 +201,7 @@ struct HfTaskB0Reduced { } } - if (doprocessMc || doprocessMcWithDecayTypeCheck || doprocessMcWithDmesMl || doprocessMcWithB0Ml || doprocessMcWithB0MlAndDecayTypeCheck) { + if (doprocessMc || doprocessMcWithDecayTypeCheck || doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck || doprocessMcWithB0Ml || doprocessMcWithB0MlAndDecayTypeCheck) { if (fillHistograms) { // gen histos registry.add("hEtaGen", "B^{0} particles (generated);#it{p}_{T}^{gen}(B^{0}) (GeV/#it{c});#it{#eta}^{gen}(B^{0});entries", {HistType::kTH2F, {axisPtB0, axisEta}}); @@ -258,7 +256,7 @@ struct HfTaskB0Reduced { registry.add("hCospXyDRecBg", "B^{0} candidates (unmatched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});D^{#minus} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtDminus, axisCosp}}); } // MC checks - if (doprocessMcWithDecayTypeCheck || doprocessMcWithB0MlAndDecayTypeCheck) { + if (doprocessMcWithDecayTypeCheck || doprocessMcWithB0MlAndDecayTypeCheck || doprocessMcWithDmesMlAndDecayTypeCheck) { constexpr uint8_t kNBinsDecayTypeMc = hf_cand_b0::DecayTypeMc::NDecayTypeMc; TString labels[kNBinsDecayTypeMc]; labels[hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi] = "B^{0} #rightarrow (D^{#minus} #rightarrow #pi^{#minus} K^{#plus} #pi^{#minus}) #pi^{#plus}"; @@ -272,7 +270,7 @@ struct HfTaskB0Reduced { } } // ML scores of D- daughter - if (doprocessMcWithDmesMl) { + if (doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck) { // signal registry.add("hMlScoreBkgDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML background score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); registry.add("hMlScorePromptDRecSig", "B^{0} candidates (matched);#it{p}_{T}(D^{#minus}) (GeV/#it{c});prong0, D^{#minus} ML prompt score;entries", {HistType::kTH2F, {axisPtDminus, axisMlScore}}); @@ -336,7 +334,7 @@ struct HfTaskB0Reduced { auto invMassB0 = hfHelper.invMassB0ToDPi(candidate); auto candD = candidate.template prong0_as(); auto ptD = candidate.ptProng0(); - auto invMassD = candD.invMass(); + auto invMassD = candD.invMassHypo0(); std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; std::array posSvD{candD.xSecondaryVertex(), candD.ySecondaryVertex(), candD.zSecondaryVertex()}; std::array momD{candD.pVector()}; @@ -346,9 +344,11 @@ struct HfTaskB0Reduced { auto decLenXyD = RecoDecay::distanceXY(posPv, posSvD); int8_t flagMcMatchRec = 0; + int8_t flagWrongCollision = 0; bool isSignal = false; if constexpr (doMc) { flagMcMatchRec = candidate.flagMcMatchRec(); + flagWrongCollision = candidate.flagWrongCollision(); isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_b0::DecayTypeMc::B0ToDplusPiToPiKPiPi); } @@ -524,26 +524,29 @@ struct HfTaskB0Reduced { hfHelper.yB0(candidate), flagMcMatchRec, isSignal, + flagWrongCollision, ptMother); - } - if constexpr (withDecayTypeCheck) { - float candidateMlScoreSig = -1; - if constexpr (withB0Ml) { - candidateMlScoreSig = candidate.mlProbB0ToDPi(); + + if constexpr (withDecayTypeCheck) { + float candidateMlScoreSig = -1; + if constexpr (withB0Ml) { + candidateMlScoreSig = candidate.mlProbB0ToDPi(); + } + hfRedB0McCheck( + flagMcMatchRec, + flagWrongCollision, + invMassD, + ptD, + invMassB0, + ptCandB0, + candidateMlScoreSig, + candidate.pdgCodeBeautyMother(), + candidate.pdgCodeCharmMother(), + candidate.pdgCodeProng0(), + candidate.pdgCodeProng1(), + candidate.pdgCodeProng2(), + candidate.pdgCodeProng3()); } - hfRedB0McCheck( - flagMcMatchRec, - invMassD, - ptD, - invMassB0, - ptCandB0, - candidateMlScoreSig, - candidate.pdgCodeBeautyMother(), - candidate.pdgCodeCharmMother(), - candidate.pdgCodeProng0(), - candidate.pdgCodeProng1(), - candidate.pdgCodeProng2(), - candidate.pdgCodeProng3()); } } } @@ -597,7 +600,7 @@ struct HfTaskB0Reduced { } fillCand(candidate, candidatesD); } // candidate loop - } // processData + } // processData PROCESS_SWITCH(HfTaskB0Reduced, processData, "Process data without ML scores for B0 and D daughter", true); void processDataWithDmesMl(soa::Filtered> const& candidates, @@ -610,7 +613,7 @@ struct HfTaskB0Reduced { } fillCand(candidate, candidatesD); } // candidate loop - } // processDataWithDmesMl + } // processDataWithDmesMl PROCESS_SWITCH(HfTaskB0Reduced, processDataWithDmesMl, "Process data with(out) ML scores for D daughter (B0)", false); void processDataWithB0Ml(soa::Filtered> const& candidates, @@ -623,7 +626,7 @@ struct HfTaskB0Reduced { } fillCand(candidate, candidatesD); } // candidate loop - } // processDataWithB0Ml + } // processDataWithB0Ml PROCESS_SWITCH(HfTaskB0Reduced, processDataWithB0Ml, "Process data with(out) ML scores for B0 (D daughter)", false); void processMc(soa::Filtered> const& candidates, @@ -643,7 +646,7 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc + } // processMc PROCESS_SWITCH(HfTaskB0Reduced, processMc, "Process MC without ML scores for B0 and D daughter", false); void processMcWithDecayTypeCheck(soa::Filtered> const& candidates, @@ -663,7 +666,7 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc + } // processMc PROCESS_SWITCH(HfTaskB0Reduced, processMcWithDecayTypeCheck, "Process MC with decay type check and without ML scores for B0 and D daughter", false); void processMcWithDmesMl(soa::Filtered> const& candidates, @@ -683,9 +686,29 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMcWithDmesMl + } // processMcWithDmesMl PROCESS_SWITCH(HfTaskB0Reduced, processMcWithDmesMl, "Process MC with(out) ML scores for D daughter (B0)", false); + void processMcWithDmesMlAndDecayTypeCheck(soa::Filtered> const& candidates, + aod::HfMcGenRedB0s const& mcParticles, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yB0(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskB0Reduced, processMcWithDmesMlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B0 (D daughter)", false); + void processMcWithB0Ml(soa::Filtered> const& candidates, aod::HfMcGenRedB0s const& mcParticles, aod::HfRed3Prongs const& candidatesD, @@ -703,7 +726,7 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMcWithB0Ml + } // processMcWithB0Ml PROCESS_SWITCH(HfTaskB0Reduced, processMcWithB0Ml, "Process MC with(out) ML scores for B0 (D daughter)", false); void processMcWithB0MlAndDecayTypeCheck(soa::Filtered> const& candidates, @@ -723,7 +746,7 @@ struct HfTaskB0Reduced { for (const auto& particle : mcParticles) { fillCandMcGen(particle); } // gen - } // processMc + } // processMc PROCESS_SWITCH(HfTaskB0Reduced, processMcWithB0MlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B0 (D daughter)", false); }; // struct diff --git a/PWGHF/D2H/Tasks/taskBplusReduced.cxx b/PWGHF/D2H/Tasks/taskBplusReduced.cxx index 5b56d523944..af95d1c8179 100644 --- a/PWGHF/D2H/Tasks/taskBplusReduced.cxx +++ b/PWGHF/D2H/Tasks/taskBplusReduced.cxx @@ -57,6 +57,7 @@ DECLARE_SOA_COLUMN(Cpa, cpa, float); //! 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 @@ -88,10 +89,12 @@ DECLARE_SOA_TABLE(HfRedCandBpLites, "AOD", "HFREDCANDBPLITE", //! Table with som hf_cand_bplus_lite::Y, hf_cand_2prong::FlagMcMatchRec, hf_cand_2prong::OriginMcRec, + hf_cand_bplus_lite::FlagWrongCollision, hf_cand_bplus_lite::PtGen); DECLARE_SOA_TABLE(HfRedBpMcCheck, "AOD", "HFREDBPMCCHECK", //! Table with MC decay type check - hf_cand_3prong::FlagMcMatchRec, + hf_cand_2prong::FlagMcMatchRec, + hf_cand_bplus_lite::FlagWrongCollision, hf_cand_bplus_lite::MProng0, hf_cand_bplus_lite::PtProng0, hf_cand_bplus_lite::M, @@ -140,24 +143,20 @@ struct HfTaskBplusReduced { void init(InitContext&) { - std::array processFuncData{doprocessData, doprocessDataWithDmesMl}; + std::array processFuncData{doprocessData, doprocessDataWithDmesMl, doprocessDataWithBplusMl}; if ((std::accumulate(processFuncData.begin(), processFuncData.end(), 0)) > 1) { LOGP(fatal, "Only one process function for data can be enabled at a time."); } - std::array processFuncMc{doprocessMc, doprocessMcWithDmesMl}; + std::array processFuncMc{doprocessMc, doprocessMcWithDecayTypeCheck, doprocessMcWithDmesMl, doprocessMcWithDmesMlAndDecayTypeCheck, doprocessMcWithBplusMl, doprocessMcWithBplusMlAndDecayTypeCheck}; if ((std::accumulate(processFuncMc.begin(), processFuncMc.end(), 0)) > 1) { LOGP(fatal, "Only one process function for MC can be enabled at a time."); } - if (((doprocessData || doprocessDataWithDmesMl) && fillTree && downSampleBkgFactor >= 1.) || - ((doprocessMc || doprocessMcWithDmesMl) && fillTree && fillBackground && downSampleBkgFactor >= 1.)) { - LOGP(fatal, "Set downSampleBkgFactor below unity when filling tree with background."); - } - const AxisSpec axisMlScore{100, 0.f, 1.f}; const AxisSpec axisMassBplus{150, 4.5, 6.0}; const AxisSpec axisMassD0{300, 1.75f, 2.05f}; const AxisSpec axisCpa{120, -1.1, 1.1}; + const AxisSpec axisCpaD{101, 0.9, 1.01}; const AxisSpec axisPtProng{100, 0., 10.}; const AxisSpec axisD0Prong{200, -0.05, 0.05}; const AxisSpec axisImpParProd{200, -0.001, 0.001}; @@ -186,10 +185,10 @@ struct HfTaskBplusReduced { registry.add("hRapidity", bPlusCandTitle + "candidate #it{y};" + stringPt, {HistType::kTH2F, {axisRapidity, axisPtB}}); registry.add("hd0d0", bPlusCandTitle + "candidate product of DCAxy to prim. vertex (cm^{2});" + stringPt, {HistType::kTH2F, {axisImpParProd, axisPtB}}); registry.add("hInvMassD0", bPlusCandTitle + "prong0, D0 inv. mass (GeV/#it{c}^{2});" + stringPt, {HistType::kTH2F, {axisMassD0, axisPtD0}}); - registry.add("hDecLengthD", bPlusCandTitle + "#it{p}_{T}(D^{0}) (GeV/#it{c});D^{0} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtD0, axisDecLength}}); - registry.add("hDecLengthXyD", bPlusCandTitle + "#it{p}_{T}(D^{0}) (GeV/#it{c});decay length XY (cm);entries", {HistType::kTH2F, {axisPtD0, axisDecLength}}); - registry.add("hCpaD", bPlusCandTitle + "#it{p}_{T}(D^{0}) (GeV/#it{c});D^{0} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtD0, axisCpa}}); - registry.add("hCpaXyD", bPlusCandTitle + "#it{p}_{T}(D^{0}) (GeV/#it{c});D^{0} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtD0, axisCpa}}); + registry.add("hDecLengthD0", bPlusCandTitle + "D^{0} candidate decay length (cm);#it{p}_{T}(D^{0}) (GeV/#it{c});entries", {HistType::kTH2F, {axisDecLength, axisPtD0}}); + registry.add("hDecLengthXyD0", bPlusCandTitle + "decay length XY (cm);#it{p}_{T}(D^{0}) (GeV/#it{c});entries", {HistType::kTH2F, {axisDecLength, axisPtD0}}); + registry.add("hCpaD0", bPlusCandTitle + "D^{0} candidate cos(#vartheta_{P});#it{p}_{T}(D^{0}) (GeV/#it{c});entries", {HistType::kTH2F, {axisCpaD, axisPtD0}}); + registry.add("hCpaXyD0", bPlusCandTitle + "D^{0} candidate cos(#vartheta_{P}^{XY});#it{p}_{T}(D^{0}) (GeV/#it{c});entries", {HistType::kTH2F, {axisCpaD, axisPtD0}}); // ML scores of D0 daughter if (doprocessDataWithDmesMl) { @@ -213,7 +212,7 @@ struct HfTaskBplusReduced { } // histograms processMC - if (doprocessMc || doprocessMcWithDecayTypeCheck || doprocessMcWithDmesMl || doprocessMcWithBplusMl || doprocessMcWithBplusMlAndDecayTypeCheck) { + if (doprocessMc || doprocessMcWithDecayTypeCheck || doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck || doprocessMcWithBplusMl || doprocessMcWithBplusMlAndDecayTypeCheck) { if (fillHistograms) { // Gen Level registry.add("hEtaGen", mcParticleMatched + "candidate #it{#eta}^{gen};" + stringPt, {HistType::kTH2F, {axisEta, axisPtB}}); @@ -270,7 +269,7 @@ struct HfTaskBplusReduced { registry.add("hDecLengthXyD0RecBg", bPlusCandUnmatch + "prong0 D^{0} decay length XY (cm);" + stringPtD + entries, {HistType::kTH2F, {{100, 0., 0.5}, {120, 0., 60.}}}); } // MC checks - if (doprocessMcWithDecayTypeCheck || doprocessMcWithBplusMlAndDecayTypeCheck) { + if (doprocessMcWithDecayTypeCheck || doprocessMcWithDmesMlAndDecayTypeCheck || doprocessMcWithBplusMlAndDecayTypeCheck) { constexpr uint8_t kNBinsDecayTypeMc = hf_cand_bplus::DecayTypeMc::NDecayTypeMc; TString labels[kNBinsDecayTypeMc]; labels[hf_cand_bplus::DecayTypeMc::BplusToD0PiToKPiPi] = "B^{+} #rightarrow (#overline{D^{0}} #rightarrow K^{#plus} #pi^{#minus}) #pi^{#plus}"; @@ -283,7 +282,7 @@ struct HfTaskBplusReduced { } } // ML scores of D0 daughter - if (doprocessMcWithDmesMl) { + if (doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck) { // signal registry.add("hMlScoreBkgDRecSig", bPlusCandMatch + stringPtD + "prong0, D0 ML background score;entries", {HistType::kTH2F, {axisPtD0, axisMlScore}}); registry.add("hMlScorePromptDRecSig", bPlusCandMatch + stringPtD + "prong0, D0 ML prompt score;entries", {HistType::kTH2F, {axisPtD0, axisMlScore}}); @@ -340,14 +339,15 @@ struct HfTaskBplusReduced { /// \param candidatesD is the table with D0 candidates template void fillCand(Cand const& candidate, - aod::HfRed2Prongs const& /*candidatesD*/) + aod::HfRed2Prongs const& /*candidatesD*/, + TracksPion const&) { auto ptCandBplus = candidate.pt(); auto invMassBplus = hfHelper.invMassBplusToD0Pi(candidate); auto candD0 = candidate.template prong0_as(); - auto candPi = candidate.template prong1_as(); + auto candPi = candidate.template prong1_as(); auto ptD0 = candidate.ptProng0(); - auto invMassD0 = (candPi.signed1Pt() < 0) ? candD0.invMassD0() : candD0.invMassD0Bar(); + auto invMassD0 = (candPi.signed1Pt() < 0) ? candD0.invMassHypo0() : candD0.invMassHypo1(); std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; std::array posSvD{candD0.xSecondaryVertex(), candD0.ySecondaryVertex(), candD0.zSecondaryVertex()}; std::array momD{candD0.pVector()}; @@ -357,9 +357,11 @@ struct HfTaskBplusReduced { auto decLenXyD0 = RecoDecay::distanceXY(posPv, posSvD); int8_t flagMcMatchRec = 0; + int8_t flagWrongCollision = 0; bool isSignal = false; if constexpr (doMc) { flagMcMatchRec = candidate.flagMcMatchRec(); + flagWrongCollision = candidate.flagWrongCollision(); isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_bplus::DecayTypeMc::BplusToD0PiToKPiPi); } @@ -537,6 +539,7 @@ struct HfTaskBplusReduced { hfHelper.yBplus(candidate), flagMcMatchRec, isSignal, + flagWrongCollision, ptMother); } if constexpr (withDecayTypeCheck) { @@ -546,6 +549,7 @@ struct HfTaskBplusReduced { } hfRedBpMcCheck( flagMcMatchRec, + flagWrongCollision, invMassD0, ptD0, invMassBplus, @@ -600,54 +604,54 @@ struct HfTaskBplusReduced { // Process functions void processData(soa::Filtered> const& candidates, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // candidate loop } // processData PROCESS_SWITCH(HfTaskBplusReduced, processData, "Process data without ML scores for D0 daughter", true); void processDataWithDmesMl(soa::Filtered> const& candidates, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // candidate loop } // processDataWithDmesMl PROCESS_SWITCH(HfTaskBplusReduced, processDataWithDmesMl, "Process data with ML scores for D0 daughter", false); void processDataWithBplusMl(soa::Filtered> const& candidates, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // candidate loop } // processDataWithBplusMl PROCESS_SWITCH(HfTaskBplusReduced, processDataWithBplusMl, "Process data with(out) ML scores for B+ (D0 daughter)", false); - void processMc(soa::Join const& candidates, + void processMc(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { // MC rec for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // rec // MC gen. level @@ -660,14 +664,14 @@ struct HfTaskBplusReduced { void processMcWithDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { // MC rec for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // rec // MC gen. level @@ -677,17 +681,17 @@ struct HfTaskBplusReduced { } // processMc PROCESS_SWITCH(HfTaskBplusReduced, processMcWithDecayTypeCheck, "Process MC with decay type check and without ML scores for B+ and D daughter", false); - void processMcWithDmesMl(soa::Join const& candidates, + void processMcWithDmesMl(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { // MC rec for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // rec // MC gen. level @@ -697,17 +701,37 @@ struct HfTaskBplusReduced { } // 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, + TracksPion const& pionTracks) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD, pionTracks); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskBplusReduced, processMcWithDmesMlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B+ (D0 daughter)", false); + void processMcWithBplusMl(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { // MC rec for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // rec // MC gen. level @@ -720,14 +744,14 @@ struct HfTaskBplusReduced { void processMcWithBplusMlAndDecayTypeCheck(soa::Filtered> const& candidates, aod::HfMcGenRedBps const& mcParticles, aod::HfRed2Prongs const& candidatesD, - TracksPion const&) + TracksPion const& pionTracks) { // MC rec for (const auto& candidate : candidates) { if (yCandRecoMax >= 0. && std::abs(hfHelper.yBplus(candidate)) > yCandRecoMax) { continue; } - fillCand(candidate, candidatesD); + fillCand(candidate, candidatesD, pionTracks); } // rec // MC gen. level diff --git a/PWGHF/D2H/Tasks/taskBs.cxx b/PWGHF/D2H/Tasks/taskBs.cxx index 29c424f869b..e661c8d739b 100644 --- a/PWGHF/D2H/Tasks/taskBs.cxx +++ b/PWGHF/D2H/Tasks/taskBs.cxx @@ -128,8 +128,8 @@ struct HfTaskBs { if (checkDecayTypeMc) { constexpr uint8_t kNBinsDecayTypeMc = hf_cand_bs::DecayTypeMc::NDecayTypeMc + 1; TString labels[kNBinsDecayTypeMc]; - labels[hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi] = "B^{0}_{s} #rightarrow (D^{#mp}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#mp}) #pi^{#pm}"; - labels[hf_cand_bs::DecayTypeMc::B0ToDsPiToKKPiPi] = "B^{0} #rightarrow (D^{#pm}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#pm}) #pi^{#mp}"; + labels[hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi] = "B^{0}_{s} #rightarrow (D^{#mp}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#mp}) #pi^{#pm}"; + labels[hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi] = "B^{0} #rightarrow (D^{#pm}_{s} #rightarrow K^{#minus} K^{#plus} #pi^{#pm}) #pi^{#mp}"; labels[hf_cand_bs::DecayTypeMc::PartlyRecoDecay] = "Partly reconstructed decay channel"; labels[hf_cand_bs::DecayTypeMc::NDecayTypeMc] = "Other decays"; static const AxisSpec axisDecayType = {kNBinsDecayTypeMc, 0.5, kNBinsDecayTypeMc + 0.5, ""}; @@ -155,9 +155,6 @@ struct HfTaskBs { TracksWithSel const&) { for (const auto& candidate : candidates) { - if (!TESTBIT(candidate.hfflag(), hf_cand_bs::DecayType::BsToDsPi)) { - continue; - } if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { continue; } @@ -194,9 +191,6 @@ struct HfTaskBs { { // MC rec for (const auto& candidate : candidates) { - if (!TESTBIT(candidate.hfflag(), hf_cand_bs::DecayType::BsToDsPi)) { - continue; - } if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { continue; } @@ -206,7 +200,7 @@ struct HfTaskBs { auto invMassCandBs = hfHelper.invMassBsToDsPi(candidate); int flagMcMatchRecBs = std::abs(candidate.flagMcMatchRec()); - if (TESTBIT(flagMcMatchRecBs, hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi)) { + if (TESTBIT(flagMcMatchRecBs, hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi)) { auto indexMother = RecoDecay::getMother(mcParticles, candidate.prong1_as().mcParticle_as>(), o2::constants::physics::Pdg::kBS, true); auto particleMother = mcParticles.rawIteratorAt(indexMother); @@ -230,7 +224,7 @@ struct HfTaskBs { registry.fill(HIST("hChi2PCARecSig"), candidate.chi2PCA(), ptCandBs); if (checkDecayTypeMc) { - registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi, invMassCandBs, ptCandBs); + registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi, invMassCandBs, ptCandBs); } } else { registry.fill(HIST("hPtRecBg"), ptCandBs); @@ -252,8 +246,8 @@ struct HfTaskBs { registry.fill(HIST("hChi2PCARecBg"), candidate.chi2PCA(), ptCandBs); if (checkDecayTypeMc) { - if (TESTBIT(flagMcMatchRecBs, hf_cand_bs::DecayTypeMc::B0ToDsPiToKKPiPi)) { // B0(bar) → Ds± π∓ → (K- K+ π±) π∓ - registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bs::DecayTypeMc::B0ToDsPiToKKPiPi, invMassCandBs, ptCandBs); + if (TESTBIT(flagMcMatchRecBs, hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi)) { // B0(bar) → Ds± π∓ → (K- K+ π±) π∓ + registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi, invMassCandBs, ptCandBs); } else if (TESTBIT(flagMcMatchRecBs, hf_cand_bs::DecayTypeMc::PartlyRecoDecay)) { // Partly reconstructed decay channel registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bs::DecayTypeMc::PartlyRecoDecay, invMassCandBs, ptCandBs); } else { @@ -265,7 +259,7 @@ struct HfTaskBs { // MC gen. level for (const auto& particle : mcParticles) { - if (TESTBIT(std::abs(particle.flagMcMatchGen()), hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi)) { + if (TESTBIT(std::abs(particle.flagMcMatchGen()), hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi)) { auto ptParticle = particle.pt(); auto yParticle = RecoDecay::y(particle.pVector(), o2::constants::physics::MassBS); diff --git a/PWGHF/D2H/Tasks/taskBsReduced.cxx b/PWGHF/D2H/Tasks/taskBsReduced.cxx new file mode 100644 index 00000000000..cbe0ddc2fa4 --- /dev/null +++ b/PWGHF/D2H/Tasks/taskBsReduced.cxx @@ -0,0 +1,760 @@ +// 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 taskBsReduced.cxx +/// \brief Bs → Ds- π+ → (K- K+ π-) π+ analysis task +/// +/// \author Fabio Catalano , CERN + +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "Common/Core/RecoDecay.h" + +#include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/D2H/DataModel/ReducedDataModel.h" + +using namespace o2; +using namespace o2::aod; +using namespace o2::analysis; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace o2::aod +{ +namespace hf_cand_bs_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 +} // namespace hf_cand_bs_lite + +DECLARE_SOA_TABLE(HfRedCandBsLites, "AOD", "HFREDCANDBSLITE", //! Table with some Bs properties + hf_cand::Chi2PCA, + hf_cand_bs_lite::DecayLength, + hf_cand_bs_lite::DecayLengthXY, + hf_cand_bs_lite::DecayLengthNormalised, + hf_cand_bs_lite::DecayLengthXYNormalised, + hf_cand_bs_lite::MProng0, + hf_cand_bs_lite::PtProng0, + hf_cand_bs_lite::PtProng1, + hf_cand::ImpactParameter0, + hf_cand::ImpactParameter1, + hf_cand_bs_lite::ImpactParameterProduct, + hf_cand_bs_lite::NSigTpcPi1, + hf_cand_bs_lite::NSigTofPi1, + hf_cand_bs_reduced::Prong0MlScoreBkg, + hf_cand_bs_reduced::Prong0MlScorePrompt, + hf_cand_bs_reduced::Prong0MlScoreNonprompt, + hf_cand_bs_lite::MlScoreSig, + hf_sel_candidate_bs::IsSelBsToDsPi, + hf_cand_bs_lite::M, + hf_cand_bs_lite::Pt, + hf_cand_bs_lite::Cpa, + hf_cand_bs_lite::CpaXY, + hf_cand_bs_lite::MaxNormalisedDeltaIP, + hf_cand_bs_lite::Eta, + hf_cand_bs_lite::Phi, + hf_cand_bs_lite::Y, + hf_cand_3prong::FlagMcMatchRec, + hf_cand_3prong::OriginMcRec, + hf_cand_bs_lite::FlagWrongCollision, + hf_cand_bs_lite::PtGen); + +DECLARE_SOA_TABLE(HfRedBsMcCheck, "AOD", "HFREDBSMCCHECK", //! Table with MC decay type check + hf_cand_3prong::FlagMcMatchRec, + hf_cand_bs_lite::FlagWrongCollision, + hf_cand_bs_lite::MProng0, + hf_cand_bs_lite::PtProng0, + hf_cand_bs_lite::M, + hf_cand_bs_lite::Pt, + hf_cand_bs_lite::MlScoreSig, + hf_bs_mc::PdgCodeBeautyMother, + hf_bs_mc::PdgCodeCharmMother, + hf_bs_mc::PdgCodeProng0, + hf_bs_mc::PdgCodeProng1, + hf_bs_mc::PdgCodeProng2, + hf_bs_mc::PdgCodeProng3); +} // namespace o2::aod + +/// Bs analysis task +struct HfTaskBsReduced { + Produces hfRedCandBsLite; + Produces hfRedBsMcCheck; + + Configurable selectionFlagBs{"selectionFlagBs", 1, "Selection Flag for Bs"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; + Configurable yCandRecoMax{"yCandRecoMax", 0.8, "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"}; + Configurable fillHistograms{"fillHistograms", true, "Flag to enable histogram filling"}; + Configurable fillSparses{"fillSparses", false, "Flag to enable sparse filling"}; + Configurable fillTree{"fillTree", false, "Flag to enable tree filling"}; + Configurable fillBackground{"fillBackground", false, "Flag to enable filling of background histograms/sparses/tree (only MC)"}; + Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of background_{s} candidates to keep for ML trainings"}; + Configurable ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"}; + + HfHelper hfHelper; + + Filter filterSelectCandidates = (aod::hf_sel_candidate_bs::isSelBsToDsPi >= selectionFlagBs); + + HistogramRegistry registry{"registry"}; + + using TracksPion = soa::Join; + + void init(InitContext&) + { + std::array processFuncData{doprocessData, doprocessDataWithDmesMl, doprocessDataWithBsMl}; + if ((std::accumulate(processFuncData.begin(), processFuncData.end(), 0)) > 1) { + LOGP(fatal, "Only one process function for data can be enabled at a time."); + } + std::array processFuncMc{doprocessMc, doprocessMcWithDecayTypeCheck, doprocessMcWithDmesMl, doprocessMcWithDmesMlAndDecayTypeCheck, doprocessMcWithBsMl, doprocessMcWithBsMlAndDecayTypeCheck}; + if ((std::accumulate(processFuncMc.begin(), processFuncMc.end(), 0)) > 1) { + LOGP(fatal, "Only one process function for MC can be enabled at a time."); + } + + const AxisSpec axisMlScore{100, 0.f, 1.f}; + const AxisSpec axisMassBs{300, 4.5f, 6.0f}; + const AxisSpec axisMassDs{300, 1.75f, 2.05f}; + const AxisSpec axisDecayLength{200, 0.f, 0.4f}; + const AxisSpec axisNormDecayLength{100, 0.f, 50.f}; + const AxisSpec axisDca{100, -0.05f, 0.05f}; + const AxisSpec axisCosp{110, 0.f, 1.1f}; + const AxisSpec axisEta{30, -1.5f, 1.5f}; + const AxisSpec axisError{100, 0.f, 1.f}; + const AxisSpec axisImpParProd{100, -1.e-3, 1.e-3}; + const AxisSpec axisPtBs{100, 0.f, 50.f}; + const AxisSpec axisPtDs{100, 0.f, 50.f}; + const AxisSpec axisPtPi{100, 0.f, 10.f}; + + if (doprocessData || doprocessDataWithDmesMl || doprocessDataWithBsMl) { + if (fillHistograms) { + registry.add("hMass", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{M} (D_{s}#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtBs, axisMassBs}}); + registry.add("hDecLength", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtBs, axisDecayLength}}); + registry.add("hDecLengthXy", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length XY (cm);entries", {HistType::kTH2F, {axisPtBs, axisDecayLength}}); + registry.add("hNormDecLengthXy", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate norm. decay length XY (cm);entries", {HistType::kTH2F, {axisPtBs, axisNormDecayLength}}); + registry.add("hDcaProng0", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong 0 (D_{s}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtBs, axisDca}}); + registry.add("hDcaProng1", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong 1 (#pi) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtBs, axisDca}}); + registry.add("hPtProng0", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}(D_{s}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtDs}}); + registry.add("hPtProng1", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}(#pi) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtPi}}); + registry.add("hCosp", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtBs, axisCosp}}); + registry.add("hCospXy", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtBs, axisCosp}}); + registry.add("hEta", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate #it{#eta};entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hRapidity", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate #it{y};entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hImpParProd", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtBs, axisImpParProd}}); + registry.add("hInvMassD", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtDs, axisMassDs}}); + registry.add("hDecLengthD", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtDs, axisDecayLength}}); + registry.add("hDecLengthXyD", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length XY (cm);entries", {HistType::kTH2F, {axisPtDs, axisDecayLength}}); + registry.add("hCospD", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtDs, axisCosp}}); + registry.add("hCospXyD", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtDs, axisCosp}}); + + // ML scores of Ds- daughter + if (doprocessDataWithDmesMl) { + registry.add("hMlScoreBkgDs", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML background score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + registry.add("hMlScorePromptDs", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML prompt score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + registry.add("hMlScoreNonPromptDs", "B^{0}_{s} candidates;#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML nonprompt score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + } + + // ML scores of Bs candidate + if (doprocessDataWithBsMl) { + registry.add("hMlScoreSigBs", "B^{0}_{s} candidates;#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong0, B^{0}_{s} ML signal score;entries", {HistType::kTH2F, {axisPtBs, axisMlScore}}); + } + } + if (fillSparses) { + if (!(doprocessDataWithDmesMl || doprocessDataWithBsMl)) { + registry.add("hMassPtCutVars", "B^{0}_{s} candidates;#it{M} (D_{s}#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);B^{0}_{s} candidate norm. decay length XY (cm);B^{0}_{s} candidate impact parameter product (cm);B^{0}_{s} candidate cos(#vartheta_{P});#it{M} (KK#pi) (GeV/#it{c}^{2});#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length (cm);D_{s} candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassBs, axisPtBs, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDs, axisPtDs, axisDecayLength, axisCosp}}); + } else { + registry.add("hMassPtCutVars", "B^{0}_{s} candidates;#it{M} (D_{s}#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);B^{0}_{s} candidate norm. decay length XY (cm);B^{0}_{s} candidate impact parameter product (cm);B^{0}_{s} candidate cos(#vartheta_{P});#it{M} (KK#pi) (GeV/#it{c}^{2});#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate ML score bkg;D_{s} candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassBs, axisPtBs, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDs, axisPtDs, axisMlScore, axisMlScore}}); + } + } + } + + if (doprocessMc || doprocessMcWithDecayTypeCheck || doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck || doprocessMcWithBsMl || doprocessMcWithBsMlAndDecayTypeCheck) { + if (fillHistograms) { + // gen histos + registry.add("hEtaGen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{#eta}^{gen}(B^{0}_{s});entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hYGen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{y}^{gen}(B^{0}_{s});entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hYGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{y}^{gen}(B^{0}_{s});entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hPtProng0Gen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}^{gen}(D_{s}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtDs}}); + registry.add("hPtProng1Gen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}^{gen}(#pi) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtPi}}); + registry.add("hYProng0Gen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{y}^{gen}(D_{s});entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hYProng1Gen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{y}^{gen}(#pi);entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hEtaProng0Gen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{#eta}^{gen}(D_{s});entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hEtaProng1Gen", "B^{0}_{s} particles (generated);#it{p}_{T}^{gen}(B^{0}_{s}) (GeV/#it{c});#it{#eta}^{gen}(#pi);entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + + // reco histos + // signal + registry.add("hMassRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{M} (D_{s}#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtBs, axisMassBs}}); + registry.add("hDecLengthRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtBs, axisDecayLength}}); + registry.add("hDecLengthXyRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length XY (cm);entries", {HistType::kTH2F, {axisPtBs, axisDecayLength}}); + registry.add("hNormDecLengthXyRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate norm. decay length XY (cm);entries", {HistType::kTH2F, {axisPtBs, axisNormDecayLength}}); + registry.add("hDcaProng0RecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong 0 (D_{s}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtBs, axisDca}}); + registry.add("hDcaProng1RecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong 1 (#pi) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtBs, axisDca}}); + registry.add("hPtProng0RecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}(D_{s}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtDs}}); + registry.add("hPtProng1RecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}(#pi) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtPi}}); + registry.add("hCospRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtBs, axisCosp}}); + registry.add("hCospXyRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtBs, axisCosp}}); + registry.add("hEtaRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate #it{#eta};entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hRapidityRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate #it{y};entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hImpParProdRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtBs, axisImpParProd}}); + registry.add("hInvMassDRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtDs, axisMassDs}}); + registry.add("hDecLengthDRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtDs, axisDecayLength}}); + registry.add("hDecLengthXyDRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length XY (cm);entries", {HistType::kTH2F, {axisPtDs, axisDecayLength}}); + registry.add("hCospDRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtDs, axisCosp}}); + registry.add("hCospXyDRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtDs, axisCosp}}); + // background + if (fillBackground) { + registry.add("hMassRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{M} (D_{s}#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtBs, axisMassBs}}); + registry.add("hDecLengthRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtBs, axisDecayLength}}); + registry.add("hDecLengthXyRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length XY (cm);entries", {HistType::kTH2F, {axisPtBs, axisDecayLength}}); + registry.add("hNormDecLengthXyRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate norm. decay length XY (cm);entries", {HistType::kTH2F, {axisPtBs, axisNormDecayLength}}); + registry.add("hDcaProng0RecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong 0 (D_{s}) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtBs, axisDca}}); + registry.add("hDcaProng1RecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong 1 (#pi) DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {axisPtBs, axisDca}}); + registry.add("hPtProng0RecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}(D_{s}) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtDs}}); + registry.add("hPtProng1RecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{p}_{T}(#pi) (GeV/#it{c});entries", {HistType::kTH2F, {axisPtBs, axisPtPi}}); + registry.add("hCospRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtBs, axisCosp}}); + registry.add("hCospXyRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtBs, axisCosp}}); + registry.add("hEtaRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate #it{#eta};entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hRapidityRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate #it{y};entries", {HistType::kTH2F, {axisPtBs, axisEta}}); + registry.add("hImpParProdRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate impact parameter product;entries", {HistType::kTH2F, {axisPtBs, axisImpParProd}}); + registry.add("hInvMassDRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {axisPtDs, axisMassDs}}); + registry.add("hDecLengthDRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length (cm);entries", {HistType::kTH2F, {axisPtDs, axisDecayLength}}); + registry.add("hDecLengthXyDRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length XY (cm);entries", {HistType::kTH2F, {axisPtDs, axisDecayLength}}); + registry.add("hCospDRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate cos(#vartheta_{P});entries", {HistType::kTH2F, {axisPtDs, axisCosp}}); + registry.add("hCospXyDRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate cos(#vartheta_{P}^{XY});entries", {HistType::kTH2F, {axisPtDs, axisCosp}}); + } + // MC checks + if (doprocessMcWithDecayTypeCheck || doprocessMcWithBsMlAndDecayTypeCheck || doprocessMcWithDmesMlAndDecayTypeCheck) { + constexpr uint8_t kNBinsDecayTypeMc = hf_cand_bs::DecayTypeMc::NDecayTypeMc; + TString labels[kNBinsDecayTypeMc]; + labels[hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi] = "B^{0}_{s} #rightarrow (D_{s} #rightarrow #Phi#pi #rightarrow KK#pi) #pi"; + labels[hf_cand_bs::DecayTypeMc::BsToDsPiToK0starKPiToKKPiPi] = "B^{0}_{s} #rightarrow (D_{s} #rightarrow K^{0*}K #rightarrow KK#pi) #pi"; + labels[hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi] = "B^{0} #rightarrow (D_{s} #rightarrow #Phi#pi #rightarrow KK#pi) #pi"; + labels[hf_cand_bs::DecayTypeMc::B0ToDsPiToK0starKPiToKKPiPi] = "B^{0} #rightarrow (D_{s} #rightarrow K^{0*}K #rightarrow KK#pi) #pi"; + labels[hf_cand_bs::DecayTypeMc::PartlyRecoDecay] = "Partly reconstructed decay channel"; + labels[hf_cand_bs::DecayTypeMc::OtherDecay] = "Other decays"; + static const AxisSpec axisDecayType = {kNBinsDecayTypeMc, 0.5, kNBinsDecayTypeMc + 0.5, ""}; + registry.add("hDecayTypeMc", "DecayType", {HistType::kTH3F, {axisDecayType, axisMassBs, axisPtBs}}); + for (uint8_t iBin = 0; iBin < kNBinsDecayTypeMc; ++iBin) { + registry.get(HIST("hDecayTypeMc"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin]); + } + } + // ML scores of Ds- daughter + if (doprocessMcWithDmesMl || doprocessMcWithDmesMlAndDecayTypeCheck) { + // signal + registry.add("hMlScoreBkgDsRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML background score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + registry.add("hMlScorePromptDsRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML prompt score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + registry.add("hMlScoreNonPromptDsRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML nonprompt score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + // background + registry.add("hMlScoreBkgDsRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML background score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + registry.add("hMlScorePromptDsRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML prompt score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + registry.add("hMlScoreNonPromptDsRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(D_{s}) (GeV/#it{c});prong0, Ds ML nonprompt score;entries", {HistType::kTH2F, {axisPtDs, axisMlScore}}); + } + // ML scores of Bs candidate + if (doprocessMcWithBsMl || doprocessMcWithBsMlAndDecayTypeCheck) { + // signal + registry.add("hMlScoreSigBsRecSig", "B^{0}_{s} candidates (matched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong0, B^{0}_{s} ML signal score;entries", {HistType::kTH2F, {axisPtBs, axisMlScore}}); + // background + registry.add("hMlScoreSigBsRecBg", "B^{0}_{s} candidates (unmatched);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});prong0, B^{0}_{s} ML signal score;entries", {HistType::kTH2F, {axisPtBs, axisMlScore}}); + } + } + if (fillSparses) { + // gen sparses + registry.add("hPtYGenSig", "B^{0}_{s} particles (generated);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{y}(B^{0}_{s})", {HistType::kTHnSparseF, {axisPtBs, axisEta}}); + registry.add("hPtYWithProngsInAccepanceGenSig", "B^{0}_{s} particles (generated-daughters in acceptance);#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});#it{y}(B^{0}_{s})", {HistType::kTHnSparseF, {axisPtBs, axisEta}}); + + // reco sparses + if (!(doprocessDataWithDmesMl || doprocessDataWithBsMl)) { + registry.add("hMassPtCutVarsRecSig", "B^{0}_{s} candidates (matched);#it{M} (D_{s}#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);B^{0}_{s} candidate norm. decay length XY (cm);B^{0}_{s} candidate impact parameter product (cm);B^{0}_{s} candidate cos(#vartheta_{P});#it{M} (KK#pi) (GeV/#it{c}^{2});#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length (cm);D_{s} candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassBs, axisPtBs, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDs, axisPtDs, axisDecayLength, axisCosp}}); + if (fillBackground) { + registry.add("hMassPtCutVarsRecBg", "B^{0}_{s} candidates (unmatched);#it{M} (D_{s}#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);B^{0}_{s} candidate norm. decay length XY (cm);B^{0}_{s} candidate impact parameter product (cm);B^{0}_{s} candidate cos(#vartheta_{P});#it{M} (KK#pi) (GeV/#it{c}^{2});#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate decay length (cm);D_{s} candidate cos(#vartheta_{P})", {HistType::kTHnSparseF, {axisMassBs, axisPtBs, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDs, axisPtDs, axisDecayLength, axisCosp}}); + } + } else { + registry.add("hMassPtCutVarsRecSig", "B^{0}_{s} candidates (matched);#it{M} (D_{s}#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);B^{0}_{s} candidate norm. decay length XY (cm);B^{0}_{s} candidate impact parameter product (cm);B^{0}_{s} candidate cos(#vartheta_{P});#it{M} (KK#pi) (GeV/#it{c}^{2});#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate ML score bkg;D_{s} candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassBs, axisPtBs, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDs, axisPtDs, axisMlScore, axisMlScore}}); + if (fillBackground) { + registry.add("hMassPtCutVarsRecBg", "B^{0}_{s} candidates (unmatched);#it{M} (D_{s}#pi) (GeV/#it{c}^{2});#it{p}_{T}(B^{0}_{s}) (GeV/#it{c});B^{0}_{s} candidate decay length (cm);B^{0}_{s} candidate norm. decay length XY (cm);B^{0}_{s} candidate impact parameter product (cm);B^{0}_{s} candidate cos(#vartheta_{P});#it{M} (KK#pi) (GeV/#it{c}^{2});#it{p}_{T}(D_{s}) (GeV/#it{c});D_{s} candidate ML score bkg;D_{s} candidate ML score nonprompt", {HistType::kTHnSparseF, {axisMassBs, axisPtBs, axisDecayLength, axisNormDecayLength, axisImpParProd, axisCosp, axisMassDs, axisPtDs, axisMlScore, axisMlScore}}); + } + } + } + } + } + + /// Selection of Bs daughter in geometrical acceptance + /// \param etaProng is the pseudorapidity of Bs prong + /// \param ptProng is the pT of Bs prong + /// \return true if prong is in geometrical acceptance + template + bool isProngInAcceptance(const T& etaProng, const T& ptProng) + { + return std::abs(etaProng) <= etaTrackMax && ptProng >= ptTrackMin; + } + + /// Fill candidate information at reconstruction level + /// \param doMc is the flag to enable the filling with MC information + /// \param withDecayTypeCheck is the flag to enable MC with decay type check + /// \param withDmesMl is the flag to enable the filling with ML scores for the Ds- daughter + /// \param withBsMl is the flag to enable the filling with ML scores for the Bs candidate + /// \param candidate is the Bs candidate + /// \param candidatesD is the table with Ds- candidates + template + void fillCand(Cand const& candidate, + aod::HfRed3Prongs const&) + { + auto ptCandBs = candidate.pt(); + auto invMassBs = hfHelper.invMassBsToDsPi(candidate); + auto candDs = candidate.template prong0_as(); + auto ptDs = candidate.ptProng0(); + auto invMassDs = candDs.invMassHypo0() > 0 ? candDs.invMassHypo0() : candDs.invMassHypo1(); + // TODO: here we are assuming that only one of the two hypotheses is filled, to be checked + std::array posPv{candidate.posX(), candidate.posY(), candidate.posZ()}; + std::array posSvDs{candDs.xSecondaryVertex(), candDs.ySecondaryVertex(), candDs.zSecondaryVertex()}; + std::array momDs{candDs.pVector()}; + auto cospDs = RecoDecay::cpa(posPv, posSvDs, momDs); + auto cospXyDs = RecoDecay::cpaXY(posPv, posSvDs, momDs); + auto decLenDs = RecoDecay::distance(posPv, posSvDs); + auto decLenXyDs = RecoDecay::distanceXY(posPv, posSvDs); + + int8_t flagMcMatchRec = 0; + int8_t flagWrongCollision = 0; + bool isSignal = false; + if constexpr (doMc) { + flagMcMatchRec = candidate.flagMcMatchRec(); + flagWrongCollision = candidate.flagWrongCollision(); + isSignal = TESTBIT(std::abs(flagMcMatchRec), hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); + } + + if (fillHistograms) { + if constexpr (doMc) { + if (isSignal) { + registry.fill(HIST("hMassRecSig"), ptCandBs, invMassBs); + registry.fill(HIST("hPtProng0RecSig"), ptCandBs, candidate.ptProng0()); + registry.fill(HIST("hPtProng1RecSig"), ptCandBs, candidate.ptProng1()); + registry.fill(HIST("hImpParProdRecSig"), ptCandBs, candidate.impactParameterProduct()); + registry.fill(HIST("hDecLengthRecSig"), ptCandBs, candidate.decayLength()); + registry.fill(HIST("hDecLengthXyRecSig"), ptCandBs, candidate.decayLengthXY()); + registry.fill(HIST("hNormDecLengthXyRecSig"), ptCandBs, candidate.decayLengthXY() / candidate.errorDecayLengthXY()); + registry.fill(HIST("hDcaProng0RecSig"), ptCandBs, candidate.impactParameter0()); + registry.fill(HIST("hDcaProng1RecSig"), ptCandBs, candidate.impactParameter1()); + registry.fill(HIST("hCospRecSig"), ptCandBs, candidate.cpa()); + registry.fill(HIST("hCospXyRecSig"), ptCandBs, candidate.cpaXY()); + registry.fill(HIST("hEtaRecSig"), ptCandBs, candidate.eta()); + registry.fill(HIST("hRapidityRecSig"), ptCandBs, hfHelper.yBs(candidate)); + registry.fill(HIST("hInvMassDRecSig"), ptDs, invMassDs); + registry.fill(HIST("hDecLengthDRecSig"), ptDs, decLenDs); + registry.fill(HIST("hDecLengthXyDRecSig"), ptDs, decLenXyDs); + registry.fill(HIST("hCospDRecSig"), ptDs, cospDs); + registry.fill(HIST("hCospXyDRecSig"), ptDs, cospXyDs); + if constexpr (withDecayTypeCheck) { + registry.fill(HIST("hDecayTypeMc"), 1 + hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi, invMassBs, ptCandBs); + } + if constexpr (withDmesMl) { + registry.fill(HIST("hMlScoreBkgDsRecSig"), ptDs, candidate.prong0MlScoreBkg()); + registry.fill(HIST("hMlScorePromptDsRecSig"), ptDs, candidate.prong0MlScorePrompt()); + registry.fill(HIST("hMlScoreNonPromptDsRecSig"), ptDs, candidate.prong0MlScoreNonprompt()); + } + if constexpr (withBsMl) { + registry.fill(HIST("hMlScoreSigBsRecSig"), ptCandBs, candidate.mlProbBsToDsPi()[1]); + } + } else if (fillBackground) { + registry.fill(HIST("hMassRecBg"), ptCandBs, invMassBs); + registry.fill(HIST("hPtProng0RecBg"), ptCandBs, candidate.ptProng0()); + registry.fill(HIST("hPtProng1RecBg"), ptCandBs, candidate.ptProng1()); + registry.fill(HIST("hImpParProdRecBg"), ptCandBs, candidate.impactParameterProduct()); + registry.fill(HIST("hDecLengthRecBg"), ptCandBs, candidate.decayLength()); + registry.fill(HIST("hDecLengthXyRecBg"), ptCandBs, candidate.decayLengthXY()); + registry.fill(HIST("hNormDecLengthXyRecBg"), ptCandBs, candidate.decayLengthXY() / candidate.errorDecayLengthXY()); + registry.fill(HIST("hDcaProng0RecBg"), ptCandBs, candidate.impactParameter0()); + registry.fill(HIST("hDcaProng1RecBg"), ptCandBs, candidate.impactParameter1()); + registry.fill(HIST("hCospRecBg"), ptCandBs, candidate.cpa()); + registry.fill(HIST("hCospXyRecBg"), ptCandBs, candidate.cpaXY()); + registry.fill(HIST("hEtaRecBg"), ptCandBs, candidate.eta()); + registry.fill(HIST("hRapidityRecBg"), ptCandBs, hfHelper.yBs(candidate)); + registry.fill(HIST("hInvMassDRecBg"), ptDs, invMassDs); + registry.fill(HIST("hDecLengthDRecBg"), ptDs, decLenDs); + registry.fill(HIST("hDecLengthXyDRecBg"), ptDs, decLenXyDs); + registry.fill(HIST("hCospDRecBg"), ptDs, cospDs); + registry.fill(HIST("hCospXyDRecBg"), ptDs, cospXyDs); + if constexpr (withDmesMl) { + registry.fill(HIST("hMlScoreBkgDsRecBg"), ptDs, candidate.prong0MlScoreBkg()); + registry.fill(HIST("hMlScorePromptDsRecBg"), ptDs, candidate.prong0MlScorePrompt()); + registry.fill(HIST("hMlScoreNonPromptDsRecBg"), ptDs, candidate.prong0MlScoreNonprompt()); + } + if constexpr (withBsMl) { + registry.fill(HIST("hMlScoreSigBsRecBg"), ptCandBs, candidate.mlProbBsToDsPi()[1]); + } + } else if constexpr (withDecayTypeCheck) { + for (uint8_t iFlag = 1; iFlag < hf_cand_bs::DecayTypeMc::NDecayTypeMc; ++iFlag) { + if (TESTBIT(flagMcMatchRec, iFlag)) { + registry.fill(HIST("hDecayTypeMc"), 1 + iFlag, invMassBs, ptCandBs); + } + } + } + } else { + registry.fill(HIST("hMass"), ptCandBs, invMassBs); + registry.fill(HIST("hPtProng0"), ptCandBs, candidate.ptProng0()); + registry.fill(HIST("hPtProng1"), ptCandBs, candidate.ptProng1()); + registry.fill(HIST("hImpParProd"), ptCandBs, candidate.impactParameterProduct()); + registry.fill(HIST("hDecLength"), ptCandBs, candidate.decayLength()); + registry.fill(HIST("hDecLengthXy"), ptCandBs, candidate.decayLengthXY()); + registry.fill(HIST("hNormDecLengthXy"), ptCandBs, candidate.decayLengthXY() / candidate.errorDecayLengthXY()); + registry.fill(HIST("hDcaProng0"), ptCandBs, candidate.impactParameter0()); + registry.fill(HIST("hDcaProng1"), ptCandBs, candidate.impactParameter1()); + registry.fill(HIST("hCosp"), ptCandBs, candidate.cpa()); + registry.fill(HIST("hCospXy"), ptCandBs, candidate.cpaXY()); + registry.fill(HIST("hEta"), ptCandBs, candidate.eta()); + registry.fill(HIST("hRapidity"), ptCandBs, hfHelper.yBs(candidate)); + registry.fill(HIST("hInvMassD"), ptDs, invMassDs); + registry.fill(HIST("hDecLengthD"), ptDs, decLenDs); + registry.fill(HIST("hDecLengthXyD"), ptDs, decLenXyDs); + registry.fill(HIST("hCospD"), ptDs, cospDs); + registry.fill(HIST("hCospXyD"), ptDs, cospXyDs); + + if constexpr (withDmesMl) { + registry.fill(HIST("hMlScoreBkgDs"), ptDs, candidate.prong0MlScoreBkg()); + registry.fill(HIST("hMlScorePromptDs"), ptDs, candidate.prong0MlScorePrompt()); + registry.fill(HIST("hMlScoreNonPromptDs"), ptDs, candidate.prong0MlScoreNonprompt()); + } + if constexpr (withBsMl) { + registry.fill(HIST("hMlScoreSigBs"), ptCandBs, candidate.mlProbBsToDsPi()[1]); + } + } + } + if (fillSparses) { + if constexpr (withDmesMl) { + if (isSignal) { + if constexpr (withDmesMl) { + registry.fill(HIST("hMassPtCutVarsRecSig"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); + } else { + registry.fill(HIST("hMassPtCutVarsRecSig"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, decLenDs, cospDs); + } + } else if (fillBackground) { + if constexpr (withDmesMl) { + registry.fill(HIST("hMassPtCutVarsRecBg"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); + } else { + registry.fill(HIST("hMassPtCutVarsRecBg"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, decLenDs, cospDs); + } + } + } else { + if constexpr (withDmesMl) { + registry.fill(HIST("hMassPtCutVars"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, candidate.prong0MlScoreBkg(), candidate.prong0MlScoreNonprompt()); + } else { + registry.fill(HIST("hMassPtCutVars"), invMassBs, ptCandBs, candidate.decayLength(), candidate.decayLengthXY() / candidate.errorDecayLengthXY(), candidate.impactParameterProduct(), candidate.cpa(), invMassDs, ptDs, decLenDs, cospDs); + } + } + } + if (fillTree) { + float pseudoRndm = ptDs * 1000. - (int64_t)(ptDs * 1000); + if (flagMcMatchRec != 0 || (((doMc && fillBackground) || !doMc) && (ptCandBs >= ptMaxForDownSample || pseudoRndm < downSampleBkgFactor))) { + float prong0MlScoreBkg = -1.; + float prong0MlScorePrompt = -1.; + float prong0MlScoreNonprompt = -1.; + float candidateMlScoreSig = -1; + if constexpr (withDmesMl) { + prong0MlScoreBkg = candidate.prong0MlScoreBkg(); + prong0MlScorePrompt = candidate.prong0MlScorePrompt(); + prong0MlScoreNonprompt = candidate.prong0MlScoreNonprompt(); + } + if constexpr (withBsMl) { + candidateMlScoreSig = candidate.mlProbBsToDsPi()[1]; + } + auto prong1 = candidate.template prong1_as(); + + float ptMother = -1.; + if constexpr (doMc) { + ptMother = candidate.ptMother(); + } + + hfRedCandBsLite( + candidate.chi2PCA(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + invMassDs, + ptDs, + candidate.ptProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameterProduct(), + prong1.tpcNSigmaPi(), + prong1.tofNSigmaPi(), + prong0MlScoreBkg, + prong0MlScorePrompt, + prong0MlScoreNonprompt, + candidateMlScoreSig, + candidate.isSelBsToDsPi(), + invMassBs, + ptCandBs, + candidate.cpa(), + candidate.cpaXY(), + candidate.maxNormalisedDeltaIP(), + candidate.eta(), + candidate.phi(), + hfHelper.yBs(candidate), + flagMcMatchRec, + isSignal, + flagWrongCollision, + ptMother); + + if constexpr (withDecayTypeCheck) { + float candidateMlScoreSig = -1; + if constexpr (withBsMl) { + candidateMlScoreSig = candidate.mlProbBsToDsPi()[1]; + } + hfRedBsMcCheck( + flagMcMatchRec, + flagWrongCollision, + invMassDs, + ptDs, + invMassBs, + ptCandBs, + candidateMlScoreSig, + candidate.pdgCodeBeautyMother(), + candidate.pdgCodeCharmMother(), + candidate.pdgCodeProng0(), + candidate.pdgCodeProng1(), + candidate.pdgCodeProng2(), + candidate.pdgCodeProng3()); + } + } + } + } + + /// Fill particle histograms (gen MC truth) + void fillCandMcGen(aod::HfMcGenRedBss::iterator const& particle) + { + // keep only generated Bs with the analysis decay channel + if (!TESTBIT(std::abs(particle.flagMcMatchGen()), hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi)) { + return; + } + auto ptParticle = particle.ptTrack(); + auto yParticle = particle.yTrack(); + auto etaParticle = particle.etaTrack(); + if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { + return; + } + std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; + std::array yProngs = {particle.yProng0(), particle.yProng1()}; + std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; + bool prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); + + if (fillHistograms) { + registry.fill(HIST("hPtProng0Gen"), ptParticle, ptProngs[0]); + registry.fill(HIST("hPtProng1Gen"), ptParticle, ptProngs[1]); + registry.fill(HIST("hYProng0Gen"), ptParticle, yProngs[0]); + registry.fill(HIST("hYProng1Gen"), ptParticle, yProngs[1]); + registry.fill(HIST("hEtaProng0Gen"), ptParticle, etaProngs[0]); + registry.fill(HIST("hEtaProng1Gen"), ptParticle, etaProngs[1]); + + registry.fill(HIST("hYGen"), ptParticle, yParticle); + registry.fill(HIST("hEtaGen"), ptParticle, etaParticle); + + // generated Bs with daughters in geometrical acceptance + if (prongsInAcc) { + registry.fill(HIST("hYGenWithProngsInAcceptance"), ptParticle, yParticle); + } + } + if (fillSparses) { + registry.fill(HIST("hPtYGenSig"), ptParticle, yParticle); + if (prongsInAcc) { + registry.fill(HIST("hPtYWithProngsInAccepanceGenSig"), ptParticle, yParticle); + } + } + } + + // Process functions + void processData(soa::Filtered> const& candidates, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // candidate loop + } // processData + PROCESS_SWITCH(HfTaskBsReduced, processData, "Process data without ML scores for Bs and D daughter", true); + + void processDataWithDmesMl(soa::Filtered> const& candidates, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // candidate loop + } // processDataWithDmesMl + PROCESS_SWITCH(HfTaskBsReduced, processDataWithDmesMl, "Process data with(out) ML scores for D daughter (Bs)", false); + + void processDataWithBsMl(soa::Filtered> const& candidates, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // candidate loop + } // processDataWithBsMl + PROCESS_SWITCH(HfTaskBsReduced, processDataWithBsMl, "Process data with(out) ML scores for Bs (D daughter)", false); + + void processMc(soa::Filtered> const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskBsReduced, processMc, "Process MC without ML scores for Bs and D daughter", false); + + void processMcWithDecayTypeCheck(soa::Filtered> const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskBsReduced, processMcWithDecayTypeCheck, "Process MC with decay type check and without ML scores for Bs and D daughter", false); + + void processMcWithDmesMl(soa::Filtered> const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMcWithDmesMl + PROCESS_SWITCH(HfTaskBsReduced, processMcWithDmesMl, "Process MC with(out) ML scores for D daughter (Bs)", false); + + void processMcWithDmesMlAndDecayTypeCheck(soa::Filtered> const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskBsReduced, processMcWithDmesMlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for Bs (D daughter)", false); + + void processMcWithBsMl(soa::Filtered> const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMcWithBsMl + PROCESS_SWITCH(HfTaskBsReduced, processMcWithBsMl, "Process MC with(out) ML scores for Bs (D daughter)", false); + + void processMcWithBsMlAndDecayTypeCheck(soa::Filtered> const& candidates, + aod::HfMcGenRedBss const& mcParticles, + aod::HfRed3Prongs const& candidatesD, + TracksPion const&) + { + // MC rec + for (const auto& candidate : candidates) { + if (yCandRecoMax >= 0. && std::abs(hfHelper.yBs(candidate)) > yCandRecoMax) { + continue; + } + fillCand(candidate, candidatesD); + } // rec + + // MC gen. level + for (const auto& particle : mcParticles) { + fillCandMcGen(particle); + } // gen + } // processMc + PROCESS_SWITCH(HfTaskBsReduced, processMcWithBsMlAndDecayTypeCheck, "Process MC with decay type check and with(out) ML scores for B0 (D daughter)", false); +}; // struct + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index 212d4cb9e11..cbcfb44a85b 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -159,12 +159,15 @@ struct TaskPolarisationCharmHadrons { struct : ConfigurableGroup { Configurable applyLcBkgVeto{"applyLcBkgVeto", false, "Flag to enable the veto on D+ and Ds+ background for Lc->pKpi analysis"}; /// background from D+->K-pi+pi+ + Configurable enableLcBkgVetoDplusKPiPi{"enableLcBkgVetoDplusKPiPi", false, "Flag to enable the veto on D+->K-pi+pi+ for Lc->pKpi analysis"}; Configurable massDplusKPiPiMinVeto{"massDplusKPiPiMinVeto", 1.85, "Min. value for D+->K-pi+pi+ veto"}; Configurable massDplusKPiPiMaxVeto{"massDplusKPiPiMaxVeto", 1.90, "Max. value for D+->K-pi+pi+ veto"}; /// background from D+->K+K-pi+ + Configurable enableLcBkgVetoDplusKKPi{"enableLcBkgVetoDplusKKPi", false, "Flag to enable the veto on D+->K+K-pi+ for Lc->pKpi analysis"}; Configurable massDplusKKPiMinVeto{"massDplusKKPiMinVeto", 1.85, "Min. value for D+->K+K-pi+ veto"}; // one can use also massDplusKPiPiMinVeto, but this allows more flexibility in analysis Configurable massDplusKKPiMaxVeto{"massDplusKKPiMaxVeto", 1.90, "Max. value for D+->K+K-pi+ veto"}; // one can use also massDplusKPiPiMaxVeto, but this allows more flexibility in analysis /// background from Ds+->K+K-pi+ + Configurable enableLcBkgVetoDsKKPi{"enableLcBkgVetoDsKKPi", false, "Flag to enable the veto on Ds+->K+K-pi+ for Lc->pKpi analysis"}; Configurable massDsKKPiMinVeto{"massDsKKPiMinVeto", 1.94, "Min. value for Ds+->K+K-pi+ veto"}; Configurable massDsKKPiMaxVeto{"massDsKKPiMaxVeto", 2.00, "Max. value for Ds+->K+K-pi+ veto"}; } lcBkgVeto; @@ -1135,11 +1138,11 @@ struct TaskPolarisationCharmHadrons { } /// put veto on D+, Ds+ inv. masses, to reduce the background - if (lcBkgVeto.applyLcBkgVeto && ((lcBkgVeto.massDplusKPiPiMinVeto < invMassPiKPi && invMassPiKPi < lcBkgVeto.massDplusKPiPiMaxVeto) /*bkg. from D+ -> K+pi-pi-*/ || - (lcBkgVeto.massDplusKKPiMinVeto < invMassKKPi && invMassKKPi < lcBkgVeto.massDplusKKPiMaxVeto) /*bkg. from D+ -> K+K-pi+ (1st mass hypothesis)*/ || - (lcBkgVeto.massDplusKKPiMinVeto < invMassPiKK && invMassPiKK < lcBkgVeto.massDplusKKPiMaxVeto) /*bkg. from D+ -> K+K-pi+ (2nd mass hypothesis)*/ || - (lcBkgVeto.massDsKKPiMinVeto < invMassKKPi && invMassKKPi < lcBkgVeto.massDsKKPiMaxVeto) /*bkg. from Ds+ -> K+K-pi+ (1st mass hypothesis)*/ || - (lcBkgVeto.massDsKKPiMinVeto < invMassPiKK && invMassPiKK < lcBkgVeto.massDsKKPiMaxVeto)) /*bkg. from Ds+ -> K+K-pi+ (2nd mass hypothesis)*/) { + if (lcBkgVeto.applyLcBkgVeto && ((lcBkgVeto.enableLcBkgVetoDplusKPiPi && lcBkgVeto.massDplusKPiPiMinVeto < invMassPiKPi && invMassPiKPi < lcBkgVeto.massDplusKPiPiMaxVeto) /*bkg. from D+ -> K+pi-pi-*/ || + (lcBkgVeto.enableLcBkgVetoDplusKKPi && lcBkgVeto.massDplusKKPiMinVeto < invMassKKPi && invMassKKPi < lcBkgVeto.massDplusKKPiMaxVeto) /*bkg. from D+ -> K+K-pi+ (1st mass hypothesis)*/ || + (lcBkgVeto.enableLcBkgVetoDplusKKPi && lcBkgVeto.massDplusKKPiMinVeto < invMassPiKK && invMassPiKK < lcBkgVeto.massDplusKKPiMaxVeto) /*bkg. from D+ -> K+K-pi+ (2nd mass hypothesis)*/ || + (lcBkgVeto.enableLcBkgVetoDsKKPi && lcBkgVeto.massDsKKPiMinVeto < invMassKKPi && invMassKKPi < lcBkgVeto.massDsKKPiMaxVeto) /*bkg. from Ds+ -> K+K-pi+ (1st mass hypothesis)*/ || + (lcBkgVeto.enableLcBkgVetoDsKKPi && lcBkgVeto.massDsKKPiMinVeto < invMassPiKK && invMassPiKK < lcBkgVeto.massDsKKPiMaxVeto)) /*bkg. from Ds+ -> K+K-pi+ (2nd mass hypothesis)*/) { /// this candidate has D+ and/or Ds+ in the veto range, let's reject it continue; } @@ -1379,7 +1382,7 @@ struct TaskPolarisationCharmHadrons { isRealPKPi, isRealLcPKPi, isReflected, charge); } // end studyLcPKPiBkgMc - } // end table for Lc->pKpi background studies + } // end table for Lc->pKpi background studies } /// end loop over mass hypotheses diff --git a/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx index d50644fe55e..6890975926c 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx @@ -29,6 +29,92 @@ 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); + +} // namespace o2::aod enum DecayChannel : uint8_t { Ds1ToDstarK0s = 0, @@ -38,9 +124,16 @@ enum DecayChannel : uint8_t { }; struct HfTaskCharmResoReduced { + Produces hfCandResoLite; 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"}; + 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", 0.8, "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,17 +144,15 @@ 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"}; - - using ReducedResoWithMl = soa::Join; - SliceCache cache; - Preslice resoPerCollision = aod::hf_track_index_reduced::hfRedCollisionId; + 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 ReducedReso = soa::Join; + using ReducedResoWithMl = soa::Join; + using ReducedResoMc = soa::Join; + using ReducedResoWithMlMc = soa::Join; + using CharmBach = soa::Join; // Histogram Registry HistogramRegistry registry; @@ -79,11 +170,16 @@ struct HfTaskCharmResoReduced { 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) { + // gen histos + 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,9 +187,77 @@ 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(); + // signD0 = candidate.signD0(); + } + 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()); @@ -105,131 +269,184 @@ struct HfTaskCharmResoReduced { 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(), candidate.invMass(), candidate.invMassProng0(), candidate.invMassProng1(), cosThetaStar, mlScoreBkg, mlScoreNonPrompt); } - registry.fill(HIST("hSparse"), candidate.pt(), candidate.ptProng0(), candidate.ptProng1(), candidate.invMass(), candidate.invMassProng0(), candidate.invMassProng1(), cosThetaStar, candidate.mlScoreBkgProng0(), candidate.mlScoreNonpromptProng0()); - } // fillHisto + if (doMc && 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::Ds1ToDStarK0ToDPlusPi0K0s || std::abs(flagMcMatchRec) == DecayTypeMc::Ds2StarToDplusK0sOneMu)) { + return; + } + } + 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); + } + } // 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 + template void processData(Coll const&, Candidates const& candidates) { for (const auto& cand : candidates) { if (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); } } } - } + } // fillCandMcGen // process functions - void processDs1Data(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates) + void processDs1Data(aod::HfRedCollisions const& collisions, ReducedReso const& candidates) + { + processData(collisions, candidates); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1Data, "Process data for Ds1 analysis without Ml", true); + + void processDs1DataWithMl(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates) + { + processData(collisions, candidates); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs1DataWithMl, "Process data for Ds1 analysis with Ml", false); + + void processDs2StarData(aod::HfRedCollisions const& collisions, ReducedReso const& candidates) + { + processData(collisions, candidates); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarData, "Process data Ds2Star analysis without Ml", false); + + void processDs2StarDataWithMl(aod::HfRedCollisions const& collisions, ReducedResoWithMl const& candidates) + { + processData(collisions, candidates); + } + PROCESS_SWITCH(HfTaskCharmResoReduced, processDs2StarDataWithMl, "Process data Ds2Star analysis with Ml", false); + + void processDs1Mc(aod::HfRedCollisions const& collisions, ReducedResoMc const& candidates, aod::HfMcGenRedResos const& mcParticles) { - processData(collisions, candidates); + processData(collisions, candidates); + 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) { - processDataMixedEvent(collisions, candidates); + processData(collisions, candidates); + 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) { - processData(collisions, candidates); + processData(collisions, candidates); + 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) { - processDataMixedEvent(collisions, candidates); + processData(collisions, candidates); + 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 94c1e28f498..e5e12298f3f 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -55,6 +55,7 @@ struct HfTaskD0 { // ThnSparse for ML outputScores and Vars ConfigurableAxis thnConfigAxisBkgScore{"thnConfigAxisBkgScore", {50, 0, 1}, "Bkg score bins"}; ConfigurableAxis thnConfigAxisNonPromptScore{"thnConfigAxisNonPromptScore", {50, 0, 1}, "Non-prompt score bins"}; + ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {50, 0, 1}, "Prompt score bins"}; ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {120, 1.5848, 2.1848}, "Cand. inv-mass bins"}; ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {1000, 0, 100}, "Cand. beauty mother pTB bins"}; ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {500, 0, 50}, "Cand. pT bins"}; @@ -226,8 +227,9 @@ struct HfTaskD0 { 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, thnAxisMass, thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin, thnAxisCandType}); + registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin, 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}); @@ -297,10 +299,10 @@ struct HfTaskD0 { if constexpr (applyMl) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], massD0, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], massD0bar, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, -1, hfHelper.yD0(candidate), 0, SigD0bar); } } else { if (candidate.isSelD0() >= selectionFlagD0) { @@ -474,7 +476,7 @@ 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], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0); } else { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0); } @@ -496,7 +498,7 @@ 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], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0); } else { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0); } @@ -508,7 +510,7 @@ 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], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0bar); } else { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), SigD0bar); } @@ -517,7 +519,7 @@ struct HfTaskD0 { 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], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0bar); } else { registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, candidate.ptBhadMotherPart(), rapidityCandidate, candidate.originMcRec(), ReflectedD0bar); } diff --git a/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx new file mode 100644 index 00000000000..1905048725f --- /dev/null +++ b/PWGHF/D2H/Tasks/taskDirectedFlowCharmHadrons.cxx @@ -0,0 +1,240 @@ +// 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 + +#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 }; + +struct HfTaskDirectedFlowCharmHadrons { + 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 computation"}; + Configurable centralityMax{"centralityMax", 100., "Maximum centrality accepted in SP computation"}; + Configurable storeMl{"storeMl", false, "Flag to store ML scores"}; + 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 CollsWithQvecs = soa::Join; + using TracksWithExtra = soa::Join; + + Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= 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}; + 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}); + } + 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("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); + + 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.triggerevent()) { // 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 QxpQyt = qxZDCA * qyZDCC; + auto QxtQyp = qxZDCC * qyZDCA; + + // correlations in the denominators for SP calculation + registry.fill(HIST("hpQxtQxpvscent"), cent, QxtQxp); + registry.fill(HIST("hpQytQypvscent"), cent, QytQyp); + registry.fill(HIST("hpQxpQytvscent"), cent, QxpQyt); + registry.fill(HIST("hpQxtQypvscent"), cent, QxtQyp); + + for (const auto& candidate : candidates) { + double massCand = 0.; + std::vector outputMl = {-999., -999.}; + if constexpr (std::is_same_v || std::is_same_v) { + massCand = hfHelper.invMassDplusToPiKPi(candidate); + if constexpr (std::is_same_v) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) + outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; + } + } + + auto trackprong0 = candidate.template prong0_as(); + double sign = trackprong0.sign(); // to differentiate between D+ and D- + + double ptCand = candidate.pt(); + double etaCand = candidate.eta(); + double phiCand = candidate.phi(); + double cosNPhi = std::cos(phiCand); + double sinNPhi = std::sin(phiCand); + + 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 uxQxt = ux * qxZDCC; + auto uyQyt = uy * qyZDCC; + + if (storeMl) { + 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]); + } 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); + } + } + } + // 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); + +}; // 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 e113c5fef63..5cd09dfa9f5 100644 --- a/PWGHF/D2H/Tasks/taskDs.cxx +++ b/PWGHF/D2H/Tasks/taskDs.cxx @@ -41,14 +41,10 @@ enum DataType { Data = 0, McDplusPrompt, McDplusNonPrompt, McDplusBkg, + McLcBkg, McBkg, kDataTypes }; -enum SpeciesAndDecay { DsToKKPi = 0, - DplusToKKPi, - DplusToPiKPi, - kSpeciesAndDecay }; - template concept hasDsMlInfo = requires(T candidate) { @@ -78,7 +74,6 @@ struct HfTaskDs { HfHelper hfHelper; - using CentralityEstimator = o2::hf_centrality::CentralityEstimator; using TH1_ptr = std::shared_ptr; using TH2_ptr = std::shared_ptr; using THnSparse_ptr = std::shared_ptr; @@ -101,15 +96,8 @@ struct HfTaskDs { using CandDsMcRecoWithMl = soa::Filtered>; using CandDsMcGen = soa::Join; - Preslice candDsDataPerCollision = aod::hf_cand::collisionId; - Preslice candDsDataWithMlPerCollision = aod::hf_cand::collisionId; - Preslice candDsMcRecoPerCollision = aod::hf_cand::collisionId; - Preslice candDsMcRecoWithMlPerCollision = aod::hf_cand::collisionId; - - PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - PresliceUnsorted colPerMcCollisionWithFT0C = aod::mccollisionlabel::mcCollisionId; - PresliceUnsorted colPerMcCollisionWithFT0M = aod::mccollisionlabel::mcCollisionId; - PresliceUnsorted colPerMcCollisionWithNTracksPV = aod::mccollisionlabel::mcCollisionId; + Preslice candDsPerCollision = aod::hf_cand::collisionId; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; 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 @@ -118,7 +106,7 @@ struct HfTaskDs { 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 = {}; @@ -126,15 +114,10 @@ struct HfTaskDs { std::unordered_map mcDplusPromptHistograms = {}; std::unordered_map mcDplusNonPromptHistograms = {}; std::unordered_map mcDplusBkgHistograms = {}; + std::unordered_map mcLcBkgHistograms = {}; std::unordered_map mcBkgHistograms = {}; - std::map, PresliceUnsorted, PresliceUnsorted, PresliceUnsorted>> colPerMcCollisionMap{ - {CentralityEstimator::None, colPerMcCollision}, - {CentralityEstimator::FT0C, colPerMcCollisionWithFT0C}, - {CentralityEstimator::FT0M, colPerMcCollisionWithFT0M}, - {CentralityEstimator::NTracksPV, colPerMcCollisionWithNTracksPV}}; - - 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&) { @@ -202,7 +185,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}}); @@ -245,6 +228,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 @@ -403,19 +392,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; } @@ -476,15 +467,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)); @@ -511,7 +503,7 @@ struct HfTaskDs { // TODO: add histograms for reflections } - template + template void fillMcGenHistos(CandDsMcGen const& mcParticles, Coll const& recoCollisions) { @@ -523,8 +515,8 @@ struct HfTaskDs { double y{0.f}; unsigned maxNumContrib = 0; - const auto& recoCollsPerMcColl = recoCollisions.sliceBy(std::get>(colPerMcCollisionMap.at(centDetector)), particle.mcCollision().globalIndex()); - for (const auto& recCol : recoCollisions) { + const auto& recoCollsPerMcColl = recoCollisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); + for (const auto& recCol : recoCollsPerMcColl) { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; } @@ -588,7 +580,7 @@ struct HfTaskDs { } template - void runDataAnalysisPerCollision(const Coll& collisions, const CandsDs& candsDs, Preslice candDsPerCollision) + void runDataAnalysisPerCollision(const Coll& collisions, const CandsDs& candsDs) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); @@ -615,11 +607,10 @@ struct HfTaskDs { } } - template + template void runMcAnalysisPerCollision(const Coll& collisions, const CandsDs& candsDs, - const CandDsMcGen& mcParticles, - Preslice candDsPerCollision) + const CandDsMcGen& mcParticles) { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); @@ -673,14 +664,14 @@ struct HfTaskDs { } fillNPvContribHisto(collision, nCandsPerType, nCandsInSignalRegionDsPerType, nCandsInSignalRegionDplusPerType); } - fillMcGenHistos(mcParticles, collisions); + fillMcGenHistos(mcParticles, collisions); } void processDataWithCentFT0C(CollisionsWithFT0C const& collisions, CandDsData const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processDataWithCentFT0C, "Process data w/o ML information on Ds, with information on centrality from FT0C", false); @@ -688,7 +679,7 @@ struct HfTaskDs { CandDsData const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processDataWithCentFT0M, "Process data w/o ML information on Ds, with information on centrality from FT0M", false); @@ -696,7 +687,7 @@ struct HfTaskDs { CandDsData const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processDataWithCentNTracksPV, "Process data w/o ML information on Ds, with information on centrality from NTracksPV", false); @@ -704,7 +695,7 @@ struct HfTaskDs { CandDsData const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processData, "Process data w/o ML information on Ds, w/o information on centrality", true); @@ -712,7 +703,7 @@ struct HfTaskDs { CandDsDataWithMl const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataWithMlPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processDataWithMlAndCentFT0C, "Process data with ML information on Ds, with information on centrality from FT0C", false); @@ -720,7 +711,7 @@ struct HfTaskDs { CandDsDataWithMl const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataWithMlPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processDataWithMlAndCentFT0M, "Process data with ML information on Ds, with information on centrality from FT0M", false); @@ -728,7 +719,7 @@ struct HfTaskDs { CandDsDataWithMl const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataWithMlPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processDataWithMlAndCentNTracksPV, "Process data with ML information on Ds, with information on centrality", false); @@ -736,7 +727,7 @@ struct HfTaskDs { CandDsDataWithMl const& candsDs, aod::Tracks const&) { - runDataAnalysisPerCollision(collisions, candsDs, candDsDataWithMlPerCollision); + runDataAnalysisPerCollision(collisions, candsDs); } PROCESS_SWITCH(HfTaskDs, processDataWithMl, "Process data with ML information on Ds, w/o information on centrality", false); @@ -746,7 +737,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMcWithCentFT0C, "Process MC w/o ML information on Ds, with information on centrality from FT0C", false); @@ -756,7 +747,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMcWithCentFT0M, "Process MC w/o ML information on Ds, with information on centrality from FT0M", false); @@ -766,7 +757,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMcWithCentNTracksPV, "Process MC w/o ML information on Ds, with information on centrality from NTracksPV", false); @@ -776,7 +767,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMc, "Process MC w/o ML information on Ds, w/o information on centrality", false); @@ -786,7 +777,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoWithMlPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMcWithMlAndCentFT0C, "Process MC with ML information on Ds, with information on centrality from FT0C", false); @@ -796,7 +787,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoWithMlPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMcWithMlAndCentFT0M, "Process MC with ML information on Ds, with information on centrality from FT0M", false); @@ -806,7 +797,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoWithMlPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMcWithMlAndCentNTracksPV, "Process MC with ML information on Ds, with information on centrality from NTracksPV", false); @@ -816,7 +807,7 @@ struct HfTaskDs { aod::McCollisions const&, aod::TracksWMc const&) { - runMcAnalysisPerCollision(collisions, candsDs, mcParticles, candDsMcRecoWithMlPerCollision); + runMcAnalysisPerCollision(collisions, candsDs, mcParticles); } PROCESS_SWITCH(HfTaskDs, processMcWithMl, "Process MC with ML information on Ds, w/o information on centrality", false); }; diff --git a/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx b/PWGHF/D2H/Tasks/taskDstarToD0Pi.cxx index 35a6ce4c74b..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; @@ -47,16 +52,22 @@ struct HfTaskDstarToD0Pi { using CollisionsWCent = soa::Join; using CollisionsWCentMcLabel = soa::Join; + 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; - Partition rowsSelectedCandDstar = aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == selectionFlagDstarToD0Pi; Partition rowsSelectedCandDstarMcRec = aod::hf_sel_candidate_dstar::isRecoD0Flag == selectionFlagHfD0ToPiK; 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", @@ -77,10 +88,14 @@ struct HfTaskDstarToD0Pi { AxisSpec axisDecayLength = {binningDecayLength, " decay length (cm)"}; AxisSpec axisNormDecayLength = {binningNormDecayLength, "normalised decay length (cm)"}; AxisSpec axisCentrality = {binningCentrality, "centrality (%)"}; - - 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, {{100, 0.13, 0.16}, {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, {{100, 0.13, 0.16}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); - registry.add("Yield/hDeltaInvMassDstar1D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2}); entries", {HistType::kTH1F, {{100, 0.13, 0.16}}}, true); + 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); + registry.add("Yield/hDeltaInvMassDstar1D", "#Delta #it{M}_{inv} D* Candidate; inv. mass ((#pi #pi k) - (#pi k)) (GeV/#it{c}^{2}); entries", {HistType::kTH1F, {{axisDeltaInvMass}}}, true); registry.add("Yield/hInvMassDstar", "#Delta #it{M}_{inv} D* Candidate; inv. mass (#pi #pi k) (GeV/#it{c}^{2}); entries", {HistType::kTH1F, {{500, 0., 5.0}}}, true); registry.add("Yield/hInvMassD0", "#it{M}_{inv}D^{0} candidate;#it{M}_{inv} D^{0} (GeV/#it{c});#it{p}_{T} (GeV/#it{c})", {HistType::kTH2F, {{500, 0., 5.0}, {vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}, true); // only QA @@ -112,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.}}}); @@ -139,68 +155,123 @@ struct HfTaskDstarToD0Pi { // Non Prmpt Gen registry.add("QA/hPtNonPromptDstarGen", "MC Matched Non-Prompt D* Candidates at Generator Level; #it{p}_{T} of D*", {HistType::kTH1F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("QA/hPtVsYNonPromptDstarGen", "MC Matched Non-Prompt D* Candidates at Generator Level; #it{p}_{T} of D*; #it{y}", {HistType::kTH2F, {{vecPtBins, "#it{p}_{T} (GeV/#it{c})"}, {100, -5., 5.}}}); + + // Checking PV contributors from Data as well MC rec + 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&, CandDstarWSelFlag const&) + template + void runTaskDstar(CollisionsWCent const& cols, T1 selectedCands, T2 preslice) { - for (const auto& candDstar : rowsSelectedCandDstar) { - auto yDstar = candDstar.y(constants::physics::MassDStar); - if (yCandDstarRecoMax >= 0. && std::abs(yDstar) > yCandDstarRecoMax) { - continue; + for (const auto& col : cols) { + auto nPVContributors = col.numContrib(); + auto centrality = col.centFT0M(); + registry.fill(HIST("Efficiency/hNumPvContributorsAll"), nPVContributors, centrality); + + auto gIndexCol = col.globalIndex(); + auto selectedCandsCurrentCol = selectedCands.sliceBy(preslice, gIndexCol); + auto nCandsCurrentCol = selectedCandsCurrentCol.size(); + + if (nCandsCurrentCol > 0) { + LOGF(debug, "size of selectedCandsCurrentCol: %d", nCandsCurrentCol); + registry.fill(HIST("Efficiency/hNumPvContributorsCand"), nPVContributors, centrality); } - registry.fill(HIST("QA/hPtDstar"), candDstar.pt()); - registry.fill(HIST("QA/hPtD0"), candDstar.ptD0()); - registry.fill(HIST("QA/hPtSoftPi"), candDstar.ptSoftPi()); - registry.fill(HIST("QA/hEtaDstar"), candDstar.eta(), candDstar.pt()); - registry.fill(HIST("QA/hCtD0"), candDstar.ctD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthD0"), candDstar.decayLengthD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthXYD0"), candDstar.decayLengthXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthNormalisedD0"), candDstar.decayLengthNormalisedD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthXYNormalisedD0"), candDstar.decayLengthXYNormalisedD0(), candDstar.pt()); - registry.fill(HIST("QA/hCPAD0"), candDstar.cpaD0(), candDstar.pt()); - registry.fill(HIST("QA/hCPAxyD0"), candDstar.cpaXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterXYD0"), candDstar.impactParameterXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hDeltaIPMaxNormalisedD0"), candDstar.deltaIPNormalisedMaxD0(), candDstar.pt()); - registry.fill(HIST("QA/hSqSumProngsImpactParameterD0"), candDstar.impactParameterProngSqSumD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthErrorD0"), candDstar.errorDecayLengthD0(), candDstar.pt()); - registry.fill(HIST("QA/hDecayLengthXYErrorD0"), candDstar.errorDecayLengthXYD0(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter0(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter1(), candDstar.pt()); - registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpParamSoftPi(), candDstar.pt()); - registry.fill(HIST("QA/hd0Prong0"), candDstar.impactParameter0(), candDstar.pt()); - registry.fill(HIST("QA/hd0Prong1"), candDstar.impactParameter1(), candDstar.pt()); - registry.fill(HIST("QA/hd0ProngSoftPi"), candDstar.impParamSoftPi(), candDstar.pt()); - - auto invDstar = candDstar.invMassDstar(); - auto invAntiDstar = candDstar.invMassAntiDstar(); - auto invD0 = candDstar.invMassD0(); - auto invD0Bar = candDstar.invMassD0Bar(); - - auto collision = candDstar.collision_as(); - auto centrality = collision.centFT0M(); // 0-100% - - auto signDstar = candDstar.signSoftPi(); - if (signDstar > 0) { - registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), (invDstar - invD0), candDstar.pt(), centrality); - registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), (invDstar - invD0), candDstar.pt()); - registry.fill(HIST("Yield/hInvMassD0"), invD0, candDstar.ptD0()); - registry.fill(HIST("Yield/hDeltaInvMassDstar1D"), (invDstar - invD0)); - registry.fill(HIST("Yield/hInvMassDstar"), invDstar); - // filling pt of two pronges of D0 - registry.fill(HIST("QA/hPtProng0D0"), candDstar.ptProng0()); - registry.fill(HIST("QA/hPtProng1D0"), candDstar.ptProng1()); - } else if (signDstar < 0) { - registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), (invAntiDstar - invD0Bar), candDstar.pt(), centrality); - registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), (invAntiDstar - invD0Bar), candDstar.pt()); - registry.fill(HIST("Yield/hInvMassD0"), invD0Bar, candDstar.ptD0()); - registry.fill(HIST("Yield/hDeltaInvMassDstar1D"), (invAntiDstar - invD0Bar)); - registry.fill(HIST("Yield/hInvMassDstar"), invAntiDstar); - // filling pt of two pronges of D0Bar - registry.fill(HIST("QA/hPtProng0D0Bar"), candDstar.ptProng0()); - registry.fill(HIST("QA/hPtProng1D0Bar"), candDstar.ptProng1()); + + int nCandsSignalRegion = 0; + for (const auto& candDstar : selectedCandsCurrentCol) { + auto yDstar = candDstar.y(constants::physics::MassDStar); + if (yCandDstarRecoMax >= 0. && std::abs(yDstar) > yCandDstarRecoMax) { + continue; + } + + registry.fill(HIST("QA/hPtDstar"), candDstar.pt()); + registry.fill(HIST("QA/hPtD0"), candDstar.ptD0()); + registry.fill(HIST("QA/hPtSoftPi"), candDstar.ptSoftPi()); + registry.fill(HIST("QA/hEtaDstar"), candDstar.eta(), candDstar.pt()); + registry.fill(HIST("QA/hCtD0"), candDstar.ctD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthD0"), candDstar.decayLengthD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthXYD0"), candDstar.decayLengthXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthNormalisedD0"), candDstar.decayLengthNormalisedD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthXYNormalisedD0"), candDstar.decayLengthXYNormalisedD0(), candDstar.pt()); + registry.fill(HIST("QA/hCPAD0"), candDstar.cpaD0(), candDstar.pt()); + registry.fill(HIST("QA/hCPAxyD0"), candDstar.cpaXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterXYD0"), candDstar.impactParameterXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hDeltaIPMaxNormalisedD0"), candDstar.deltaIPNormalisedMaxD0(), candDstar.pt()); + registry.fill(HIST("QA/hSqSumProngsImpactParameterD0"), candDstar.impactParameterProngSqSumD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthErrorD0"), candDstar.errorDecayLengthD0(), candDstar.pt()); + registry.fill(HIST("QA/hDecayLengthXYErrorD0"), candDstar.errorDecayLengthXYD0(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter0(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpactParameter1(), candDstar.pt()); + registry.fill(HIST("QA/hImpactParameterError"), candDstar.errorImpParamSoftPi(), candDstar.pt()); + registry.fill(HIST("QA/hd0Prong0"), candDstar.impactParameter0(), candDstar.pt()); + registry.fill(HIST("QA/hd0Prong1"), candDstar.impactParameter1(), candDstar.pt()); + registry.fill(HIST("QA/hd0ProngSoftPi"), candDstar.impParamSoftPi(), candDstar.pt()); + + auto invDstar = candDstar.invMassDstar(); + auto invAntiDstar = candDstar.invMassAntiDstar(); + auto invD0 = candDstar.invMassD0(); + auto invD0Bar = candDstar.invMassD0Bar(); + + auto signDstar = candDstar.signSoftPi(); + if (signDstar > 0) { + auto deltaMDstar = std::abs(invDstar - invD0); + 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()); + registry.fill(HIST("Yield/hDeltaInvMassDstar1D"), deltaMDstar); + registry.fill(HIST("Yield/hInvMassDstar"), invDstar); + // filling pt of two pronges of D0 + registry.fill(HIST("QA/hPtProng0D0"), candDstar.ptProng0()); + registry.fill(HIST("QA/hPtProng1D0"), candDstar.ptProng1()); + } else if (signDstar < 0) { + auto deltaMAntiDstar = std::abs(invAntiDstar - invD0Bar); + if (0.142f < deltaMAntiDstar && deltaMAntiDstar < 0.15f) { + nCandsSignalRegion++; + } + registry.fill(HIST("Yield/hDeltaInvMassDstar3D"), deltaMAntiDstar, candDstar.pt(), centrality); + registry.fill(HIST("Yield/hDeltaInvMassDstar2D"), deltaMAntiDstar, candDstar.pt()); + registry.fill(HIST("Yield/hInvMassD0"), invD0Bar, candDstar.ptD0()); + registry.fill(HIST("Yield/hDeltaInvMassDstar1D"), deltaMAntiDstar); + registry.fill(HIST("Yield/hInvMassDstar"), invAntiDstar); + // filling pt of two pronges of D0Bar + registry.fill(HIST("QA/hPtProng0D0Bar"), candDstar.ptProng0()); + registry.fill(HIST("QA/hPtProng1D0Bar"), candDstar.ptProng1()); + } + } // candidate loop for current collision ends + + if (nCandsSignalRegion > 0) { + registry.fill(HIST("Efficiency/hNumPvContributorsCandInMass"), nPVContributors, centrality); } - } + } // 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, @@ -224,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..25f0803bdb9 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -57,6 +57,9 @@ 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 saveEpResoHisto{"saveEpResoHisto", false, "Flag to save event plane resolution histogram"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -118,53 +121,59 @@ struct HfTaskFlowCharmHadrons { const AxisSpec thnAxisMlOne{thnConfigAxisMlOne, "Bkg score"}; const AxisSpec thnAxisMlTwo{thnConfigAxisMlTwo, "FD score"}; + 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}}); + registry.add("hSparseFlowCharm", "THn for SP", HistType::kTHnSparseF, axes); + + 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}}); + } - 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(); } - - hfEvSel.addHistograms(registry); // collision monitoring - ccdb->setURL(ccdbUrl); - ccdb->setCaching(true); - ccdb->setLocalObjectValidityChecking(); }; // end init /// Compute the Q vector for the candidate's tracks @@ -236,9 +245,17 @@ struct HfTaskFlowCharmHadrons { std::vector& outputMl) { if (storeMl) { - registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp, outputMl[0], outputMl[1]); + 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 { - registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, cosNPhi, cosDeltaPhi, sp); + if (storeEP) { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp, cosNPhi, cosDeltaPhi); + } else { + registry.fill(HIST("hSparseFlowCharm"), mass, pt, cent, sp); + } } } @@ -339,12 +356,16 @@ struct HfTaskFlowCharmHadrons { void runFlowAnalysis(CollsWithQvecs::iterator const& collision, T1 const& candidates) { + float cent = getCentrality(collision); + if (cent < centralityMin || cent > centralityMax) { + return; + } + 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) { diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 842c4b18e11..2a5b869b789 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -18,12 +18,15 @@ /// \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" #include "Framework/runDataProcessing.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -39,11 +42,11 @@ 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}, ""}; - ConfigurableAxis thnConfigAxisMultiplicity{"thnConfigAxisMultiplicity", {100, 0, 1000}, ""}; + ConfigurableAxis thnConfigAxisCentrality{"thnConfigAxisCentrality", {100, 0, 100}, ""}; ConfigurableAxis thnConfigAxisChi2PCA{"thnConfigAxisChi2PCA", {100, 0, 20}, ""}; ConfigurableAxis thnConfigAxisDecLength{"thnConfigAxisDecLength", {10, 0, 0.05}, ""}; ConfigurableAxis thnConfigAxisCPA{"thnConfigAxisCPA", {20, 0.8, 1}, ""}; @@ -52,13 +55,24 @@ struct HfTaskLc { ConfigurableAxis thnConfigAxisCanType{"thnConfigAxisCanType", {5, 0., 5.}, ""}; HfHelper hfHelper; - Filter filterSelectCandidates = aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc; + + 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; + Preslice perMcCollision = aod::mcparticle::mcCollisionId; + Preslice candLcPerCollision = aod::hf_cand::collisionId; + SliceCache cache; HistogramRegistry registry{ "registry", @@ -88,7 +102,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}}}}, @@ -154,14 +167,14 @@ struct HfTaskLc { void init(InitContext&) { - std::array doprocess{doprocessDataStd, doprocessDataWithMl, doprocessMcStd, doprocessMcWithMl}; + std::array doprocess{doprocessDataStd, doprocessDataStdWithFT0C, doprocessDataStdWithFT0M, doprocessDataWithMl, doprocessDataWithMlWithFT0C, doprocessDataWithMlWithFT0M, doprocessMcStd, doprocessMcStdWithFT0C, doprocessMcStdWithFT0M, doprocessMcWithMl, doprocessMcWithMlWithFT0C, doprocessMcWithMlWithFT0M}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "no or more than one process function enabled! Please check your configuration!"); } 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})"}}}); @@ -259,13 +272,13 @@ 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})"}; const AxisSpec thnAxisPtProng1{thnConfigAxisPtProng, "#it{p}_{T}(prong1) (GeV/#it{c})"}; const AxisSpec thnAxisPtProng2{thnConfigAxisPtProng, "#it{p}_{T}(prong2) (GeV/#it{c})"}; - const AxisSpec thnAxisMultiplicity{thnConfigAxisMultiplicity, "multiplicity"}; + const AxisSpec thnAxisCentrality{thnConfigAxisCentrality, "centrality (FT0C)"}; const AxisSpec thnAxisChi2PCA{thnConfigAxisChi2PCA, "Chi2PCA to sec. vertex (cm)"}; const AxisSpec thnAxisDecLength{thnConfigAxisDecLength, "decay length (cm)"}; const AxisSpec thnAxisCPA{thnConfigAxisCPA, "cosine of pointing angle"}; @@ -274,157 +287,33 @@ struct HfTaskLc { const AxisSpec thnAxisBdtScoreLcNonPrompt{thnConfigAxisBdtScoreSignal, "BDT non-prompt score (Lc)"}; const AxisSpec thnAxisCanType{thnConfigAxisCanType, "candidates type"}; - if (doprocessDataWithMl || doprocessMcWithMl) { - registry.add("hnLcVarsWithBdt", "THn for Lambdac candidates with BDT scores", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisMultiplicity, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisCanType}); + 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, thnAxisMultiplicity, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisCanType}); + registry.add("hnLcVars", "THn for Lambdac candidates", HistType::kTHnSparseF, {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisCanType}); } } } - template - void processData(aod::Collision const& collision, - CandType const& candidates, - aod::TracksWDca const& tracks) + /// 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) { - 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(); - - 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) { - 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, nTracks, outputBkg, outputPrompt, outputFD, 0); - } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, nTracks, 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, nTracks, outputBkg, outputPrompt, outputFD, 0); - } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, nTracks, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, 0); - } - } - } - } + return o2::hf_centrality::getCentralityColl(collision); } - void processDataStd(aod::Collision const& collision, - LcCandidates const& selectedLcCandidates, - 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) { - processData(collision, selectedLcCandidates, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataStd, "Process Data with the standard method", true); - void processDataWithMl(aod::Collision const& collision, - LcCandidatesMl const& selectedLcCandidatesMl, - aod::TracksWDca const& tracks) - { - processData(collision, selectedLcCandidatesMl, tracks); - } - PROCESS_SWITCH(HfTaskLc, processDataWithMl, "Process Data with the ML method", false); + auto thisCollId = collision.globalIndex(); + auto groupedLcCandidates = candidates.sliceBy(candLcPerCollision, thisCollId); - /// Fills MC histograms. - template - void processMc(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; @@ -573,47 +462,50 @@ 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); if ((candidate.isSelLcToPKPi() >= selectionFlagLc) && pdgCodeProng0 == kProton) { 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 (todo: add multiplicity) - registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, 0, outputBkg, outputPrompt, outputFD, originType); + /// Fill the ML outputScores and variables of candidate + registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, originType); } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, 0, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, originType); + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, 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, 0, outputBkg, outputPrompt, outputFD, originType); + registry.get(HIST("hnLcVarsWithBdt"))->Fill(massLc, pt, cent, outputBkg, outputPrompt, outputFD, originType); } else { - registry.get(HIST("hnLcVars"))->Fill(massLc, pt, 0, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, originType); + registry.get(HIST("hnLcVars"))->Fill(massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, originType); } } } } } + } + /// Fill MC histograms at generated level + /// \tparam fillMl switch to fill ML histograms + template + void fillHistosMcGen(CandLcMcGen const& mcParticles) + { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::LcToPKPi) { @@ -652,21 +544,248 @@ struct HfTaskLc { } } - void processMcStd(LcCandidatesMc const& selectedLcCandidatesMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + /// Fill histograms for real data + /// \tparam fillMl switch to fill ML histograms + template + void fillHistosData(CollType const& collision, CandType const& candidates) { - processMc(selectedLcCandidatesMc, mcParticles, tracksWithMc); + 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, 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); + } + } + } + } + } + + /// 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. + auto mcParticlesPerColl = mcParticles.sliceBy(perMcCollision, collision.globalIndex()); + fillHistosMcGen(mcParticlesPerColl); + } + } + + 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, + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) + { + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMc, mcParticles); } PROCESS_SWITCH(HfTaskLc, processMcStd, "Process MC with the standard method", false); - void processMcWithMl(LcCandidatesMlMc const& selectedLcCandidatesMlMc, - soa::Join const& mcParticles, - aod::TracksWMc const& tracksWithMc) + void processMcWithMl(CollisionsMc const& collisions, + LcCandidatesMlMc const& selectedLcCandidatesMlMc, + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) + { + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMlMc, mcParticles); + } + PROCESS_SWITCH(HfTaskLc, processMcWithMl, "Process Mc with the ML method and without centrality", false); + + void processMcStdWithFT0C(CollisionsMcWithFT0C const& collisions, + LcCandidatesMc const& selectedLcCandidatesMc, + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) + { + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMc, mcParticles); + } + PROCESS_SWITCH(HfTaskLc, processMcStdWithFT0C, "Process MC with the standard method with FT0C centrality", false); + + void processMcWithMlWithFT0C(CollisionsMcWithFT0C const& collisions, + LcCandidatesMlMc const& selectedLcCandidatesMlMc, + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) + { + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMlMc, mcParticles); + } + PROCESS_SWITCH(HfTaskLc, processMcWithMlWithFT0C, "Process Mc with the ML method with FT0C centrality", false); + + void processMcStdWithFT0M(CollisionsMcWithFT0M const& collisions, + LcCandidatesMc const& selectedLcCandidatesMc, + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) + { + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMc, mcParticles); + } + PROCESS_SWITCH(HfTaskLc, processMcStdWithFT0M, "Process MC with the standard method with FT0M centrality", false); + + void processMcWithMlWithFT0M(CollisionsMcWithFT0M const& collisions, + LcCandidatesMlMc const& selectedLcCandidatesMlMc, + McParticles3ProngMatched const& mcParticles, + aod::McCollisions const&, + aod::TracksWMc const&) { - processMc(selectedLcCandidatesMlMc, mcParticles, tracksWithMc); + runAnalysisPerCollisionMc(collisions, selectedLcCandidatesMlMc, mcParticles); } - PROCESS_SWITCH(HfTaskLc, processMcWithMl, "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/taskXic.cxx b/PWGHF/D2H/Tasks/taskXic.cxx index df164fb9a77..613112f3279 100644 --- a/PWGHF/D2H/Tasks/taskXic.cxx +++ b/PWGHF/D2H/Tasks/taskXic.cxx @@ -74,20 +74,28 @@ struct HfTaskXic { HistogramRegistry registry{ "registry", // histo not in pt bins { - {"Data/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, // pt Xic - {"Data/hEta", "3-prong candidates;candidate #it{eta};entries", {HistType::kTH1F, {{100, -5., 5.}}}}, // eta Xic - {"Data/hPhi", "3-prong candidates;candidate #varphi;entries", {HistType::kTH1F, {{72, 0., constants::math::TwoPI}}}}, // phi Xic - {"Data/hMass", "3-prong candidates; inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1F, {{600, 2.18, 2.58}}}}, // mass Xic - {"Data/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{1000, 0., 1000.}}}}, - - {"MC/reconstructed/signal/hPtRecSig", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{360, 0., 36.}}}}, // pt Xic - {"MC/reconstructed/background/hPtRecBg", "3-prong candidates (unmatched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"MC/generated/hPtGen", "MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"MC/generated/hPtGenWithProngsInAcceptance", "MC particles (generated-daughters in acceptance); #it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 10.}}}}, - {"MC/generated/hEtaGen", "MC particles; #it{eta}^{gen} ;#it{p}_{T}^{gen.};entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - {"MC/generated/hYGen", "MC particles; #it{y}^{gen} ;#it{p}_{T}^{gen.} ;entries", {HistType::kTH1F, {{100, -2., 2.}}}}, - // add generated in acceptance!! - }}; + {"Data/hPt", "3-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, // pt Xic + {"Data/hEta", "3-prong candidates;candidate #it{eta};entries", {HistType::kTH1D, {{100, -5., 5.}}}}, // eta Xic + {"Data/hPhi", "3-prong candidates;candidate #varphi;entries", {HistType::kTH1D, {{72, 0., constants::math::TwoPI}}}}, // phi Xic + {"Data/hMass", "3-prong candidates; inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1D, {{600, 2.18, 2.58}}}}, // mass Xic + {"Data/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1D, {{1000, 0., 1000.}}}}, + {"MC/generated/signal/hPtGenSig", "3-prong candidates (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, + {"MC/generated/signal/hPtGen", "MC particles (matched);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, + {"MC/generated/prompt/hPtGenPrompt", "MC particles (matched, prompt);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, + {"MC/generated/nonprompt/hPtGenNonPrompt", "MC particles (matched, non-prompt);#it{p}_{T}^{gen.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, + {"MC/generated/signal/hEtaGen", "MC particles (matched);#it{#eta};entries", {HistType::kTH1D, {{100, -2., 2.}}}}, + {"MC/generated/prompt/hEtaGenPrompt", "MC particles (matched, prompt);#it{#eta};entries", {HistType::kTH1D, {{100, -2., 2.}}}}, + {"MC/generated/nonprompt/hEtaGenNonPrompt", "MC particles (matched, non-prompt);#it{#eta};entries", {HistType::kTH1D, {{100, -2., 2.}}}}, + {"MC/generated/signal/hYGen", "MC particles (matched);#it{y};entries", {HistType::kTH1D, {{100, -2., 2.}}}}, + {"MC/generated/prompt/hYGenPrompt", "MC particles (matched, prompt);#it{y};entries", {HistType::kTH1D, {{100, -2., 2.}}}}, + {"MC/generated/nonprompt/hYGenNonPrompt", "MC particles (matched, non-prompt);#it{y};entries", {HistType::kTH1D, {{100, -2., 2.}}}}, + {"MC/reconstructed/signal/hMassRecSig", "3-prong candidates (matched);inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1D, {{600, 2.18, 2.58}}}}, + {"MC/reconstructed/prompt/hMassRecSigPrompt", "3-prong candidates (matched, prompt);inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1D, {{600, 2.18, 2.58}}}}, + {"MC/reconstructed/nonprompt/hMassRecSigNonPrompt", "3-prong candidates (matched, non-prompt);inv. mass (p K #pi) (GeV/#it{c}^{2})", {HistType::kTH1D, {{600, 2.18, 2.58}}}}, + {"MC/reconstructed/signal/hPtRecSig", "3-prong candidates (matched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, + {"MC/reconstructed/prompt/hPtRecSigPrompt", "3-prong candidates (matched, prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, + {"MC/reconstructed/nonprompt/hPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1D, {{360, 0., 36.}}}}, + {"MC/reconstructed/background/hPtRecBg", "3-prong candidates (unmatched);#it{p}_{T}^{rec.} (GeV/#it{c});entries", {HistType::kTH1D, {{100, 0., 10.}}}}}}; void init(InitContext&) { @@ -174,6 +182,22 @@ struct HfTaskXic { registry.add("MC/reconstructed/signal/hPtProng2RecSig", "3-prong candidates;prong 2 #it{p}_{T} (GeV/#it{c});;entries", {HistType::kTH2F, {{100, 0., 10.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("MC/reconstructed/signal/hChi2PCARecSig", "3-prong candidates;prong Chi2PCA to sec. vertex (cm);; entries", {HistType::kTH2F, {{100, 0, 120}, {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, 2.18, 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, 2.18, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("MC/reconstructed/nonprompt/hMassVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);inv. mass (p K #pi) (GeV/#it{c}^{2}); p_{T}", {HistType::kTH2F, {{600, 2.18, 2.58}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + + registry.add("MC/reconstructed/signal/hEtaVsPtRecSig", "3-prong candidates (matched);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("MC/reconstructed/prompt/hEtaVsPtRecSigPrompt", "3-prong candidates (matched, prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("MC/reconstructed/nonprompt/hEtaVsPtRecSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + + registry.add("MC/generated/signal/hEtaVsPtGenSig", "3-prong candidates (matched);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("MC/generated/prompt/hEtaVsPtGenSigPrompt", "3-prong candidates (matched, prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("MC/generated/nonprompt/hEtaVsPtGenSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + + registry.add("MC/generated/signal/hYVsPtGenSig", "3-prong candidates (matched);candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("MC/generated/prompt/hYVsPtGenSigPrompt", "3-prong candidates (matched, prompt);candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("MC/generated/nonprompt/hYVsPtGenSigNonPrompt", "3-prong candidates (matched, non-prompt);candidate #it{y};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + // background registry.add("MC/reconstructed/background/hMassBg", "Invariant mass (unmatched);m (p K #pi) (GeV/#it{c}^{2});;entries", {HistType::kTH2F, {{500, 1.6, 3.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("MC/reconstructed/background/hDecLengthRecBg", "3-prong candidates;decay length (cm);;entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -413,12 +437,13 @@ struct HfTaskXic { registry.fill(HIST("MC/reconstructed/signal/hPtRecSig"), ptCandidate); // rec. level pT if (massXicToPKPi != 0.) { - registry.fill(HIST("MC/reconstructed/signal/hMassSig"), massXicToPKPi, ptCandidate); + registry.fill(HIST("MC/reconstructed/signal/hMassVsPtRecSig"), massXicToPKPi, ptCandidate); + registry.fill(HIST("MC/reconstructed/signal/hMassRecSig"), massXicToPKPi); } if (massXicToPiKP != 0.) { - registry.fill(HIST("MC/reconstructed/signal/hMassSig"), massXicToPiKP, ptCandidate); + registry.fill(HIST("MC/reconstructed/signal/hMassVsPtRecSig"), massXicToPiKP, ptCandidate); + registry.fill(HIST("MC/reconstructed/signal/hMassRecSig"), massXicToPiKP); } - registry.fill(HIST("MC/reconstructed/signal/hDecLengthRecSig"), candidate.decayLength(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hDecLengthXYRecSig"), candidate.decayLengthXY(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hNormalisedDecayLengthXYRecSig"), candidate.decayLengthXYNormalised(), ptCandidate); @@ -436,6 +461,32 @@ struct HfTaskXic { registry.fill(HIST("MC/reconstructed/signal/hImpParErrSig"), candidate.errorImpactParameter0(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hDecLenErrSig"), candidate.errorDecayLength(), ptCandidate); registry.fill(HIST("MC/reconstructed/signal/hChi2PCARecSig"), candidate.chi2PCA(), ptCandidate); + registry.fill(HIST("MC/reconstructed/signal/hEtaVsPtRecSig"), candidate.eta(), ptCandidate); + + /// reconstructed signal prompt + if (candidate.originMcRec() == RecoDecay::OriginType::Prompt) { + if ((candidate.isSelXicToPKPi() >= selectionFlagXic) && pdgCodeProng0 == kProton) { + registry.fill(HIST("MC/reconstructed/prompt/hMassRecSigPrompt"), massXicToPKPi); + registry.fill(HIST("MC/reconstructed/prompt/hMassVsPtRecSigPrompt"), massXicToPKPi, ptCandidate); + } + if ((candidate.isSelXicToPiKP() >= selectionFlagXic) && pdgCodeProng0 == kPiPlus) { + registry.fill(HIST("MC/reconstructed/prompt/hMassRecSigPrompt"), massXicToPiKP); + registry.fill(HIST("MC/reconstructed/prompt/hMassVsPtRecSigPrompt"), massXicToPiKP, ptCandidate); + } + registry.fill(HIST("MC/reconstructed/prompt/hEtaVsPtRecSigPrompt"), candidate.eta(), ptCandidate); + registry.fill(HIST("MC/reconstructed/prompt/hPtRecSigPrompt"), ptCandidate); + } else { + if ((candidate.isSelXicToPKPi() >= selectionFlagXic) && pdgCodeProng0 == kProton) { + registry.fill(HIST("MC/reconstructed/nonprompt/hMassRecSigNonPrompt"), massXicToPKPi); + registry.fill(HIST("MC/reconstructed/nonprompt/hMassVsPtRecSigNonPrompt"), massXicToPKPi, ptCandidate); + } + if ((candidate.isSelXicToPiKP() >= selectionFlagXic) && pdgCodeProng0 == kPiPlus) { + registry.fill(HIST("MC/reconstructed/nonprompt/hMassRecSigNonPrompt"), massXicToPiKP); + registry.fill(HIST("MC/reconstructed/nonprompt/hMassVsPtRecSigNonPrompt"), massXicToPiKP, ptCandidate); + } + registry.fill(HIST("MC/reconstructed/nonprompt/hEtaVsPtRecSigNonPrompt"), candidate.eta(), ptCandidate); + registry.fill(HIST("MC/reconstructed/nonprompt/hPtRecSigNonPrompt"), ptCandidate); + } if (enableTHn) { double massXic(-1); @@ -519,31 +570,31 @@ struct HfTaskXic { // MC gen. for (const auto& particle : mcParticles) { if (std::abs(particle.flagMcMatchGen()) == 1 << aod::hf_cand_3prong::DecayType::XicToPKPi) { - auto yParticle = RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus); - if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) { + auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassXiCPlus); + if (yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) { continue; } - auto ptParticle = particle.pt(); - std::array ptProngs; - std::array yProngs; - std::array etaProngs; - int counter = 0; - 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())); - counter++; + auto ptGen = particle.pt(); + 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); + registry.fill(HIST("MC/generated/signal/hEtaVsPtGenSig"), particle.eta(), ptGen); + registry.fill(HIST("MC/generated/signal/hYVsPtGenSig"), yGen, ptGen); + + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + 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); + registry.fill(HIST("MC/generated/prompt/hEtaVsPtGenSigPrompt"), particle.eta(), ptGen); + registry.fill(HIST("MC/generated/prompt/hYVsPtGenSigPrompt"), yGen, ptGen); } - registry.fill(HIST("MC/generated/hPtGen"), ptParticle); - registry.fill(HIST("MC/generated/hEtaGen"), particle.eta(), ptParticle); - registry.fill(HIST("MC/generated/hYGen"), yParticle, ptParticle); - // reject Xic daughters that are not in geometrical acceptance - if (!isProngInAcceptance(etaProngs[0], ptProngs[0]) || !isProngInAcceptance(etaProngs[1], ptProngs[1]) || !isProngInAcceptance(etaProngs[2], ptProngs[2])) { - continue; + if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { + 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); + registry.fill(HIST("MC/generated/nonprompt/hEtaVsPtGenSigNonPrompt"), particle.eta(), ptGen); + registry.fill(HIST("MC/generated/nonprompt/hYVsPtGenSigNonPrompt"), yGen, ptGen); } - registry.fill(HIST("MC/generated/hPtGenWithProngsInAcceptance"), ptParticle); - registry.fill(HIST("MC/generated/hYGenWithProngsInAcceptance"), yParticle, ptParticle); - registry.fill(HIST("MC/generated/hEtaGenWithProngsInAcceptance"), particle.eta(), ptParticle); } } } diff --git a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx index 56e39031b18..a5a14c734cc 100644 --- a/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx +++ b/PWGHF/D2H/Tasks/taskXicToXiPiPi.cxx @@ -13,7 +13,8 @@ /// \brief Ξc± → (Ξ∓ → (Λ → p π∓) π∓) π± π± analysis task /// \note adapted from taskBs.cxx /// -/// \author Phil Stahlhut +/// \author Phil Lennart Stahlhut , Heidelberg University +/// \author Carolina Reetz , Heidelberg University #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" diff --git a/PWGHF/D2H/Utils/utilsRedDataFormat.h b/PWGHF/D2H/Utils/utilsRedDataFormat.h index 2d99105e474..9740e55d372 100644 --- a/PWGHF/D2H/Utils/utilsRedDataFormat.h +++ b/PWGHF/D2H/Utils/utilsRedDataFormat.h @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file utilsRedDataFormat.h -/// \brief Event selection utilities for reduced data format analyses +/// \brief Utilities for reduced data format analyses /// \author Luca Aglietta , UniTO Turin #ifndef PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ @@ -51,4 +51,31 @@ void checkEvSel(Coll const& collision, o2::hf_evsel::HfEventSelection& hfEvSel, } } // namespace o2::hf_evsel +namespace o2::pid_tpc_tof_utils +{ +/// Helper function to retrive PID information of bachelor pion from b-hadron decay +/// \param prong1 pion track from reduced data format, soa::Join +template +float getTpcTofNSigmaPi1(const T1& prong1) +{ + float defaultNSigma = -999.f; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + + bool hasTpc = prong1.hasTPC(); + bool hasTof = prong1.hasTOF(); + + if (hasTpc && hasTof) { + float tpcNSigma = prong1.tpcNSigmaPi(); + float tofNSigma = prong1.tofNSigmaPi(); + return std::sqrt(.5f * tpcNSigma * tpcNSigma + .5f * tofNSigma * tofNSigma); + } + if (hasTpc) { + return std::abs(prong1.tpcNSigmaPi()); + } + if (hasTof) { + return std::abs(prong1.tofNSigmaPi()); + } + return defaultNSigma; +} +} // namespace o2::pid_tpc_tof_utils + #endif // PWGHF_D2H_UTILS_UTILSREDDATAFORMAT_H_ diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 27716aee943..5c206512490 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -34,6 +34,7 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" #include "PWGHF/Core/SelectorCuts.h" +#include "PWGHF/Utils/utilsPid.h" namespace o2::aod { @@ -338,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; @@ -482,7 +483,64 @@ DECLARE_SOA_COLUMN(ImpactParameterZ2, impactParameterZ2, float); DECLARE_SOA_COLUMN(ErrorImpactParameterZ2, errorImpactParameterZ2, float); //! DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterZNormalised2, impactParameterZNormalised2, //! [](float dca, float err) -> float { return dca / err; }); +/// prong PID nsigma DECLARE_SOA_COLUMN(NProngsContributorsPV, nProngsContributorsPV, uint8_t); //! number of prongs contributing to the primary-vertex reconstruction +DECLARE_SOA_COLUMN(NSigTpcPi0, nSigTpcPi0, float); //! TPC nSigma for pion hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTpcPi1, nSigTpcPi1, float); //! TPC nSigma for pion hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTpcPi2, nSigTpcPi2, float); //! TPC nSigma for pion hypothesis - prong 2 +DECLARE_SOA_COLUMN(NSigTpcKa0, nSigTpcKa0, float); //! TPC nSigma for kaon hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTpcKa1, nSigTpcKa1, float); //! TPC nSigma for kaon hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTpcKa2, nSigTpcKa2, float); //! TPC nSigma for kaon hypothesis - prong 2 +DECLARE_SOA_COLUMN(NSigTpcPr0, nSigTpcPr0, float); //! TPC nSigma for proton hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTpcPr1, nSigTpcPr1, float); //! TPC nSigma for proton hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTpcPr2, nSigTpcPr2, float); //! TPC nSigma for proton hypothesis - prong 2 +DECLARE_SOA_COLUMN(NSigTofPi0, nSigTofPi0, float); //! TOF nSigma for pion hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTofPi1, nSigTofPi1, float); //! TOF nSigma for pion hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTofPi2, nSigTofPi2, float); //! TOF nSigma for pion hypothesis - prong 2 +DECLARE_SOA_COLUMN(NSigTofKa0, nSigTofKa0, float); //! TOF nSigma for kaon hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTofKa1, nSigTofKa1, float); //! TOF nSigma for kaon hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTofKa2, nSigTofKa2, float); //! TOF nSigma for kaon hypothesis - prong 2 +DECLARE_SOA_COLUMN(NSigTofPr0, nSigTofPr0, float); //! TOF nSigma for proton hypothesis - prong 0 +DECLARE_SOA_COLUMN(NSigTofPr1, nSigTofPr1, float); //! TOF nSigma for proton hypothesis - prong 1 +DECLARE_SOA_COLUMN(NSigTofPr2, nSigTofPr2, float); //! TOF nSigma for proton hypothesis - prong 2 +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi0, tpcTofNSigmaPi0, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 0 + [](float tpcNSigmaPi0, float tofNSigmaPi0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi0, tofNSigmaPi0); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi1, tpcTofNSigmaPi1, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 1 + [](float tpcNSigmaPi1, float tofNSigmaPi1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi1, tofNSigmaPi1); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPi2, tpcTofNSigmaPi2, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 2 + [](float tpcNSigmaPi2, float tofNSigmaPi2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi2, tofNSigmaPi2); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaKa0, tpcTofNSigmaKa0, //! Combined NSigma separation with the TPC & TOF detectors for kaon - prong 0 + [](float tpcNSigmaKa0, float tofNSigmaKa0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa0, tofNSigmaKa0); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaKa1, tpcTofNSigmaKa1, //! Combined NSigma separation with the TPC & TOF detectors for kaon - prong 1 + [](float tpcNSigmaKa1, float tofNSigmaKa1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa1, tofNSigmaKa1); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaKa2, tpcTofNSigmaKa2, //! Combined NSigma separation with the TPC & TOF detectors for kaon - prong 2 + [](float tpcNSigmaKa2, float tofNSigmaKa2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa2, tofNSigmaKa2); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPr0, tpcTofNSigmaPr0, //! Combined NSigma separation with the TPC & TOF detectors for proton - prong 0 + [](float tpcNSigmaPr0, float tofNSigmaPr0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr0, tofNSigmaPr0); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPr1, tpcTofNSigmaPr1, //! Combined NSigma separation with the TPC & TOF detectors for proton - prong 1 + [](float tpcNSigmaPr1, float tofNSigmaPr1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr1, tofNSigmaPr1); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaPr2, tpcTofNSigmaPr2, //! Combined NSigma separation with the TPC & TOF detectors for proton - prong 2 + [](float tpcNSigmaPr2, float tofNSigmaPr2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr2, tofNSigmaPr2); }); +// tiny (binned) option +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyPi0, tpcTofNSigmaTinyPi0, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 0 + [](float tpcNSigmaPi0, float tofNSigmaPi0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi0, tofNSigmaPi0); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyPi1, tpcTofNSigmaTinyPi1, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 1 + [](float tpcNSigmaPi1, float tofNSigmaPi1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi1, tofNSigmaPi1); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyPi2, tpcTofNSigmaTinyPi2, //! Combined NSigma separation with the TPC & TOF detectors for pion - prong 2 + [](float tpcNSigmaPi2, float tofNSigmaPi2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi2, tofNSigmaPi2); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyKa0, tpcTofNSigmaTinyKa0, //! Combined NSigma separation with the TPC & TOF detectors for kaon - prong 0 + [](float tpcNSigmaKa0, float tofNSigmaKa0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa0, tofNSigmaKa0); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyKa1, tpcTofNSigmaTinyKa1, //! Combined NSigma separation with the TPC & TOF detectors for kaon - prong 1 + [](float tpcNSigmaKa1, float tofNSigmaKa1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa1, tofNSigmaKa1); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyKa2, tpcTofNSigmaTinyKa2, //! Combined NSigma separation with the TPC & TOF detectors for kaon - prong 2 + [](float tpcNSigmaKa2, float tofNSigmaKa2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa2, tofNSigmaKa2); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyPr0, tpcTofNSigmaTinyPr0, //! Combined NSigma separation with the TPC & TOF detectors for proton - prong 0 + [](float tpcNSigmaPr0, float tofNSigmaPr0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr0, tofNSigmaPr0); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyPr1, tpcTofNSigmaTinyPr1, //! Combined NSigma separation with the TPC & TOF detectors for proton - prong 1 + [](float tpcNSigmaPr1, float tofNSigmaPr1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr1, tofNSigmaPr1); }); +DECLARE_SOA_DYNAMIC_COLUMN(TpcTofNSigmaTinyPr2, tpcTofNSigmaTinyPr2, //! Combined NSigma separation with the TPC & TOF detectors for proton - prong 2 + [](float tpcNSigmaPr2, float tofNSigmaPr2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPr2, tofNSigmaPr2); }); + // candidate properties DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, //! [](float px, float py) -> float { return RecoDecay::pt(px, py); }); @@ -633,7 +691,36 @@ DECLARE_SOA_TABLE(HfCand2ProngBase, "AOD", "HFCAND2PBASE", //! DECLARE_SOA_EXTENDED_TABLE_USER(HfCand2ProngExt, HfCand2ProngBase, "HFCAND2PEXT", //! hf_cand_2prong::Px, hf_cand_2prong::Py, hf_cand_2prong::Pz); +DECLARE_SOA_TABLE(HfProng0PidPi, "AOD", "HFP0PIDPI", //! + hf_cand::NSigTpcPi0, hf_cand::NSigTofPi0, + hf_cand::TpcTofNSigmaPi0); +DECLARE_SOA_TABLE(HfProng1PidPi, "AOD", "HFP1PIDPI", //! + hf_cand::NSigTpcPi1, hf_cand::NSigTofPi1, + hf_cand::TpcTofNSigmaPi1); +DECLARE_SOA_TABLE(HfProng2PidPi, "AOD", "HFP2PIDPI", //! + hf_cand::NSigTpcPi2, hf_cand::NSigTofPi2, + hf_cand::TpcTofNSigmaPi2); +DECLARE_SOA_TABLE(HfProng0PidKa, "AOD", "HFP0PIDKA", //! + hf_cand::NSigTpcKa0, hf_cand::NSigTofKa0, + hf_cand::TpcTofNSigmaKa0); +DECLARE_SOA_TABLE(HfProng1PidKa, "AOD", "HFP1PIDKA", //! + hf_cand::NSigTpcKa1, hf_cand::NSigTofKa1, + hf_cand::TpcTofNSigmaKa1); +DECLARE_SOA_TABLE(HfProng2PidKa, "AOD", "HFP2PIDKA", //! + hf_cand::NSigTpcKa2, hf_cand::NSigTofKa2, + hf_cand::TpcTofNSigmaKa2); +DECLARE_SOA_TABLE(HfProng0PidPr, "AOD", "HFP0PIDPR", //! + hf_cand::NSigTpcPr0, hf_cand::NSigTofPr0, + hf_cand::TpcTofNSigmaPr0); +DECLARE_SOA_TABLE(HfProng1PidPr, "AOD", "HFP1PIDPR", //! + hf_cand::NSigTpcPr1, hf_cand::NSigTofPr1, + hf_cand::TpcTofNSigmaPr1); +DECLARE_SOA_TABLE(HfProng2PidPr, "AOD", "HFP2PIDPR", //! + hf_cand::NSigTpcPr2, hf_cand::NSigTofPr2, + hf_cand::TpcTofNSigmaPr2); + using HfCand2Prong = HfCand2ProngExt; +using HfCand2ProngWPid = soa::Join; DECLARE_SOA_TABLE(HfCand2ProngKF, "AOD", "HFCAND2PKF", hf_cand::KfTopolChi2OverNdf, @@ -756,11 +843,12 @@ namespace hf_cand_bplus { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfCand2Prong, "_0"); // D0 index // MC matching result: -DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level -DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level -DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level -DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level +DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level +DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level enum DecayType { BplusToD0Pi = 0 }; @@ -1432,7 +1520,9 @@ 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); // MC matching result: DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level @@ -1503,7 +1593,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); @@ -1659,17 +1750,19 @@ namespace hf_cand_b0 { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfCand3Prong, "_0"); // D index // MC matching result: -DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level -DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level -DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level -DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level +DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level +DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level // mapping of decay types enum DecayType { B0ToDPi }; enum DecayTypeMc : uint8_t { B0ToDplusPiToPiKPiPi = 0, B0ToDsPiToKKPiPi, + BsToDsPiToKKPiPi, PartlyRecoDecay, OtherDecay, NDecayTypeMc }; @@ -1732,16 +1825,23 @@ namespace hf_cand_bs { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfCand3Prong, "_0"); // Ds index // MC matching result: -DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level -DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstruction level +DECLARE_SOA_COLUMN(FlagMcMatchGen, flagMcMatchGen, int8_t); // generator level +DECLARE_SOA_COLUMN(OriginMcRec, originMcRec, int8_t); // particle origin, reconstruction level +DECLARE_SOA_COLUMN(OriginMcGen, originMcGen, int8_t); // particle origin, generator level +DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level // mapping of decay types enum DecayType { BsToDsPi }; -enum DecayTypeMc : uint8_t { BsToDsPiToKKPiPi = 0, // Bs(bar) → Ds∓ π± → (Phi π∓) π± → (K- K+ π∓) π± - B0ToDsPiToKKPiPi, // B0(bar) → Ds± π∓ → (Phi π±) π∓ → (K- K+ π±) π∓ - PartlyRecoDecay, // 4 final state particles have another common b-hadron ancestor - NDecayTypeMc }; // counter of differentiated MC decay types +enum DecayTypeMc : uint8_t { BsToDsPiToPhiPiPiToKKPiPi = 0, // Bs(bar) → Ds∓ π± → (Phi π∓) π± → (K- K+ π∓) π± + BsToDsPiToK0starKPiToKKPiPi, // Bs(bar) → Ds∓ π± → (K0* K∓) π± → (K- K+ π∓) π± + B0ToDsPiToPhiPiPiToKKPiPi, // B0(bar) → Ds± π∓ → (Phi π±) π∓ → (K- K+ π±) π∓ + B0ToDsPiToK0starKPiToKKPiPi, // B0(bar) → Ds± π∓ → (K0* K±) π∓ → (K- K+ π±) π∓ + PartlyRecoDecay, // 4 final state particles have another common b-hadron ancestor + OtherDecay, + NDecayTypeMc }; // counter of differentiated MC decay types } // namespace hf_cand_bs @@ -1754,8 +1854,6 @@ DECLARE_SOA_TABLE(HfCandBsBase, "AOD", "HFCANDBSBASE", hf_cand::PxProng1, hf_cand::PyProng1, hf_cand::PzProng1, hf_cand::ImpactParameter0, hf_cand::ImpactParameter1, hf_cand::ErrorImpactParameter0, hf_cand::ErrorImpactParameter1, - hf_cand_bs::Prong0Id, hf_track_index::Prong1Id, - hf_track_index::HFflag, /* dynamic columns */ hf_cand_2prong::M, hf_cand_2prong::M2, @@ -1777,13 +1875,17 @@ DECLARE_SOA_TABLE(HfCandBsBase, "AOD", "HFCANDBSBASE", hf_cand::Phi, hf_cand::Y, hf_cand::E, - hf_cand::E2); + hf_cand::E2, + o2::soa::Marker<1>); // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(HfCandBsExt, HfCandBsBase, "HFCANDBSEXT", hf_cand_2prong::Px, hf_cand_2prong::Py, hf_cand_2prong::Pz); -using HfCandBs = HfCandBsExt; +DECLARE_SOA_TABLE(HfCandBsProngs, "AOD", "HFCANDBSPRONGS", + hf_cand_bs::Prong0Id, hf_track_index::Prong1Id); + +using HfCandBs = soa::Join; // table with results of reconstruction level MC matching DECLARE_SOA_TABLE(HfCandBsMcRec, "AOD", "HFCANDBSMCREC", diff --git a/PWGHF/DataModel/DerivedTables.h b/PWGHF/DataModel/DerivedTables.h index 30bc06c3bc6..62c7a9cd15c 100644 --- a/PWGHF/DataModel/DerivedTables.h +++ b/PWGHF/DataModel/DerivedTables.h @@ -18,7 +18,6 @@ #include -#include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisDataModel.h" #include "Framework/ASoA.h" @@ -29,8 +28,8 @@ namespace o2::aod { -constexpr uint MarkerD0 = 1; -constexpr uint Marker3P = 2; +constexpr uint MarkerD0 = 10; +constexpr uint Marker3P = 20; // ================ // Collision tables @@ -51,49 +50,50 @@ DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float); //! z-equalised b // 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); +DECLARE_SOA_TABLE_STAGED(HfD0CollBases, "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; +using StoredHfD0CollBase = StoredHfD0CollBases::iterator; -DECLARE_SOA_TABLE(HfD0CollIds, "AOD", "HFD0COLLID", //! Table with original global indices of collisions - hf_cand::CollisionId, - soa::Marker); +DECLARE_SOA_TABLE_STAGED(HfD0CollIds, "HFD0COLLID", //! Table with original global indices of collisions + hf_cand::CollisionId); // 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); +DECLARE_SOA_TABLE_STAGED(Hf3PCollBases, "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, + o2::soa::Marker); using Hf3PCollBase = Hf3PCollBases::iterator; +using StoredHf3PCollBase = StoredHf3PCollBases::iterator; -DECLARE_SOA_TABLE(Hf3PCollIds, "AOD", "HF3PCOLLID", //! Table with original global indices of collisions - hf_cand::CollisionId, - soa::Marker); +DECLARE_SOA_TABLE_STAGED(Hf3PCollIds, "HF3PCOLLID", //! Table with original global indices of collisions + hf_cand::CollisionId, + soa::Marker); // =================== // MC collision tables @@ -115,39 +115,41 @@ DECLARE_SOA_ARRAY_INDEX_COLUMN(Hf3PCollBase, hfCollBases); //! collision index a // DO -DECLARE_SOA_TABLE(HfD0McCollBases, "AOD", "HFD0MCCOLLBASE", //! Table with basic MC collision info - o2::soa::Index<>, - mccollision::PosX, - mccollision::PosY, - mccollision::PosZ, - soa::Marker); +DECLARE_SOA_TABLE_STAGED(HfD0McCollBases, "HFD0MCCOLLBASE", //! Table with basic MC collision info + o2::soa::Index<>, + mccollision::PosX, + mccollision::PosY, + mccollision::PosZ, + soa::Marker); using HfD0McCollBase = HfD0McCollBases::iterator; +using StoredHfD0McCollBase = StoredHfD0McCollBases::iterator; -DECLARE_SOA_TABLE(HfD0McCollIds, "AOD", "HFD0MCCOLLID", //! Table with original global indices of MC collisions - hf_mc_coll::McCollisionId, - soa::Marker); +DECLARE_SOA_TABLE_STAGED(HfD0McCollIds, "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); +DECLARE_SOA_TABLE_STAGED(HfD0McRCollIds, "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); +DECLARE_SOA_TABLE_STAGED(Hf3PMcCollBases, "HF3PMCCOLLBASE", //! Table with basic MC collision info + o2::soa::Index<>, + mccollision::PosX, + mccollision::PosY, + mccollision::PosZ, + soa::Marker); using Hf3PMcCollBase = Hf3PMcCollBases::iterator; +using StoredHf3PMcCollBase = StoredHf3PMcCollBases::iterator; -DECLARE_SOA_TABLE(Hf3PMcCollIds, "AOD", "HF3PMCCOLLID", //! Table with original global indices of MC collisions - hf_mc_coll::McCollisionId, - soa::Marker); +DECLARE_SOA_TABLE_STAGED(Hf3PMcCollIds, "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); +DECLARE_SOA_TABLE_STAGED(Hf3PMcRCollIds, "HF3PMCRCOLLID", //! Table with indices pointing to the derived reconstructed-collision table + hf_mc_coll::der_3p::Hf3PCollBaseIds); // ================ // Candidate tables @@ -267,195 +269,195 @@ DECLARE_SOA_COLUMN(MlScores, mlScores, std::vector); //! vector o // 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); +DECLARE_SOA_TABLE_STAGED(HfD0Bases, "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(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); +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, + 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, + soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfD0Sels, "HFD0SEL", //! Table with candidate selection flags + hf_cand_sel::CandidateSelFlag, + soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfD0Mls, "HFD0ML", //! Table with candidate selection ML scores + hf_cand_mc::MlScores, + soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfD0Ids, "HFD0ID", //! Table with original global indices for candidates + hf_cand::CollisionId, + hf_track_index::Prong0Id, + hf_track_index::Prong1Id, + soa::Marker); + +DECLARE_SOA_TABLE_STAGED(HfD0Mcs, "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(Hf3PBases, "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(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); +DECLARE_SOA_TABLE_STAGED(Hf3PPars, "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_STAGED(Hf3PParEs, "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_STAGED(Hf3PSels, "HF3PSEL", //! Table with candidate selection flags + hf_cand_sel::CandidateSelFlag, + soa::Marker); + +DECLARE_SOA_TABLE_STAGED(Hf3PMls, "HF3PML", //! Table with candidate selection ML scores + hf_cand_mc::MlScores, + soa::Marker); + +DECLARE_SOA_TABLE_STAGED(Hf3PIds, "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_STAGED(Hf3PMcs, "HF3PMC", //! Table with MC candidate info + hf_cand_mc::FlagMcMatchRec, + hf_cand_mc::OriginMcRec, + hf_cand_mc::IsCandidateSwapped, + soa::Marker); // ================== // MC particle tables @@ -481,47 +483,47 @@ DECLARE_SOA_COLUMN(FlagMcDecayChanGen, flagMcDecayChanGen, int8_t); //! resonant // 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); +DECLARE_SOA_TABLE_STAGED(HfD0PBases, "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_STAGED(HfD0PIds, "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); +DECLARE_SOA_TABLE_STAGED(Hf3PPBases, "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_STAGED(Hf3PPIds, "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..4609b21df95 100644 --- a/PWGHF/HFC/DataModel/CorrelationTables.h +++ b/PWGHF/HFC/DataModel/CorrelationTables.h @@ -97,13 +97,14 @@ DECLARE_SOA_TABLE(DHadronRecoInfo, "AOD", "DHADRONRECOINFO", //! D0-Hadrons pair // 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(SignalStatus, signalStatus, int); //! Tag for LcToPKPi/LcToPiKP +DECLARE_SOA_COLUMN(PoolBin, poolBin, int); //! Pool Bin for the MixedEvent +DECLARE_SOA_COLUMN(IsAutoCorrelated, isAutoCorrelated, bool); //! Correlation Status } // namespace hf_correlation_lc_hadron DECLARE_SOA_TABLE(LcHadronPair, "AOD", "LCHPAIR", //! Lc-Hadrons pairs Informations @@ -111,7 +112,8 @@ 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, diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h new file mode 100644 index 00000000000..f8350111bdc --- /dev/null +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -0,0 +1,70 @@ +// 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(DsCandReduced, "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(AssocTrackRed, "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/TableProducer/correlatorD0Hadrons.cxx b/PWGHF/HFC/TableProducer/correlatorD0Hadrons.cxx index 3fc2a915496..3d8bf16dd31 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 @@ -264,22 +268,6 @@ 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; - } // ======= 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) @@ -293,7 +281,7 @@ struct HfCorrelatorD0Hadrons { } // find leading particle if (correlateD0WithLeadingParticle) { - leadingIndex = findLeadingParticle(tracks); + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value); } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); @@ -437,7 +425,7 @@ struct HfCorrelatorD0Hadrons { } // find leading particle if (correlateD0WithLeadingParticle) { - leadingIndex = findLeadingParticle(tracks); + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value); } int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); int nTracks = 0; @@ -559,7 +547,7 @@ struct HfCorrelatorD0Hadrons { if (track.globalIndex() != leadingIndex) { continue; } - registry.fill(HIST("hTrackCounter"), 4); // fill no. of tracks have leading particle + registry.fill(HIST("hTrackCounterRec"), 4); // fill no. of tracks have leading particle } int signalStatus = 0; @@ -605,6 +593,10 @@ struct HfCorrelatorD0Hadrons { { registry.fill(HIST("hEvtCountGen"), 0); // MC gen level + // find leading particle + if (correlateD0WithLeadingParticle) { + 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! if (std::abs(particle1.pdgCode()) != Pdg::kD0) { @@ -647,11 +639,23 @@ struct HfCorrelatorD0Hadrons { auto indexMotherPi = RecoDecay::getMother(mcParticles, particle2, Pdg::kDStar, true, nullptr, 1); // last arguement 1 is written to consider immediate decay mother only auto indexMotherD0 = RecoDecay::getMother(mcParticles, particle1, Pdg::kDStar, true, nullptr, 1); - if (std::abs(particle2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0) - continue; + bool correlationStatus = false; + if (std::abs(particle2.pdgCode()) == kPiPlus && indexMotherPi >= 0 && indexMotherD0 >= 0 && indexMotherPi == indexMotherD0) { + if (!storeAutoCorrelationFlag) { + continue; + } + correlationStatus = true; + } registry.fill(HIST("hTrackCounterGen"), 3); // fill after soft pion removal + if (correlateD0WithLeadingParticle) { + if (particle2.globalIndex() != leadingIndex) { + continue; + } + registry.fill(HIST("hTrackCounterGen"), 4); // fill no. of tracks have leading particle + } + auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) { int nTracks = 0; for (const auto& track : mcParticles) { @@ -664,8 +668,6 @@ struct HfCorrelatorD0Hadrons { using BinningTypeMcGen = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getTracksSize)>; BinningTypeMcGen corrBinningMcGen{{getTracksSize}, {zPoolBins, multPoolBinsMcGen}, true}; int poolBin = corrBinningMcGen.getBin(std::make_tuple(mcCollision.posZ(), getTracksSize(mcCollision))); - - bool correlationStatus = false; entryD0HadronPair(getDeltaPhi(particle2.phi(), particle1.phi()), particle2.eta() - particle1.eta(), particle1.pt(), diff --git a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx index 6288d7388b5..0ba872d67d5 100644 --- a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx @@ -53,7 +53,7 @@ using McParticlesPlus2Prong = soa::Join perCol2Prong = aod::hf_cand::collisionId; + Preslice perCol2Prong = aod::hf_cand::collisionId; Produces entryD0Pair; Produces entryD0PairMcInfo; @@ -72,15 +72,16 @@ struct HfCorrelatorDMesonPairs { HfHelper hfHelper; - using TracksWPid = soa::Join; + // using TracksWPid = soa::Join; - Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Partition> selectedD0CandidatesMc = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf; + Partition> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; + Partition> selectedD0CandidatesMc = aod::hf_sel_candidate_d0::isRecoHfFlag >= selectionFlagHf; HistogramConfigSpec hTH1Pt{HistType::kTH1F, {{180, 0., 36.}}}; HistogramConfigSpec hTH1Y{HistType::kTH1F, {{100, -5., 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.}}}; HistogramRegistry registry{ "registry", @@ -96,6 +97,9 @@ 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}, + // MC Rec plots + {"hPtVsYMcRec", "D meson candidates MC Rec;candidate #it{p}_{T} (GeV/#it{c});#it{y}", hTH2PtVsY}, // 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}, @@ -202,6 +206,9 @@ struct HfCorrelatorDMesonPairs { registry.add("hInputCheckD0OrD0barMcGen", "Check on input D0 | D0bar meson candidates/event MC Gen", {HistType::kTH1F, {axisInputD0}}); registry.add("hMass", "D Meson pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassMcRecPrompt", "D Meson pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassMcRecNonPrompt", "D Meson pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("hMassMcRecReflections", "D Meson pair candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{120, 1.5848, 2.1848}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); } /// Sets bits to select candidate type for D0 @@ -282,23 +289,21 @@ struct HfCorrelatorDMesonPairs { template void AnalysePid(const T& candidate) { - auto prong0 = candidate.template prong0_as(); - auto prong1 = candidate.template prong1_as(); if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("PID/hTofNSigmaPi"), candidate.ptProng0(), prong0.tofNSigmaPi()); - registry.fill(HIST("PID/hTofNSigmaKa"), candidate.ptProng1(), prong1.tofNSigmaKa()); - registry.fill(HIST("PID/hTpcNSigmaPi"), candidate.ptProng0(), prong0.tpcNSigmaPi()); - registry.fill(HIST("PID/hTpcNSigmaKa"), candidate.ptProng1(), prong1.tpcNSigmaKa()); - registry.fill(HIST("PID/hTpcTofNSigmaPi"), candidate.ptProng0(), prong0.tpcTofNSigmaPi()); - registry.fill(HIST("PID/hTpcTofNSigmaKa"), candidate.ptProng1(), prong1.tpcTofNSigmaKa()); + registry.fill(HIST("PID/hTofNSigmaPi"), candidate.ptProng0(), candidate.nSigTofPi0()); + registry.fill(HIST("PID/hTofNSigmaKa"), candidate.ptProng1(), candidate.nSigTofKa1()); + registry.fill(HIST("PID/hTpcNSigmaPi"), candidate.ptProng0(), candidate.nSigTpcPi0()); + registry.fill(HIST("PID/hTpcNSigmaKa"), candidate.ptProng1(), candidate.nSigTpcKa1()); + registry.fill(HIST("PID/hTpcTofNSigmaPi"), candidate.ptProng0(), candidate.tpcTofNSigmaPi0()); + registry.fill(HIST("PID/hTpcTofNSigmaKa"), candidate.ptProng1(), candidate.tpcTofNSigmaKa1()); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("PID/hTofNSigmaPi"), candidate.ptProng1(), prong1.tofNSigmaPi()); - registry.fill(HIST("PID/hTofNSigmaKa"), candidate.ptProng0(), prong0.tofNSigmaKa()); - registry.fill(HIST("PID/hTpcNSigmaPi"), candidate.ptProng1(), prong1.tpcNSigmaPi()); - registry.fill(HIST("PID/hTpcNSigmaKa"), candidate.ptProng0(), prong0.tpcNSigmaKa()); - registry.fill(HIST("PID/hTpcTofNSigmaPi"), candidate.ptProng1(), prong1.tpcTofNSigmaPi()); - registry.fill(HIST("PID/hTpcTofNSigmaKa"), candidate.ptProng0(), prong0.tpcTofNSigmaKa()); + registry.fill(HIST("PID/hTofNSigmaPi"), candidate.ptProng1(), candidate.nSigTofPi1()); + registry.fill(HIST("PID/hTofNSigmaKa"), candidate.ptProng0(), candidate.nSigTofKa0()); + registry.fill(HIST("PID/hTpcNSigmaPi"), candidate.ptProng1(), candidate.nSigTpcPi1()); + registry.fill(HIST("PID/hTpcNSigmaKa"), candidate.ptProng0(), candidate.nSigTpcKa0()); + registry.fill(HIST("PID/hTpcTofNSigmaPi"), candidate.ptProng1(), candidate.tpcTofNSigmaPi1()); + registry.fill(HIST("PID/hTpcTofNSigmaKa"), candidate.ptProng0(), candidate.tpcTofNSigmaKa0()); } } @@ -329,7 +334,6 @@ struct HfCorrelatorDMesonPairs { registry.fill(HIST("hPhi"), candidate.phi()); registry.fill(HIST("hY"), candidate.y(MassD0)); registry.fill(HIST("hPtCandAfterCut"), candidate.pt()); - registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); bool isDCand1 = isD(candidateType1); bool isDbarCand1 = isDbar(candidateType1); @@ -432,7 +436,7 @@ struct HfCorrelatorDMesonPairs { /// D0(bar)-D0(bar) correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth) void processData(aod::Collision const& collision, - soa::Join const& candidates, TracksWPid const&) + soa::Join const& candidates, aod::Tracks const&) { for (const auto& candidate : candidates) { AnalysePid(candidate); @@ -450,8 +454,8 @@ struct HfCorrelatorDMesonPairs { if (ptCandMin >= 0. && candidate1.pt() < ptCandMin) { continue; } - auto prong0Cand1 = candidate1.template prong0_as(); - auto prong1Cand1 = candidate1.template prong1_as(); + auto prong0Cand1 = candidate1.template prong0_as(); + auto prong1Cand1 = candidate1.template prong1_as(); bool isSignalD0Cand1 = std::abs(hfHelper.invMassD0ToPiK(candidate1) - MassD0) < massCut; bool isSignalD0barCand1 = std::abs(hfHelper.invMassD0barToKPi(candidate1) - MassD0Bar) < massCut; @@ -463,6 +467,13 @@ struct HfCorrelatorDMesonPairs { bool isDCand1 = isD(candidateType1); bool isDbarCand1 = isDbar(candidateType1); + if (isDCand1) { + registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); + } + if (isDbarCand1) { + registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + } + for (auto candidate2 = candidate1 + 1; candidate2 != selectedD0CandidatesGrouped.end(); ++candidate2) { if (abs(hfHelper.yD0(candidate2)) > yCandMax) { continue; @@ -470,8 +481,8 @@ struct HfCorrelatorDMesonPairs { if (ptCandMin >= 0. && candidate2.pt() < ptCandMin) { continue; } - auto prong0Cand2 = candidate2.template prong0_as(); - auto prong1Cand2 = candidate2.template prong1_as(); + auto prong0Cand2 = candidate2.template prong0_as(); + auto prong1Cand2 = candidate2.template prong1_as(); if (daughterTracksCutFlag && ((prong0Cand1 == prong0Cand2) || (prong1Cand1 == prong1Cand2) || (prong0Cand1 == prong1Cand2) || (prong1Cand1 == prong0Cand2))) { continue; } @@ -490,12 +501,12 @@ struct HfCorrelatorDMesonPairs { candidate1.pt(), candidate2.pt(), hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), hfHelper.invMassD0ToPiK(candidate2), hfHelper.invMassD0barToKPi(candidate2)); } // end inner loop (Cand2) - } // end outer loop (Cand1) + } // end outer loop (Cand1) } PROCESS_SWITCH(HfCorrelatorDMesonPairs, processData, "Process data mode", true); - void processMcRec(aod::Collision const& collision, soa::Join const& candidates, TracksWPid const&) + void processMcRec(aod::Collision const& collision, soa::Join const& candidates, aod::Tracks const&) { for (const auto& candidate : candidates) { AnalysePid(candidate); @@ -511,8 +522,8 @@ struct HfCorrelatorDMesonPairs { auto yCandidate1 = hfHelper.yD0(candidate1); float massD0Cand1 = hfHelper.invMassD0ToPiK(candidate1); float massD0barCand1 = hfHelper.invMassD0barToKPi(candidate1); - auto prong0Cand1 = candidate1.template prong0_as(); - auto prong1Cand1 = candidate1.template prong1_as(); + auto prong0Cand1 = candidate1.template prong0_as(); + auto prong1Cand1 = candidate1.template prong1_as(); if (abs(hfHelper.yD0(candidate1)) > yCandMax) { continue; @@ -545,13 +556,40 @@ struct HfCorrelatorDMesonPairs { registry.fill(HIST("hStatusSinglePart"), 6); } + if (isDCand1) { + if (isTrueDCand1) { + registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); + registry.fill(HIST("hPtVsYMcRec"), candidate1.pt(), hfHelper.yD0(candidate1)); + if (originRec1 == 1) { + registry.fill(HIST("hMassMcRecPrompt"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); + } else if (originRec1 == 2) { + registry.fill(HIST("hMassMcRecNonPrompt"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); + } + } else if (isTrueDbarCand1) { + registry.fill(HIST("hMassMcRecReflections"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); + } + } + if (isDbarCand1) { + if (isTrueDbarCand1) { + registry.fill(HIST("hMass"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + registry.fill(HIST("hPtVsYMcRec"), candidate1.pt(), hfHelper.yD0(candidate1)); + if (originRec1 == 1) { + registry.fill(HIST("hMassMcRecPrompt"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + } else if (originRec1 == 2) { + registry.fill(HIST("hMassMcRecNonPrompt"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + } + } else if (isTrueDCand1) { + registry.fill(HIST("hMassMcRecReflections"), hfHelper.invMassD0barToKPi(candidate1), candidate1.pt()); + } + } + for (auto candidate2 = candidate1 + 1; candidate2 != selectedD0CandidatesGroupedMc.end(); ++candidate2) { auto ptCandidate2 = candidate2.pt(); auto yCandidate2 = hfHelper.yD0(candidate2); float massD0Cand2 = hfHelper.invMassD0ToPiK(candidate2); float massD0barCand2 = hfHelper.invMassD0barToKPi(candidate2); - auto prong0Cand2 = candidate2.template prong0_as(); - auto prong1Cand2 = candidate2.template prong1_as(); + auto prong0Cand2 = candidate2.template prong0_as(); + auto prong1Cand2 = candidate2.template prong1_as(); if (abs(hfHelper.yD0(candidate2)) > yCandMax) { continue; @@ -622,7 +660,7 @@ struct HfCorrelatorDMesonPairs { ptCandidate1, ptCandidate2, massD0Cand1, massD0barCand1, massD0Cand2, massD0barCand2); entryD0PairMcInfo(originRec1, originRec2, matchedRec1, matchedRec2); } // end inner loop (Cand2) - } // end outer loop (Cand1) + } // end outer loop (Cand1) } PROCESS_SWITCH(HfCorrelatorDMesonPairs, processMcRec, "Process Mc reco mode", false); @@ -712,6 +750,8 @@ struct HfCorrelatorDMesonPairs { registry.fill(HIST("hStatusSinglePartMcGen"), 4); } + registry.fill(HIST("hPtVsYMcGen"), particle1.pt(), particle1.y()); + for (auto particle2 = particle1 + 1; particle2 != mcParticles.end(); ++particle2) { // check if the particle is D0 or D0bar if (std::abs(particle2.pdgCode()) != Pdg::kD0) { @@ -794,7 +834,7 @@ struct HfCorrelatorDMesonPairs { entryD0PairMcGenInfo(originGen1, originGen2, matchedGen1, matchedGen2); } // end inner loop - } // end outer loop + } // end outer loop } PROCESS_SWITCH(HfCorrelatorDMesonPairs, processMcGen, "Process D0 Mc Gen mode", false); diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 016c672f50e..a0514f97a62 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; @@ -135,6 +138,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 +686,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 91bc73c3edd..2d9221f7190 100644 --- a/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorHfeHadrons.cxx @@ -124,18 +124,19 @@ struct HfCorrelatorHfeHadrons { ptElectron = eTrack.ptTrack(); phiElectron = eTrack.phiTrack(); etaElectron = eTrack.etaTrack(); + double deltaPhi = -999; double deltaEta = -999; double ptHadron = -999; double etaHadron = -999; double phiHadron = -999; + if (!eTrack.isEmcal()) continue; registry.fill(HIST("hptElectron"), ptElectron); for (const auto& hTrack : tracks) { - - if (hTrack.globalIndex() == eTrack.globalIndex()) + if (hTrack.globalIndex() == eTrack.trackId()) continue; // Apply Hadron cut if (!selAssoHadron(hTrack)) @@ -157,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..a2f57e21a9f 100644 --- a/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorLcHadrons.cxx @@ -15,6 +15,8 @@ /// \author Marianna Mazzilli /// \author Zhen Zhang +#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 values in range [-pi/2., 3.*pi/2.], typically used for correlation studies @@ -189,10 +193,14 @@ struct HfCorrelatorLcHadrons { 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 storeAutoCorrelationFlag{"storeAutoCorrelationFlag", false, "Store flag that indicates if the track is paired to its D-meson mother instead of skipping it"}; + Configurable correlateLcWithLeadingParticle{"correlateLcWithLeadingParticle", false, "Switch for correlation of Lc baryons with leading particle only"}; HfHelper hfHelper; SliceCache cache; BinningType corrBinning{{binsZVtx, binsMultiplicity}, true}; + int leadingIndex = 0; + bool correlationStatus = false; // Filters for ME Filter collisionFilter = aod::hf_selection_lc_collision::lcSel >= filterFlagLc; @@ -263,6 +271,12 @@ struct HfCorrelatorLcHadrons { if (selectedLcCandidates.size() == 0) { return; } + + // find leading particle + if (correlateLcWithLeadingParticle) { + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value); + } + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); int nTracks = 0; if (collision.numContrib() > 1) { @@ -335,16 +349,28 @@ struct HfCorrelatorLcHadrons { if (std::abs(track.dcaXY()) >= dcaXYTrackMax || std::abs(track.dcaZ()) >= dcaZTrackMax) { continue; // Remove secondary tracks } + // Remove 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; + } + } + if (candidate.isSelLcToPKPi() >= selectionFlagLc) { entryLcHadronPair(getDeltaPhi(track.phi(), candidate.phi()), track.eta() - candidate.eta(), candidate.pt(), track.pt(), - poolBin); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), false); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { @@ -352,7 +378,8 @@ struct HfCorrelatorLcHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), - poolBin); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), false); } } // Hadron Tracks loop @@ -370,6 +397,12 @@ struct HfCorrelatorLcHadrons { if (selectedLcCandidatesMc.size() == 0) { return; } + + // find leading particle + if (correlateLcWithLeadingParticle) { + leadingIndex = findLeadingParticle(tracks, dcaXYTrackMax.value, dcaZTrackMax.value); + } + int poolBin = corrBinning.getBin(std::make_tuple(collision.posZ(), collision.multFT0M())); int nTracks = 0; if (collision.numContrib() > 1) { @@ -472,16 +505,26 @@ struct HfCorrelatorLcHadrons { } // 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; } registry.fill(HIST("hPtParticleAssocMcRec"), track.pt()); + 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); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(candidate), isLcSignal); } if (candidate.isSelLcToPiKP() >= selectionFlagLc) { @@ -489,7 +532,8 @@ struct HfCorrelatorLcHadrons { track.eta() - candidate.eta(), candidate.pt(), track.pt(), - poolBin); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(candidate), isLcSignal); } } // end inner loop (Tracks) @@ -506,6 +550,11 @@ struct HfCorrelatorLcHadrons { int counterLcHadron = 0; registry.fill(HIST("hMcEvtCount"), 0); + // find leading particle + if (correlateLcWithLeadingParticle) { + leadingIndex = findLeadingParticleMcGen(mcParticles, etaTrackMax.value, ptTrackMin.value); + } + auto getTracksSize = [&mcParticles](aod::McCollision const& /*collision*/) { int nTracks = 0; for (const auto& track : mcParticles) { @@ -556,15 +605,26 @@ struct HfCorrelatorLcHadrons { } 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 (!storeAutoCorrelationFlag) { + continue; + } + correlationStatus = true; } + + 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); + poolBin, + correlationStatus); entryLcHadronRecoInfo(MassLambdaCPlus, true); } // end inner loop } @@ -600,7 +660,8 @@ struct HfCorrelatorLcHadrons { t1.eta() - t2.eta(), t1.pt(), t2.pt(), - poolBin); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(t1), false); } if (t1.isSelLcToPiKP() >= selectionFlagLc) { @@ -608,7 +669,8 @@ struct HfCorrelatorLcHadrons { t1.eta() - t2.eta(), t1.pt(), t2.pt(), - poolBin); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(t1), false); } } @@ -634,7 +696,8 @@ struct HfCorrelatorLcHadrons { t1.eta() - t2.eta(), t1.pt(), t2.pt(), - poolBin); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPKPi(t1), false); } if (t1.isSelLcToPiKP() >= selectionFlagLc) { @@ -642,7 +705,8 @@ struct HfCorrelatorLcHadrons { t1.eta() - t2.eta(), t1.pt(), t2.pt(), - poolBin); + poolBin, + correlationStatus); entryLcHadronRecoInfo(hfHelper.invMassLcToPiKP(t1), false); } } @@ -696,7 +760,8 @@ struct HfCorrelatorLcHadrons { t1.eta() - t2.eta(), t1.pt(), t2.pt(), - poolBin); + poolBin, + correlationStatus); } } } diff --git a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx index 3a2bd3434e8..7b493c9a733 100644 --- a/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx +++ b/PWGHF/HFC/TableProducer/femtoDreamProducer.cxx @@ -13,6 +13,8 @@ /// \brief Tasks that produces the track tables used for the pairing /// \author Ravindra Singh, GSI, ravindra.singh@cern.ch +#include +#include #include "CCDB/BasicCCDBManager.h" #include "Common/Core/trackUtilities.h" @@ -46,6 +48,7 @@ using namespace o2::analysis::femtoDream; struct HfFemtoDreamProducer { Produces outputCollision; + Produces rowMasks; Produces rowCandCharmHad; Produces rowCandMcCharmHad; Produces rowCandCharmHadGen; @@ -196,13 +199,21 @@ struct HfFemtoDreamProducer { particle.dcaXY(), particle.dcaZ(), particle.tpcSignal(), + -999., particle.tpcNSigmaPi(), particle.tpcNSigmaKa(), particle.tpcNSigmaPr(), + -999., + -999., + -999., + -999., particle.tofNSigmaPi(), particle.tofNSigmaKa(), particle.tofNSigmaPr(), - -999., -999., -999., -999., -999., -999., -999., -999., -999., -999.); + -999., + -999., + -999., + -999., -999., -999., -999., -999., -999.); } template @@ -275,8 +286,8 @@ struct HfFemtoDreamProducer { } } - template - bool fillTracksForCharmHadron(CollisionType const& col, TrackType const& tracks, ProngType const& prong0, ProngType const& prong1, ProngType const& prong2, int candSize) + template + bool fillTracksForCharmHadron(CollisionType const& col, TrackType const& tracks) { std::vector childIDs = {0, 0}; // these IDs are necessary to keep track of the children @@ -290,9 +301,6 @@ struct HfFemtoDreamProducer { continue; } - if ((candSize == 1) && (track.globalIndex() == prong0.globalIndex() || track.globalIndex() == prong1.globalIndex() || track.globalIndex() == prong2.globalIndex())) - continue; - trackCuts.fillQA(track); // the bit-wise container of the systematic variations is obtained auto cutContainer = trackCuts.getCutContainer(track, track.pt(), track.eta(), sqrtf(powf(track.dcaXY(), 2.f) + powf(track.dcaZ(), 2.f))); @@ -301,7 +309,7 @@ struct HfFemtoDreamProducer { outputPartsIndex(track.globalIndex()); // now the table is filled - outputParts(outputCollision.lastIndex() + 1, + outputParts(outputCollision.lastIndex(), track.pt(), track.eta(), track.phi(), @@ -327,8 +335,6 @@ struct HfFemtoDreamProducer { { const auto vtxZ = col.posZ(); const auto sizeCand = candidates.size(); - if (sizeCand == 0) - return; const auto spher = colCuts.computeSphericity(col, tracks); float mult = 0; @@ -356,6 +362,12 @@ struct HfFemtoDreamProducer { if (colCuts.isEmptyCollision(col, tracks, trackCuts)) { return; } + + outputCollision(vtxZ, mult, multNtr, spher, magField); + if constexpr (isMc) { + fillMcCollision(col); + } + // Filling candidate properties rowCandCharmHad.reserve(sizeCand); bool isTrackFilled = false; @@ -386,22 +398,6 @@ struct HfFemtoDreamProducer { float BDTScorePrompt, float BDTScoreFD) { if (FunctionSelection >= 1){ - // Fill tracks if it is not filled for Lc Candidate in an event - if (!isTrackFilled) { - isTrackFilled = fillTracksForCharmHadron(col, tracks, trackPos1, trackNeg, trackPos2, sizeCand); - - // If track filling was successful, fill the collision table - if (isTrackFilled) { - outputCollision(vtxZ, mult, multNtr, spher, magField); - if constexpr (isMc) { - fillMcCollision(col); - } - } - } - - // fill collision table if track table is filled, i.e., there is at least one Lc-p pair - if (isTrackFilled) { - // Row for candidate charm hadron rowCandCharmHad( outputCollision.lastIndex(), trackPos1.sign() + trackNeg.sign() + trackPos2.sign(), @@ -426,14 +422,31 @@ struct HfFemtoDreamProducer { if constexpr (isMc) { rowCandMcCharmHad( candidate.flagMcMatchRec(), - candidate.originMcRec()); - } - } + candidate.originMcRec());} } }; fillTable(0, candidate.isSelLcToPKPi(), outputMlPKPi.at(0), outputMlPKPi.at(1), outputMlPKPi.at(2)); fillTable(1, candidate.isSelLcToPiKP(), outputMlPiKP.at(0), outputMlPiKP.at(1), outputMlPiKP.at(2)); } + + if (!isTrackFilled) { + isTrackFilled = fillTracksForCharmHadron(col, tracks); + // If track filling was successful, fill the collision table + } + + aod::femtodreamcollision::BitMaskType bitTrack = 0; + if (isTrackFilled) { + bitTrack |= 1 << 0; + } + + aod::femtodreamcollision::BitMaskType bitCand = 0; + if (sizeCand > 0) { + bitCand |= 1 << 0; + } + + rowMasks(static_cast(bitTrack), + static_cast(bitCand), + 0); } template diff --git a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx index 32cd888d109..351b900d48a 100644 --- a/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx +++ b/PWGHF/HFC/Tasks/taskCharmHadronsFemtoDream.cxx @@ -12,8 +12,10 @@ /// \file taskCharmHadronsFemtoDream.cxx.cxx /// \brief Tasks that reads the track tables used for the pairing and builds pairs of two tracks /// \author Ravindra SIngh, GSI, ravindra.singh@cern.ch +/// \author Biao Zhang, Heidelberg University, biao.zhang@cern.ch #include +#include #include "Framework/Expressions.h" #include "Framework/AnalysisTask.h" @@ -60,10 +62,18 @@ struct HfTaskCharmHadronsFemtoDream { 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 binMulPercentile{"binMulPercentile", {10, 0.0f, 100.0f}, "multiplicity percentile Binning"}; ConfigurableAxis binpT{"binpT", {20, 0.5, 4.05}, "pT 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)"}; @@ -92,11 +102,11 @@ struct HfTaskCharmHadronsFemtoDream { ConfigurableAxis dummy{"dummy", {1, 0, 1}, "dummy axis"}; // Mixing configurables - ConfigurableAxis mixingBinMult{"mixingBinMult", {VARIABLE_WIDTH, 0.0f, 200.0f}, "Mixing bins - multiplicity"}; + ConfigurableAxis mixingBinMult{"mixingBinMult", {VARIABLE_WIDTH, 0.0f, 20.0f, 60.0f, 200.0f}, "Mixing bins - multiplicity"}; ConfigurableAxis mixingBinMultPercentile{"mixingBinMultPercentile", {VARIABLE_WIDTH, 0.0f, 100.f}, "Mixing bins - multiplicity percentile"}; ConfigurableAxis mixingBinVztx{"mixingBinVztx", {VARIABLE_WIDTH, -10.0f, -4.f, 0.f, 4.f, 10.f}, "Mixing bins - z-vertex"}; Configurable mixingDepth{"mixingDepth", 5, "Number of events for mixing"}; - Configurable mixingPolicy{"mixingBinPolicy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; + Configurable mixingBinPolicy{"mixingBinPolicy", 0, "Binning policy for mixing - 0: multiplicity, 1: multipliciy percentile, 2: both"}; /// Event selection struct : ConfigurableGroup { @@ -125,8 +135,8 @@ struct HfTaskCharmHadronsFemtoDream { FemtoDreamContainer sameEventCont; FemtoDreamContainer mixedEventCont; FemtoDreamPairCleaner pairCleaner; - FemtoDreamDetaDphiStar pairCloseRejection; - + FemtoDreamDetaDphiStar pairCloseRejectionSE; + 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; @@ -142,28 +152,30 @@ struct HfTaskCharmHadronsFemtoDream { using FilteredCharmMcCands = soa::Filtered>; using FilteredCharmMcCand = FilteredCharmMcCands::iterator; - using FilteredColisions = FDCollisions; + using FilteredColisions = soa::Filtered>; using FilteredColision = FilteredColisions::iterator; - using FilteredMcColisions = soa::Filtered>; + 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; /// Histogramming for Event FemtoDreamEventHisto eventHisto; /// Histogram output HistogramRegistry registry{"CorrelationsAndQA", {}, OutputObjHandlingPolicy::AnalysisObject}; - + HistogramRegistry registryMixQa{"registryMixQa"}; /// 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)) && @@ -185,7 +197,7 @@ struct HfTaskCharmHadronsFemtoDream { void init(InitContext& /*context*/) { eventHisto.init(®istry); - trackHistoPartOne.init(®istry, binmultTempFit, dummy, binpTTrack, dummy, dummy, binTempFitVarTrack, dummy, dummy, dummy, dummy, dummy, isMc, pdgCodeTrack1); + trackHistoPartOne.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, @@ -203,27 +215,54 @@ struct HfTaskCharmHadronsFemtoDream { 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}}); pairCleaner.init(®istry); if (useCPR.value) { - pairCloseRejection.init(®istry, ®istry, cprDeltaPhiMax.value, cprDeltaEtaMax.value, cprPlotPerRadii.value); + pairCloseRejectionSE.init(®istry, ®istry, cprDeltaPhiMax.value, cprDeltaEtaMax.value, cprPlotPerRadii.value, 1); + pairCloseRejectionME.init(®istry, ®istry, cprDeltaPhiMax.value, cprDeltaEtaMax.value, cprPlotPerRadii.value, 2); } } + template + void fillCollision(CollisionType const& col) + { + registryMixQa.fill(HIST("MixingQA/hSECollisionBins"), colBinningMult.getBin({col.posZ(), col.multNtr()})); + registryMixQa.fill(HIST("MixingQA/hSECollisionPool"), col.posZ(), col.multNtr()); + } + /// This function processes the same event and takes care of all the histogramming template void doSameEvent(PartitionType& sliceTrk1, CandType& sliceCharmHad, TableTracks const& parts, Collision const& col) { + 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()); + trackHistoPartOne.fillQA(part, aod::femtodreamparticle::kPt, col.multNtr(), col.multV0M()); } for (auto const& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceTrk1, sliceCharmHad))) { + + if (p1.trackId() == p2.prong0Id() || p1.trackId() == p2.prong1Id() || p1.trackId() == p2.prong2Id()) + continue; + + if (useCPR.value) { + if (pairCloseRejectionSE.isClosePair(p1, p2, parts, col.magField())) { + continue; + } + } + + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + // proton track charge float chargeTrack = 0.; - if ((p1.cut() & 1) == 1) { + if ((p1.cut() & 2) == 2) { chargeTrack = PositiveCharge; } else { chargeTrack = NegativeCharge; @@ -247,16 +286,6 @@ struct HfTaskCharmHadronsFemtoDream { // partSign = 1 << 1; // } - if (useCPR.value) { - if (pairCloseRejection.isClosePair(p1, p2, parts, col.magField())) { - continue; - } - } - - if (!pairCleaner.isCleanPair(p1, p2, parts)) { - continue; - } - float invMass; if (p2.candidateSelFlag() == 1) { invMass = p2.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); @@ -303,16 +332,41 @@ struct HfTaskCharmHadronsFemtoDream { template void doMixedEvent(CollisionType const& cols, PartType const& parts, PartitionType1& part1, PartitionType2& part2, BinningType policy) { - processType = 1 << 1; // for mixed event - for (auto const& [collision1, collision2] : soa::selfCombinations(policy, mixingDepth.value, -1, cols, cols)) { + // Mixed events that contain the pair of interest + processType = 2; // for mixed event + + Partition PartitionMaskedCol1 = (aod::femtodreamcollision::bitmaskTrackOne & BitMask) == BitMask; + PartitionMaskedCol1.bindTable(cols); + + Partition PartitionMaskedCol2 = (aod::femtodreamcollision::bitmaskTrackTwo & BitMask) == BitMask; + PartitionMaskedCol2.bindTable(cols); + + for (auto const& [collision1, collision2] : combinations(soa::CombinationsBlockFullIndexPolicy(policy, mixingDepth.value, -1, *PartitionMaskedCol1.mFiltered, *PartitionMaskedCol2.mFiltered))) { + // make sure that tracks in the same events are not mixed + if (collision1.globalIndex() == collision2.globalIndex()) { + continue; + } + + 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); auto sliceCharmHad = part2->sliceByCached(aod::femtodreamparticle::fdCollisionId, collision2.globalIndex(), cache); for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(sliceTrk1, sliceCharmHad))) { + if (useCPR.value) { + if (pairCloseRejectionME.isClosePair(p1, p2, parts, collision1.magField())) { + continue; + } + } + if (!pairCleaner.isCleanPair(p1, p2, parts)) { + continue; + } + float chargeTrack = 0.; - if ((p1.cut() & 1) == 1) { + if ((p1.cut() & 2) == 2) { chargeTrack = PositiveCharge; } else { chargeTrack = NegativeCharge; @@ -329,7 +383,6 @@ struct HfTaskCharmHadronsFemtoDream { if (kstar > highkstarCut) { continue; } - float invMass; if (p2.candidateSelFlag() == 1) { invMass = p2.m(std::array{o2::constants::physics::MassProton, o2::constants::physics::MassKPlus, o2::constants::physics::MassPiPlus}); @@ -361,14 +414,6 @@ struct HfTaskCharmHadronsFemtoDream { charmHadMc, originType); - if (useCPR.value) { - if (pairCloseRejection.isClosePair(p1, p2, parts, collision1.magField())) { - continue; - } - } - if (!pairCleaner.isCleanPair(p1, p2, parts)) { - continue; - } // if constexpr (!isMc) mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), use4D, extendedPlots, smearingByOrigin); mixedEventCont.setPair(p1, p2, collision1.multNtr(), collision1.multV0M(), use4D, extendedPlots, smearingByOrigin); } @@ -379,6 +424,9 @@ 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); @@ -390,7 +438,7 @@ struct HfTaskCharmHadronsFemtoDream { FilteredFDParticles const& parts, FilteredCharmCands const&) { - switch (mixingPolicy.value) { + switch (mixingBinPolicy.value) { case femtodreamcollision::kMult: doMixedEvent(cols, parts, partitionTrk1, partitionCharmHadron, colBinningMult); break; @@ -413,8 +461,12 @@ 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; + } auto sliceMcTrk1 = partitionMcTrk1->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto sliceMcCharmHad = partitionMcCharmHadron->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); @@ -432,9 +484,10 @@ struct HfTaskCharmHadronsFemtoDream { void processMixedEventMc(FilteredMcColisions const& cols, FilteredFDMcParts const& parts, o2::aod::FDMCParticles const&, + o2::aod::FDExtMCParticles const&, FilteredCharmMcCands const&) { - switch (mixingPolicy.value) { + switch (mixingBinPolicy.value) { case femtodreamcollision::kMult: doMixedEvent(cols, parts, partitionMcTrk1, partitionMcCharmHadron, colBinningMult); break; diff --git a/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationD0Hadrons.cxx index 9ac7c6ae3de..416460e4689 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,11 +26,13 @@ #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 { @@ -52,7 +56,7 @@ AxisSpec axisDeltaPhi = {64, -o2::constants::math::PIHalf, 3. * o2::constants::m AxisSpec axisPtD = {10, 0., 10., ""}; AxisSpec axisPtHadron = {11, 0., 11., ""}; AxisSpec axisPoolBin = {9, 0., 9., ""}; -AxisSpec axisCorrelationState = {2, 0., 1., ""}; +AxisSpec axisCorrelationState = {2, 0., 2., ""}; ConfigurableAxis axisMass{"axisMass", {250, 1.65f, 2.15f}, ""}; // definition of vectors for standard ptbin and invariant mass configurables @@ -94,13 +98,6 @@ struct HfTaskCorrelationD0Hadrons { 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 - }; - HistogramRegistry registry{ "registry", {{"hDeltaEtaPtIntSignalRegion", stringDHadron + stringSignal + stringDeltaEta + "entries", {HistType::kTH1F, {axisDeltaEta}}}, @@ -180,7 +177,16 @@ struct HfTaskCorrelationD0Hadrons { // Toward Transverse Away {"hToward", "Toward invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, {"hTransverse", "Transverse invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, - {"hAway", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}}}; + {"hAway", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, + + // Toward Transverse Away for McRec + {"hTowardRec", "Toward invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, + {"hTransverseRec", "Transverse invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, + {"hAwayRec", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, + // Toward Transverse Away for McGen + {"hTowardGen", "Toward invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, + {"hTransverseGen", "Transverse invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}, + {"hAwayGen", "Away invmass; ptD; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtD}, {axisCorrelationState}}}}}}; void init(InitContext&) { int nBinsPtAxis = binsCorrelations->size() - 1; @@ -225,16 +231,6 @@ 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) @@ -275,35 +271,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 @@ -395,12 +375,32 @@ struct HfTaskCorrelationD0Hadrons { int signalStatus = pairEntry.signalStatus(); int ptBinD = o2::analysis::findBin(binsCorrelations, ptD); int poolBin = pairEntry.poolBin(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); double efficiencyWeight = 1.; if (applyEfficiency) { efficiencyWeight = 1. / (efficiencyDmeson->at(o2::analysis::findBin(binsEfficiency, ptD))); } - + 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"), massD, ptD, isAutoCorrelated, efficiencyWeight); + break; + case Away: + registry.fill(HIST("hAwayRec"), massD, ptD, isAutoCorrelated, efficiencyWeight); + break; + case Transverse: + registry.fill(HIST("hTransverseRec"), massD, ptD, isAutoCorrelated, efficiencyWeight); + break; + default: + break; + } + } // fill correlation plots for signal/bagkground correlations if (pairEntry.signalStatus()) { registry.fill(HIST("hCorrel2DVsPtRecSig"), deltaPhi, deltaEta, ptD, ptHadron, efficiencyWeight); @@ -589,6 +589,8 @@ struct HfTaskCorrelationD0Hadrons { double ptD = pairEntry.ptD(); double ptHadron = pairEntry.ptHadron(); int poolBin = pairEntry.poolBin(); + double massD = pairEntry.mD(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); // reject entries outside pT ranges of interest if (o2::analysis::findBin(binsCorrelations, ptD) < 0) { continue; @@ -596,7 +598,26 @@ struct HfTaskCorrelationD0Hadrons { if (ptHadron > ptHadronMax) { ptHadron = ptHadronMax + 0.5; } - + 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("hTowardGen"), massD, ptD, isAutoCorrelated); + break; + case Away: + registry.fill(HIST("hAwayGen"), massD, ptD, isAutoCorrelated); + break; + case Transverse: + registry.fill(HIST("hTransverseGen"), massD, ptD, isAutoCorrelated); + break; + default: + break; + } + } registry.fill(HIST("hCorrel2DVsPtGen"), deltaPhi, deltaEta, ptD, ptHadron, poolBin); registry.fill(HIST("hCorrel2DPtIntGen"), deltaPhi, deltaEta); registry.fill(HIST("hDeltaEtaPtIntGen"), deltaEta); 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..3acc221d30f 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationLcHadrons.cxx @@ -14,6 +14,8 @@ /// \author Marianna Mazzilli /// \author Zhen Zhang +#include + #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" @@ -22,10 +24,12 @@ #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::analysis::hf_correlations; /// /// Returns deltaPhi value in range [-pi/2., 3.*pi/2], typically used for correlation studies @@ -61,6 +65,8 @@ AxisSpec axisDeltaPhi = {64, -o2::constants::math::PIHalf, 3. * o2::constants::m AxisSpec axisPtLc = {10, 0., 10.}; AxisSpec axisPtHadron = {11, 0., 11.}; AxisSpec axisPoolBin = {9, 0., 9.}; +AxisSpec axisCorrelationState = {2, 0., 2., ""}; +ConfigurableAxis axisMass{"axisMass", {120, 1.98f, 2.58f}, ""}; // definition of vectors for standard ptbin and invariant mass configurables const int nPtBinsCorrelations = 8; @@ -96,35 +102,47 @@ struct HfTaskCorrelationLcHadrons { 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 "}; + Configurable isTowardTransverseAway{"isTowardTransverseAway", false, "Divide into three regions: toward, transverse, and away"}; + Configurable leadingParticlePtMin{"leadingParticlePtMin", 0., "Min for leading particle pt"}; 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() - }}; + {{"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() + // Toward Transverse Away + {"hToward", "Toward invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + {"hTransverse", "Transverse invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + {"hAway", "Away invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + // Toward Transverse Away for McRec + {"hTowardRec", "Toward invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + {"hTransverseRec", "Transverse invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + {"hAwayRec", "Away invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + // Toward Transverse Away for McGen + {"hTowardGen", "Toward invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + {"hTransverseGen", "Transverse invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}, + {"hAwayGen", "Away invmass; ptLc; correlationState;entries", {HistType::kTH3F, {{axisMass}, {axisPtLc}, {axisCorrelationState}}}}}}; void init(InitContext&) { @@ -160,6 +178,7 @@ struct HfTaskCorrelationLcHadrons { int effBinLc = o2::analysis::findBin(binsPtEfficiency, ptLc); int ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); int poolBin = pairEntry.poolBin(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); // reject entries outside Pt ranges of interest if (ptBinLc < 0 || effBinLc < 0) { continue; @@ -172,6 +191,28 @@ struct HfTaskCorrelationLcHadrons { if (applyEfficiency) { efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHadron); } + + // 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; + } + } + // 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 @@ -208,6 +249,7 @@ struct HfTaskCorrelationLcHadrons { int effBinLc = o2::analysis::findBin(binsPtEfficiency, ptLc); int ptBinLc = o2::analysis::findBin(binsPtCorrelations, ptLc); int poolBin = pairEntry.poolBin(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); if (ptBinLc < 0 || effBinLc < 0) { continue; } @@ -217,6 +259,28 @@ struct HfTaskCorrelationLcHadrons { if (applyEfficiency) { efficiencyWeight = 1. / (efficiencyLc->at(effBinLc) * efficiencyHadron); } + + // 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; + } + } + // fill correlation plots for signal/bagkground correlations if (pairEntry.signalStatus()) { registry.fill(HIST("hCorrel2DVsPtSignalMcRec"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin, efficiencyWeight); @@ -256,6 +320,7 @@ struct HfTaskCorrelationLcHadrons { double ptLc = pairEntry.ptLc(); double ptHadron = pairEntry.ptHadron(); int poolBin = pairEntry.poolBin(); + bool isAutoCorrelated = pairEntry.isAutoCorrelated(); // reject entries outside Pt ranges of interest if (o2::analysis::findBin(binsPtCorrelations, ptLc) < 0) { continue; @@ -264,6 +329,26 @@ struct HfTaskCorrelationLcHadrons { ptHadron = 10.5; } + 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; + } + } registry.fill(HIST("hCorrel2DVsPtMcGen"), deltaPhi, deltaEta, ptLc, ptHadron, poolBin); registry.fill(HIST("hCorrel2DPtIntMcGen"), deltaPhi, deltaEta); registry.fill(HIST("hDeltaEtaPtIntMcGen"), deltaEta); diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 5f6a5b2a95a..023a5b02923 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -13,6 +13,9 @@ /// \author Katarina Krizkova Gajdosova , CERN /// \author Maja Kabus , CERN +#include +#include + #include #include #include @@ -23,6 +26,8 @@ #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" #include "Framework/StepTHn.h" @@ -47,7 +52,9 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct HfTaskFlow { + // configurables for processing options + Configurable doReferenceFlow{"doReferenceFlow", false, "Flag to know if reference flow should be done"}; Configurable processRun2{"processRun2", false, "Flag to run on Run 2 data"}; Configurable processRun3{"processRun3", true, "Flag to run on Run 3 data"}; Configurable processMc{"processMc", false, "Flag to run on MC"}; @@ -60,28 +67,89 @@ struct HfTaskFlow { // configurables for HF candidates 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; SliceCache cache; + // ========================= + // using declarations : DATA + // ========================= + using FilteredCollisionsWSelMult = soa::Filtered>; + using HfCandidatesSelD0 = soa::Filtered>; + using HfCandidatesSelLc = soa::Filtered>; using TracksWDcaSel = soa::Filtered>; - using HfCandidatesSel = soa::Filtered>; + + // ========================= + // using declarations : MC + // ========================= + + // Even add McCollisions in the join ? + // Kata adds subscribes to it but do not add it in the join + // using FilteredCollisionsWSelMultMC = soa::Filtered>; + using FilteredCollisionsWSelMultMC = soa::Filtered>; + using FilteredMcCollisions = soa::Filtered; + using FilteredMcParticles = soa::Filtered; + using TracksWDcaSelMC = soa::Filtered>; + + // Remnants, need Katarina's info + // using FilteredCollisionsWDcaSelMcLabels = soa::Filtered>; + // using FilteredTracksWDcaSelMcLabels = soa::Filtered>; + + // ========================= + // Filters & partitions : DATA + // ========================= + + // HF candidate filter + // TODO: use Partition instead of filter + 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! Filter collisionVtxZFilter = nabs(aod::collision::posZ) < zVertexMax; - // Charged track filters + Filter trackFilter = (nabs(aod::track::eta) < etaTrackAssocMax) && (aod::track::pt > ptTrackAssocMin) && requireGlobalTrackWoPtEtaInFilter(); - // 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; - Preslice perCol = aod::track::collisionId; + // ========================= + // Filters & partitions : MC + // ========================= + + // From Katarina's code, but not sure if I use it + Filter mcCollisionFilter = nabs(aod::mccollision::posZ) < zVertexMax; + + // From Katarina's code + Filter mcParticlesFilter = (nabs(aod::mcparticle::eta) < etaTrackAssocMax) && + (aod::mcparticle::pt > ptTrackAssocMin); //&& + //(aod::mcparticle::sign != 0) + + // ========================= + // Preslice : DATA + // ========================= + + Preslice dataPerCol = aod::track::collisionId; + + // ========================= + // Preslice : MC + // ========================= + + Preslice mcTruthPerCol = aod::mcparticle::mcCollisionId; + // Do I have to adapt this preslice to MC ? How does it work exactly ? + // Preslice mcRecPerCol = aod::track::collisionId; // configurables for containers ConfigurableAxis axisVertex{"axisVertex", {14, -7, 7}, "vertex axis for histograms"}; @@ -100,19 +168,29 @@ struct HfTaskFlow { HistogramRegistry registry{"registry"}; + // 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"}; // 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"}; + OutputObj mixedTPCTPCChChMC{"mixedTPCTPCChChMC"}; // ========================= // init() // ========================= void init(InitContext&) { - // EVENT HISTOGRAMS + // ========================= + // Event histograms + // TO-DO : do i have to separate event histograms between DATA and MC ? + // ========================= constexpr int kNBinsEvents = 3; registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1F, {{kNBinsEvents, 0.5, 0.5 + kNBinsEvents}}}); // set axes of the event counter histogram @@ -120,70 +198,314 @@ struct HfTaskFlow { labels[0] = "all"; labels[1] = "after trigger selection (Run 2)"; labels[2] = "after Physics selection"; + + const int nBinsMix = axisMultiplicity->size() * 14; // 14 bins for z-vertex + for (int iBin = 0; iBin < kNBinsEvents; iBin++) { registry.get(HIST("Data/hEventCounter"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } + + // ========================= + // DATA : histograms for TPC-TPC h-h case + // ========================= + + // DATA : event histograms for TPC-TPC h-h same event registry.add("Data/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + + // DATA : associated particles histograms for TPC-TPC h-h same event + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + 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}}}); - // histograms for event mixing - const int maxMixBin = axisMultiplicity->size() * 14; // 14 bins for z-vertex - registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); + // Katarina had this : + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVzEta", "eta vs. Vz", {HistType::kTH2F, {{100, -4, 4, "#eta"}, {20, -10, 10, "Vz"}}}); + + // DATA : event mixing histograms for TPC-TPC h-h mixed event + registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); - 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}}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing", "hNtracksHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); - - // TRACK HISTOGRAMS - // histograms for associated particles - 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/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); - // histograms for particles in event mixing + // DATA : particles histograms for TPC-TPC h-h mixed event registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); - // histograms for MFT tracks - registry.add("Data/TpcMft/HadronHadron/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/hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("Data/TpcMft/HadronHadron/hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + // ========================= + // DATA : histograms for TPC-TPC HF-h case for 2PRONG + // ========================= - // histograms for candidates - auto vbins = (std::vector)binsPt; + // DATA : event histograms for TPC-TPC HF-h same event + 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}}}); + registry.add("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing", "hNtracksHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("Data/TpcTpc/HfHadron/hPtCand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/hMass", "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/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/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/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/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/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/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/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/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/hEtaCand", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/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/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/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/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - - // histograms for candidates in event mixing + // DATA : trigger particles (candidates) histograms for TPC-TPC h-h same event + auto vbins = (std::vector)binsPt; + 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"}}}); - // set axes of the correlation container + // ========================= + // DATA : histograms for TPC-TPC HF-h case for 3PRONG + // =================== + + 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, {{10000, 0., 10000.}}}); + 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/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/TpcMft/HadronHadron/SameEvent/hNtracksTPC", "hNtracks", {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/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}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingTPC", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingTPC", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingTPC", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingTPC", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingTPC", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for MFT tracks + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingMFT", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingMFT", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingMFT", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingMFT", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingMFT", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for events QA + 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 FOR 2PRONG + // ========================= + + // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event + 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/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/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}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for candidates + registry.add("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingCandidate", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hVtxZMixingCandidate", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPtMixingCandidate", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingCandidate", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingCandidate", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingCandidate", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for MFT tracks + registry.add("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingMFT", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hVtxZMixingMFT", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPtMixingMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingMFT", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingMFT", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingMFT", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for events QA + registry.add("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + + // ========================= + // DATA : histograms for TPC-MFT HF-h case FOR 3PRONG + // ========================= + + 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/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/hMultiplicity", "multiplicity;multiplicity;entries", {HistType::kTH1F, {{10000, 0., 10000.}}}); + 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}}}); + // Katarina had this : + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC associated particles + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Rec/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("MC/Rec/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("MC/Rec/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC particles in event mixing + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // MC Truth + + 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}}}); + // Katarina had this : + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC associated particles + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Gen/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("MC/Gen/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("MC/Gen/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC particles in event mixing + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // ========================= + // Declaration of correlation containers and their respective axis + // ========================= + std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, {axisPtAssoc, "p_{T} (GeV/c)"}, {axisPtTrigger, "p_{T} (GeV/c)"}, @@ -195,107 +517,317 @@ struct HfTaskFlow { {axisVertexEfficiency, "z-vtx (cm)"}}; std::vector userAxis = {{axisMass, "m_{inv} (GeV/c^{2})"}}; + // initialization of correlation containers for data sameTPCTPCChCh.setObject(new CorrelationContainer("sameTPCTPCChCh", "sameTPCTPCChCh", corrAxis, effAxis, {})); mixedTPCTPCChCh.setObject(new CorrelationContainer("mixedTPCTPCChCh", "mixedTPCTPCChCh", corrAxis, effAxis, {})); sameTPCTPCHfCh.setObject(new CorrelationContainer("sameTPCTPCHfCh", "sameTPCTPCHfCh", corrAxis, effAxis, userAxis)); mixedTPCTPCHfCh.setObject(new CorrelationContainer("mixedTPCTPCHfCh", "mixedTPCTPCHfCh", corrAxis, effAxis, userAxis)); sameTPCMFTChCh.setObject(new CorrelationContainer("sameTPCMFTChCh", "sameTPCMFTChCh", corrAxis, effAxis, {})); mixedTPCMFTChCh.setObject(new CorrelationContainer("mixedTPCMFTChCh", "mixedTPCMFTChCh", corrAxis, effAxis, {})); - } + sameTPCMFTHfCh.setObject(new CorrelationContainer("sameTPCMFTHfCh", "sameTPCMFTHfCh", corrAxis, effAxis, userAxis)); + mixedTPCMFTHfCh.setObject(new CorrelationContainer("mixedTPCMFTHfCh", "mixedTPCMFTHfCh", corrAxis, effAxis, userAxis)); - // --------------- + // initialization of correlation containes for monte-carlo + sameTPCTPCChChMC.setObject(new CorrelationContainer("sameTPCTPCChChMC", "sameTPCTPCChChMC", corrAxis, effAxis, {})); + mixedTPCTPCChChMC.setObject(new CorrelationContainer("mixedTPCTPCChChMC", "mixedTPCTPCChChMC", corrAxis, effAxis, {})); + } // End of init() function + + // ========================= // templates // 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 (processRun2 == true) { - // Run 2: trigger selection for data case - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 1); - if (!processMc) { - if (!collision.alias_bit(kINT7)) { - return false; - } - } - // Run 2: further offline selection - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 2); - if (!collision.sel7()) { - return false; - } - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 3); - } else { - // Run 3: selection - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 1); + if (fillHistograms) + registry.fill(HIST("Data/hEventCounter"), 1); + + if (processMc == false) { if (!collision.sel8()) { return false; } - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 3); } + + if (fillHistograms) + registry.fill(HIST("Data/hEventCounter"), 3); + return true; } + // ========================= + // Quality Assesment plots + // ========================= + + // ---- DATA : TPC-TPC h-h Same Event QA ---- template - void fillQA(float multiplicity, TTracks const& tracks) + void fillTpcTpcChChSameEventQa(float multiplicity, TTracks const& tracks) { - int Ntracks = 0; + int nTracks = tracks.size(); for (const auto& track1 : tracks) { - Ntracks++; 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/HadronHadron/SameEvent/hNtracks"), nTracks); + } + + // ---- MC : TPC-TPC h-h Same Event QA ---- + // Changed quickly void for int type + added the return for a test + template + int fillTpcTpcChChSameEventQaMc(float multiplicity, TTracks const& tracks) + { + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + + // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary + if constexpr (std::is_same_v) { + if (!isMcParticleSelected(track1)) { + continue; + } + // TO-DO : add other if constexpr conditions when I will have more MC cases + } + + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPt"), track1.pt()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEta"), track1.eta()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPhi"), track1.phi()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track1.pt(), track1.eta()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track1.eta(), track1.phi()); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPt"), track1.pt()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEta"), track1.eta()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPhi"), track1.phi()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track1.pt(), track1.eta()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track1.eta(), track1.phi()); + } + } + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hNtracks"), nTracks); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary"), nTracks); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hNtracks"), nTracks); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary"), nTracks); + } + return nTracks; } + // ---- DATA : TPC-TPC h-h Mixed Event QA ---- template - void fillMixingQA(float multiplicity, float vz, TTracks const& tracks) + void fillTpcTpcChChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) { registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing"), multiplicity); registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing"), vz); - int Ntracks = 0; + int nTracks = tracks.size(); for (const auto& track1 : tracks) { - Ntracks++; registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hPtMixing"), track1.pt()); registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEtaMixing"), track1.eta()); registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hPhiMixing"), track1.phi()); } - registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), Ntracks); + registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), nTracks); + } + + // ---- MC : TPC-TPC h-h Mixed Event QA ---- + template + void fillTpcTpcChChMixedEventQaMc(float multiplicity, float vz, TTracks const& tracks) + { + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing"), multiplicity); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing"), vz); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing"), multiplicity); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing"), vz); + } + + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPtMixing"), track1.pt()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEtaMixing"), track1.eta()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPhiMixing"), track1.phi()); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPtMixing"), track1.pt()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEtaMixing"), track1.eta()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPhiMixing"), track1.phi()); + } + } + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), nTracks); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), nTracks); + } } + // ---- DATA : TPC-TPC HF-h Mixed Event QA ---- template - void fillHFMixingQA(float multiplicity, float vz, TTracks const& tracks) + 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 = 0; + int nTracks = tracks.size(); for (const auto& track1 : tracks) { - Ntracks++; + + // 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()); } - registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing"), Ntracks); + registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing"), nTracks); } + // ---- DATA : TPC-MFT h-h Same Event QA ---- template - void fillMFTQA(float multiplicity, TTracks const& tracks) + void fillTpcMftChChSameEventQa(float multiplicity, TTracks const& tracks) { + int nTracks = tracks.size(); + bool isMFT = false; for (const auto& track1 : tracks) { - registry.fill(HIST("Data/TpcMft/HadronHadron/hEtaMFT"), track1.eta()); - float phi = track1.phi(); - o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/hPhiMFT"), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/hEtaPhiMFT"), multiplicity, track1.eta(), phi); + if constexpr (std::is_same_v) { // if MFT tracks + + // apply cuts for MFT tracks + if (!isAcceptedMftTrack(track1)) { + continue; + } + + 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/TpcMft/HadronHadron/SameEvent/hNtracksMFT"), nTracks); + } else { + registry.fill(HIST("Data/TpcMft/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 + + // apply cuts for MFT tracks + if (!isAcceptedMftTrack(track1)) { + continue; + } + + float phi = track1.phi(); + o2::math_utils::bringTo02Pi(phi); + + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaMFT"), track1.eta()); + 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); + + 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); + + 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()); + } + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingTPC"), nTracks); + } + } + + // ---- DATA : TPC-MFT h-h Mixed Event QA ---- + template + void fillTpcMftHfChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) + { + if constexpr (std::is_same_v) { // if MFT tracks + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingMFT"), multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/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/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()); + } + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingMFT"), nTracks); + } else { // if candidate tracks + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingCandidate"), multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hVtxZMixingCandidate"), vz); + + 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()); + } + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingCandidate"), nTracks); } } @@ -303,18 +835,68 @@ struct HfTaskFlow { template bool isAcceptedCandidate(TTrack const& candidate) { - if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + + 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; + } + 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; + } + 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; + } + + // I am not sure if to template McParticles is useful, I'll address this when doing the MC Gen case of HF-h correlations + template + bool isMcParticleSelected(TMcParticles& mcParticles) + { + // remove MC particles with charge = 0 + TParticlePDG* pdgparticle = pdg->GetParticle(mcParticles.pdgCode()); + if (pdgparticle != nullptr) { + if (pdgparticle->Charge() == 0) { + return false; + } + } + + // MC particle has to be primary + if constexpr (step <= CorrelationContainer::kCFStepAnaTopology) { + return mcParticles.isPhysicalPrimary(); + } 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 fillCandidateQA(TTracks const& candidates) + void fillTpcTpcD0CandidateQa(TTracks const& candidates) { for (const auto& candidate : candidates) { if (!isAcceptedCandidate(candidate)) { @@ -322,33 +904,224 @@ struct HfTaskFlow { } if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("Data/TpcTpc/HfHadron/hMass"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0ToPiK(candidate)); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("Data/TpcTpc/HfHadron/hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); - } - - registry.fill(HIST("Data/TpcTpc/HfHadron/hPtCand"), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hPtProng0"), candidate.ptProng0()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hPtProng1"), candidate.ptProng1()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLength"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hCt"), hfHelper.ctD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hCPA"), candidate.cpa(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hEtaCand"), candidate.eta(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); - } - } - - template + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hMass"), hfHelper.invMassD0barToKPi(candidate)); + } + + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hPtCandidate"), candidate.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(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCt"), hfHelper.ctD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hCPA"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hEtaCandVsPt"), candidate.eta(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/2Prong/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.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(TTracks const& candidates) + { + int nTracks = candidates.size(); + for (const auto& candidate : candidates) { + if (!isAcceptedCandidate(candidate)) { + 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() >= 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, nTracks); + 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, nTracks); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMassVsPt"), hfHelper.invMassLcToPiKP(candidate), pt); + } + + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hMultiplicity"), nTracks); + 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"), candidate.phi()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/3Prong/hPhiVsPt"), candidate.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(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/2Prong/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), 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), 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()); + float phi = candidate.phi(); + o2::math_utils::bringTo02Pi(phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPhiCandidate"), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaPhiCandidate"), multiplicity, candidate.eta(), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hYieldsCandidate"), multiplicity, candidate.pt(), candidate.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hNtracksCandidate"), nTracks); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hPtCandidate"), candidate.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(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hCt"), hfHelper.ctD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hCPA"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hEtaCandVsPt"), candidate.eta(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/2Prong/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 fillTpcMftLcCandidateQa(TTracks const& candidates, float multiplicity) + { + for (const auto& candidate : candidates) { + if (!isAcceptedCandidate(candidate)) { + 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(); + 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, candidate.pt(), candidate.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hEtaPhiCandidate"), multiplicity, candidate.eta(), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/3Prong/hNtracksCandidate"), 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); + } + } + + // ========================= + // Correlation functions + // ========================= + + template void fillCorrelations(TTarget target, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, float multiplicity, float posZ) { auto triggerWeight = 1; @@ -365,26 +1138,51 @@ struct HfTaskFlow { // calculating inv. mass to be filled into the container below // Note: this is needed only in case of HF-hadron correlations + // 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 + // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary + // if (processMc) { + // NOTE : this version with FilteredMcParticles is only for MC truth + if constexpr (std::is_same_v || std::is_same_v) { + if (!isMcParticleSelected(track1)) { + continue; + } + // TO-DO : add other if constexpr conditions when I will have more MC cases } // fill single-track distributions - if (!fillingHFcontainer) { - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, triggerWeight); + if (!fillingHFcontainer) { // if not HF-h case + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); } else { - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, invmass, triggerWeight); } 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) { @@ -394,11 +1192,27 @@ struct HfTaskFlow { } // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons - // with which the candidate is being correlated - if constexpr (std::is_same_v) { - if ((track1.prong0Id() == track2.globalIndex()) || (track1.prong1Id() == track2.globalIndex())) { + // 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) { // 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 + // if (processMc) { + if constexpr (std::is_same_v || std::is_same_v) { + if (!isMcParticleSelected(track2)) { continue; } + // Note : no need for HF if condition as this will always be normal track, but maybe for MFT } float eta2 = track2.eta(); @@ -416,57 +1230,139 @@ struct HfTaskFlow { if (!fillingHFcontainer) { // fill pair correlations - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, + target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, triggerWeight * associatedWeight); } else { - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, + target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, triggerWeight * associatedWeight); } } } } - template - void mixCollisions(FilteredCollisionsWSelMult const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + // 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) { - using BinningType = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; - BinningType binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; + // The first one that I call "Data" should work for data and mc rec + using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; + + BinningTypeData binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { - if (!(isCollisionSelected(collision1, false))) { - continue; - } - if (!(isCollisionSelected(collision2, false))) { - continue; + if constexpr (!std::is_same_v) { // if NOT MC -> do collision cut + if (!(isCollisionSelected(collision1, false))) { + continue; + } + if (!(isCollisionSelected(collision2, false))) { + continue; + } } auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); int bin = binningWithTracksSize.getBin(binningValues); - const auto multiplicity = 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) { - registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); - fillHFMixingQA(multiplicity, vz, tracks1); - } else { - registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); - fillMixingQA(multiplicity, vz, tracks1); + if constexpr (std::is_same_v) { // If MC + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcTpcChChMixedEventQaMc(multiplicityTracks2, vz, tracks1); + + // if constexpr (std::is_same_v || std::is_same_v) { + // registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); + // fillHFMixingQA(multiplicity, vz, tracks1); + // } else { + // registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + // fillMixingQA(multiplicity, vz, tracks1); + // } + + } 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 + } else { // IF h-h case -> TPC-MFT h-h case + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcMftChChMixedEventQa(multiplicityTracks1, vz, tracks1); // TPC tracks + fillTpcMftChChMixedEventQa(multiplicityTracks2, vz, tracks2); // MFT tracks + } + } 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 + registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcTpcChChMixedEventQa(multiplicityTracks2, vz, tracks1); + } + } // end of if condition for TPC-TPC or TPC-MFT case } - corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(corrContainer, tracks1, tracks2, multiplicity, collision1.posZ()); + corrContainer->fillEvent(multiplicityTracks2, CorrelationContainer::kCFStepReconstructed); + fillCorrelations(corrContainer, tracks1, tracks2, multiplicityTracks2, collision1.posZ()); + } + } + + // template + // void mixCollisions(FilteredCollisionsWSelMult const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + template + void mixCollisionsMcTruth(TCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + { + using BinningTypeMcTruth = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getPartsSize)>; + + BinningTypeMcTruth binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; + auto tracksTuple = std::make_tuple(tracks1, tracks2); + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + + for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { + + // added this to try to compile when doing mixed event with FilteredMcParticles and FilteredMcCollisions (MC truth) + // TODO : GET RID OF THE COLLISION SELECTION FOR MC TRUTH + // if constexpr (!std::is_same_v) { + // if (!(isCollisionSelected(collision1, false))) { + // continue; + // } + // if (!(isCollisionSelected(collision2, false))) { + // continue; + // } + //} + + auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); + 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(); + + // 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); + + // if constexpr (std::is_same_v || std::is_same_v) { + // registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); + // fillHFMixingQA(multiplicity, vz, tracks1); + // } else { + // registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + // fillMixingQA(multiplicity, vz, tracks1); + // } + + corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); + fillCorrelations(corrContainer, tracks1, tracks2, multiplicity, collision1.posZ()); } } // ===================================== - // process same event correlations: h-h case + // DATA : process same event correlations: TPC-TPC h-h case // ===================================== + void processSameTpcTpcChCh(FilteredCollisionsWSelMult::iterator const& collision, TracksWDcaSel const& tracks) { @@ -489,52 +1385,218 @@ struct HfTaskFlow { sameTPCTPCChCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillQA(multiplicity, tracks); - fillCorrelations(sameTPCTPCChCh, tracks, tracks, multiplicity, collision.posZ()); + fillTpcTpcChChSameEventQa(multiplicity, tracks); + // TO-DO : add if condition for when we will implant corrected correlations (kCFStepReconstructed -> kCFStepCorrected) + fillCorrelations(sameTPCTPCChCh, tracks, tracks, multiplicity, collision.posZ()); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "Process same-event correlations for TPC-TPC h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "DATA : Process same-event correlations for TPC-TPC h-h case", false); // ===================================== - // process same event correlations: HF-h case + // DATA : process same event correlations: TPC-TPC HF-h case for D0 // ===================================== - void processSameTpcTpcHfCh(FilteredCollisionsWSelMult::iterator const& collision, + + void processSameTpcTpcD0Ch(FilteredCollisionsWSelMult::iterator const& collision, TracksWDcaSel const& tracks, - HfCandidatesSel const& candidates) + HfCandidatesSelD0 const& candidates) { - if (!(isCollisionSelected(collision, true))) { + 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 = tracks.size(); + + sameTPCTPCHfCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + + fillTpcTpcD0CandidateQa(candidates); + fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ()); + } + 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 processSameTpcTpcLcCh(FilteredCollisionsWSelMult::iterator const& collision, + TracksWDcaSel const& tracks, + HfCandidatesSelLc 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 = tracks.size(); sameTPCTPCHfCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCandidateQA(candidates); - fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ()); + fillTpcTpcLcCandidateQa(candidates); + fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ()); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcHfCh, "Process same-event correlations for TPC-TPC HF-h case", true); + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcLcCh, "DATA : Process same-event correlations for TPC-TPC Lc-h case", false); // ===================================== - // process same event correlations: h-MFT case + // DATA : process same event correlations: TPC-MFT h-h case // ===================================== + void processSameTpcMftChCh(FilteredCollisionsWSelMult::iterator const& collision, TracksWDcaSel const& tracks, - aod::MFTTracks const& mfttracks) + aod::MFTTracks const& mftTracks) { if (!(isCollisionSelected(collision, true))) { return; } - const auto multiplicity = tracks.size(); + const auto multiplicityTPC = tracks.size(); + const auto multiplicityMFT = mftTracks.size(); - sameTPCMFTChCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillMFTQA(multiplicity, mfttracks); - fillCorrelations(sameTPCMFTChCh, tracks, mfttracks, multiplicity, collision.posZ()); + sameTPCMFTChCh->fillEvent(multiplicityTPC, CorrelationContainer::kCFStepReconstructed); + fillTpcMftChChSameEventQa(multiplicityTPC, tracks); + fillTpcMftChChSameEventQa(multiplicityMFT, mftTracks); + fillCorrelations(sameTPCMFTChCh, tracks, mftTracks, multiplicityTPC, collision.posZ()); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "Process same-event correlations for TPC-MFT h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "DATA : Process same-event correlations for TPC-MFT h-h case", false); // ===================================== - // process mixed event correlations: h-h case + // DATA : process same event correlations: TPC-MFT HF-h case for D0 // ===================================== + + void processSameTpcMftD0Ch(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSelD0 const& candidates, + 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 multiplicityCandidates = candidates.size(); + const auto multiplicityMFT = mftTracks.size(); + + sameTPCMFTHfCh->fillEvent(multiplicityCandidates, CorrelationContainer::kCFStepReconstructed); + fillTpcMftD0CandidateQa(candidates, multiplicityCandidates); + fillTpcMftHfChSameEventQa(multiplicityMFT, mftTracks); + fillCorrelations(sameTPCMFTHfCh, candidates, mftTracks, multiplicityCandidates, collision.posZ()); + } + 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, + 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 multiplicityCandidates = candidates.size(); + const auto multiplicityMFT = mftTracks.size(); + + sameTPCMFTHfCh->fillEvent(multiplicityCandidates, CorrelationContainer::kCFStepReconstructed); + fillTpcMftLcCandidateQa(candidates, multiplicityCandidates); + fillTpcMftHfChSameEventQa(multiplicityMFT, mftTracks); + fillCorrelations(sameTPCMFTHfCh, candidates, mftTracks, multiplicityCandidates, collision.posZ()); + } + 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 + // ===================================== + + void processSameTpcTpcChChmcREC(FilteredCollisionsWSelMultMC::iterator const& mcCollision, + TracksWDcaSelMC const& mcTracks) + { + + // NEED TO COMMENT THIS + // if (!(isCollisionSelected(mcCollision, true))) { + // return; + //} + + const auto multiplicity = mcTracks.size(); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hVtxZ"), mcCollision.posZ()); + + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(mcCollision.posZ(), multiplicity)); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEventCountSame"), bin); + + sameTPCTPCChChMC->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + + fillTpcTpcChChSameEventQaMc(multiplicity, mcTracks); + fillCorrelations(sameTPCTPCChChMC, mcTracks, mcTracks, multiplicity, mcCollision.posZ()); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChChmcREC, "MONTE-CARLO : Process same-event correlations for TPC-TPC h-h case", false); + + // Katarina's version = MC Truth + void processSameTpcTpcChChmcGEN(FilteredMcCollisions::iterator const& mcCollision, + FilteredMcParticles const& mcParticles) + { + + // if (!(isCollisionSelected(mcCollision, true))) { + // return; + // } + + // Not sure why to use this + // if (collisions.size() == 0) { + // return; + //} + + // if (!collision.has_mcCollision()) { + // LOGF(info, "No MC collision for this collision, skip..."); + // return; + // } + + const auto multiplicity = mcParticles.size(); // Note: these are all MC particles after selection (not only primary) + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hVtxZ"), mcCollision.posZ()); + + // fill correlations for all MC collisions + // 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()); + + // NOT USED BY KATARINA APPARENTLY + // BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + // int bin = baseBinning.getBin(std::make_tuple(mcCollision.posZ(), multiplicity)); + // registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEventCountSame"), bin); + + // TO-DO : fill correlation container for MC collisions that have a reconstructed collision + // got rid of the second const auto for multPrimaryCharge0 + // 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()); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChChmcGEN, "MONTE-CARLO : Process same-event correlations for TPC-TPC h-h case", false); + + // ===================================== + // DATA : process mixed event correlations:TPC-TPC h-h case + // ===================================== + // TO BECOME DATA & MC REC ? + void processMixedTpcTpcChCh(FilteredCollisionsWSelMult const& collisions, TracksWDcaSel const& tracks) { @@ -547,32 +1609,55 @@ struct HfTaskFlow { mixCollisions(collisions, tracks, tracks, getTracksSize, mixedTPCTPCChCh); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "Process mixed-event correlations for TPC-TPC h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "DATA : Process mixed-event correlations for TPC-TPC h-h case", false); // ===================================== - // process mixed event correlations: h-HF case + // DATA : process mixed event correlations: TPC-TPC HF-h case for D0 // ===================================== - void processMixedTpcTpcHfCh(FilteredCollisionsWSelMult const& collisions, + + void processMixedTpcTpcD0Ch(FilteredCollisionsWSelMult const& collisions, TracksWDcaSel const& tracks, - HfCandidatesSel const& candidates) + HfCandidatesSelD0 const& candidates) { // 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 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; }; mixCollisions(collisions, candidates, tracks, getTracksSize, mixedTPCTPCHfCh); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcHfCh, "Process mixed-event correlations for TPC-TPC HF-h case", true); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcD0Ch, "DATA : Process mixed-event correlations for TPC-TPC D0-h case", false); // ===================================== - // process mixed event correlations: h-MFT case + // DATA : process mixed event correlations: TPC-TPC HF-h case for Lc + // ===================================== + + void processMixedTpcTpcLcCh(FilteredCollisionsWSelMult const& collisions, + TracksWDcaSel const& tracks, + HfCandidatesSelLc const& candidates) + { + // 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; + }; + + mixCollisions(collisions, candidates, tracks, getTracksSize, mixedTPCTPCHfCh); + } + 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 + // ===================================== + void processMixedTpcMftChCh(FilteredCollisionsWSelMult const& collisions, TracksWDcaSel const& tracks, - aod::MFTTracks const& mfttracks) + aod::MFTTracks const& mftTracks) { // we want to group collisions based on charged-track multiplicity auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { @@ -581,9 +1666,90 @@ struct HfTaskFlow { return size; }; - mixCollisions(collisions, tracks, mfttracks, getTracksSize, mixedTPCMFTChCh); + mixCollisions(collisions, tracks, mftTracks, getTracksSize, 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) + { + // 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; + }; + + mixCollisions(collisions, candidates, mftTracks, getTracksSize, 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 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; + }; + + mixCollisions(collisions, candidates, mftTracks, getTracksSize, mixedTPCMFTHfCh); + } + 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 + // ===================================== + + // MC rec + void processMixedTpcTpcChChmcREC(FilteredCollisionsWSelMultMC const& mcCollisions, + TracksWDcaSelMC const& mcTracks) + { + // use normal index instead of globalIndex for MixedEvent ?? + + // we want to group collisions based on charged-track multiplicity + auto getTracksSize = [&mcTracks, this](FilteredCollisionsWSelMultMC::iterator const& mcCol) { + auto associatedTracks = mcTracks.sliceByCached(o2::aod::track::collisionId, mcCol.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once + auto size = associatedTracks.size(); + return size; + }; + + mixCollisions(mcCollisions, mcTracks, mcTracks, getTracksSize, mixedTPCTPCChChMC); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChChmcREC, "MONTE-CARLO : Process mixed-event correlations for TPC-TPC h-h case", false); + + // MC gen + void processMixedTpcTpcChChmcGEN(FilteredMcCollisions const& mcCollisions, + FilteredMcParticles const& mcParticles) + { + // use normal index instead of globalIndex for MixedEvent ?? + + // we want to group collisions based on charged-track multiplicity + auto getTracksSize = [&mcParticles, this](FilteredMcCollisions::iterator const& mcCol) { + auto associatedTracks = mcParticles.sliceByCached(o2::aod::mcparticle::mcCollisionId, mcCol.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once + auto size = associatedTracks.size(); + return size; + }; + + mixCollisionsMcTruth(mcCollisions, mcParticles, mcParticles, getTracksSize, mixedTPCTPCChChMC); + + // TO-DO : mixed event for particles that have a reconstructed collision kCFStepVertex } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftChCh, "Process mixed-event correlations for TPC-MFT h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChChmcGEN, "MONTE-CARLO : Process mixed-event correlations for TPC-TPC h-h case", false); }; // End of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/HFC/Utils/utilsCorrelations.h b/PWGHF/HFC/Utils/utilsCorrelations.h new file mode 100644 index 00000000000..0c214cb1c6f --- /dev/null +++ b/PWGHF/HFC/Utils/utilsCorrelations.h @@ -0,0 +1,83 @@ +// 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 +}; + +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; + } +} + +// ========= Find Leading Particle ============== +template +int findLeadingParticle(TTracks const& tracks, T1 const dcaXYTrackMax, T2 const dcaZTrackMax) +{ + auto leadingParticle = tracks.begin(); + for (auto const& track : tracks) { + if (std::abs(track.dcaXY()) >= dcaXYTrackMax || std::abs(track.dcaZ()) >= dcaZTrackMax) { + 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/TableProducer/electronSelectionWithTpcEmcal.cxx b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx index 610a9e7a1ff..cd583c3a83f 100644 --- a/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx +++ b/PWGHF/HFL/TableProducer/electronSelectionWithTpcEmcal.cxx @@ -40,11 +40,39 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; +const int etaAxisBins = 100; +const float trackEtaAxisMin = -1.5; +const float trackEtaAxisMax = 1.5; +const int phiAxisBins = 100; +const float trackPhiAxisMin = 0.; +const float trackPhiAxisMax = o2::constants::math::TwoPI; +const int passEMCalBins = 3; +const int passEMCalAxisMin = 0.; +const int passEMCalAxisMax = 3; +const int eopAxisBins = 60; +const float eopAxisMin = 0.; +const float eopAxisMax = 3.0; +const int pAxisBins = 500; +const float pAxisMin = 0.; +const float pAxisMax = 50.0; +const int m02AxisBins = 100; +const float m02AxisMin = 0.; +const float m02AxisMax = 2.0; +const int m20AxisBins = 100; +const float m20AxisMin = 0.; +const float m20AxisMax = 2.0; +const int nSigmaAxisBins = 300; +const float nSigmaAxisMin = -15.; +const float nSigmaAxisMax = 15.; +const int dEdxAxisBins = 480; +const float dEdxAxisMin = 0.; +const float dEdxAxisMax = 160.; struct HfElectronSelectionWithTpcEmcal { Produces electronSel; // Configurables // EMCal Cluster information + Configurable fillEmcClusterInfo{"fillEmcClusterInfo", true, "Fill histograms with EMCal cluster info before and after track match"}; // Event Selection @@ -113,34 +141,55 @@ struct HfElectronSelectionWithTpcEmcal { Filter CollisionFilter = nabs(aod::collision::posZ) < zPvPosMax && aod::collision::numContrib > (uint16_t)1; PresliceUnsorted perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId; - HistogramConfigSpec hEmcClusterInfoSpec{HistType::kTHnSparseD, {{300, 0.0, 30.0}, {100, -0.9, 0.9}, {200, 0, 6.3}, {50, 0, 50}, {1800, -900, 900}}}; - HistogramConfigSpec hDeltaPhiDeltaEtaEmcClusterTrackSpecEnergy{HistType::kTHnSparseD, {{400, -0.2, 0.2}, {400, -0.2, 0.2}, {600, -300, 300}, {300, 0.0, 30.0}}}; - HistogramConfigSpec hPIDSpec{HistType::kTHnSparseD, {{60, 0, 3}, {500, 0.0, 50.0}, {500, 0., 50.}, {300, -15, 15}, {300, 0.0, 30.0}, {400, 0, 2}, {400, 0, 2}}}; - HistogramConfigSpec hTrackAllInfoSpec{HistType::kTHnSparseD, {{480, 0, 160}, {300, -15, 15}, {500, 0., 50.}, {500, 0., 50.}, {100, -1.5, 1.5}, {100, 0, 7}, {3, 0, 3}}}; - HistogramConfigSpec hTrackInfoSpec{HistType::kTHnSparseD, {{60, 0, 3}, {480, 0, 160}, {300, -15, 15}, {500, 0., 50.}, {500, 0., 50.}, {100, -1.5, 1.5}, {100, 0, 7}}}; + HistogramConfigSpec hEmcClusterEnergySpec{HistType::kTH1F, {{300, 0.0, 30.0}}}; + HistogramConfigSpec hEmcClusterEtaPhiSpec{HistType::kTH2F, {{100, -0.9, 0.9}, {200, 0, 6.3}}}; + HistogramConfigSpec hEmcClusterEnergyCellSpec{HistType::kTH2F, {{400, 0.0, 30.0}, {50, 0, 50}}}; + HistogramConfigSpec hEmcClusterEnergyTimeSpec{HistType::kTH2F, {{300, 0.0, 30.0}, {1800, -900, 900}}}; + + HistogramConfigSpec hDeltaPhiDeltaEtaEmcClusterTrackSpecEnergy{HistType::kTH3F, {{400, -0.2, 0.2}, {400, -0.2, 0.2}, {600, -300, 300}}}; + HistogramConfigSpec hAfterMatchEoPSigamSpec{HistType::kTHnSparseD, {{eopAxisBins, eopAxisMin, eopAxisMax}, {pAxisBins, pAxisMin, pAxisMax}, {nSigmaAxisBins, nSigmaAxisMin, nSigmaAxisMax}, {m02AxisBins, m02AxisMin, m02AxisMax}, {m20AxisBins, m20AxisMin, m20AxisMax}}}; + + HistogramConfigSpec hTrackEnergyLossSpec{HistType::kTH3F, {{dEdxAxisBins, dEdxAxisMin, dEdxAxisMax}, {pAxisBins, pAxisMin, pAxisMax}, {passEMCalBins, passEMCalAxisMin, passEMCalAxisMax}}}; + + HistogramConfigSpec hTracknSigmaSpec{HistType::kTH3F, {{nSigmaAxisBins, nSigmaAxisMin, nSigmaAxisMax}, {pAxisBins, pAxisMin, pAxisMax}, {passEMCalBins, passEMCalAxisMin, passEMCalAxisMax}}}; HistogramRegistry registry{ "registry", {{"hNevents", "No of events", {HistType::kTH1F, {{3, 1, 4}}}}, {"hZvertex", "z vertex", {HistType::kTH1F, {{100, -100, 100}}}}, - {"hTrackInformation", "Sparse TPC info; dE/dx;n#sigma;#it{p} (GeV#it{/c});#it{p}_{T} (GeV#it{/c});#eta;#varphi;passEMcal;", hTrackAllInfoSpec}, - {"hEmcClusterInformationBefore", "EMCal Cluster Info before match; Energy (GeV);#eta;#varphi", hEmcClusterInfoSpec}, - {"hEmcClusterInformationAfter", "EMCal Cluster Info after match; Energy (GeV);#eta;#varphi", hEmcClusterInfoSpec}, - {"hPIDafterMatch", "PID Info after match; E/P; dE/dx;n#sigma;#it{p} (GeV#it{/c});#it{p}_{T} (GeV#it{/c});#eta;#varphi;", hTrackInfoSpec}, - {"hEPRatioafterPID", "E/P Ratio after PID Cuts apply only trackwodca filter", {HistType::kTH2F, {{60, 0, 3}, {100, 0, 10}}}}, - {"hPIDafterPIDcuts", "PID Info after PID cuts; E/P; #it{p} (GeV#it{/c});#it{p}_{T} (GeV#it{/c});n_{#sigma}^{e};GeV;M02;M20", hPIDSpec}, - {"hEmcClsTrkEtaPhiDiffTimeEnergy", "EmcClsTrkEtaPhiDiffTimeEnergy;#Delta#eta;#Delta#varphi;Sec; Energy (GeV)", hDeltaPhiDeltaEtaEmcClusterTrackSpecEnergy}}}; - - void init(InitContext&) + {"hEmcClusterM02", "m02", {HistType::kTH1F, {{m02AxisBins, m02AxisMin, m02AxisMax}}}}, + {"hEmcClusterM20", "m20", {HistType::kTH1F, {{m20AxisBins, m20AxisMin, m20AxisMax}}}}, + {"hTrackEtaPhi", "TPC EtaPhi Info; #eta;#varphi;passEMcal;", {HistType::kTH3F, {{etaAxisBins, trackEtaAxisMin, trackEtaAxisMax}, {phiAxisBins, trackPhiAxisMin, trackPhiAxisMax}, {passEMCalBins, passEMCalAxisMin, passEMCalAxisMax}}}}, + {"hTrackEnergyLossVsP", " TPC Energy loss info vs P; dE/dx;#it{p} (GeV#it{/c});passEMcal;", hTrackEnergyLossSpec}, + {"hTrackEnergyLossVsPt", " TPC Energy loss info vs Pt; dE/dx;#it{p}_{T} (GeV#it{/c});passEMcal;", hTrackEnergyLossSpec}, + {"hTracknSigmaVsP", " TPC nSigma info vs P; n#sigma;#it{p} (GeV#it{/c});passEMcal;", hTracknSigmaSpec}, + {"hTracknSigmaVsPt", " TPC nSigma info vs Pt; n#sigma;#it{p}_{T} (GeV#it{/c});passEMcal;", hTracknSigmaSpec}, + {"hEmcClusterEnergy", "EMCal Cluster Info before match Energy; Energy (GeV)", hEmcClusterEnergySpec}, + {"hEmcClusterEtaPhi", "EMCal Cluster Info before match Eta and Phi; #eta;#varphi;", hEmcClusterEtaPhiSpec}, + {"hEmcClusterEnergyCell", "EMCal Cluster Info before match Energy vs nCells; Energy (GeV);ncell;", hEmcClusterEnergyCellSpec}, + {"hEmcClusterEnergyTime", "EMCal Cluster Info before match Energy vs time; Energy (GeV); sec;", hEmcClusterEnergyTimeSpec}, + {"hEmcClusterAfterMatchEnergy", "EMCal Cluster Info After match Energy; Energy (GeV)", hEmcClusterEnergySpec}, + {"hEmcClusterAfterMatchEtaPhi", "EMCal Cluster Info After match Eta and Phi; #eta;#varphi;", hEmcClusterEtaPhiSpec}, + {"hEmcClusterAfterMatchEnergyCells", "EMCal Cluster Info After match Energy vs nCells; Energy (GeV);ncell;", hEmcClusterEnergyCellSpec}, + {"hEmcClusterAfterMatchEnergyTime", "EMCal Cluster Info After match Energy vs time; Energy (GeV); sec;", hEmcClusterEnergyTimeSpec}, + + {"hAfterMatchSigmaVsEoP", "PID Info after match EoP vs Sigma ; E/P;#it{p}_{T} (GeV#it{/c});n#sigma; m02; m20;", hAfterMatchEoPSigamSpec}, + {"hAfterMatchEoPVsP", "PID Info after match EoP vs P; E/P;#it{p} (GeV#it{/c});", {HistType::kTH2F, {{eopAxisBins, eopAxisMin, eopAxisMax}, {pAxisBins, pAxisMin, pAxisMax}}}}, + {"hAfterMatchSigmaVsP", "PID Info after match Sigma vs Momentum ; n#sigma; #it{p} (GeV#it{/c}; ", {HistType::kTH2F, {{nSigmaAxisBins, nSigmaAxisMin, nSigmaAxisMax}, {pAxisBins, pAxisMin, pAxisMax}}}}, + {"hAfterMatchEtaPhi", "PID Info after match Eta vs Phi ; #eta; #varphi; ", {HistType::kTH2F, {{etaAxisBins, trackEtaAxisMin, trackEtaAxisMax}, {phiAxisBins, trackPhiAxisMin, trackPhiAxisMax}}}}, + {"hAfterMatchEnergyLossVsP", "PID Info after match Energy loss info vs P ; dE/dx;#it{p} (GeV#it{/c});; ", {HistType::kTH2F, {{dEdxAxisBins, dEdxAxisMin, dEdxAxisMax}, {pAxisBins, pAxisMin, pAxisMax}}}}, + {"hAfterMatchEnergyLossVsPt", "PID Info after match Energy loss info vs Pt ;dE/dx;#it{p}_{T} (GeV#it{/c}); ", {HistType::kTH2F, {{dEdxAxisBins, dEdxAxisMin, dEdxAxisMax}, {pAxisBins, pAxisMin, pAxisMax}}}}, + + {"hAfterPIDEtaPhi", "PID Info after PID Cuts Eta vs Phi ; #eta; #varphi; ", {HistType::kTH2F, {{etaAxisBins, trackEtaAxisMin, trackEtaAxisMax}, {phiAxisBins, trackPhiAxisMin, trackPhiAxisMax}}}}, + {"hEPRatioAfterPID", "E/P Ratio after PID Cuts apply only trackwodca filter", {HistType::kTH2F, {{pAxisBins, pAxisMin, pAxisMax}, {300, 0, 30}}}}, + {"hPIDAfterPIDCuts", "PID Info after PID cuts; E/P;#it{p}_{T} (GeV#it{/c});n#sigma;m02; m20;", hAfterMatchEoPSigamSpec}, + {"hEmcClsTrkEtaPhiDiffTimeEnergy", "EmcClsTrkEtaPhiDiffTimeEnergy;#Delta#eta;#Delta#varphi;Sec;", hDeltaPhiDeltaEtaEmcClusterTrackSpecEnergy}}}; + + void init(o2::framework::InitContext&) { - registry.get(HIST("hTrackInformation"))->Sumw2(); - registry.get(HIST("hEmcClusterInformationBefore"))->Sumw2(); - registry.get(HIST("hEmcClusterInformationAfter"))->Sumw2(); - registry.get(HIST("hPIDafterMatch"))->Sumw2(); - registry.get(HIST("hPIDafterPIDcuts"))->Sumw2(); - registry.get(HIST("hEmcClsTrkEtaPhiDiffTimeEnergy"))->Sumw2(); + registry.get(HIST("hAfterMatchSigmaVsEoP"))->Sumw2(); + registry.get(HIST("hPIDAfterPIDCuts"))->Sumw2(); } - // Track Selection Cut template bool selTracks(T const& track) @@ -178,7 +227,12 @@ struct HfElectronSelectionWithTpcEmcal { /////////////////////////////// if (fillEmcClusterInfo) { for (const auto& emcClusterBefore : emcClusters) { - registry.fill(HIST("hEmcClusterInformationBefore"), emcClusterBefore.energy(), emcClusterBefore.eta(), emcClusterBefore.phi(), emcClusterBefore.nCells(), emcClusterBefore.time()); + registry.fill(HIST("hEmcClusterEnergy"), emcClusterBefore.energy()); // track etaphi infor after filter bit + registry.fill(HIST("hEmcClusterEtaPhi"), emcClusterBefore.eta(), emcClusterBefore.phi()); // track etaphi infor after filter bit + registry.fill(HIST("hEmcClusterEnergyCell"), emcClusterBefore.energy(), emcClusterBefore.nCells()); // track etaphi infor after filter bit + registry.fill(HIST("hEmcClusterEnergyTime"), emcClusterBefore.energy(), emcClusterBefore.time()); // track etaphi infor after filter bit + registry.fill(HIST("hEmcClusterM02"), emcClusterBefore.m02()); + registry.fill(HIST("hEmcClusterM20"), emcClusterBefore.m20()); } } int passEMCal; @@ -189,9 +243,8 @@ struct HfElectronSelectionWithTpcEmcal { float dcaxyTrack = -999; float dcazTrack = -999; float tpcNsigmaTrack = -999; - + int electronId = -999; for (const auto& track : tracks) { - phiTrack = track.phi(); etaTrack = track.eta(); pTrack = track.p(); @@ -199,7 +252,7 @@ struct HfElectronSelectionWithTpcEmcal { dcaxyTrack = track.dcaXY(); dcazTrack = track.dcaZ(); tpcNsigmaTrack = track.tpcNSigmaEl(); - + electronId = track.globalIndex(); // Apply Track Selection if (!selTracks(track)) { continue; @@ -211,7 +264,11 @@ struct HfElectronSelectionWithTpcEmcal { if ((phiTrack > phiTrackDCalMin && phiTrack < phiTrackDCalMax) && ((etaTrack > etaTrackDCalPositiveMin && etaTrack < etaTrackDCalPositiveMax) || (etaTrack > etaTrackDCalNegativeMin && etaTrack < etaTrackDCalNegativeMax))) passEMCal = 2; // Dcal acceptance passed - registry.fill(HIST("hTrackInformation"), track.tpcSignal(), tpcNsigmaTrack, pTrack, ptTrack, etaTrack, phiTrack, passEMCal); // track infor after filter bit + registry.fill(HIST("hTrackEtaPhi"), etaTrack, phiTrack, passEMCal); // track etaphi infor after filter bit + registry.fill(HIST("hTrackEnergyLossVsP"), track.tpcSignal(), pTrack, passEMCal); // track etaphi infor after filter bit + registry.fill(HIST("hTrackEnergyLossVsPt"), track.tpcSignal(), ptTrack, passEMCal); // track etaphi infor after filter bit + registry.fill(HIST("hTracknSigmaVsP"), tpcNsigmaTrack, pTrack, passEMCal); // track etaphi infor after filter bit + registry.fill(HIST("hTracknSigmaVsPt"), tpcNsigmaTrack, ptTrack, passEMCal); // track etaphi infor after filter bit auto tracksofcluster = matchedTracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); float phiMatchTrack = -999; @@ -273,12 +330,22 @@ struct HfElectronSelectionWithTpcEmcal { } } - registry.fill(HIST("hEmcClsTrkEtaPhiDiffTimeEnergy"), deltaEtaMatch, deltaPhiMatch, timeEmcCluster, eMatchEmcCluster); + registry.fill(HIST("hEmcClsTrkEtaPhiDiffTimeEnergy"), deltaEtaMatch, deltaPhiMatch, timeEmcCluster); if (fillEmcClusterInfo) - registry.fill(HIST("hEmcClusterInformationAfter"), eMatchEmcCluster, etaMatchEmcCluster, phiMatchEmcCluster, cellEmcCluster, timeEmcCluster); + registry.fill(HIST("hEmcClusterAfterMatchEnergy"), emcCluster.energy()); // track etaphi infor after filter bit + registry.fill(HIST("hEmcClusterAfterMatchEtaPhi"), emcCluster.eta(), emcCluster.phi()); // track etaphi infor after filter bit + registry.fill(HIST("hEmcClusterAfterMatchEnergyCells"), emcCluster.energy(), emcCluster.nCells()); // track etaphi infor after filter bit + registry.fill(HIST("hEmcClusterAfterMatchEnergyTime"), emcCluster.energy(), emcCluster.time()); // track etaphi infor after filter bit + eop = eMatchEmcCluster / pMatchTrack; - registry.fill(HIST("hPIDafterMatch"), eop, matchTrack.tpcSignal(), tpcNsigmaMatchTrack, pMatchTrack, ptMatchTrack, etaMatchTrack, phiMatchTrack); + + registry.fill(HIST("hAfterMatchSigmaVsEoP"), eop, ptMatchTrack, tpcNsigmaMatchTrack, m02MatchEmcCluster, m20MatchEmcCluster); + registry.fill(HIST("hAfterMatchEoPVsP"), eop, pMatchTrack); + registry.fill(HIST("hAfterMatchSigmaVsP"), tpcNsigmaMatchTrack, pMatchTrack); + registry.fill(HIST("hAfterMatchEtaPhi"), etaMatchTrack, phiMatchTrack); + registry.fill(HIST("hAfterMatchEnergyLossVsP"), matchTrack.tpcSignal(), pMatchTrack); + registry.fill(HIST("hAfterMatchEnergyLossVsPt"), matchTrack.tpcSignal(), ptMatchTrack); // Apply Electron Identification cuts if constexpr (!isMc) { @@ -291,14 +358,16 @@ struct HfElectronSelectionWithTpcEmcal { } } - registry.fill(HIST("hEPRatioafterPID"), eop, ptMatchTrack); + registry.fill(HIST("hPIDAfterPIDCuts"), eop, ptMatchTrack, tpcNsigmaMatchTrack, m02MatchEmcCluster, m20MatchEmcCluster); + registry.fill(HIST("hEPRatioAfterPID"), pMatchTrack, eMatchEmcCluster); + registry.fill(HIST("hAfterPIDEtaPhi"), etaMatchTrack, phiMatchTrack); if (eop < eopElectronMin || eop > eopElectronMax) { continue; } - registry.fill(HIST("hPIDafterPIDcuts"), eop, pMatchTrack, ptMatchTrack, tpcNsigmaMatchTrack, eMatchEmcCluster, m02MatchEmcCluster, m20MatchEmcCluster); isEMcal = true; - electronSel(matchTrack.collisionId(), matchTrack.globalIndex(), etaMatchTrack, phiMatchTrack, ptMatchTrack, pMatchTrack, trackRapidity, matchTrack.dcaXY(), matchTrack.dcaZ(), matchTrack.tpcNSigmaEl(), matchTrack.tofNSigmaEl(), + std::cout << " electron id in selection" << electronId << std::endl; + electronSel(matchTrack.collisionId(), electronId, etaMatchTrack, phiMatchTrack, ptMatchTrack, pMatchTrack, trackRapidity, matchTrack.dcaXY(), matchTrack.dcaZ(), matchTrack.tpcNSigmaEl(), matchTrack.tofNSigmaEl(), eMatchEmcCluster, etaMatchEmcCluster, phiMatchEmcCluster, m02MatchEmcCluster, m20MatchEmcCluster, cellEmcCluster, timeEmcCluster, deltaEtaMatch, deltaPhiMatch, isEMcal); } @@ -306,7 +375,7 @@ struct HfElectronSelectionWithTpcEmcal { if (isEMcal) { continue; } - electronSel(track.collisionId(), track.globalIndex(), etaTrack, phiTrack, ptTrack, pTrack, trackRapidity, dcaxyTrack, dcazTrack, track.tpcNSigmaEl(), track.tofNSigmaEl(), + electronSel(track.collisionId(), electronId, etaTrack, phiTrack, ptTrack, pTrack, trackRapidity, dcaxyTrack, dcazTrack, track.tpcNSigmaEl(), track.tofNSigmaEl(), eMatchEmcCluster, etaMatchEmcCluster, phiMatchEmcCluster, m02MatchEmcCluster, m20MatchEmcCluster, cellEmcCluster, timeEmcCluster, deltaEtaMatch, deltaPhiMatch, isEMcal); } } diff --git a/PWGHF/HFL/Tasks/CMakeLists.txt b/PWGHF/HFL/Tasks/CMakeLists.txt index 609213a5716..8a6c9ab4285 100644 --- a/PWGHF/HFL/Tasks/CMakeLists.txt +++ b/PWGHF/HFL/Tasks/CMakeLists.txt @@ -9,6 +9,11 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +o2physics_add_dpl_workflow(task-electron-weak-boson + SOURCES taskElectronWeakBoson.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(task-muon-charm-beauty-separation SOURCES taskMuonCharmBeautySeparation.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx new file mode 100644 index 00000000000..918f06da9bd --- /dev/null +++ b/PWGHF/HFL/Tasks/taskElectronWeakBoson.cxx @@ -0,0 +1,255 @@ +// 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 taskElectronWeakBoson.cxx +/// \brief task for WeakBoson (W/Z) based on electron in mid-rapidity +/// \author S. Sakai & S. Ito (Univ. of Tsukuba) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" + +#include "EMCALBase/Geometry.h" +#include "EMCALCalib/BadChannelMap.h" + +#include "DataFormatsEMCAL/Cell.h" +#include "DataFormatsEMCAL/Constants.h" +#include "DataFormatsEMCAL/AnalysisCluster.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/PIDResponse.h" + +#include "PWGJE/DataModel/EMCALClusters.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct HfTaskElectronWeakBoson { + + // configurable parameters + Configurable nBinsPt{"nBinsPt", 100, "N bins in pt registry"}; + Configurable BinPtmax{"BinPtmax", 100.0, "maximum pt registry"}; + Configurable nBinsE{"nBinsE", 100, "N bins in E registry"}; + Configurable BinEmax{"BinEmax", 100.0, "maximum E registry"}; + + Configurable vtxZ{"vtxZ", 10.f, ""}; + + Configurable etaTrLow{"etaTrLow", -0.6f, "minimun track eta"}; + Configurable etaTrUp{"etaTrUp", 0.6f, "maximum track eta"}; + Configurable dcaxyMax{"dcaxyMax", 2.0f, "mximum DCA xy"}; + Configurable chi2ItsMax{"chi2ItsMax", 15.0f, "its chi2 cut"}; + Configurable ptMin{"ptMin", 3.0f, "minimum pT cut"}; + Configurable chi2TpcMax{"chi2TpcMax", 4.0f, "tpc chi2 cut"}; + Configurable nclItsMin{"nclItsMin", 2.0f, "its # of cluster cut"}; + Configurable nclTpcMin{"nclTpcMin", 100.0f, "tpc # if cluster cut"}; + Configurable nclcrossTpcMin{"nclcrossTpcMin", 100.0f, "tpc # of crossedRows cut"}; + Configurable nsigTpcMin{"nsigTpcMin", -1.0, "tpc Nsig lower cut"}; + Configurable nsigTpcMax{"nsigTpcMax", 3.0, "tpc Nsig upper cut"}; + + Configurable phiEmcMin{"phiEmcMin", 1.39, "EMC phi acc min"}; + Configurable phiEmcMax{"phiEmcMax", 3.36, "EMC phi acc max"}; + Configurable clusterDefinition{"clusterDefinition", 10, "cluster definition to be selected, e.g. 10=kV3Default"}; + Configurable timeEmcMin{"timeEmcMin", -25., "Minimum EMCcluster timing"}; + Configurable timeEmcMax{"timeEmcMax", +20., "Maximum EMCcluster timing"}; + Configurable m02Min{"m02Min", 0.1, "Minimum M02"}; + Configurable m02Max{"m02Max", 0.9, "Maximum M02"}; + Configurable rMatchMax{"rMatchMax", 0.1, "cluster - track matching cut"}; + + using SelectedClusters = o2::aod::EMCALClusters; + // PbPb + using TrackEle = o2::soa::Join; + + // pp + // using TrackEle = o2::soa::Filtered>; + + // Filter + Filter eventFilter = (o2::aod::evsel::sel8 == true); + Filter posZFilter = (nabs(o2::aod::collision::posZ) < vtxZ); + + Filter etafilter = (aod::track::eta < etaTrUp) && (aod::track::eta > etaTrLow); + Filter dcaxyfilter = (nabs(aod::track::dcaXY) < dcaxyMax); + Filter filter_globalTr = requireGlobalTrackInFilter(); + + Filter clusterDefinitionSelection = (o2::aod::emcalcluster::definition == clusterDefinition) && (o2::aod::emcalcluster::time >= timeEmcMin) && (o2::aod::emcalcluster::time <= timeEmcMax) && (o2::aod::emcalcluster::m02 > m02Min) && (o2::aod::emcalcluster::m02 < m02Max); + + // Data Handling Objects + Preslice perCluster = o2::aod::emcalclustercell::emcalclusterId; + Preslice perClusterAmb = o2::aod::emcalclustercell::emcalambiguousclusterId; + PresliceUnsorted perClusterMatchedTracks = o2::aod::emcalmatchedtrack::trackId; + + // Histogram registry: an object to hold your registrygrams + HistogramRegistry registry{"registry"}; + + void init(InitContext const&) + { + + // define axes you want to use + const AxisSpec axisZvtx{400, -20, 20, "Zvtx"}; + const AxisSpec axisCounter{1, 0, 1, "events"}; + const AxisSpec axisEta{200, -1.0, 1.0, "#eta"}; + const AxisSpec axisPt{nBinsPt, 0, BinPtmax, "p_{T}"}; + const AxisSpec axisNsigma{100, -5, 5, "N#sigma"}; + const AxisSpec axisE{nBinsE, 0, BinEmax, "Energy"}; + const AxisSpec axisM02{100, 0, 1, "M02"}; + const AxisSpec axisdPhi{200, -1, 1, "dPhi"}; + const AxisSpec axisdEta{200, -1, 1, "dEta"}; + const AxisSpec axisPhi{350, 0, 7, "Phi"}; + const AxisSpec axisEop{200, 0, 2, "Eop"}; + const AxisSpec axisChi2{500, 0.0, 50.0, "#chi^{2}"}; + const AxisSpec axisCluster{100, 0.0, 200.0, "counts"}; + const AxisSpec axisITSNCls{20, 0.0, 20, "counts"}; + const AxisSpec axisEMCtime{200, -100.0, 100, "EMC time"}; + + // create registrygrams + registry.add("hZvtx", "Z vertex", kTH1F, {axisZvtx}); + registry.add("hEventCounter", "hEventCounter", kTH1F, {axisCounter}); + registry.add("hITSchi2", "ITS #chi^{2}", kTH1F, {axisChi2}); + registry.add("hTPCchi2", "TPC #chi^{2}", kTH1F, {axisChi2}); + registry.add("hTPCnCls", "TPC NCls", kTH1F, {axisCluster}); + registry.add("hITSnCls", "ITS NCls", kTH1F, {axisITSNCls}); + registry.add("hTPCnClsCrossedRows", "TPC NClsCrossedRows", kTH1F, {axisCluster}); + registry.add("hEta", "track eta", kTH1F, {axisEta}); + registry.add("hPt", "track pt", kTH1F, {axisPt}); + registry.add("hTPCNsigma", "TPC electron Nsigma", kTH2F, {{axisPt}, {axisNsigma}}); + registry.add("hEnergy", "EMC cluster energy", kTH1F, {axisE}); + registry.add("hM02", "EMC M02", kTH2F, {{axisNsigma}, {axisM02}}); + registry.add("hM20", "EMC M20", kTH2F, {{axisNsigma}, {axisM02}}); + registry.add("hTrMatch", "Track EMC Match", kTH2F, {{axisdPhi}, {axisdEta}}); + registry.add("hTrMatch_mim", "Track EMC Match minimu minimumm", kTH2F, {{axisdPhi}, {axisdEta}}); + registry.add("hMatchPhi", "Match in Phi", kTH2F, {{axisPhi}, {axisPhi}}); + registry.add("hMatchEta", "Match in Eta", kTH2F, {{axisEta}, {axisEta}}); + registry.add("hEop", "energy momentum match", kTH2F, {{axisPt}, {axisEop}}); + registry.add("hEopNsigTPC", "Eop vs. Nsigma", kTH2F, {{axisNsigma}, {axisEop}}); + registry.add("hEMCtime", "EMC timing", kTH1F, {axisEMCtime}); + } + + void process(soa::Filtered::iterator const& collision, + SelectedClusters const&, + TrackEle const& tracks, + o2::aod::EMCALMatchedTracks const& matchedtracks) + { + registry.fill(HIST("hEventCounter"), 0.5); + + // LOGF(info, "Collision index : %d", collision.index()); + // LOGF(info, "Number of tracks: %d", tracks.size()); + // LOGF(info, "Number of clusters: %d", clusters.size()); + + registry.fill(HIST("hZvtx"), collision.posZ()); + + for (const auto& track : tracks) { + + if (std::abs(track.eta()) > etaTrUp) + continue; + if (track.tpcNClsCrossedRows() < nclcrossTpcMin) + continue; + if (std::abs(track.dcaXY()) > dcaxyMax) + continue; + if (track.itsChi2NCl() > chi2ItsMax) + continue; + if (track.tpcChi2NCl() > chi2TpcMax) + continue; + if (track.tpcNClsFound() < nclTpcMin) + continue; + if (track.itsNCls() < nclItsMin) + continue; + if (track.pt() < ptMin) + continue; + + registry.fill(HIST("hEta"), track.eta()); + registry.fill(HIST("hITSchi2"), track.itsChi2NCl()); + registry.fill(HIST("hTPCchi2"), track.tpcChi2NCl()); + registry.fill(HIST("hTPCnCls"), track.tpcNClsFound()); + registry.fill(HIST("hITSnCls"), track.itsNCls()); + registry.fill(HIST("hTPCnClsCrossedRows"), track.tpcNClsCrossedRows()); + registry.fill(HIST("hPt"), track.pt()); + registry.fill(HIST("hTPCNsigma"), track.p(), track.tpcNSigmaEl()); + + // track - match + + // continue; + if (track.phi() < phiEmcMin || track.phi() > phiEmcMax) + continue; + auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, track.globalIndex()); + + // LOGF(info, "Number of matched track: %d", tracksofcluster.size()); + + double rMin = 999.9; + double dPhiMin = 999.9; + double dEtaMin = 999.9; + + if (tracksofcluster.size()) { + int nMatch = 0; + for (const auto& match : tracksofcluster) { + if (match.emcalcluster_as().time() < timeEmcMin || match.emcalcluster_as().time() > timeEmcMax) + continue; + if (match.emcalcluster_as().m02() < m02Min || match.emcalcluster_as().m02() > m02Max) + continue; + + float m20Emc = match.emcalcluster_as().m20(); + float m02Emc = match.emcalcluster_as().m02(); + float energyEmc = match.emcalcluster_as().energy(); + double phiEmc = match.emcalcluster_as().phi(); + double etaEmc = match.emcalcluster_as().eta(); + double timeEmc = match.emcalcluster_as().time(); + // LOG(info) << "tr phi0 = " << match.track_as().phi(); + // 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; + dPhi = RecoDecay::constrainAngle(dPhi, -o2::constants::math::PI); + + registry.fill(HIST("hMatchPhi"), phiEmc, match.track_as().phi()); + registry.fill(HIST("hMatchEta"), etaEmc, match.track_as().eta()); + + double r = RecoDecay::sqrtSumOfSquares(dPhi, dEta); + if (r < rMin) { + rMin = r; + dPhiMin = dPhi; + dEtaMin = dEta; + } + registry.fill(HIST("hTrMatch"), dPhi, dEta); + registry.fill(HIST("hEMCtime"), timeEmc); + registry.fill(HIST("hEnergy"), energyEmc); + + if (r < rMatchMax) + continue; + + double eop = energyEmc / match.track_as().p(); + // LOG(info) << "E/p" << eop; + registry.fill(HIST("hEopNsigTPC"), match.track_as().tpcNSigmaEl(), eop); + registry.fill(HIST("hM02"), match.track_as().tpcNSigmaEl(), m02Emc); + registry.fill(HIST("hM20"), match.track_as().tpcNSigmaEl(), m20Emc); + if (match.track_as().tpcNSigmaEl() > nsigTpcMin && match.track_as().tpcNSigmaEl() < nsigTpcMax) { + registry.fill(HIST("hEop"), match.track_as().pt(), eop); + } + } + + nMatch++; + } + } + + if (rMin < rMatchMax) { + // LOG(info) << "R mim = " << rMin; + registry.fill(HIST("hTrMatch_mim"), dPhiMin, dEtaMin); + } + + } // end of track loop + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index 96981187d1f..133d4bf3d45 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -28,6 +28,11 @@ o2physics_add_dpl_workflow(pid-creator PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(mc-pid-tof + SOURCES mcPidTof.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::TOFWorkflowUtils + COMPONENT_NAME Analysis) + # Candidate creators o2physics_add_dpl_workflow(candidate-creator-2prong @@ -231,7 +236,7 @@ o2physics_add_dpl_workflow(tree-creator-lc-to-p-k-pi o2physics_add_dpl_workflow(tree-creator-omegac-st SOURCES treeCreatorOmegacSt.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(tree-creator-omegac0-to-omega-ka @@ -280,3 +285,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 82412417a32..59426b210bb 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -43,6 +43,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" #include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Utils/utilsPid.h" #include "PWGHF/Utils/utilsTrkCandHf.h" using namespace o2; @@ -53,10 +54,15 @@ using namespace o2::aod::hf_cand_2prong; using namespace o2::hf_centrality; using namespace o2::constants::physics; using namespace o2::framework; +using namespace o2::aod::pid_tpc_tof_utils; /// Reconstruction of heavy-flavour 2-prong decay candidates struct HfCandidateCreator2Prong { Produces rowCandidateBase; + Produces rowProng0PidPi; + Produces rowProng0PidKa; + Produces rowProng1PidPi; + Produces rowProng1PidKa; Produces rowCandidateKF; // vertexing @@ -82,6 +88,8 @@ struct HfCandidateCreator2Prong { o2::base::MatLayerCylSet* lut; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; + using TracksWCovExtraPidPiKa = soa::Join; + int runNumber{0}; float toMicrometers = 10000.; // from cm to µm double massPi{0.}; @@ -296,6 +304,12 @@ struct HfCandidateCreator2Prong { rowTrackIndexProng2.prong0Id(), rowTrackIndexProng2.prong1Id(), nProngsContributorsPV, rowTrackIndexProng2.hfflag()); + // fill candidate prong PID rows + fillProngPid(track0, rowProng0PidPi); + fillProngPid(track0, rowProng0PidKa); + fillProngPid(track1, rowProng1PidPi); + fillProngPid(track1, rowProng1PidKa); + // fill histograms if (fillHistograms) { // calculate invariant masses @@ -440,6 +454,14 @@ struct HfCandidateCreator2Prong { 0.f, 0.f, rowTrackIndexProng2.prong0Id(), rowTrackIndexProng2.prong1Id(), nProngsContributorsPV, rowTrackIndexProng2.hfflag()); + + // fill candidate prong PID rows + fillProngPid(track0, rowProng0PidPi); + fillProngPid(track0, rowProng0PidKa); + fillProngPid(track1, rowProng1PidPi); + fillProngPid(track1, rowProng1PidKa); + + // fill KF info rowCandidateKF(topolChi2PerNdfD0, massD0, massD0bar); @@ -460,7 +482,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using DCA fitter w/ PV refit and w/o centrality selections void processPvRefitWithDCAFitterN(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -470,7 +492,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using DCA fitter w/o PV refit and w/o centrality selections void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -480,7 +502,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using KFParticle package w/ PV refit and w/o centrality selections void processPvRefitWithKFParticle(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -490,7 +512,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections void processNoPvRefitWithKFParticle(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -506,7 +528,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on FT0C void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -516,7 +538,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection FT0C void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -526,7 +548,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on FT0C void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -536,7 +558,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -552,7 +574,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on FT0M void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -562,7 +584,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection FT0M void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -572,7 +594,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on FT0M void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); @@ -582,7 +604,7 @@ struct HfCandidateCreator2Prong { /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, - aod::TracksWCovExtra const& tracks, + TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 144f6c45ea6..4e1349786e5 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -529,7 +529,7 @@ struct HfCandidateCreator3ProngExpressions { std::array arrPDGDaugh; std::array arrPDGResonant1 = {kProton, 313}; // Λc± → p± K* std::array arrPDGResonant2 = {2224, kKPlus}; // Λc± → Δ(1232)±± K∓ - std::array arrPDGResonant3 = {3124, kPiPlus}; // Λc± → Λ(1520) π± + std::array arrPDGResonant3 = {102134, kPiPlus}; // Λc± → Λ(1520) π± std::array arrPDGResonantDPhiPi = {333, kPiPlus}; // Ds± → Phi π± and D± → Phi π± std::array arrPDGResonantDKstarK = {313, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K± diff --git a/PWGHF/TableProducer/candidateCreatorBs.cxx b/PWGHF/TableProducer/candidateCreatorBs.cxx index 69fb0c3f178..e9aef03fd30 100644 --- a/PWGHF/TableProducer/candidateCreatorBs.cxx +++ b/PWGHF/TableProducer/candidateCreatorBs.cxx @@ -42,6 +42,7 @@ using namespace o2::hf_trkcandsel; /// Reconstruction of Bs candidates struct HfCandidateCreatorBs { Produces rowCandidateBase; // table defined in CandidateReconstructionTables.h + Produces rowCandidateProngs; // table defined in CandidateReconstructionTables.h // vertexing Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; @@ -320,8 +321,6 @@ struct HfCandidateCreatorBs { auto errorDecayLength = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, theta) + getRotatedCovMatrixXX(covMatrixPCA, phi, theta)); auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.)); - int hfFlag = BIT(hf_cand_bs::DecayType::BsToDsPi); - // fill output histograms for Bs candidates hMassDsToKKPi->Fill(hfHelper.invMassDsToKKPi(candDs), candDs.pt()); hCovSVXX->Fill(covMatrixPCA[0]); @@ -340,9 +339,9 @@ struct HfCandidateCreatorBs { pVecDs[0], pVecDs[1], pVecDs[2], pVecPion[0], pVecPion[1], pVecPion[2], dcaDs.getY(), dcaPion.getY(), - std::sqrt(dcaDs.getSigmaY2()), std::sqrt(dcaPion.getSigmaY2()), - candDs.globalIndex(), trackPion.globalIndex(), - hfFlag); + std::sqrt(dcaDs.getSigmaY2()), std::sqrt(dcaPion.getSigmaY2())); + + rowCandidateProngs(candDs.globalIndex(), trackPion.globalIndex()); } // pi loop } // Ds loop } // collision loop @@ -357,13 +356,11 @@ struct HfCandidateCreatorBsExpressions { void init(InitContext const&) {} - void processMc(aod::HfCand3Prong const& ds, - aod::TracksWMc const& tracks, - aod::McParticles const& mcParticles) + void processMc(aod::HfCand3Prong const&, + aod::TracksWMc const&, + aod::McParticles const& mcParticles, + aod::HfCandBsProngs const& candsBs) { - rowCandidateBs->bindExternalIndices(&tracks); - rowCandidateBs->bindExternalIndices(&ds); - int indexRec = -1; int8_t sign = 0; int8_t flag = 0; @@ -372,8 +369,7 @@ struct HfCandidateCreatorBsExpressions { std::array arrPDGResonantDsPhiPi = {Pdg::kPhi, kPiPlus}; // Ds± → Phi π± // Match reconstructed candidates. - // Spawned table can be used directly - for (const auto& candidate : *rowCandidateBs) { + for (const auto& candidate : candsBs) { flag = 0; arrDaughDsIndex.clear(); auto candDs = candidate.prong0(); @@ -398,7 +394,7 @@ struct HfCandidateCreatorBsExpressions { arrPDGDaughDs[iProng] = std::abs(daughI.pdgCode()); } if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi); + flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); } } } @@ -418,7 +414,7 @@ struct HfCandidateCreatorBsExpressions { arrPDGDaughDs[iProng] = std::abs(daughI.pdgCode()); } if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToKKPiPi); + flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi); } } } @@ -471,7 +467,7 @@ struct HfCandidateCreatorBsExpressions { arrPDGDaughDs[jProng] = std::abs(daughJ.pdgCode()); } if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi); + flag = sign * BIT(hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); } } } @@ -490,7 +486,7 @@ struct HfCandidateCreatorBsExpressions { arrPDGDaughDs[jProng] = std::abs(daughJ.pdgCode()); } if ((arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[0] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[1]) || (arrPDGDaughDs[0] == arrPDGResonantDsPhiPi[1] && arrPDGDaughDs[1] == arrPDGResonantDsPhiPi[0])) { - flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToKKPiPi); + flag = sign * BIT(hf_cand_bs::DecayTypeMc::B0ToDsPiToPhiPiPiToKKPiPi); } } } @@ -499,7 +495,7 @@ struct HfCandidateCreatorBsExpressions { rowMcMatchGen(flag); } // gen - } // processMc + } // processMc PROCESS_SWITCH(HfCandidateCreatorBsExpressions, processMc, "Process MC", false); }; // struct diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 3b1a5685ac8..b8846c23e19 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -25,6 +25,7 @@ #include "Framework/RunningWorkflowInfo.h" #include "ReconstructionDataFormats/DCA.h" #include "ReconstructionDataFormats/V0.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" #include "Common/Core/trackUtilities.h" @@ -136,20 +137,24 @@ struct HfCandidateCreatorCascade { setLabelHistoCands(hCandidates); } + using V0full = soa::Join; + using V0fCfull = soa::Join; + template void runCreatorCascade(Coll const&, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const&, - aod::V0Datas const&, - aod::V0fCDatas const&, + V0full const&, + V0fCfull const&, aod::TracksWCov const&, aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) { + // loop over pairs of track indices for (const auto& casc : rowsTrackIndexCasc) { - /// reject candidates in collisions not satisfying the event selections auto collision = casc.template collision_as(); + /// reject candidates in collisions not satisfying the event selections float centrality{-1.f}; const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); if (rejectionMask != 0) { @@ -168,18 +173,14 @@ struct HfCandidateCreatorCascade { float v0x, v0y, v0z, v0px, v0py, v0pz; float v0PosPx, v0PosPy, v0PosPz, v0NegPx, v0NegPy, v0NegPz; float dcaV0dau, dcaPosToPV, dcaNegToPV, v0cosPA; - float posTrackX, negTrackX; - o2::track::TrackParCov trackParCovV0DaughPos; - o2::track::TrackParCov trackParCovV0DaughNeg; + std::array covV = {0.}; - auto v0index = casc.v0_as(); + auto v0index = casc.template v0_as(); if (v0index.has_v0Data()) { // this V0 passed both standard V0 and cascade V0 selections - auto v0row = v0index.v0Data(); + auto v0row = v0index.template v0Data_as(); const auto& trackV0DaughPos = v0row.posTrack_as(); const auto& trackV0DaughNeg = v0row.negTrack_as(); - trackParCovV0DaughPos = getTrackParCov(trackV0DaughPos); // check that aod::TracksWCov does not need TracksDCA! - trackParCovV0DaughNeg = getTrackParCov(trackV0DaughNeg); // check that aod::TracksWCov does not need TracksDCA! posGlobalIndex = trackV0DaughPos.globalIndex(); negGlobalIndex = trackV0DaughNeg.globalIndex(); v0x = v0row.x(); @@ -198,15 +199,17 @@ struct HfCandidateCreatorCascade { dcaPosToPV = v0row.dcapostopv(); dcaNegToPV = v0row.dcanegtopv(); v0cosPA = v0row.v0cosPA(); - posTrackX = v0row.posX(); - negTrackX = v0row.negX(); + + constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (int i = 0; i < 6; i++) { + covV[MomInd[i]] = v0row.momentumCovMat()[i]; + covV[i] = v0row.positionCovMat()[i]; + } } else if (v0index.has_v0fCData()) { // this V0 passes only V0-for-cascade selections, use that instead - auto v0row = v0index.v0fCData(); + auto v0row = v0index.template v0fCData_as(); const auto& trackV0DaughPos = v0row.posTrack_as(); const auto& trackV0DaughNeg = v0row.negTrack_as(); - trackParCovV0DaughPos = getTrackParCov(trackV0DaughPos); // check that aod::TracksWCov does not need TracksDCA! - trackParCovV0DaughNeg = getTrackParCov(trackV0DaughNeg); // check that aod::TracksWCov does not need TracksDCA! posGlobalIndex = trackV0DaughPos.globalIndex(); negGlobalIndex = trackV0DaughNeg.globalIndex(); v0x = v0row.x(); @@ -225,8 +228,12 @@ struct HfCandidateCreatorCascade { dcaPosToPV = v0row.dcapostopv(); dcaNegToPV = v0row.dcanegtopv(); v0cosPA = v0row.v0cosPA(); - posTrackX = v0row.posX(); - negTrackX = v0row.negX(); + + constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component + for (int i = 0; i < 6; i++) { + covV[MomInd[i]] = v0row.momentumCovMat()[i]; + covV[i] = v0row.positionCovMat()[i]; + } } else { LOGF(warning, "V0Data/V0fCData not there for V0 %d in HF cascade %d. Skipping candidate.", casc.v0Id(), casc.globalIndex()); continue; // this was inadequately linked, should not happen @@ -243,24 +250,24 @@ struct HfCandidateCreatorCascade { } df.setBz(bz); - auto trackParCovBach = getTrackParCov(bach); - trackParCovV0DaughPos.propagateTo(posTrackX, bz); // propagate the track to the X closest to the V0 vertex - trackParCovV0DaughNeg.propagateTo(negTrackX, bz); // propagate the track to the X closest to the V0 vertex + auto trackBach = getTrackParCov(bach); const std::array vertexV0 = {v0x, v0y, v0z}; const std::array momentumV0 = {v0px, v0py, v0pz}; // we build the neutral track to then build the cascade - auto trackV0 = o2::dataformats::V0(vertexV0, momentumV0, {0, 0, 0, 0, 0, 0}, trackParCovV0DaughPos, trackParCovV0DaughNeg); // build the V0 track (indices for v0 daughters set to 0 for now) + auto trackV0 = o2::track::TrackParCov(vertexV0, momentumV0, covV, 0, true); + trackV0.setAbsCharge(0); + trackV0.setPID(o2::track::PID::K0); // reconstruct the cascade secondary vertex hCandidates->Fill(SVFitting::BeforeFit); try { - if (df.process(trackV0, trackParCovBach) == 0) { + if (df.process(trackV0, trackBach) == 0) { continue; } else { - // LOG(info) << "Vertexing succeeded for Lc candidate"; + LOG(debug) << "Vertexing succeeded for Lc candidate"; } } catch (const std::runtime_error& error) { - LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + LOG(debug) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; hCandidates->Fill(SVFitting::Fail); continue; } @@ -308,7 +315,6 @@ struct HfCandidateCreatorCascade { std::sqrt(impactParameterBach.getSigmaY2()), std::sqrt(impactParameterV0.getSigmaY2()), casc.prong0Id(), casc.v0Id(), v0x, v0y, v0z, - // v0.posTrack(), v0.negTrack(), // why this was not fine? posGlobalIndex, negGlobalIndex, v0PosPx, v0PosPy, v0PosPz, v0NegPx, v0NegPy, v0NegPz, @@ -332,12 +338,12 @@ struct HfCandidateCreatorCascade { void processNoCent(soa::Join const& collisions, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, - aod::V0Datas const& v0Data, - aod::V0fCDatas const& v0fCDatas, + V0full const& v0Full, + V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, aod::BCsWithTimestamps const& bcs) { - runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Data, v0fCDatas, tracks, bcs); + runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorCascade, processNoCent, " Run candidate creator w/o centrality selections", true); @@ -345,12 +351,12 @@ struct HfCandidateCreatorCascade { void processCentFT0C(soa::Join const& collisions, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, - aod::V0Datas const& v0Data, - aod::V0fCDatas const& v0fCDatas, + V0full const& v0Full, + V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, aod::BCsWithTimestamps const& bcs) { - runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Data, v0fCDatas, tracks, bcs); + runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorCascade, processCentFT0C, " Run candidate creator w/ centrality selection on FT0C", false); @@ -358,12 +364,12 @@ struct HfCandidateCreatorCascade { void processCentFT0M(soa::Join const& collisions, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, - aod::V0Datas const& v0Data, - aod::V0fCDatas const& v0fCDatas, + V0full const& v0Full, + V0fCfull const& v0fcFull, aod::TracksWCov const& tracks, aod::BCsWithTimestamps const& bcs) { - runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Data, v0fCDatas, tracks, bcs); + runCreatorCascade(collisions, rowsTrackIndexCasc, v0sLinked, v0Full, v0fcFull, tracks, bcs); } PROCESS_SWITCH(HfCandidateCreatorCascade, processCentFT0M, " Run candidate creator w/ centrality selection on FT0M", false); @@ -472,17 +478,14 @@ struct HfCandidateCreatorCascadeMc { aod::McCollisions const& mcCollisions, BCsInfo const&) { - int8_t sign = 0; - int8_t origin = 0; - int indexRec = -1; - std::vector arrDaughLcIndex; - std::array arrDaughLcPDG; - std::array arrDaughLcPDGRef = {+kProton, +kPiPlus, -kPiPlus}; - // Match reconstructed candidates. rowCandidateCasc->bindExternalIndices(&tracks); for (const auto& candidate : *rowCandidateCasc) { - origin = 0; + + int8_t sign = 0; + int8_t origin = 0; + int indexRec = -1; + std::vector idxBhadMothers{}; const auto& bach = candidate.prong0_as(); @@ -509,14 +512,14 @@ struct HfCandidateCreatorCascadeMc { } } - RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1); - if (sign != 0) { // we have already positively checked the K0s + int indexK0SRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersV0, kK0Short, std::array{+kPiPlus, -kPiPlus}, false, &sign, 1); + if (indexK0SRec >= 0) { // we have already positively checked the K0s // then we check the Lc - indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, Pdg::kLambdaCPlus, std::array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi- + indexRec = RecoDecay::getMatchedMCRec(mcParticles, arrayDaughtersLc, Pdg::kLambdaCPlus, std::array{+kProton, +kPiPlus, -kPiPlus}, true, &sign, 3); // 3-levels Lc --> p + K0 --> p + K0s --> p + pi+ pi- } // Check whether the particle is non-prompt (from a b quark). - if (sign != 0) { + if (indexRec >= 0) { auto particle = mcParticles.rawIteratorAt(indexRec); origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers); } @@ -556,7 +559,11 @@ struct HfCandidateCreatorCascadeMc { // Match generated particles. for (const auto& particle : mcParticlesPerMcColl) { - origin = 0; + + int8_t sign = 0; + int8_t origin = 0; + int8_t flag = 0; + std::vector idxBhadMothers{}; // Reject particles from background events if (particle.fromBackgroundEvent() && rejectBackground) { @@ -564,35 +571,35 @@ struct HfCandidateCreatorCascadeMc { continue; } // checking if I have a Lc --> K0S + p - RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kLambdaCPlus, std::array{+kProton, +kK0Short}, false, &sign, 2); + RecoDecay::isMatchedMCGen(mcParticles, particle, Pdg::kLambdaCPlus, std::array{+kProton, +kK0Short}, false, &sign, 2); if (sign == 0) { // now check for anti-Lc - RecoDecay::isMatchedMCGen(mcParticles, particle, -Pdg::kLambdaCPlus, std::array{-kProton, +kK0Short}, false, &sign, 2); + RecoDecay::isMatchedMCGen(mcParticles, particle, -Pdg::kLambdaCPlus, std::array{-kProton, +kK0Short}, false, &sign, 2); sign = -sign; } if (sign != 0) { - arrDaughLcIndex.clear(); - // checking that the final daughters (decay depth = 3) are p, pi+, pi- - RecoDecay::getDaughters(particle, &arrDaughLcIndex, arrDaughLcPDGRef, 3); // best would be to check the K0S daughters - if (arrDaughLcIndex.size() == 3) { - for (std::size_t iProng = 0; iProng < arrDaughLcIndex.size(); ++iProng) { - auto daughI = mcParticles.rawIteratorAt(arrDaughLcIndex[iProng]); - arrDaughLcPDG[iProng] = daughI.pdgCode(); + // we check the K0S + for (const auto& daughterK0 : particle.daughters_as()) { + if (std::abs(daughterK0.pdgCode()) != kK0) { + continue; } - if (!(arrDaughLcPDG[0] == sign * arrDaughLcPDGRef[0] && arrDaughLcPDG[1] == arrDaughLcPDGRef[1] && arrDaughLcPDG[2] == arrDaughLcPDGRef[2])) { // this should be the condition, first bach, then v0 - sign = 0; - } else { - LOG(debug) << "Lc --> K0S+p found in MC table"; + for (const auto& daughterK0S : daughterK0.daughters_as()) { + if (daughterK0S.pdgCode() != kK0Short) { + continue; + } + if (RecoDecay::isMatchedMCGen(mcParticles, daughterK0S, kK0Short, std::array{+kPiPlus, -kPiPlus}, true)) { + flag = sign; + } } } } // Check whether the particle is non-prompt (from a b quark). - if (sign != 0) { + if (flag != 0) { origin = RecoDecay::getCharmHadronOrigin(mcParticles, particle, false, &idxBhadMothers); } if (origin == RecoDecay::OriginType::NonPrompt) { - rowMcMatchGen(sign, origin, idxBhadMothers[0]); + rowMcMatchGen(flag, origin, idxBhadMothers[0]); } else { - rowMcMatchGen(sign, origin, -1); + rowMcMatchGen(flag, origin, -1); } } } diff --git a/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx b/PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx index cff26b7e340..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; @@ -134,14 +141,14 @@ struct HfCandidateCreatorXic0Omegac0 { float chi2TopoCascToPv; float decayLenXYLambda; float decayLenXYCasc; - float cosPaV0ToCasc; // PA + float cosPaV0ToCasc; float cosPaXYV0ToCasc; - float cosPaV0ToPv; // PA + float cosPaV0ToPv; float cosPaXYV0ToPv; - float cosPaCascToOmegac; // PA + float cosPaCascToOmegac; float cosPaXYCascToOmegac; - float cosPaCascToPv; // PA - float cosPaXYCascToPv; // PA + float cosPaCascToPv; + float cosPaXYCascToPv; float massV0; float massCasc; float ptPiFromOmegac; @@ -160,7 +167,7 @@ struct HfCandidateCreatorXic0Omegac0 { float kfDcaOmegacDau; float kfDcaXYCascToPv; float chi2TopoOmegacToPv; - float cosPaOmegacToPv; // PA + float cosPaOmegacToPv; float cosPaXYOmegacToPv; float ldlOmegac; float ctV0; @@ -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)) { @@ -221,12 +228,12 @@ struct HfCandidateCreatorXic0Omegac0 { hCascadesCounterToOmegaK = registry.add("hCascadesCounterToOmegaK", "Cascades counter wrt derived data - #Omega K decay;status;entries", {HistType::kTH1F, {{2, -0.5, 1.5}}}); // 0 --> cascades in derived data table (and stored in AOD table), 1 --> cascades in derived data table and also accessible in cascData table // KFparticle variables hist - registry.add("hKFParticleV0Chi2", "hKFParticleV0Chi2", kTH1F, {{1000, -0.10f, 100.0f}}); - registry.add("hKFParticleCascChi2", "hKFParticleCascChi2 from \"track to kf\" daughter", kTH1F, {{1000, -0.1f, 100.0f}}); - registry.add("hKFParticleOmegaC0Chi2", "hKFParticleOmegaC0Chi2", kTH1F, {{1000, -0.1f, 10.0f}}); registry.add("hKFParticleV0TopoChi2", "hKFParticleV0TopoChi2", kTH1F, {{1000, -0.10f, 100.0f}}); registry.add("hKFParticleCascTopoChi2", "hKFParticleCascTopoChi2", kTH1F, {{1000, -0.1f, 100.0f}}); registry.add("hKFParticleCascBachTopoChi2", "hKFParticleCascBachTopoChi2", kTH1F, {{1000, -0.1f, 100.0f}}); + registry.add("hKFParticleDcaCharmBaryonDau", "hKFParticleDcaCharmBaryonDau", kTH1F, {{1000, -0.1f, 100.0f}}); + registry.add("hKFParticleDcaXYV0DauToPv", "hKFParticleDcaXYV0DauToPv", kTH1F, {{1000, -0.1f, 100.0f}}); + registry.add("hKFParticleDcaXYCascBachToPv", "hKFParticleDcaXYCascBachToPv", kTH1F, {{1000, -0.1f, 100.0f}}); registry.add("hKfLambda_ldl", "hKfLambda_ldl", kTH1F, {{1000, 0.0f, 1000.0f}}); registry.add("hKfOmega_ldl", "hKfOmega_ldl", kTH1F, {{1000, 0.0f, 1000.0f}}); registry.add("hKfOmegaC0_ldl", "hKfOmegaC0_ldl", kTH1F, {{1000, 0.0f, 1000.0f}}); @@ -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 @@ -638,38 +666,38 @@ struct HfCandidateCreatorXic0Omegac0 { // kaon <- casc TrackParCov auto omegaDauChargedTrackParCov = getTrackParCov(trackCascDauCharged); // convert tracks into KFParticle object - KFPTrack kfpTrack0 = createKFPTrackFromTrack(trackV0Dau0); - KFPTrack kfpTrack1 = createKFPTrackFromTrack(trackV0Dau1); - KFPTrack kfpTrackBach = createKFPTrackFromTrack(trackCascDauCharged); - - KFParticle kfpPosPr(kfpTrack0, kProton); - KFParticle kfpNegPi(kfpTrack1, kPiMinus); - KFParticle kfpNegKa(kfpTrackBach, kKMinus); - KFParticle kfpPosPi(kfpTrack0, kPiPlus); - KFParticle kfpNegPr(kfpTrack1, kProton); - KFParticle kfpPosKa(kfpTrackBach, kKPlus); - - KFParticle kfpBachKaon; - KFParticle kfpPos; - KFParticle kfpNeg; + KFPTrack kfTrack0 = createKFPTrackFromTrack(trackV0Dau0); + KFPTrack kfTrack1 = createKFPTrackFromTrack(trackV0Dau1); + KFPTrack kfTrackBach = createKFPTrackFromTrack(trackCascDauCharged); + + KFParticle kfPosPr(kfTrack0, kProton); + KFParticle kfNegPi(kfTrack1, kPiMinus); + KFParticle kfNegKa(kfTrackBach, kKMinus); + KFParticle kfPosPi(kfTrack0, kPiPlus); + KFParticle kfNegPr(kfTrack1, kProton); + KFParticle kfPosKa(kfTrackBach, kKPlus); + + KFParticle kfBachKaon; + KFParticle kfPos; + KFParticle kfNeg; if (bachCharge < 0) { - kfpPos = kfpPosPr; - kfpNeg = kfpNegPi; - kfpBachKaon = kfpNegKa; + kfPos = kfPosPr; + kfNeg = kfNegPi; + kfBachKaon = kfNegKa; } else { - kfpPos = kfpPosPi; - kfpNeg = kfpNegPr; - kfpBachKaon = kfpPosKa; + kfPos = kfPosPi; + kfNeg = kfNegPr; + kfBachKaon = kfPosKa; } //__________________________________________ //*>~<* step 1 : construct V0 with KF - const KFParticle* V0Daughters[2] = {&kfpPos, &kfpNeg}; + const KFParticle* v0Daughters[2] = {&kfPos, &kfNeg}; // construct V0 - KFParticle KFV0; - KFV0.SetConstructMethod(kfConstructMethod); + KFParticle kfV0; + kfV0.SetConstructMethod(kfConstructMethod); try { - KFV0.Construct(V0Daughters, 2); + kfV0.Construct(v0Daughters, 2); } catch (std::runtime_error& e) { LOG(debug) << "Failed to construct cascade V0 from daughter tracks: " << e.what(); continue; @@ -677,133 +705,172 @@ struct HfCandidateCreatorXic0Omegac0 { // mass window cut on lambda before mass constraint float massLam, sigLam; - KFV0.GetMass(massLam, sigLam); + kfV0.GetMass(massLam, sigLam); if (TMath::Abs(massLam - MassLambda0) > lambdaMassWindow) continue; - registry.fill(HIST("hKFParticleV0Chi2"), KFV0.GetChi2()); + // err_mass>0 of Lambda + if (sigLam <= 0) + continue; + // chi2>0 && NDF>0 for selecting Lambda + if ((kfV0.GetNDF() <= 0 || kfV0.GetChi2() <= 0)) + continue; + kfOmegac0Candidate.chi2GeoV0 = kfV0.GetChi2(); + KFParticle kfV0MassConstrained = kfV0; + kfV0MassConstrained.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); // set mass constrain to Lambda if (kfUseV0MassConstraint) { - KFV0.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); + KFParticle kfV0 = kfV0MassConstrained; } - - KFParticle KFV0_m = KFV0; - KFV0_m.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); - - //-------------------------- V0 info--------------------------- - // pseudorapidity - float pseudorapV0Dau0 = trackV0Dau0.eta(); - float pseudorapV0Dau1 = trackV0Dau1.eta(); - - // info from from KFParticle - std::array pVecV0 = {KFV0.GetPx(), KFV0.GetPy(), KFV0.GetPz()}; // pVec stands for vector containing the 3-momentum components - std::array vertexV0 = {KFV0.GetX(), KFV0.GetY(), KFV0.GetZ()}; - std::array pVecV0Dau0 = {kfpPos.GetPx(), kfpPos.GetPy(), kfpPos.GetPz()}; - std::array pVecV0Dau1 = {kfpNeg.GetPx(), kfpNeg.GetPy(), kfpNeg.GetPz()}; + kfV0.TransportToDecayVertex(); //__________________________________________ - //*>~<* step 2 : reconstruc cascade(Omega) with KF - KFParticle kfpV0 = KFV0; - const KFParticle* OmegaDaugthers[2] = {&kfpBachKaon, &kfpV0}; + //*>~<* step 2 : reconstruct cascade(Omega) with KF + const KFParticle* omegaDaugthers[2] = {&kfBachKaon, &kfV0}; // construct cascade - KFParticle KFOmega; - KFOmega.SetConstructMethod(kfConstructMethod); + KFParticle kfOmega; + kfOmega.SetConstructMethod(kfConstructMethod); try { - KFOmega.Construct(OmegaDaugthers, 2); + kfOmega.Construct(omegaDaugthers, 2); } catch (std::runtime_error& e) { - LOG(debug) << "Failed to construct omega from V0 and bachelor track: " << e.what(); + LOG(debug) << "Failed to construct Omega from V0 and bachelor track: " << e.what(); continue; } float massCasc, sigCasc; - KFOmega.GetMass(massCasc, sigCasc); + kfOmega.GetMass(massCasc, sigCasc); + // err_massOmega > 0 + if (sigCasc <= 0) + continue; + if (std::abs(massCasc - MassOmegaMinus) > massToleranceCascade) + continue; + // chi2>0 && NDF>0 + if (kfOmega.GetNDF() <= 0 || kfOmega.GetChi2() <= 0) + continue; + kfOmegac0Candidate.chi2GeoCasc = kfOmega.GetChi2(); + KFParticle kfOmegaMassConstrained = kfOmega; + kfOmegaMassConstrained.SetNonlinearMassConstraint(o2::constants::physics::MassOmegaMinus); // set mass constrain to OmegaMinus if (kfUseCascadeMassConstraint) { // set mass constraint if requested - KFOmega.SetNonlinearMassConstraint(o2::constants::physics::MassOmegaMinus); + KFParticle kfOmega = kfOmegaMassConstrained; } - KFParticle KFOmega_m = KFOmega; - KFOmega_m.SetNonlinearMassConstraint(o2::constants::physics::MassOmegaMinus); registry.fill(HIST("hInvMassOmegaMinus"), massCasc); - registry.fill(HIST("hKFParticleCascChi2"), KFOmega.GetChi2()); - - //-------------------reconstruct cascade track------------------ - // pseudorapidity - float pseudorapCascBachelor = trackCascDauCharged.eta(); - - // info from KFParticle - std::array vertexCasc = {KFOmega.GetX(), KFOmega.GetY(), KFOmega.GetZ()}; - std::array pVecCasc = {KFOmega.GetPx(), KFOmega.GetPy(), KFOmega.GetPz()}; - std::array covCasc = {0.}; - for (int i = 0; i < 21; i++) { - covCasc[i] = KFOmega.GetCovariance(i); - } - o2::track::TrackParCov trackCasc = o2::track::TrackParCov(vertexCasc, pVecCasc, covCasc, bachCharge, true, o2::track::PID::OmegaMinus); - trackCasc.setAbsCharge(1); - trackCasc.setPID(o2::track::PID::OmegaMinus); - std::array pVecCascBachelor = {kfpBachKaon.GetPx(), kfpBachKaon.GetPy(), kfpBachKaon.GetPz()}; - - //------------reconstruct charm baryon decay vtx--------------- - auto trackParVarCharmBachelor = getTrackParCov(trackCharmBachelor); // charm bachelor pion track to be processed with DCAFitter + kfOmega.TransportToDecayVertex(); //__________________________________________ //*>~<* step 3 : reconstruc Omegac0 with KF // Create KF charm bach Pion from track - KFPTrack kfpTrackBachPion = createKFPTrackFromTrack(trackCharmBachelor); - - KFParticle kfpBachPion(kfpTrackBachPion, kPiPlus); - KFParticle kfpCasc = KFOmega; - const KFParticle* OmegaC0Daugthers[2] = {&kfpBachPion, &kfpCasc}; + KFPTrack kfTrackBachPion = createKFPTrackFromTrack(trackCharmBachelor); + KFParticle kfBachPion(kfTrackBachPion, kPiPlus); + const KFParticle* omegaC0Daugthers[2] = {&kfBachPion, &kfOmega}; // construct OmegaC0 - KFParticle KFOmegaC0; - KFOmegaC0.SetConstructMethod(kfConstructMethod); + KFParticle kfOmegaC0; + kfOmegaC0.SetConstructMethod(kfConstructMethod); try { - KFOmegaC0.Construct(OmegaC0Daugthers, 2); + kfOmegaC0.Construct(omegaC0Daugthers, 2); } catch (std::runtime_error& e) { - LOG(debug) << "Failed to construct OmegaC0 from V0 and bachelor track: " << e.what(); + LOG(debug) << "Failed to construct OmegaC0 from Cascade and bachelor pion track: " << e.what(); continue; } float massOmegaC0, sigOmegaC0; - KFOmegaC0.GetMass(massOmegaC0, sigOmegaC0); - registry.fill(HIST("hKFParticleOmegaC0Chi2"), KFOmegaC0.GetChi2()); + kfOmegaC0.GetMass(massOmegaC0, sigOmegaC0); + if (sigOmegaC0 <= 0) + continue; + // chi2>0 && NDF>0 + if (kfOmegaC0.GetNDF() <= 0 || kfOmegaC0.GetChi2() <= 0) + continue; hFitterStatus->Fill(0); hCandidateCounter->Fill(2); - + kfOmegaC0.TransportToDecayVertex(); // PV - KFPVertex kfpVertex = createKFPVertexFromCollision(collision); - KFParticle KFPV(kfpVertex); + KFPVertex kfVertex = createKFPVertexFromCollision(collision); + KFParticle kfPV(kfVertex); + + // set production vertex; + kfNeg.SetProductionVertex(kfV0); + kfPos.SetProductionVertex(kfV0); + + KFParticle kfBachKaonToOmega = kfBachKaon; + KFParticle kfV0ToCasc = kfV0; + kfBachKaonToOmega.SetProductionVertex(kfOmega); + kfV0ToCasc.SetProductionVertex(kfOmega); + + KFParticle kfOmegaToOmegaC = kfOmega; + KFParticle kfBachPionToOmegaC = kfBachPion; + kfBachPionToOmegaC.SetProductionVertex(kfOmegaC0); + kfOmegaToOmegaC.SetProductionVertex(kfOmegaC0); + + // KFParticle to PV + KFParticle kfV0ToPv = kfV0; + KFParticle kfOmegaToPv = kfOmega; + KFParticle kfOmegac0ToPv = kfOmegaC0; + KFParticle kfPiFromOmegacToPv = kfBachPion; + + kfV0ToPv.SetProductionVertex(kfPV); + kfOmegaToPv.SetProductionVertex(kfPV); + kfOmegac0ToPv.SetProductionVertex(kfPV); + kfPiFromOmegacToPv.SetProductionVertex(kfPV); + //------------get updated daughter tracks after vertex fit --------------- + auto trackParVarCharmBachelor = getTrackParCovFromKFP(kfBachPionToOmegaC, o2::track::PID::Pion, -bachCharge); // chrambaryon bach pion + trackParVarCharmBachelor.setAbsCharge(1); + + omegaDauChargedTrackParCov = getTrackParCovFromKFP(kfBachKaonToOmega, o2::track::PID::Kaon, bachCharge); // Cascade bach kaon + omegaDauChargedTrackParCov.setAbsCharge(1); + o2::track::TrackParCov trackCasc = getTrackParCovFromKFP(kfOmegaToOmegaC, kfOmegaToOmegaC.GetPDG(), bachCharge); + trackCasc.setAbsCharge(1); + + trackParCovV0Dau0 = getTrackParCovFromKFP(kfPos, kfPos.GetPDG(), 1); // V0 postive daughter + trackParCovV0Dau0.setAbsCharge(1); + trackParCovV0Dau1 = getTrackParCovFromKFP(kfNeg, kfNeg.GetPDG(), -1); // V0 negtive daughter + trackParCovV0Dau1.setAbsCharge(1); + + //-------------------------- V0 info--------------------------- + // pseudorapidity + float pseudorapV0Dau0 = kfPos.GetEta(); + float pseudorapV0Dau1 = kfNeg.GetEta(); + + // info from from KFParticle + std::array pVecV0 = {kfV0.GetPx(), kfV0.GetPy(), kfV0.GetPz()}; // pVec stands for vector containing the 3-momentum components + std::array vertexV0 = {kfV0.GetX(), kfV0.GetY(), kfV0.GetZ()}; + std::array pVecV0Dau0 = {kfPos.GetPx(), kfPos.GetPy(), kfPos.GetPz()}; + std::array pVecV0Dau1 = {kfNeg.GetPx(), kfNeg.GetPy(), kfNeg.GetPz()}; + + //-------------------reconstruct cascade track------------------ + // pseudorapidity + float pseudorapCascBachelor = kfBachKaonToOmega.GetEta(); + + // info from KFParticle + std::array vertexCasc = {kfOmega.GetX(), kfOmega.GetY(), kfOmega.GetZ()}; + std::array pVecCascBachelor = {kfBachKaonToOmega.GetPx(), kfBachKaonToOmega.GetPy(), kfBachKaonToOmega.GetPz()}; + auto primaryVertex = getPrimaryVertex(collision); std::array pvCoord = {collision.posX(), collision.posY(), collision.posZ()}; - std::array vertexCharmBaryonFromFitter = {0.0, 0.0, 0.0}; // This variable get from DCAfitter in default process, in KF process it is set as 0. - std::array pVecCascAsD; std::array pVecCharmBachelorAsD; - pVecCharmBachelorAsD[0] = kfpBachPion.GetPx(); - pVecCharmBachelorAsD[1] = kfpBachPion.GetPy(); - pVecCharmBachelorAsD[2] = kfpBachPion.GetPz(); - pVecCascAsD[0] = kfpCasc.GetPx(); - pVecCascAsD[1] = kfpCasc.GetPy(); - pVecCascAsD[2] = kfpCasc.GetPz(); + pVecCharmBachelorAsD[0] = kfBachPionToOmegaC.GetPx(); + pVecCharmBachelorAsD[1] = kfBachPionToOmegaC.GetPy(); + pVecCharmBachelorAsD[2] = kfBachPionToOmegaC.GetPz(); - std::array pVecCharmBaryon = {pVecCascAsD[0] + pVecCharmBachelorAsD[0], pVecCascAsD[1] + pVecCharmBachelorAsD[1], pVecCascAsD[2] + pVecCharmBachelorAsD[2]}; - std::array coordVtxCharmBaryon = {KFOmegaC0.GetX(), KFOmegaC0.GetY(), KFOmegaC0.GetZ()}; - auto covVtxCharmBaryon = KFOmegaC0.CovarianceMatrix(); + std::array pVecCharmBaryon = {kfOmegaC0.GetPx(), kfOmegaC0.GetPy(), kfOmegaC0.GetPz()}; + std::array coordVtxCharmBaryon = {kfOmegaC0.GetX(), kfOmegaC0.GetY(), kfOmegaC0.GetZ()}; + auto covVtxCharmBaryon = kfOmegaC0.CovarianceMatrix(); float covMatrixPV[6]; - kfpVertex.GetCovarianceMatrix(covMatrixPV); + kfVertex.GetCovarianceMatrix(covMatrixPV); // impact parameters - o2::dataformats::DCA impactParameterV0Dau0; - o2::dataformats::DCA impactParameterV0Dau1; - o2::dataformats::DCA impactParameterKaFromCasc; - o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, trackParCovV0Dau0, 2.f, matCorr, &impactParameterV0Dau0); - o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, trackParCovV0Dau1, 2.f, matCorr, &impactParameterV0Dau1); - o2::base::Propagator::Instance()->propagateToDCABxByBz(primaryVertex, omegaDauChargedTrackParCov, 2.f, matCorr, &impactParameterKaFromCasc); - float dcaxyV0Dau0 = impactParameterV0Dau0.getY(); - float dcaxyV0Dau1 = impactParameterV0Dau1.getY(); - float dcaxyCascBachelor = impactParameterKaFromCasc.getY(); - float dcazV0Dau0 = impactParameterV0Dau0.getZ(); - float dcazV0Dau1 = impactParameterV0Dau1.getZ(); - float dcazCascBachelor = impactParameterKaFromCasc.getZ(); + gpu::gpustd::array impactParameterV0Dau0; + gpu::gpustd::array impactParameterV0Dau1; + gpu::gpustd::array impactParameterKaFromCasc; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovV0Dau0, 2.f, matCorr, &impactParameterV0Dau0); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovV0Dau1, 2.f, matCorr, &impactParameterV0Dau1); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, omegaDauChargedTrackParCov, 2.f, matCorr, &impactParameterKaFromCasc); + float dcaxyV0Dau0 = impactParameterV0Dau0[0]; + float dcaxyV0Dau1 = impactParameterV0Dau1[0]; + float dcaxyCascBachelor = impactParameterKaFromCasc[0]; + float dcazV0Dau0 = impactParameterV0Dau0[1]; + float dcazV0Dau1 = impactParameterV0Dau1[1]; + float dcazCascBachelor = impactParameterKaFromCasc[1]; // pseudorapidity - float pseudorapCharmBachelor = trackCharmBachelor.eta(); + float pseudorapCharmBachelor = kfBachPionToOmegaC.GetEta(); // impact parameters o2::dataformats::DCA impactParameterCasc; @@ -819,7 +886,7 @@ struct HfCandidateCreatorXic0Omegac0 { float decLenV0 = RecoDecay::distance(vertexCasc, vertexV0); double phiCharmBaryon, thetaCharmBaryon; - getPointDirection(std::array{KFV0.GetX(), KFV0.GetY(), KFV0.GetZ()}, coordVtxCharmBaryon, phiCharmBaryon, thetaCharmBaryon); + getPointDirection(std::array{kfV0.GetX(), kfV0.GetY(), kfV0.GetZ()}, coordVtxCharmBaryon, phiCharmBaryon, thetaCharmBaryon); auto errorDecayLengthCharmBaryon = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phiCharmBaryon, thetaCharmBaryon) + getRotatedCovMatrixXX(covVtxCharmBaryon, phiCharmBaryon, thetaCharmBaryon)); auto errorDecayLengthXYCharmBaryon = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phiCharmBaryon, 0.) + getRotatedCovMatrixXX(covVtxCharmBaryon, phiCharmBaryon, 0.)); @@ -828,128 +895,102 @@ struct HfCandidateCreatorXic0Omegac0 { hCandidateCounter->Fill(3); //// KFParticle table information - KFParticle kfpNegToV0 = kfpNeg; - KFParticle kfpPosToV0 = kfpPos; - kfpNegToV0.SetProductionVertex(KFV0); - kfpPosToV0.SetProductionVertex(KFV0); - - KFParticle kfpBachKaonToOmega = kfpBachKaon; - KFParticle kfpV0ToCasc = kfpV0; - kfpBachKaonToOmega.SetProductionVertex(KFOmega); - kfpV0ToCasc.SetProductionVertex(KFOmega); - - KFParticle kfpCascToOmegaC = kfpCasc; - KFParticle kfpBachPionToOmegaC = kfpBachPion; - kfpBachPionToOmegaC.SetProductionVertex(KFOmegaC0); - kfpCascToOmegaC.SetProductionVertex(KFOmegaC0); - - // KFParticle to PV - KFParticle kfpV0ToPv = kfpV0; - KFParticle kfpCascToPv = kfpCasc; - KFParticle kfpOmegacToPv = KFOmegaC0; - KFParticle kfpPiFromOmegacToPv = kfpBachPion; - - kfpV0ToPv.SetProductionVertex(KFPV); - kfpCascToPv.SetProductionVertex(KFPV); - kfpOmegacToPv.SetProductionVertex(KFPV); - kfpPiFromOmegacToPv.SetProductionVertex(KFPV); - - // KF geochi2 - kfOmegac0Candidate.chi2GeoV0 = KFV0.GetChi2(); - auto v0NDF = KFV0.GetNDF(); + // KF chi2 + auto v0NDF = kfV0.GetNDF(); auto v0Chi2OverNdf = kfOmegac0Candidate.chi2GeoV0 / v0NDF; - kfOmegac0Candidate.chi2GeoCasc = KFOmega.GetChi2(); - auto cascNDF = KFOmega.GetNDF(); + auto cascNDF = kfOmega.GetNDF(); auto cascChi2OverNdf = kfOmegac0Candidate.chi2GeoCasc / cascNDF; - kfOmegac0Candidate.chi2GeoOmegac = KFOmegaC0.GetChi2(); - auto charmbaryonNDF = KFOmegaC0.GetNDF(); + kfOmegac0Candidate.chi2GeoOmegac = kfOmegaC0.GetChi2(); + auto charmbaryonNDF = kfOmegaC0.GetNDF(); auto charmbaryonChi2OverNdf = kfOmegac0Candidate.chi2GeoOmegac / charmbaryonNDF; - kfOmegac0Candidate.chi2MassV0 = KFV0_m.GetChi2(); - auto v0NDF_m = KFV0_m.GetNDF(); + kfOmegac0Candidate.chi2MassV0 = kfV0MassConstrained.GetChi2(); + auto v0NDF_m = kfV0MassConstrained.GetNDF(); auto v0Chi2OverNdf_m = kfOmegac0Candidate.chi2MassV0 / v0NDF_m; - kfOmegac0Candidate.chi2MassCasc = KFOmega_m.GetChi2(); - auto cascNDF_m = KFOmega_m.GetNDF(); + kfOmegac0Candidate.chi2MassCasc = kfOmegaMassConstrained.GetChi2(); + auto cascNDF_m = kfOmegaMassConstrained.GetNDF(); auto cascChi2OverNdf_m = kfOmegac0Candidate.chi2MassCasc / cascNDF_m; // KF topo Chi2 - kfOmegac0Candidate.chi2TopoV0ToPv = kfpV0ToPv.GetChi2(); - kfOmegac0Candidate.chi2TopoCascToPv = kfpCascToPv.GetChi2(); - kfOmegac0Candidate.chi2TopoPiFromOmegacToPv = kfpPiFromOmegacToPv.GetChi2(); - kfOmegac0Candidate.chi2TopoOmegacToPv = kfpOmegacToPv.GetChi2(); + kfOmegac0Candidate.chi2TopoV0ToPv = kfV0ToPv.GetChi2(); + kfOmegac0Candidate.chi2TopoCascToPv = kfOmegaToPv.GetChi2(); + kfOmegac0Candidate.chi2TopoPiFromOmegacToPv = kfPiFromOmegacToPv.GetChi2(); + kfOmegac0Candidate.chi2TopoOmegacToPv = kfOmegac0ToPv.GetChi2(); - auto cascBachTopoChi2 = kfpBachKaonToOmega.GetChi2(); - kfOmegac0Candidate.chi2TopoV0ToCasc = kfpV0ToCasc.GetChi2(); - kfOmegac0Candidate.chi2TopoCascToOmegac = kfpCascToOmegaC.GetChi2(); + auto cascBachTopoChi2 = kfBachKaonToOmega.GetChi2(); + kfOmegac0Candidate.chi2TopoV0ToCasc = kfV0ToCasc.GetChi2(); + kfOmegac0Candidate.chi2TopoCascToOmegac = kfOmegaToOmegaC.GetChi2(); // KF ldl - kfOmegac0Candidate.ldlV0 = ldlFromKF(KFV0, KFPV); - kfOmegac0Candidate.ldlCasc = ldlFromKF(KFOmega, KFPV); - kfOmegac0Candidate.ldlOmegac = ldlFromKF(KFOmegaC0, KFPV); + kfOmegac0Candidate.ldlV0 = ldlFromKF(kfV0, kfPV); + kfOmegac0Candidate.ldlCasc = ldlFromKF(kfOmega, kfPV); + kfOmegac0Candidate.ldlOmegac = ldlFromKF(kfOmegaC0, kfPV); // KF dca - kfOmegac0Candidate.kfDcaXYPiFromOmegac = kfpBachPion.GetDistanceFromVertexXY(KFPV); - kfOmegac0Candidate.kfDcaV0Dau = kfpNegToV0.GetDistanceFromParticle(kfpPosToV0); - kfOmegac0Candidate.kfDcaCascDau = kfpBachKaon.GetDistanceFromParticle(kfpV0); - kfOmegac0Candidate.kfDcaXYCascToPv = kfpCasc.GetDistanceFromVertexXY(KFPV); - kfOmegac0Candidate.kfDcaOmegacDau = kfpBachPion.GetDistanceFromParticle(kfpCasc); + kfOmegac0Candidate.kfDcaXYPiFromOmegac = kfBachPionToOmegaC.GetDistanceFromVertexXY(kfPV); + kfOmegac0Candidate.kfDcaV0Dau = kfNeg.GetDistanceFromParticle(kfPos); + kfOmegac0Candidate.kfDcaCascDau = kfBachKaonToOmega.GetDistanceFromParticle(kfV0ToCasc); + kfOmegac0Candidate.kfDcaXYCascToPv = kfOmegaToOmegaC.GetDistanceFromVertexXY(kfPV); + kfOmegac0Candidate.kfDcaOmegacDau = kfBachPionToOmegaC.GetDistanceFromParticle(kfOmegaToOmegaC); // KF decay length float DecayLxy_Lam, err_DecayLxy_Lam; - kfpV0ToCasc.GetDecayLengthXY(DecayLxy_Lam, err_DecayLxy_Lam); + kfV0ToCasc.GetDecayLengthXY(DecayLxy_Lam, err_DecayLxy_Lam); kfOmegac0Candidate.decayLenXYLambda = DecayLxy_Lam; float DecayLxy_Casc, err_DecayLxy_Casc; - kfpCascToPv.GetDecayLengthXY(DecayLxy_Casc, err_DecayLxy_Casc); + kfOmegaToOmegaC.GetDecayLengthXY(DecayLxy_Casc, err_DecayLxy_Casc); kfOmegac0Candidate.decayLenXYCasc = DecayLxy_Casc; float DecayLxy_Omegac0, err_DecayLxy_Omegac0; - kfpOmegacToPv.GetDecayLengthXY(DecayLxy_Omegac0, err_DecayLxy_Omegac0); + kfOmegac0ToPv.GetDecayLengthXY(DecayLxy_Omegac0, err_DecayLxy_Omegac0); kfOmegac0Candidate.decayLenXYOmegac = DecayLxy_Omegac0; // KF cosPA - kfOmegac0Candidate.cosPaV0ToPv = cpaFromKF(kfpV0, KFPV); - kfOmegac0Candidate.cosPaCascToPv = cpaFromKF(kfpCasc, KFPV); - kfOmegac0Candidate.cosPaOmegacToPv = cpaFromKF(KFOmegaC0, KFPV); - kfOmegac0Candidate.cosPaXYV0ToPv = cpaXYFromKF(kfpV0, KFPV); - kfOmegac0Candidate.cosPaXYCascToPv = cpaXYFromKF(kfpCasc, KFPV); - kfOmegac0Candidate.cosPaXYOmegacToPv = cpaXYFromKF(KFOmegaC0, KFPV); - - kfOmegac0Candidate.cosPaV0ToCasc = cpaFromKF(kfpV0, kfpCasc); - kfOmegac0Candidate.cosPaCascToOmegac = cpaFromKF(kfpCasc, KFOmegaC0); - kfOmegac0Candidate.cosPaXYV0ToCasc = cpaXYFromKF(kfpV0, kfpCasc); - kfOmegac0Candidate.cosPaXYCascToOmegac = cpaXYFromKF(kfpCasc, KFOmegaC0); + kfOmegac0Candidate.cosPaV0ToPv = cpaFromKF(kfV0, kfPV); + kfOmegac0Candidate.cosPaCascToPv = cpaFromKF(kfOmega, kfPV); + kfOmegac0Candidate.cosPaOmegacToPv = cpaFromKF(kfOmegaC0, kfPV); + kfOmegac0Candidate.cosPaXYV0ToPv = cpaXYFromKF(kfV0, kfPV); + kfOmegac0Candidate.cosPaXYCascToPv = cpaXYFromKF(kfOmega, kfPV); + kfOmegac0Candidate.cosPaXYOmegacToPv = cpaXYFromKF(kfOmegaC0, kfPV); + + kfOmegac0Candidate.cosPaV0ToCasc = cpaFromKF(kfV0, kfOmega); + kfOmegac0Candidate.cosPaCascToOmegac = cpaFromKF(kfOmega, kfOmegaC0); + kfOmegac0Candidate.cosPaXYV0ToCasc = cpaXYFromKF(kfV0, kfOmega); + kfOmegac0Candidate.cosPaXYCascToOmegac = cpaXYFromKF(kfOmega, kfOmegaC0); // KF mass kfOmegac0Candidate.massV0 = massLam; kfOmegac0Candidate.massCasc = massCasc; kfOmegac0Candidate.massOmegac = massOmegaC0; // KF pT - kfOmegac0Candidate.ptPiFromOmegac = trackCharmBachelor.pt(); - kfOmegac0Candidate.ptOmegac = kfpOmegacToPv.GetPt(); + kfOmegac0Candidate.ptPiFromOmegac = kfBachPionToOmegaC.GetPt(); + kfOmegac0Candidate.ptOmegac = kfOmegaC0.GetPt(); // KF rapidity - kfOmegac0Candidate.rapOmegac = kfpOmegacToPv.GetRapidity(); + kfOmegac0Candidate.rapOmegac = kfOmegaC0.GetRapidity(); // KF cosThetaStar - kfOmegac0Candidate.cosThetaStarPiFromOmegac = cosThetaStarFromKF(0, 4332, 211, 3312, kfpBachPionToOmegaC, kfpCascToOmegaC); + kfOmegac0Candidate.cosThetaStarPiFromOmegac = cosThetaStarFromKF(0, 4332, 211, 3312, kfBachPionToOmegaC, kfOmegaToOmegaC); // KF ct - kfOmegac0Candidate.ctV0 = kfpV0ToCasc.GetLifeTime(); - kfOmegac0Candidate.ctCasc = kfpCascToOmegaC.GetLifeTime(); - kfOmegac0Candidate.ctOmegac = kfpOmegacToPv.GetLifeTime(); + kfOmegac0Candidate.ctV0 = kfV0.GetLifeTime(); + kfOmegac0Candidate.ctCasc = kfOmega.GetLifeTime(); + kfOmegac0Candidate.ctOmegac = kfOmegaC0.GetLifeTime(); // KF eta - kfOmegac0Candidate.etaOmegac = kfpOmegacToPv.GetEta(); + kfOmegac0Candidate.etaOmegac = kfOmegaC0.GetEta(); // fill KF hist registry.fill(HIST("hKFParticleCascBachTopoChi2"), cascBachTopoChi2); registry.fill(HIST("hKFParticleV0TopoChi2"), kfOmegac0Candidate.chi2TopoV0ToCasc); registry.fill(HIST("hKFParticleCascTopoChi2"), kfOmegac0Candidate.chi2TopoCascToOmegac); - + registry.fill(HIST("hKFParticleDcaCharmBaryonDau"), kfOmegac0Candidate.kfDcaOmegacDau); + registry.fill(HIST("hKFParticleDcaXYCascBachToPv"), dcaxyCascBachelor); + registry.fill(HIST("hKFParticleDcaXYV0DauToPv"), dcaxyV0Dau0); registry.fill(HIST("hKfLambda_ldl"), kfOmegac0Candidate.ldlV0); registry.fill(HIST("hKfOmega_ldl"), kfOmegac0Candidate.ldlCasc); registry.fill(HIST("hKfOmegaC0_ldl"), kfOmegac0Candidate.ldlOmegac); @@ -964,7 +1005,7 @@ struct HfCandidateCreatorXic0Omegac0 { trackCascDauCharged.sign(), covVtxCharmBaryon[0], covVtxCharmBaryon[1], covVtxCharmBaryon[2], covVtxCharmBaryon[3], covVtxCharmBaryon[4], covVtxCharmBaryon[5], pVecCharmBaryon[0], pVecCharmBaryon[1], pVecCharmBaryon[2], - pVecCasc[0], pVecCasc[1], pVecCasc[2], + kfOmegaToOmegaC.GetPx(), kfOmegaToOmegaC.GetPy(), kfOmegaToOmegaC.GetPz(), pVecCharmBachelorAsD[0], pVecCharmBachelorAsD[1], pVecCharmBachelorAsD[2], pVecV0[0], pVecV0[1], pVecV0[2], pVecCascBachelor[0], pVecCascBachelor[1], pVecCascBachelor[2], @@ -979,7 +1020,7 @@ struct HfCandidateCreatorXic0Omegac0 { kfOmegac0Candidate.cosPaV0ToPv, kfOmegac0Candidate.cosPaOmegacToPv, kfOmegac0Candidate.cosPaCascToPv, kfOmegac0Candidate.cosPaXYV0ToPv, kfOmegac0Candidate.cosPaXYOmegacToPv, kfOmegac0Candidate.cosPaXYCascToPv, kfOmegac0Candidate.ctOmegac, kfOmegac0Candidate.ctCasc, kfOmegac0Candidate.ctV0, pseudorapV0Dau0, pseudorapV0Dau1, pseudorapCascBachelor, pseudorapCharmBachelor, - kfOmegac0Candidate.etaOmegac, KFOmega.GetEta(), KFV0.GetEta(), + kfOmegac0Candidate.etaOmegac, kfOmega.GetEta(), kfV0.GetEta(), dcaxyV0Dau0, dcaxyV0Dau1, dcaxyCascBachelor, dcazV0Dau0, dcazV0Dau1, dcazCascBachelor, kfOmegac0Candidate.kfDcaCascDau, kfOmegac0Candidate.kfDcaV0Dau, kfOmegac0Candidate.kfDcaOmegacDau, @@ -1013,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 c5390548579..cea4a034559 100644 --- a/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx @@ -13,12 +13,17 @@ /// \brief Reconstruction of Ξc± → (Ξ∓ → (Λ → p π∓) π∓) π± π± candidates /// /// \author Phil Lennart Stahlhut , Heidelberg University +/// \author Carolina Reetz , Heidelberg University /// \author Jinjoo Seo , Heidelberg University #ifndef HomogeneousField #define HomogeneousField #endif +#include +#include +#include + #include #include #include @@ -308,12 +313,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], @@ -415,15 +420,17 @@ struct HfCandidateCreatorXicToXiPiPi { 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(); @@ -531,7 +538,7 @@ 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(), @@ -549,7 +556,8 @@ struct HfCandidateCreatorXicToXiPiPi { casc.xlambda(), casc.ylambda(), casc.zlambda(), cpaXi, cpaXYXi, cpaLambda, cpaXYLambda, massXiPi0, massXiPi1); - rowCandidateKF(casc.kfCascadeChi2(), casc.kfV0Chi2(), chi2topoXicPlusPV, chi2topoXiToXicPlus, + rowCandidateKF(casc.kfCascadeChi2(), casc.kfV0Chi2(), + chi2topoXicPlusToPVBeforeConstraint, chi2topoXicPlusToPV, chi2topoXiToXicPlusBeforeConstraint, chi2topoXiToXicPlus, dcaXYPi0Pi1, dcaXYPi0Xi, dcaXYPi1Xi, dcaPi0Pi1, dcaPi0Xi, dcaPi1Xi, casc.dcacascdaughters()); diff --git a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx index 5c0c230c11f..d17f0ada8a0 100644 --- a/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorBsToDsPi.cxx @@ -116,7 +116,6 @@ struct HfCandidateSelectorBsToDsPi { hfMlResponse.setModelPathsLocal(onnxFileNames); } hfMlResponse.init(); - outputMl.assign(((std::vector)cutDirMl).size(), -1.f); // dummy value for ML output } int selectionFlagDs = -1; @@ -147,19 +146,9 @@ struct HfCandidateSelectorBsToDsPi { { for (const auto& hfCandBs : hfCandsBs) { int statusBsToDsPi = 0; + outputMl.clear(); auto ptCandBs = hfCandBs.pt(); - // check if flagged as Bs → Ds π - if (!TESTBIT(hfCandBs.hfflag(), hf_cand_bs::DecayType::BsToDsPi)) { - hfSelBsToDsPiCandidate(statusBsToDsPi); - if (applyMl) { - hfMlBsToDsPiCandidate(outputMl); - } - if (activateQA) { - registry.fill(HIST("hSelections"), 1, ptCandBs); - } - continue; - } SETBIT(statusBsToDsPi, SelectionStep::RecoSkims); // RecoSkims = 0 --> statusBsToDsPi = 1 if (activateQA) { registry.fill(HIST("hSelections"), 2 + SelectionStep::RecoSkims, ptCandBs); diff --git a/PWGHF/TableProducer/candidateSelectorD0.cxx b/PWGHF/TableProducer/candidateSelectorD0.cxx index ce2b7e9f1bf..fd249a91e3f 100644 --- a/PWGHF/TableProducer/candidateSelectorD0.cxx +++ b/PWGHF/TableProducer/candidateSelectorD0.cxx @@ -162,7 +162,7 @@ struct HfCandidateSelectorD0 { return false; } // candidate DCA - if (candidate.impactParameterXY() > cuts->get(pTBin, "DCA")) { + if (std::abs(candidate.impactParameterXY()) > cuts->get(pTBin, "DCA")) { return false; } @@ -329,20 +329,32 @@ struct HfCandidateSelectorD0 { int pidTrackNegPion = -1; if (usePidTpcOnly) { - pidTrackPosKaon = selectorKaon.statusTpc(trackPos); - pidTrackPosPion = selectorPion.statusTpc(trackPos); - pidTrackNegKaon = selectorKaon.statusTpc(trackNeg); - pidTrackNegPion = selectorPion.statusTpc(trackNeg); + /// kaon TPC PID positive daughter + pidTrackPosKaon = selectorKaon.statusTpc(trackPos, candidate.nSigTpcKa0()); + /// pion TPC PID positive daughter + pidTrackPosPion = selectorPion.statusTpc(trackPos, candidate.nSigTpcPi0()); + /// kaon TPC PID negative daughter + pidTrackNegKaon = selectorKaon.statusTpc(trackNeg, candidate.nSigTpcKa1()); + /// pion TPC PID negative daughter + pidTrackNegPion = selectorPion.statusTpc(trackNeg, candidate.nSigTpcPi1()); } else if (usePidTpcAndTof) { - pidTrackPosKaon = selectorKaon.statusTpcAndTof(trackPos); - pidTrackPosPion = selectorPion.statusTpcAndTof(trackPos); - pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg); - pidTrackNegPion = selectorPion.statusTpcAndTof(trackNeg); + /// kaon TPC, TOF PID positive daughter + pidTrackPosKaon = selectorKaon.statusTpcAndTof(trackPos, candidate.nSigTpcKa0(), candidate.nSigTofKa0()); + /// pion TPC, TOF PID positive daughter + pidTrackPosPion = selectorPion.statusTpcAndTof(trackPos, candidate.nSigTpcPi0(), candidate.nSigTofPi0()); + /// kaon TPC, TOF PID negative daughter + pidTrackNegKaon = selectorKaon.statusTpcAndTof(trackNeg, candidate.nSigTpcKa1(), candidate.nSigTofKa1()); + /// pion TPC, TOF PID negative daughter + pidTrackNegPion = selectorPion.statusTpcAndTof(trackNeg, candidate.nSigTpcPi1(), candidate.nSigTofPi1()); } else { - pidTrackPosKaon = selectorKaon.statusTpcOrTof(trackPos); - pidTrackPosPion = selectorPion.statusTpcOrTof(trackPos); - pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg); - pidTrackNegPion = selectorPion.statusTpcOrTof(trackNeg); + /// kaon TPC, TOF PID positive daughter + pidTrackPosKaon = selectorKaon.statusTpcOrTof(trackPos, candidate.nSigTpcKa0(), candidate.nSigTofKa0()); + /// pion TPC, TOF PID positive daughter + pidTrackPosPion = selectorPion.statusTpcOrTof(trackPos, candidate.nSigTpcPi0(), candidate.nSigTofPi0()); + /// kaon TPC, TOF PID negative daughter + pidTrackNegKaon = selectorKaon.statusTpcOrTof(trackNeg, candidate.nSigTpcKa1(), candidate.nSigTofKa1()); + /// pion TPC, TOF PID negative daughter + pidTrackNegPion = selectorPion.statusTpcOrTof(trackNeg, candidate.nSigTpcPi1(), candidate.nSigTofPi1()); } // int pidBayesTrackPos1Pion = selectorPion.statusBayes(trackPos); @@ -396,11 +408,11 @@ struct HfCandidateSelectorD0 { bool isSelectedMlD0bar = false; if (statusD0 > 0) { - std::vector inputFeaturesD0 = hfMlResponse.getInputFeatures(candidate, trackPos, trackNeg, o2::constants::physics::kD0); + std::vector inputFeaturesD0 = hfMlResponse.getInputFeatures(candidate, o2::constants::physics::kD0); isSelectedMlD0 = hfMlResponse.isSelectedMl(inputFeaturesD0, ptCand, outputMlD0); } if (statusD0bar > 0) { - std::vector inputFeaturesD0bar = hfMlResponse.getInputFeatures(candidate, trackPos, trackNeg, o2::constants::physics::kD0Bar); + std::vector inputFeaturesD0bar = hfMlResponse.getInputFeatures(candidate, o2::constants::physics::kD0Bar); isSelectedMlD0bar = hfMlResponse.isSelectedMl(inputFeaturesD0bar, ptCand, outputMlD0bar); } @@ -432,13 +444,13 @@ struct HfCandidateSelectorD0 { } } - void processWithDCAFitterN(aod::HfCand2Prong const& candidates, TracksSel const& tracks) + void processWithDCAFitterN(aod::HfCand2ProngWPid const& candidates, TracksSel const& tracks) { processSel(candidates, tracks); } PROCESS_SWITCH(HfCandidateSelectorD0, processWithDCAFitterN, "process candidates selection with DCAFitterN", true); - void processWithKFParticle(soa::Join const& candidates, TracksSel const& tracks) + void processWithKFParticle(soa::Join const& candidates, TracksSel const& tracks) { processSel(candidates, tracks); } diff --git a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx index b911656d114..638a25aaf7c 100644 --- a/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDplusToPiKPi.cxx @@ -60,6 +60,8 @@ struct HfCandidateSelectorDplusToPiKPi { Configurable> binsPtTrack{"binsPtTrack", std::vector{hf_cuts_single_track::vecBinsPtTrack}, "track pT bin limits for DCA pT-dependent cut"}; // QA switch Configurable activateQA{"activateQA", false, "Flag to enable QA histogram"}; + // Correlated background from Ds and D+ + Configurable storeDsDplusBkg{"storeDsDplusBkg", false, "Flag to store correlated background from misidentified product of Ds and D+ decay"}; // 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"}; @@ -223,7 +225,7 @@ struct HfCandidateSelectorDplusToPiKPi { auto ptCand = candidate.pt(); - if (!TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::DplusToPiKPi)) { + if (!TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::DplusToPiKPi) && !(storeDsDplusBkg && TESTBIT(candidate.hfflag(), aod::hf_cand_3prong::DecayType::DsToKKPi))) { // DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π± hfSelDplusToPiKPiCandidate(statusDplusToPiKPi); if (applyMl) { hfMlDplusToPiKPiCandidate(outputMlNotPreselected); diff --git a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx index 9720f270469..91df36d441c 100644 --- a/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDsToKKPi.cxx @@ -25,6 +25,7 @@ #include "PWGHF/Core/HfMlResponseDsToKKPi.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsAnalysis.h" using namespace o2; using namespace o2::analysis; @@ -73,6 +74,8 @@ struct HfCandidateSelectorDsToKKPi { Configurable> onnxFileNames{"onnxFileNames", std::vector{"ModelHandler_onnx_DsToKKPi.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"}; + // Mass cut for trigger analysis + Configurable useTriggerMassCut{"useTriggerMassCut", false, "Flag to enable parametrized pT differential mass cut for triggered data"}; HfHelper hfHelper; o2::analysis::HfMlResponseDsToKKPi hfMlResponse; @@ -81,6 +84,7 @@ struct HfCandidateSelectorDsToKKPi { o2::ccdb::CcdbApi ccdbApi; TrackSelectorPi selectorPion; TrackSelectorKa selectorKaon; + HfTrigger3ProngCuts hfTriggerCuts; using TracksSel = soa::Join; @@ -200,6 +204,9 @@ struct HfCandidateSelectorDsToKKPi { if (std::abs(hfHelper.invMassDsToKKPi(candidate) - o2::constants::physics::MassDS) > cuts->get(pTBin, "deltaM")) { return false; } + if (useTriggerMassCut && !isCandidateInMassRange(hfHelper.invMassDsToKKPi(candidate), o2::constants::physics::MassDS, candidate.pt(), hfTriggerCuts)) { + return false; + } if (hfHelper.deltaMassPhiDsToKKPi(candidate) > cuts->get(pTBin, "deltaM Phi")) { return false; } @@ -229,6 +236,9 @@ struct HfCandidateSelectorDsToKKPi { if (std::abs(hfHelper.invMassDsToPiKK(candidate) - o2::constants::physics::MassDS) > cuts->get(pTBin, "deltaM")) { return false; } + if (useTriggerMassCut && !isCandidateInMassRange(hfHelper.invMassDsToPiKK(candidate), o2::constants::physics::MassDS, candidate.pt(), hfTriggerCuts)) { + return false; + } if (hfHelper.deltaMassPhiDsToPiKK(candidate) > cuts->get(pTBin, "deltaM Phi")) { return false; } diff --git a/PWGHF/TableProducer/candidateSelectorLc.cxx b/PWGHF/TableProducer/candidateSelectorLc.cxx index afeba207356..6e50e1262a9 100644 --- a/PWGHF/TableProducer/candidateSelectorLc.cxx +++ b/PWGHF/TableProducer/candidateSelectorLc.cxx @@ -201,6 +201,21 @@ struct HfCandidateSelectorLc { return false; } + // candidate decay length XY + if (candidate.decayLengthXY() <= cuts->get(pTBin, "decLengthXY")) { + return false; + } + + // candidate normalized decay length XY + if (candidate.decayLengthXYNormalised() < cuts->get(pTBin, "normDecLXY")) { + return false; + } + + // candidate impact parameter XY + if (std::abs(candidate.impactParameterXY()) > cuts->get(pTBin, "impParXY")) { + return false; + } + if (!isSelectedCandidateProngDca(candidate)) { return false; } @@ -432,11 +447,11 @@ struct HfCandidateSelectorLc { isSelectedMlLcToPiKP = false; if (pidLcToPKPi == 1 && pidBayesLcToPKPi == 1 && topolLcToPKPi) { - std::vector inputFeaturesLcToPKPi = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2); + std::vector inputFeaturesLcToPKPi = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2, true); isSelectedMlLcToPKPi = hfMlResponse.isSelectedMl(inputFeaturesLcToPKPi, candidate.pt(), outputMlLcToPKPi); } if (pidLcToPiKP == 1 && pidBayesLcToPiKP == 1 && topolLcToPiKP) { - std::vector inputFeaturesLcToPiKP = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2); + std::vector inputFeaturesLcToPiKP = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2, false); isSelectedMlLcToPiKP = hfMlResponse.isSelectedMl(inputFeaturesLcToPiKP, candidate.pt(), outputMlLcToPiKP); } diff --git a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx index 14e9bef0bd6..cb032518305 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToPKPi.cxx @@ -313,11 +313,11 @@ struct HfCandidateSelectorXicToPKPi { bool isSelectedMlXicToPiKP = false; if (topolXicToPKPi && pidXicToPKPi) { - std::vector inputFeaturesXicToPKPi = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2); + std::vector inputFeaturesXicToPKPi = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2, true); isSelectedMlXicToPKPi = hfMlResponse.isSelectedMl(inputFeaturesXicToPKPi, ptCand, outputMlXicToPKPi); } if (topolXicToPiKP && pidXicToPiKP) { - std::vector inputFeaturesXicToPiKP = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2); + std::vector inputFeaturesXicToPiKP = hfMlResponse.getInputFeatures(candidate, trackPos1, trackNeg, trackPos2, false); isSelectedMlXicToPiKP = hfMlResponse.isSelectedMl(inputFeaturesXicToPiKP, ptCand, outputMlXicToPiKP); } diff --git a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx index 5e2d69d04bd..a1a76ac86ea 100644 --- a/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/candidateSelectorXicToXiPiPi.cxx @@ -12,7 +12,7 @@ /// \file candidateSelectorXicToXiPiPi.cxx /// \brief Ξc± → Ξ∓ π± π± candidate selector /// -/// \author Phil Lennart Stahlhut , CERN +/// \author Phil Lennart Stahlhut , Heidelberg University #include "Framework/AnalysisTask.h" #include "Framework/runDataProcessing.h" 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/derivedDataCreatorD0ToKPi.cxx b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx index d6dfcd06fcc..59480f3b50a 100644 --- a/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/derivedDataCreatorD0ToKPi.cxx @@ -79,15 +79,15 @@ struct HfDerivedDataCreatorD0ToKPi { using CollisionsWCentMult = soa::Join; using CollisionsWMcCentMult = soa::Join; - using TracksWPid = soa::Join; - using SelectedCandidates = soa::Filtered>; - using SelectedCandidatesKf = soa::Filtered>; - using SelectedCandidatesMc = soa::Filtered>; - using SelectedCandidatesMcKf = soa::Filtered>; - using SelectedCandidatesMl = soa::Filtered>; - using SelectedCandidatesKfMl = soa::Filtered>; - using SelectedCandidatesMcMl = soa::Filtered>; - using SelectedCandidatesMcKfMl = soa::Filtered>; + // using TracksWPid = soa::Join; + using SelectedCandidates = soa::Filtered>; + using SelectedCandidatesKf = soa::Filtered>; + using SelectedCandidatesMc = soa::Filtered>; + using SelectedCandidatesMcKf = soa::Filtered>; + using SelectedCandidatesMl = soa::Filtered>; + using SelectedCandidatesKfMl = soa::Filtered>; + using SelectedCandidatesMcMl = soa::Filtered>; + using SelectedCandidatesMcKfMl = soa::Filtered>; using MatchedGenCandidatesMc = soa::Filtered>; using TypeMcCollisions = aod::McCollisions; @@ -191,8 +191,8 @@ struct HfDerivedDataCreatorD0ToKPi { } } - template - void fillTablesCandidate(const T& candidate, const U& prong0, const U& prong1, int candFlag, double invMass, double cosThetaStar, double topoChi2, + template + void fillTablesCandidate(const T& candidate, int candFlag, double invMass, double cosThetaStar, double topoChi2, double ct, double y, int8_t flagMc, int8_t origin, const std::vector& mlScores) { if (fillCandidateBase) { @@ -206,31 +206,31 @@ struct HfDerivedDataCreatorD0ToKPi { } if (fillCandidatePar) { - float tpcNSigmaPiExpPi = prong0.tpcNSigmaPi(); - float tofNSigmaPiExpPi = prong0.tofNSigmaPi(); - float tpcTofNSigmaPiExpPi = prong0.tpcTofNSigmaPi(); - float tpcNSigmaKaExpPi = prong0.tpcNSigmaKa(); - float tofNSigmaKaExpPi = prong0.tofNSigmaKa(); - float tpcTofNSigmaKaExpPi = prong0.tpcTofNSigmaKa(); - float tpcNSigmaPiExpKa = prong1.tpcNSigmaPi(); - float tofNSigmaPiExpKa = prong1.tofNSigmaPi(); - float tpcTofNSigmaPiExpKa = prong1.tpcTofNSigmaPi(); - float tpcNSigmaKaExpKa = prong1.tpcNSigmaKa(); - float tofNSigmaKaExpKa = prong1.tofNSigmaKa(); - float tpcTofNSigmaKaExpKa = prong1.tpcTofNSigmaKa(); + 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 = prong1.tpcNSigmaPi(); - tofNSigmaPiExpPi = prong1.tofNSigmaPi(); - tpcTofNSigmaPiExpPi = prong1.tpcTofNSigmaPi(); - tpcNSigmaKaExpPi = prong1.tpcNSigmaKa(); - tofNSigmaKaExpPi = prong1.tofNSigmaKa(); - tpcTofNSigmaKaExpPi = prong1.tpcTofNSigmaKa(); - tpcNSigmaPiExpKa = prong0.tpcNSigmaPi(); - tofNSigmaPiExpKa = prong0.tofNSigmaPi(); - tpcTofNSigmaPiExpKa = prong0.tpcTofNSigmaPi(); - tpcNSigmaKaExpKa = prong0.tpcNSigmaKa(); - tofNSigmaKaExpKa = prong0.tofNSigmaKa(); - tpcTofNSigmaKaExpKa = prong0.tpcTofNSigmaKa(); + 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(); } rowCandidatePar( candidate.chi2PCA(), @@ -327,7 +327,7 @@ struct HfDerivedDataCreatorD0ToKPi { template void processCandidates(CollType const& collisions, Partition& candidates, - TracksWPid const&, + aod::Tracks const&, aod::BCs const&) { // Fill collision properties @@ -388,9 +388,15 @@ struct HfDerivedDataCreatorD0ToKPi { continue; } } + } else { + if (downSampleBkgFactor < 1.) { + float pseudoRndm = candidate.ptProng0() * 1000. - (int64_t)(candidate.ptProng0() * 1000); + if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { + continue; + } + } } - auto prong0 = candidate.template prong0_as(); - auto prong1 = candidate.template prong1_as(); + double ct = hfHelper.ctD0(candidate); double y = hfHelper.yD0(candidate); float massD0, massD0bar; @@ -409,10 +415,10 @@ struct HfDerivedDataCreatorD0ToKPi { std::copy(candidate.mlProbD0bar().begin(), candidate.mlProbD0bar().end(), std::back_inserter(mlScoresD0bar)); } if (candidate.isSelD0()) { - fillTablesCandidate(candidate, prong0, prong1, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0); + fillTablesCandidate(candidate, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0); } if (candidate.isSelD0bar()) { - fillTablesCandidate(candidate, prong0, prong1, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0bar); + fillTablesCandidate(candidate, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ct, y, flagMcRec, origin, mlScoresD0bar); } } } @@ -468,7 +474,7 @@ struct HfDerivedDataCreatorD0ToKPi { void processDataWithDCAFitterN(CollisionsWCentMult const& collisions, SelectedCandidates const&, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processCandidates(collisions, candidatesAll, tracks, bcs); @@ -477,7 +483,7 @@ struct HfDerivedDataCreatorD0ToKPi { void processDataWithKFParticle(CollisionsWCentMult const& collisions, SelectedCandidatesKf const&, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processCandidates(collisions, candidatesKfAll, tracks, bcs); @@ -488,7 +494,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMc const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -501,7 +507,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMc const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -514,7 +520,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMc const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -527,7 +533,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcKf const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -540,7 +546,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcKf const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -553,7 +559,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcKf const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -566,7 +572,7 @@ struct HfDerivedDataCreatorD0ToKPi { void processDataWithDCAFitterNMl(CollisionsWCentMult const& collisions, SelectedCandidatesMl const&, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processCandidates(collisions, candidatesMlAll, tracks, bcs); @@ -575,7 +581,7 @@ struct HfDerivedDataCreatorD0ToKPi { void processDataWithKFParticleMl(CollisionsWCentMult const& collisions, SelectedCandidatesKfMl const&, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processCandidates(collisions, candidatesKfMlAll, tracks, bcs); @@ -586,7 +592,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcMl const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -599,7 +605,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcMl const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -612,7 +618,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcMl const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -625,7 +631,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcKfMl const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -638,7 +644,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcKfMl const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); @@ -651,7 +657,7 @@ struct HfDerivedDataCreatorD0ToKPi { SelectedCandidatesMcKfMl const&, TypeMcCollisions const& mcCollisions, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { preProcessMcCollisions(mcCollisions, mcParticles); diff --git a/PWGHF/TableProducer/mcPidTof.cxx b/PWGHF/TableProducer/mcPidTof.cxx new file mode 100644 index 00000000000..ec4ff54b2e3 --- /dev/null +++ b/PWGHF/TableProducer/mcPidTof.cxx @@ -0,0 +1,1035 @@ +// 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 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/pidTofMerge.cxx +/// It works only for MC and adds the possibility to apply postcalibrations for MC. +/// + +#include +#include +#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 "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; +using namespace o2::framework; +using namespace o2::pid; +using namespace o2::framework::expressions; +using namespace o2::track; + +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; + mParamFileName = opt.cfgParamFileName.value; + mParametrizationPath = opt.cfgParametrizationPath.value; + mReconstructionPass = opt.cfgReconstructionPass.value; + mLoadResponseFromCCDB = opt.cfgLoadResponseFromCCDB.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, true)) { + 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", mTimeShiftCCDBPathPos, task); + getCfg(initContext, "paramFileName", mParamFileName, task); + getCfg(initContext, "parametrizationPath", mParametrizationPath, task); + getCfg(initContext, "reconstructionPass", mReconstructionPass, task); + getCfg(initContext, "loadResponseFromCCDB", mLoadResponseFromCCDB, 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 << "'"; + + 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()); + } else { + LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + } + } else { + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(mReconstructionPass)); + mRespParamsV3.printMomentumChargeShiftParameters(); + } + } else { + mRespParamsV3.loadParamFromFile(fname.data(), mParametrizationPath); + } + } 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(); + 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()); + } else { + LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", mReconstructionPass.data()); + } + } else { // Pass is available, load non standard parameters + 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); + } + } + } + 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); + } + } + } + } + + 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 getForTimeStamp(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(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()); + } + } + return; + } + + 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 mParamFileName; + std::string mParametrizationPath; + std::string mReconstructionPass; + bool mLoadResponseFromCCDB; + 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) +{ + if (!tr.hasTOF()) { + return false; + } + return true; +} + +/// 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 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 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&) + { + 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()); + } + 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; + } + + // 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; + } + } + } else { + LOG(warning) << "Calibration not updated on " << tracks.size() << " tracks !!"; + } + 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; + + // Tables to produce (full) + Produces tablePIDFullPi; + Produces tablePIDFullKa; + Produces tablePIDFullPr; + + // Detector response parameters + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; + Service ccdb; + 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{}; + int currentRun{0}; + 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"}; + } mcRecalib; + + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Running variables + 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) + { + mTOFCalibConfig.inheritFromBaseTask(initContext); + // Checking the tables are requested in the workflow and enabling them (only pi, K, p) + std::array supportedSpecies = {idxPi, idxKa, idxPr}; + for (auto iSpecie{0u}; iSpecie < supportedSpecies.size(); ++iSpecie) { + // First checking tiny + int flag = -1; + 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]); + } + } + if (mEnabledParticlesFull.size() == 0 && mEnabledParticles.size() == 0) { + LOG(info) << "No PID tables are required, disabling process function"; + doprocessFillTables.value = false; + doprocessDummy.value = true; + return; + } + if (metadataInfo.isFullyDefined()) { + if (!metadataInfo.isRun3()) { + LOG(fatal) << "Metadata says it is Run2, but this task supports only Run3 data"; + } + } + 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}); + } + 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, const bool fullTable = false) + { + switch (id) { + case idxPi: { + if (fullTable) { + tablePIDFullPi.reserve(size); + } else { + tablePIDPi.reserve(size); + } + break; + } + case idxKa: { + if (fullTable) { + tablePIDFullKa.reserve(size); + } else { + tablePIDKa.reserve(size); + } + break; + } + case idxPr: { + if (fullTable) { + tablePIDFullPr.reserve(size); + } else { + tablePIDPr.reserve(size); + } + break; + } + default: + 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, bool fullTable = false) + { + switch (id) { + case idxPi: + if (fullTable) { + tablePIDFullPi(-999.f, -999.f); + } else { + aod::pidutils::packInTable(-999.f, + tablePIDPi); + } + break; + case idxKa: + if (fullTable) { + tablePIDFullKa(-999.f, -999.f); + } else { + aod::pidutils::packInTable(-999.f, + tablePIDKa); + } + break; + 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() for " << (fullTable ? "full" : "tiny") << " tables"; + break; + } + } + + /// Retrieve MC postcalibration objects from CCDB + /// \param timestamp timestamp + void retrieveMcPostCalibFromCcdb(int64_t timestamp) + { + std::map metadata; + 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); + 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()))); + } + } + + /// Apply MC postcalibrations + /// \param pidId particle id + /// \param pt track pT + template + T applyMcRecalib(int pidId, T trackPt, T nSigma) + { + if (nSigma < -998) { + return nSigma; + } + + float shift{0.f}, scaleWidth{0.f}; + int nPoints = gMcPostCalibMean[pidId]->GetN(); + double ptMin = gMcPostCalibMean[pidId]->GetX()[0]; + double ptMax = gMcPostCalibMean[pidId]->GetX()[nPoints - 1]; + if (trackPt < ptMin) { + shift = gMcPostCalibMean[pidId]->Eval(ptMin); + scaleWidth = gMcPostCalibSigma[pidId]->Eval(ptMin); + } else if (trackPt > ptMax) { + shift = gMcPostCalibMean[pidId]->Eval(ptMax); + scaleWidth = gMcPostCalibSigma[pidId]->Eval(ptMax); + } else { + shift = gMcPostCalibMean[pidId]->Eval(trackPt); + scaleWidth = gMcPostCalibSigma[pidId]->Eval(trackPt); + } + + T nSigmaCorr = (nSigma - shift) / scaleWidth; + return nSigmaCorr; + } + + void processDummy(Trks const&) {} + PROCESS_SWITCH(mcPidTof, processDummy, "Dummy process function", false); + + template + using ResponseImplementation = o2::pid::tof::ExpTimes; + void processFillTables(TrksWtofWevTime const& tracks, + Cols const&, + aod::BCsWithTimestamps const&, + aod::McParticles const&) + { + constexpr auto responsePi = ResponseImplementation(); + constexpr auto responseKa = ResponseImplementation(); + constexpr auto responsePr = 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 + if (mcRecalib.enable && mTOFCalibConfig.collisionSystem() != CollisionSystemType::kCollSyspp) { + LOGP(fatal, "MC recalibration only available for pp! Change the mcRecalib.enable configurable to 0 and rerun"); + } + break; + } + + for (auto const& pidId : mEnabledParticles) { + reserveTable(pidId, tracks.size(), false); + } + + for (auto const& pidId : mEnabledParticlesFull) { + reserveTable(pidId, tracks.size(), true); + } + + 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, false); + } + for (auto const& pidId : mEnabledParticlesFull) { + makeTableEmpty(pidId, true); + } + continue; + } + + if (mcRecalib.enable) { + auto runNumber = trk.collision().bc_as().runNumber(); + if (runNumber != currentRun) { + // update postcalibration files + auto timestamp = trk.collision().bc_as().timestamp(); + retrieveMcPostCalibFromCcdb(timestamp); + } + currentRun = runNumber; + } + + 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); + } + } + 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); + } + } + aod::pidutils::packInTable(nSigma, tablePIDKa); + break; + } + 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; + } + if (enableQaHistograms) { + hnSigma[pidId]->Fill(trk.p(), nSigma); + } + } + + for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses with full tables + switch (pidId) { + 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); + } + } + tablePIDFullPi(resolution, nSigma); + break; + } + 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); + } + } + tablePIDFullKa(resolution, nSigma); + break; + } + 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); + } + } + tablePIDFullPr(resolution, nSigma); + break; + } + default: + LOG(fatal) << "Wrong particle ID for full tables"; + break; + } + if (enableQaHistograms) { + hnSigmaFull[pidId]->Fill(trk.p(), nSigma); + } + } + } + } + PROCESS_SWITCH(mcPidTof, processFillTables, "Process with table filling", true); +}; + +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/treeCreatorBsToDsPi.cxx b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx index aac534e265e..542ed264892 100644 --- a/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx +++ b/PWGHF/TableProducer/treeCreatorBsToDsPi.cxx @@ -172,8 +172,8 @@ struct HfTreeCreatorBsToDsPi { Filter filterSelectCandidates = aod::hf_sel_candidate_bs::isSelBsToDsPi >= selectionFlagBs; - Partition recSig = nabs(aod::hf_cand_bs::flagMcMatchRec) == (int8_t)BIT(aod::hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi); - Partition recBg = nabs(aod::hf_cand_bs::flagMcMatchRec) != (int8_t)BIT(aod::hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi); + Partition recSig = nabs(aod::hf_cand_bs::flagMcMatchRec) == (int8_t)BIT(aod::hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); + Partition recBg = nabs(aod::hf_cand_bs::flagMcMatchRec) != (int8_t)BIT(aod::hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi); void init(InitContext const&) { @@ -351,7 +351,7 @@ struct HfTreeCreatorBsToDsPi { // Filling particle properties rowCandidateFullParticles.reserve(particles.size()); for (const auto& particle : particles) { - if (TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_bs::DecayTypeMc::BsToDsPiToKKPiPi)) { + if (TESTBIT(std::abs(particle.flagMcMatchGen()), aod::hf_cand_bs::DecayTypeMc::BsToDsPiToPhiPiPiToKKPiPi)) { rowCandidateFullParticles( particle.mcCollision().bcId(), particle.pt(), diff --git a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx index 3487f1615dd..2b2a7a84ef5 100644 --- a/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorD0ToKPi.cxx @@ -217,9 +217,9 @@ struct HfTreeCreatorD0ToKPi { HfHelper hfHelper; - using TracksWPid = soa::Join; - using SelectedCandidatesMc = soa::Filtered>; - using SelectedCandidatesMcKf = soa::Filtered>; + // using TracksWPid = soa::Join; + using SelectedCandidatesMc = soa::Filtered>; + using SelectedCandidatesMcKf = soa::Filtered>; using MatchedGenCandidatesMc = soa::Filtered>; Filter filterSelectCandidates = aod::hf_sel_candidate_d0::isSelD0 >= 1 || aod::hf_sel_candidate_d0::isSelD0bar >= 1; @@ -251,8 +251,8 @@ struct HfTreeCreatorD0ToKPi { runNumber); } - template - auto fillTable(const T& candidate, const U& prong0, const U& prong1, int candFlag, double invMass, double cosThetaStar, double topoChi2, + template + auto fillTable(const T& candidate, int candFlag, double invMass, double cosThetaStar, double topoChi2, double ct, double y, double e, int8_t flagMc, int8_t origin) { if (fillCandidateLiteTable) { @@ -268,18 +268,18 @@ struct HfTreeCreatorD0ToKPi { candidate.impactParameter1(), candidate.impactParameterNormalised0(), candidate.impactParameterNormalised1(), - prong0.tpcNSigmaPi(), - prong0.tpcNSigmaKa(), - prong0.tofNSigmaPi(), - prong0.tofNSigmaKa(), - prong0.tpcTofNSigmaPi(), - prong0.tpcTofNSigmaKa(), - prong1.tpcNSigmaPi(), - prong1.tpcNSigmaKa(), - prong1.tofNSigmaPi(), - prong1.tofNSigmaKa(), - prong1.tpcTofNSigmaPi(), - prong1.tpcTofNSigmaKa(), + candidate.nSigTpcPi0(), + candidate.nSigTpcKa0(), + candidate.nSigTofPi0(), + candidate.nSigTofKa0(), + candidate.tpcTofNSigmaPi0(), + candidate.tpcTofNSigmaKa0(), + candidate.nSigTpcPi1(), + candidate.nSigTpcKa1(), + candidate.nSigTofPi1(), + candidate.nSigTofKa1(), + candidate.tpcTofNSigmaPi1(), + candidate.tpcTofNSigmaKa1(), 1 << candFlag, invMass, candidate.pt(), @@ -326,18 +326,18 @@ struct HfTreeCreatorD0ToKPi { candidate.impactParameter1(), candidate.errorImpactParameter0(), candidate.errorImpactParameter1(), - prong0.tpcNSigmaPi(), - prong0.tpcNSigmaKa(), - prong0.tofNSigmaPi(), - prong0.tofNSigmaKa(), - prong0.tpcTofNSigmaPi(), - prong0.tpcTofNSigmaKa(), - prong1.tpcNSigmaPi(), - prong1.tpcNSigmaKa(), - prong1.tofNSigmaPi(), - prong1.tofNSigmaKa(), - prong1.tpcTofNSigmaPi(), - prong1.tpcTofNSigmaKa(), + candidate.nSigTpcPi0(), + candidate.nSigTpcKa0(), + candidate.nSigTofPi0(), + candidate.nSigTofKa0(), + candidate.tpcTofNSigmaPi0(), + candidate.tpcTofNSigmaKa0(), + candidate.nSigTpcPi1(), + candidate.nSigTpcKa1(), + candidate.nSigTofPi1(), + candidate.nSigTofKa1(), + candidate.tpcTofNSigmaPi1(), + candidate.tpcTofNSigmaKa1(), 1 << candFlag, invMass, candidate.maxNormalisedDeltaIP(), @@ -361,7 +361,7 @@ struct HfTreeCreatorD0ToKPi { template void processData(aod::Collisions const& collisions, CandType const& candidates, - TracksWPid const&, aod::BCs const&) + aod::Tracks const&, aod::BCs const&) { // Filling event properties rowCandidateFullEvents.reserve(collisions.size()); @@ -382,8 +382,6 @@ struct HfTreeCreatorD0ToKPi { continue; } } - auto prong0 = candidate.template prong0_as(); - auto prong1 = candidate.template prong1_as(); double yD = hfHelper.yD0(candidate); double eD = hfHelper.eD0(candidate); double ctD = hfHelper.ctD0(candidate); @@ -398,17 +396,17 @@ struct HfTreeCreatorD0ToKPi { massD0bar = hfHelper.invMassD0barToKPi(candidate); } if (candidate.isSelD0()) { - fillTable(candidate, prong0, prong1, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ctD, yD, eD, 0, 0); + fillTable(candidate, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ctD, yD, eD, 0, 0); } if (candidate.isSelD0bar()) { - fillTable(candidate, prong0, prong1, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ctD, yD, eD, 0, 0); + fillTable(candidate, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ctD, yD, eD, 0, 0); } } } void processDataWithDCAFitterN(aod::Collisions const& collisions, - soa::Filtered> const& candidates, - TracksWPid const& tracks, + soa::Filtered> const& candidates, + aod::Tracks const& tracks, aod::BCs const& bcs) { processData(collisions, candidates, tracks, bcs); @@ -416,8 +414,8 @@ struct HfTreeCreatorD0ToKPi { PROCESS_SWITCH(HfTreeCreatorD0ToKPi, processDataWithDCAFitterN, "Process data with DCAFitterN", true); void processDataWithKFParticle(aod::Collisions const& collisions, - soa::Filtered> const& candidates, - TracksWPid const& tracks, + soa::Filtered> const& candidates, + aod::Tracks const& tracks, aod::BCs const& bcs) { processData(collisions, candidates, tracks, bcs); @@ -429,7 +427,7 @@ struct HfTreeCreatorD0ToKPi { aod::McCollisions const&, CandType const& candidates, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const&, + aod::Tracks const&, aod::BCs const&) { // Filling event properties @@ -461,8 +459,6 @@ struct HfTreeCreatorD0ToKPi { continue; } } - auto prong0 = candidate.template prong0_as(); - auto prong1 = candidate.template prong1_as(); double yD = hfHelper.yD0(candidate); double eD = hfHelper.eD0(candidate); double ctD = hfHelper.ctD0(candidate); @@ -477,10 +473,10 @@ struct HfTreeCreatorD0ToKPi { massD0bar = hfHelper.invMassD0barToKPi(candidate); } if (candidate.isSelD0()) { - fillTable(candidate, prong0, prong1, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec()); + fillTable(candidate, 0, massD0, hfHelper.cosThetaStarD0(candidate), topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec()); } if (candidate.isSelD0bar()) { - fillTable(candidate, prong0, prong1, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec()); + fillTable(candidate, 1, massD0bar, hfHelper.cosThetaStarD0bar(candidate), topolChi2PerNdf, ctD, yD, eD, candidate.flagMcMatchRec(), candidate.originMcRec()); } } @@ -505,7 +501,7 @@ struct HfTreeCreatorD0ToKPi { aod::McCollisions const& mcCollisions, SelectedCandidatesMc const&, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processMc(collisions, mcCollisions, reconstructedCandSig, mcParticles, tracks, bcs); @@ -516,7 +512,7 @@ struct HfTreeCreatorD0ToKPi { aod::McCollisions const& mcCollisions, SelectedCandidatesMc const&, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processMc(collisions, mcCollisions, reconstructedCandBkg, mcParticles, tracks, bcs); @@ -527,7 +523,7 @@ struct HfTreeCreatorD0ToKPi { aod::McCollisions const& mcCollisions, SelectedCandidatesMc const& candidates, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processMc(collisions, mcCollisions, candidates, mcParticles, tracks, bcs); @@ -538,7 +534,7 @@ struct HfTreeCreatorD0ToKPi { aod::McCollisions const& mcCollisions, SelectedCandidatesMcKf const&, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processMc(collisions, mcCollisions, reconstructedCandSigKF, mcParticles, tracks, bcs); @@ -549,7 +545,7 @@ struct HfTreeCreatorD0ToKPi { aod::McCollisions const& mcCollisions, SelectedCandidatesMcKf const&, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processMc(collisions, mcCollisions, reconstructedCandBkgKF, mcParticles, tracks, bcs); @@ -560,7 +556,7 @@ struct HfTreeCreatorD0ToKPi { aod::McCollisions const& mcCollisions, SelectedCandidatesMcKf const& candidates, MatchedGenCandidatesMc const& mcParticles, - TracksWPid const& tracks, + aod::Tracks const& tracks, aod::BCs const& bcs) { processMc(collisions, mcCollisions, candidates, mcParticles, tracks, bcs); diff --git a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx index b7e66144251..5933bda7118 100644 --- a/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDplusToPiKPi.cxx @@ -124,7 +124,8 @@ DECLARE_SOA_TABLE(HfCandDpLites, "AOD", "HFCANDDPLITE", full::Phi, full::Y, hf_cand_3prong::FlagMcMatchRec, - hf_cand_3prong::OriginMcRec) + hf_cand_3prong::OriginMcRec, + hf_cand_3prong::FlagMcDecayChanRec) DECLARE_SOA_TABLE(HfCandDpFulls, "AOD", "HFCANDDPFULL", collision::BCId, @@ -204,7 +205,8 @@ DECLARE_SOA_TABLE(HfCandDpFulls, "AOD", "HFCANDDPFULL", full::Y, full::E, hf_cand_3prong::FlagMcMatchRec, - hf_cand_3prong::OriginMcRec); + hf_cand_3prong::OriginMcRec, + hf_cand_3prong::FlagMcDecayChanRec); DECLARE_SOA_TABLE(HfCandDpFullEvs, "AOD", "HFCANDDPFULLEV", collision::BCId, @@ -249,7 +251,7 @@ struct HfTreeCreatorDplusToPiKPi { Filter filterSelectCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus; Filter filterMcGenMatching = nabs(o2::aod::hf_cand_3prong::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)); - Partition reconstructedCandSig = nabs(aod::hf_cand_3prong::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)); + Partition reconstructedCandSig = nabs(aod::hf_cand_3prong::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)) || nabs(aod::hf_cand_3prong::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi)); // DecayType::DsToKKPi is used to flag both Ds± → K± K∓ π± and D± → K± K∓ π± Partition reconstructedCandBkg = nabs(aod::hf_cand_3prong::flagMcMatchRec) != static_cast(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi)); void init(InitContext const&) @@ -274,9 +276,11 @@ struct HfTreeCreatorDplusToPiKPi { { int8_t flagMc = 0; int8_t originMc = 0; + int8_t channelMc = 0; if constexpr (doMc) { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); + channelMc = candidate.flagMcDecayChanRec(); } auto prong0 = candidate.template prong0_as(); @@ -327,7 +331,8 @@ struct HfTreeCreatorDplusToPiKPi { candidate.phi(), hfHelper.yDplus(candidate), flagMc, - originMc); + originMc, + channelMc); } else { rowCandidateFull( candidate.collision().bcId(), @@ -407,7 +412,8 @@ struct HfTreeCreatorDplusToPiKPi { hfHelper.yDplus(candidate), hfHelper.eDplus(candidate), flagMc, - originMc); + originMc, + channelMc); } } diff --git a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx index 4e7e3fb7471..99428bf1e42 100644 --- a/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx +++ b/PWGHF/TableProducer/treeCreatorDsToKKPi.cxx @@ -22,6 +22,7 @@ #include "Framework/runDataProcessing.h" #include "PWGHF/Core/HfHelper.h" +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -77,10 +78,11 @@ DECLARE_SOA_COLUMN(MaxNormalisedDeltaIP, maxNormalisedDeltaIP, float); //! DECLARE_SOA_COLUMN(ImpactParameterXY, impactParameterXY, float); //! Transverse impact parameter of candidate (cm) DECLARE_SOA_COLUMN(DeltaMassPhi, deltaMassPhi, float); //! Absolute mass difference between kaon-pair and phi-meson invariant mass (Gev/c2) DECLARE_SOA_COLUMN(AbsCos3PiK, absCos3PiK, float); //! Cube of absolute value of the cosine of pion-kaon angle in the phi rest frame +DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the candidate // Events DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); //! Event rejection flag DECLARE_SOA_COLUMN(RunNumber, runNumber, int); //! Run number -DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign +DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Centrality (or multiplicity) percentile } // namespace full DECLARE_SOA_TABLE(HfCandDsLites, "AOD", "HFCANDDSLITE", @@ -126,9 +128,12 @@ DECLARE_SOA_TABLE(HfCandDsLites, "AOD", "HFCANDDSLITE", full::DeltaMassPhi, full::AbsCos3PiK, hf_cand::Chi2PCA, + full::Centrality, + collision::NumContrib, hf_cand_3prong::FlagMcMatchRec, hf_cand_3prong::OriginMcRec, hf_cand_3prong::FlagMcDecayChanRec, + hf_cand_3prong::IsCandidateSwapped, full::Sign); DECLARE_SOA_TABLE(HfCandDsFulls, "AOD", "HFCANDDSFULL", @@ -197,9 +202,11 @@ DECLARE_SOA_TABLE(HfCandDsFulls, "AOD", "HFCANDDSFULL", full::DeltaMassPhi, full::AbsCos3PiK, hf_cand::Chi2PCA, + full::Centrality, hf_cand_3prong::FlagMcMatchRec, hf_cand_3prong::OriginMcRec, hf_cand_3prong::FlagMcDecayChanRec, + hf_cand_3prong::IsCandidateSwapped, full::Sign); DECLARE_SOA_TABLE(HfCandDsFullEvs, "AOD", "HFCANDDSFULLEV", @@ -208,6 +215,7 @@ DECLARE_SOA_TABLE(HfCandDsFullEvs, "AOD", "HFCANDDSFULLEV", collision::PosX, collision::PosY, collision::PosZ, + full::Centrality, full::IsEventReject, full::RunNumber); @@ -245,6 +253,10 @@ struct HfTreeCreatorDsToKKPi { using CandDsMcGen = soa::Filtered>; using TracksWPid = soa::Join; + using CollisionsWithFT0C = soa::Join; + using CollisionsWithFT0M = soa::Join; + using CollisionsWithNTracksPV = soa::Join; + 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 Filter filterSelectCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlagDs; @@ -269,6 +281,7 @@ struct HfTreeCreatorDsToKKPi { collision.posX(), collision.posY(), collision.posZ(), + o2::hf_centrality::getCentralityColl(collision), isEventReject, runNumber); } @@ -277,12 +290,13 @@ struct HfTreeCreatorDsToKKPi { /// \param doMc true to fill MC information /// \param massHypo mass hypothesis considered: 0 = KKPi, 1 = PiKK /// \param candidate is candidate - template + template void fillCandidateTable(const T& candidate) { int8_t flagMc = 0; int8_t originMc = 0; int8_t channelMc = 0; + int8_t isSwapped = massHypo; // 0 if KKPi, 1 if PiKK float yCand = 0; float eCand = 0; float ctCand = 0; @@ -290,6 +304,7 @@ struct HfTreeCreatorDsToKKPi { flagMc = candidate.flagMcMatchRec(); originMc = candidate.originMcRec(); channelMc = candidate.flagMcDecayChanRec(); + isSwapped = candidate.isCandidateSwapped(); if (fillDplusMc && candidate.flagMcDecayChanRec() == (decayChannel + offsetDplusDecayChannel)) { yCand = hfHelper.yDplus(candidate); eCand = hfHelper.eDplus(candidate); @@ -314,6 +329,9 @@ struct HfTreeCreatorDsToKKPi { absCos3PiKDs = hfHelper.absCos3PiKDsToPiKK(candidate); } + auto const& collision = candidate.template collision_as(); + float centrality = o2::hf_centrality::getCentralityColl(collision); + auto prong0 = candidate.template prong0_as(); auto prong1 = candidate.template prong1_as(); auto prong2 = candidate.template prong2_as(); @@ -344,8 +362,8 @@ struct HfTreeCreatorDsToKKPi { prong2.tofNSigmaKa(), prong2.tpcTofNSigmaPi(), prong2.tpcTofNSigmaKa(), - candidate.isSelDsToKKPi(), - candidate.isSelDsToPiKK(), + massHypo == 0 ? candidate.isSelDsToKKPi() : -1, + massHypo == 1 ? candidate.isSelDsToPiKK() : -1, invMassDs, candidate.pt(), candidate.eta(), @@ -362,14 +380,17 @@ struct HfTreeCreatorDsToKKPi { deltaMassPhiKK, absCos3PiKDs, candidate.chi2PCA(), + centrality, + candidate.template collision_as().numContrib(), flagMc, originMc, channelMc, + isSwapped, prong0.sign() + prong1.sign() + prong2.sign()); } else { rowCandidateFull( - candidate.collision().bcId(), - candidate.collision().numContrib(), + candidate.template collision_as().bcId(), + candidate.template collision_as().numContrib(), candidate.posX(), candidate.posY(), candidate.posZ(), @@ -409,8 +430,8 @@ struct HfTreeCreatorDsToKKPi { prong2.tofNSigmaKa(), prong2.tpcTofNSigmaPi(), prong2.tpcTofNSigmaKa(), - candidate.isSelDsToKKPi(), - candidate.isSelDsToPiKK(), + massHypo == 0 ? candidate.isSelDsToKKPi() : -1, + massHypo == 1 ? candidate.isSelDsToPiKK() : -1, candidate.xSecondaryVertex(), candidate.ySecondaryVertex(), candidate.zSecondaryVertex(), @@ -433,16 +454,18 @@ struct HfTreeCreatorDsToKKPi { deltaMassPhiKK, absCos3PiKDs, candidate.chi2PCA(), + centrality, flagMc, originMc, channelMc, + isSwapped, prong0.sign() + prong1.sign() + prong2.sign()); } } - void processData(aod::Collisions const& collisions, - CandDsData const&, - TracksWPid const&) + template + void runData(Coll const& collisions, + CandDsData const&) { // Filling event properties rowCandidateFullEvents.reserve(collisions.size()); @@ -464,7 +487,7 @@ struct HfTreeCreatorDsToKKPi { continue; } } - fillCandidateTable(candidate); + fillCandidateTable(candidate); } for (const auto& candidate : selectedDsToPiKKCand) { @@ -474,17 +497,15 @@ struct HfTreeCreatorDsToKKPi { continue; } } - fillCandidateTable(candidate); + fillCandidateTable(candidate); } } - PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processData, "Process data", true); - - void processMc(aod::Collisions const& collisions, - aod::McCollisions const&, - CandDsMcReco const&, - CandDsMcGen const& mcParticles, - TracksWPid const&) + template + void runMc(Coll const& collisions, + aod::McCollisions const&, + CandDsMcReco const&, + CandDsMcGen const& mcParticles) { // Filling event properties rowCandidateFullEvents.reserve(collisions.size()); @@ -502,10 +523,10 @@ struct HfTreeCreatorDsToKKPi { for (const auto& candidate : reconstructedCandSig) { if (candidate.isCandidateSwapped() == 0) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } if (candidate.isCandidateSwapped() == 1) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } } } else if (fillOnlyBackground) { @@ -524,10 +545,10 @@ struct HfTreeCreatorDsToKKPi { } // Bkg candidates are not matched to MC so rely on selections only if (candidate.isSelDsToKKPi() >= selectionFlagDs) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } if (candidate.isSelDsToPiKK() >= selectionFlagDs) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } } } else { @@ -539,20 +560,20 @@ struct HfTreeCreatorDsToKKPi { for (const auto& candidate : reconstructedCandSig) { if (candidate.isCandidateSwapped() == 0) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } if (candidate.isCandidateSwapped() == 1) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } } for (const auto& candidate : reconstructedCandBkg) { // Bkg candidates are not matched to MC so rely on selections only if (candidate.isSelDsToKKPi() >= selectionFlagDs) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } if (candidate.isSelDsToPiKK() >= selectionFlagDs) { - fillCandidateTable(candidate); + fillCandidateTable(candidate); } } } @@ -571,7 +592,77 @@ struct HfTreeCreatorDsToKKPi { } } - PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processMc, "Process MC", false); + void processDataWithFT0C(CollisionsWithFT0C const& collisions, + CandDsData const& candsDs, + TracksWPid const&) + { + runData(collisions, candsDs); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processDataWithFT0C, "Process data with centrality information from FT0C", false); + + void processDataWithFT0M(CollisionsWithFT0M const& collisions, + CandDsData const& candsDs, + TracksWPid const&) + { + runData(collisions, candsDs); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processDataWithFT0M, "Process data with centrality information from FT0M", false); + + void processDataWithNTracksPV(CollisionsWithNTracksPV const& collisions, + CandDsData const& candsDs, + TracksWPid const&) + { + runData(collisions, candsDs); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processDataWithNTracksPV, "Process data with centrality information from NTracksPV", false); + + void processData(soa::Join const& collisions, + CandDsData const& candsDs, + TracksWPid const&) + { + runData>(collisions, candsDs); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processData, "Process data without centrality information", true); + + void processMcWithFT0C(CollisionsWithFT0C const& collisions, + aod::McCollisions const& mcCollisions, + CandDsMcReco const& mcRecoCands, + CandDsMcGen const& mcParticles, + TracksWPid const&) + { + runMc(collisions, mcCollisions, mcRecoCands, mcParticles); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processMcWithFT0C, "Process MC with centrality information from FT0C", false); + + void processMcWithFT0M(CollisionsWithFT0M const& collisions, + aod::McCollisions const& mcCollisions, + CandDsMcReco const& mcRecoCands, + CandDsMcGen const& mcParticles, + TracksWPid const&) + { + runMc(collisions, mcCollisions, mcRecoCands, mcParticles); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processMcWithFT0M, "Process MC with centrality information from FT0M", false); + + void processMcWithNTracksPV(CollisionsWithNTracksPV const& collisions, + aod::McCollisions const& mcCollisions, + CandDsMcReco const& mcRecoCands, + CandDsMcGen const& mcParticles, + TracksWPid const&) + { + runMc(collisions, mcCollisions, mcRecoCands, mcParticles); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processMcWithNTracksPV, "Process MC with centrality information from NTracksPV", false); + + void processMc(soa::Join const& collisions, + aod::McCollisions const& mcCollisions, + CandDsMcReco const& mcRecoCands, + CandDsMcGen const& mcParticles, + TracksWPid const&) + { + runMc(collisions, mcCollisions, mcRecoCands, mcParticles); + } + PROCESS_SWITCH(HfTreeCreatorDsToKKPi, processMc, "Process MC without centrality information", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx index 4dfde61847f..14ae8ab647c 100644 --- a/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx +++ b/PWGHF/TableProducer/treeCreatorLcToK0sP.cxx @@ -27,6 +27,8 @@ using namespace o2; using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; namespace o2::aod { @@ -213,10 +215,17 @@ struct HfTreeCreatorLcToK0sP { Configurable fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"}; Configurable downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to store in the tree"}; Configurable ptMaxForDownSample{"ptMaxForDownSample", 24., "Maximum pt for the application of the downsampling factor"}; + Configurable fillOnlySignal{"fillOnlySignal", false, "Flag to fill derived tables with signal for ML trainings"}; + Configurable fillOnlyBackground{"fillOnlyBackground", false, "Flag to fill derived tables with background for ML trainings"}; HfHelper hfHelper; + Filter filterSelectCandidates = aod::hf_sel_candidate_lc_to_k0s_p::isSelLcToK0sP >= 1; using TracksWPid = soa::Join; + using SelectedCandidatesMc = soa::Filtered>; + + Partition recSig = nabs(aod::hf_cand_casc::flagMcMatchRec) != int8_t(0); + Partition recBkg = nabs(aod::hf_cand_casc::flagMcMatchRec) == int8_t(0); void init(InitContext const&) { @@ -349,7 +358,7 @@ struct HfTreeCreatorLcToK0sP { void processMc(aod::Collisions const& collisions, aod::McCollisions const&, - soa::Join const& candidates, + SelectedCandidatesMc const& candidates, soa::Join const& particles, TracksWPid const&) { @@ -360,21 +369,41 @@ struct HfTreeCreatorLcToK0sP { fillEvent(collision); } - // Filling candidate properties - if (fillCandidateLiteTable) { - rowCandidateLite.reserve(candidates.size()); - } else { - rowCandidateFull.reserve(candidates.size()); - } - for (const auto& candidate : candidates) { - auto bach = candidate.prong0_as(); // bachelor - if (downSampleBkgFactor < 1.) { - double pseudoRndm = bach.pt() * 1000. - (int16_t)(bach.pt() * 1000); - if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { - continue; + if (fillOnlySignal) { + if (fillCandidateLiteTable) { + rowCandidateLite.reserve(recSig.size()); + } else { + rowCandidateFull.reserve(recSig.size()); + } + for (const auto& candidate : recSig) { + auto bach = candidate.prong0_as(); // bachelor + fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); + } + } else if (fillOnlyBackground) { + if (fillCandidateLiteTable) { + rowCandidateLite.reserve(recBkg.size()); + } else { + rowCandidateFull.reserve(recBkg.size()); + } + for (const auto& candidate : recBkg) { + if (downSampleBkgFactor < 1.) { + float pseudoRndm = candidate.ptProng0() * 1000. - (int64_t)(candidate.ptProng0() * 1000); + if (candidate.pt() < ptMaxForDownSample && pseudoRndm >= downSampleBkgFactor) { + continue; + } } + auto bach = candidate.prong0_as(); // bachelor + fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); + } + } else { + // Filling candidate properties + if (fillCandidateLiteTable) { + rowCandidateLite.reserve(candidates.size()); + } else { + rowCandidateFull.reserve(candidates.size()); } - if (candidate.isSelLcToK0sP() >= 1) { + for (const auto& candidate : candidates) { + auto bach = candidate.prong0_as(); // bachelor fillCandidate(candidate, bach, candidate.flagMcMatchRec(), candidate.originMcRec()); } } diff --git a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx index b91f65cb654..e2af6b5cff8 100644 --- a/PWGHF/TableProducer/treeCreatorOmegacSt.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegacSt.cxx @@ -23,6 +23,8 @@ #include "DataFormatsParameters/GRPObject.h" #include "DCAFitter/DCAFitterN.h" #include "DetectorsBase/Propagator.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/ASoA.h" @@ -127,6 +129,8 @@ DECLARE_SOA_COLUMN(Chi2TopologicalCharmedBaryon, chi2TopologicalCharmedBaryon, f DECLARE_SOA_COLUMN(Chi2TopologicalCasc, chi2TopologicalCasc, float); DECLARE_SOA_COLUMN(DecayLengthCharmedBaryon, decayLengthCharmedBaryon, float); DECLARE_SOA_COLUMN(DecayLengthXYCharmedBaryon, decayLengthXYCharmedBaryon, float); +DECLARE_SOA_COLUMN(DecayLengthCharmedBaryonUntracked, decayLengthCharmedBaryonUntracked, float); +DECLARE_SOA_COLUMN(DecayLengthXYCharmedBaryonUntracked, decayLengthXYCharmedBaryonUntracked, float); DECLARE_SOA_COLUMN(DecayLengthCasc, decayLengthCasc, float); DECLARE_SOA_COLUMN(DecayLengthXYCasc, decayLengthXYCasc, float); DECLARE_SOA_INDEX_COLUMN_FULL(MotherCasc, motherCasc, int, HfStChBarGens, "_Casc"); @@ -178,6 +182,8 @@ DECLARE_SOA_TABLE(HfStChBars, "AOD", "HFSTCHBAR", hf_st_charmed_baryon::Chi2TopologicalCasc, hf_st_charmed_baryon::DecayLengthCharmedBaryon, hf_st_charmed_baryon::DecayLengthXYCharmedBaryon, + hf_st_charmed_baryon::DecayLengthCharmedBaryonUntracked, + hf_st_charmed_baryon::DecayLengthXYCharmedBaryonUntracked, hf_st_charmed_baryon::DecayLengthCasc, hf_st_charmed_baryon::DecayLengthXYCasc, hf_st_charmed_baryon::MotherCascId, @@ -188,6 +194,9 @@ struct HfTreeCreatorOmegacSt { Produces outputTable; Produces outputTableGen; + Zorro zorro; + OutputObj zorroSummary{"zorroSummary"}; + Configurable materialCorrectionType{"materialCorrectionType", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"}; 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"}; @@ -195,6 +204,7 @@ struct HfTreeCreatorOmegacSt { Configurable matLutPath{"matLutPath", "GLO/Param/MatLUT", "Path of the material LUT"}; Configurable propToDCA{"propToDCA", true, "create tracks version propagated to PCA"}; Configurable useAbsDCA{"useAbsDCA", true, "Minimise abs. distance rather than chi2"}; + Configurable skimmedProcessing{"skimmedProcessing", false, "Put true if you are processing apass*_skimmed datasets"}; Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"}; @@ -362,6 +372,13 @@ struct HfTreeCreatorOmegacSt { for (const auto& collision : collisions) { const auto bc = collision.bc_as(); if (runNumber != bc.runNumber()) { + if (skimmedProcessing) { + if (runNumber == 0) { + zorroSummary.setObject(zorro.getZorroSummary()); + } + zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), "fTrackedOmega"); + zorro.populateHistRegistry(registry, bc.runNumber()); + } runNumber = bc.runNumber(); auto timestamp = bc.timestamp(); @@ -376,6 +393,9 @@ struct HfTreeCreatorOmegacSt { } df2.setBz(bz); } + if (skimmedProcessing) { + zorro.isSelected(collision.bc().globalBC()); + } const auto primaryVertex = getPrimaryVertex(collision); const std::array primaryVertexPos = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}; @@ -460,8 +480,9 @@ struct HfTreeCreatorOmegacSt { std::array, 2> momentaCascDaughters; trackParV0.getPxPyPzGlo(momentaCascDaughters[0]); trackParBachelor.getPxPyPzGlo(momentaCascDaughters[1]); + o2::track::TrackParCov trackParCovCascUntracked = df2.createParentTrackParCov(0); std::array pCasc; - df2.createParentTrackParCov().getPxPyPzGlo(pCasc); + trackParCovCascUntracked.getPxPyPzGlo(pCasc); const auto cpaCasc = RecoDecay::cpa(primaryVertexPos, df2.getPCACandidate(), pCasc); const auto cpaXYCasc = RecoDecay::cpaXY(primaryVertexPos, df2.getPCACandidate(), pCasc); @@ -538,6 +559,13 @@ struct HfTreeCreatorOmegacSt { hCandidatesCascPi->Fill(SVFitting::BeforeFit); try { + auto decayLengthUntracked = -1.; + auto decayLengthXYUntracked = -1.; + if (df2.process(trackParCovCascUntracked, trackParCovPion)) { + const auto& secondaryVertexUntracked = df2.getPCACandidate(); + decayLengthUntracked = RecoDecay::distance(secondaryVertexUntracked, primaryVertexPos); + decayLengthXYUntracked = RecoDecay::distanceXY(secondaryVertexUntracked, primaryVertexPos); + } if (df2.process(trackParCovCasc, trackParCovPion)) { const auto& secondaryVertex = df2.getPCACandidate(); const auto decayLength = RecoDecay::distance(secondaryVertex, primaryVertexPos); @@ -603,6 +631,8 @@ struct HfTreeCreatorOmegacSt { trackedCascade.topologyChi2(), decayLength, decayLengthXY, + decayLengthUntracked, + decayLengthXYUntracked, decayLengthCasc, decayLengthCascXY, trackCascMotherId, diff --git a/PWGHF/TableProducer/treeCreatorOmegacToOmegaPi.cxx b/PWGHF/TableProducer/treeCreatorOmegacToOmegaPi.cxx index 99128171973..42b40686a15 100644 --- a/PWGHF/TableProducer/treeCreatorOmegacToOmegaPi.cxx +++ b/PWGHF/TableProducer/treeCreatorOmegacToOmegaPi.cxx @@ -181,6 +181,7 @@ DECLARE_SOA_TABLE(HfKfOmegacFulls, "AOD", "HFKFOMEGACFULL", full::NSigmaTPCPiFromOmegac, full::NSigmaTOFPiFromOmegac, full::NSigmaTPCKaFromCasc, full::NSigmaTOFKaFromCasc, full::NSigmaTPCPiFromV0, full::NSigmaTPCPrFromV0, full::KfDcaXYPiFromOmegac, full::DcaCascDau, full::DcaCharmBaryonDau, full::KfDcaXYCascToPv, + full::DcaXYToPvV0Dau0, full::DcaXYToPvV0Dau1, full::DcaXYToPvCascDau, full::Chi2GeoV0, full::Chi2GeoCasc, full::Chi2GeoOmegac, full::Chi2MassV0, full::Chi2MassCasc, full::V0ldl, full::Cascldl, full::Omegacldl, @@ -310,6 +311,9 @@ struct HfTreeCreatorOmegac0ToOmegaPi { candidate.dcaCascDau(), candidate.dcaCharmBaryonDau(), candidate.kfDcaXYCascToPv(), + candidate.dcaXYToPvV0Dau0(), + candidate.dcaXYToPvV0Dau1(), + candidate.dcaXYToPvCascDau(), candidate.chi2GeoV0(), candidate.chi2GeoCasc(), candidate.chi2GeoOmegac(), diff --git a/PWGHF/TableProducer/treeCreatorToXiPi.cxx b/PWGHF/TableProducer/treeCreatorToXiPi.cxx index facd45a4718..b875db47a41 100644 --- a/PWGHF/TableProducer/treeCreatorToXiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorToXiPi.cxx @@ -116,6 +116,10 @@ DECLARE_SOA_COLUMN(NormImpParPiFromCharmBar, normImpParPiFromCharmBar, double); DECLARE_SOA_COLUMN(NormDecayLenCharmBar, normDecayLenCharmBar, double); DECLARE_SOA_COLUMN(IsPionGlbTrkWoDca, isPionGlbTrkWoDca, bool); DECLARE_SOA_COLUMN(PionItsNCls, pionItsNCls, uint8_t); +DECLARE_SOA_COLUMN(NTpcRowsPion, nTpcRowsPion, int16_t); +DECLARE_SOA_COLUMN(NTpcRowsPiFromCasc, nTpcRowsPiFromCasc, int16_t); +DECLARE_SOA_COLUMN(NTpcRowsPosV0Dau, nTpcRowsPosV0Dau, int16_t); +DECLARE_SOA_COLUMN(NTpcRowsNegV0Dau, nTpcRowsNegV0Dau, int16_t); // from creator - MC DECLARE_SOA_COLUMN(FlagMcMatchRec, flagMcMatchRec, int8_t); // reconstruction level DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level @@ -172,6 +176,7 @@ DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL", full::DcaCascDau, full::DcaV0Dau, full::DcaCharmBaryonDau, full::DecLenCharmBaryon, full::DecLenCascade, full::DecLenV0, full::ErrorDecayLengthCharmBaryon, full::ErrorDecayLengthXYCharmBaryon, full::NormImpParCascade, full::NormImpParPiFromCharmBar, full::NormDecayLenCharmBar, full::IsPionGlbTrkWoDca, full::PionItsNCls, + full::NTpcRowsPion, full::NTpcRowsPiFromCasc, full::NTpcRowsPosV0Dau, full::NTpcRowsNegV0Dau, full::StatusPidLambda, full::StatusPidCascade, full::StatusPidCharmBaryon, full::StatusInvMassLambda, full::StatusInvMassCascade, full::StatusInvMassCharmBaryon, full::ResultSelections, full::PidTpcInfoStored, full::PidTofInfoStored, full::TpcNSigmaPiFromCharmBaryon, full::TpcNSigmaPiFromCasc, full::TpcNSigmaPiFromLambda, full::TpcNSigmaPrFromLambda, @@ -197,6 +202,7 @@ DECLARE_SOA_TABLE(HfToXiPiLites, "AOD", "HFTOXIPILITE", full::DcaCascDau, full::DcaV0Dau, full::DcaCharmBaryonDau, full::ErrorDecayLengthCharmBaryon, full::NormImpParCascade, full::NormImpParPiFromCharmBar, full::IsPionGlbTrkWoDca, full::PionItsNCls, + full::NTpcRowsPion, full::NTpcRowsPiFromCasc, full::NTpcRowsPosV0Dau, full::NTpcRowsNegV0Dau, full::PidTpcInfoStored, full::PidTofInfoStored, full::TpcNSigmaPiFromCharmBaryon, full::TpcNSigmaPiFromCasc, full::TpcNSigmaPiFromLambda, full::TpcNSigmaPrFromLambda, full::TofNSigmaPiFromCharmBaryon, full::TofNSigmaPiFromCasc, full::TofNSigmaPiFromLambda, full::TofNSigmaPrFromLambda, @@ -317,6 +323,10 @@ struct HfTreeCreatorToXiPi { candidate.decLenCharmBaryon() / candidate.errorDecayLengthCharmBaryon(), candidate.template bachelorFromCharmBaryon_as().isGlobalTrackWoDCA(), candidate.template bachelorFromCharmBaryon_as().itsNCls(), + candidate.template bachelorFromCharmBaryon_as().tpcNClsCrossedRows(), + candidate.template bachelor_as().tpcNClsCrossedRows(), + candidate.template posTrack_as().tpcNClsCrossedRows(), + candidate.template negTrack_as().tpcNClsCrossedRows(), candidate.statusPidLambda(), candidate.statusPidCascade(), candidate.statusPidCharmBaryon(), @@ -398,6 +408,10 @@ struct HfTreeCreatorToXiPi { candidate.impactParBachFromCharmBaryonXY() / candidate.errImpactParBachFromCharmBaryonXY(), candidate.template bachelorFromCharmBaryon_as().isGlobalTrackWoDCA(), candidate.template bachelorFromCharmBaryon_as().itsNCls(), + candidate.template bachelorFromCharmBaryon_as().tpcNClsCrossedRows(), + candidate.template bachelor_as().tpcNClsCrossedRows(), + candidate.template posTrack_as().tpcNClsCrossedRows(), + candidate.template negTrack_as().tpcNClsCrossedRows(), candidate.pidTpcInfoStored(), candidate.pidTofInfoStored(), candidate.tpcNSigmaPiFromCharmBaryon(), diff --git a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx index 06d16c85d1e..488a9fee249 100644 --- a/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx +++ b/PWGHF/TableProducer/treeCreatorXicToXiPiPi.cxx @@ -12,7 +12,10 @@ /// \file treeCreatorXicToXiPiPi.cxx /// \brief Writer of Ξc± → Ξ∓ π± π± candidates in the form of flat tables to be stored in TTrees. /// -/// \author Phil Lennart Stahlhut , CERN +/// \author Phil Lennart Stahlhut , Heidelberg University +/// \author Carolina Reetz , Heidelberg University + +#include #include "CommonConstants/PhysicsConstants.h" #include "Framework/AnalysisTask.h" @@ -24,16 +27,13 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::constants::physics; namespace o2::aod { namespace full { -// track indices DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int); //! Selection flag of candidate (output of candidateSelector) -DECLARE_SOA_INDEX_COLUMN_FULL(Xi, xi, int, Tracks, "_pi0"); -DECLARE_SOA_INDEX_COLUMN_FULL(Pi0, pi0, int, Tracks, "_pi0"); -DECLARE_SOA_INDEX_COLUMN_FULL(Pi1, pi1, int, Tracks, "_pi1"); // vertices DECLARE_SOA_COLUMN(XPv, xPv, float); DECLARE_SOA_COLUMN(YPv, yPv, float); @@ -41,13 +41,19 @@ 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(Chi2Sv, chi2Sv, 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); @@ -72,8 +78,10 @@ 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) @@ -98,116 +106,123 @@ DECLARE_SOA_COLUMN(DcaPi1Xi, dcaPi1Xi, float); DECLARE_SOA_COLUMN(DcaXiDaughters, dcaXiDaughters, float); DECLARE_SOA_COLUMN(InvMassXiPi0, invMassXiPi0, float); DECLARE_SOA_COLUMN(InvMassXiPi1, invMassXiPi1, float); +// residuals and pulls +DECLARE_SOA_COLUMN(PtResidual, ptResidual, float); +DECLARE_SOA_COLUMN(PResidual, pResidual, float); +DECLARE_SOA_COLUMN(XPvResidual, xPvResidual, float); +DECLARE_SOA_COLUMN(YPvResidual, yPvResidual, float); +DECLARE_SOA_COLUMN(ZPvResidual, zPvResidual, float); +DECLARE_SOA_COLUMN(XPvPull, xPvPull, float); +DECLARE_SOA_COLUMN(YPvPull, yPvPull, float); +DECLARE_SOA_COLUMN(ZPvPull, zPvPull, float); +DECLARE_SOA_COLUMN(XSvResidual, xSvResidual, float); +DECLARE_SOA_COLUMN(YSvResidual, ySvResidual, float); +DECLARE_SOA_COLUMN(ZSvResidual, zSvResidual, float); +DECLARE_SOA_COLUMN(XSvPull, xSvPull, float); +DECLARE_SOA_COLUMN(YSvPull, ySvPull, float); +DECLARE_SOA_COLUMN(ZSvPull, zSvPull, float); } // namespace full DECLARE_SOA_TABLE(HfCandXicToXiPiPiLites, "AOD", "HFXICXI2PILITE", + hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, full::CandidateSelFlag, - full::XPv, - full::YPv, - full::ZPv, - full::XSv, - full::YSv, - full::ZSv, - full::Chi2Sv, full::Sign, - full::E, - full::M, - full::P, - full::Pt, full::Y, full::Eta, full::Phi, + full::P, + full::Pt, + full::PtXi, + full::PtPi0, + full::PtPi1, + full::M, + full::InvMassXiPi0, + full::InvMassXiPi1, + full::Chi2Sv, full::Ct, full::DecayLength, + full::DecayLengthNormalised, full::DecayLengthXY, + full::DecayLengthXYNormalised, full::Cpa, full::CpaXY, - full::PtXi, - full::PtPi0, - full::PtPi1, - full::ImpactParameterXi, - full::ImpactParameterPi0, - full::ImpactParameterPi1, full::CpaXi, full::CpaXYXi, full::CpaLam, full::CpaXYLam, - hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec); + full::ImpactParameterXi, + full::ImpactParameterNormalisedXi, + full::ImpactParameterPi0, + full::ImpactParameterNormalisedPi0, + full::ImpactParameterPi1, + full::ImpactParameterNormalisedPi1, + full::MaxNormalisedDeltaIP); DECLARE_SOA_TABLE(HfCandXicToXiPiPiLiteKfs, "AOD", "HFXICXI2PILITKF", + hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, full::CandidateSelFlag, - full::XPv, - full::YPv, - full::ZPv, - full::XSv, - full::YSv, - full::ZSv, - full::Chi2Sv, full::Sign, - full::E, - full::M, - full::P, - full::Pt, full::Y, full::Eta, full::Phi, + full::P, + full::Pt, + full::PtXi, + full::PtPi0, + full::PtPi1, + full::M, + full::InvMassXiPi0, + full::InvMassXiPi1, + full::Chi2Sv, full::Ct, full::DecayLength, + full::DecayLengthNormalised, full::DecayLengthXY, + full::DecayLengthXYNormalised, full::Cpa, full::CpaXY, - full::PtXi, - full::PtPi0, - full::PtPi1, - full::ImpactParameterXi, - full::ImpactParameterPi0, - full::ImpactParameterPi1, full::CpaXi, full::CpaXYXi, full::CpaLam, full::CpaXYLam, + full::ImpactParameterXi, + full::ImpactParameterNormalisedXi, + full::ImpactParameterPi0, + full::ImpactParameterNormalisedPi0, + full::ImpactParameterPi1, + full::ImpactParameterNormalisedPi1, + full::MaxNormalisedDeltaIP, + // 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, full::DcaPi0Pi1, full::DcaPi0Xi, full::DcaPi1Xi, - full::DcaXiDaughters, - hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec); + full::DcaXiDaughters); DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL", + hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, full::CandidateSelFlag, - full::XPv, - full::YPv, - full::ZPv, - full::XPvErr, - full::YPvErr, - full::ZPvErr, - full::XSv, - full::YSv, - full::ZSv, - full::Chi2Sv, - full::XSvErr, - full::YSvErr, - full::ZSvErr, - full::XDecVtxXi, - full::YDecVtxXi, - full::ZDecVtxXi, - full::XDecVtxLam, - full::YDecVtxLam, - full::ZDecVtxLam, full::Sign, - full::E, - full::M, - full::P, - full::Pt, full::Y, full::Eta, full::Phi, + full::P, + full::Pt, + full::PtXi, + full::PtPi0, + full::PtPi1, + full::M, + full::InvMassXiPi0, + full::InvMassXiPi1, + full::Chi2Sv, full::Ct, full::DecayLength, full::DecayLengthNormalised, @@ -215,9 +230,10 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL", full::DecayLengthXYNormalised, full::Cpa, full::CpaXY, - full::PtXi, - full::PtPi0, - full::PtPi1, + full::CpaXi, + full::CpaXYXi, + full::CpaLam, + full::CpaXYLam, full::ImpactParameterXi, full::ImpactParameterNormalisedXi, full::ImpactParameterPi0, @@ -225,16 +241,8 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFulls, "AOD", "HFXICXI2PIFULL", full::ImpactParameterPi1, full::ImpactParameterNormalisedPi1, full::MaxNormalisedDeltaIP, - full::CpaXi, - full::CpaXYXi, - full::CpaLam, - full::CpaXYLam, - full::InvMassXiPi0, - full::InvMassXiPi1, - hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec); - -DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", - full::CandidateSelFlag, + // additional columns only stored in the full candidate table + full::E, full::XPv, full::YPv, full::ZPv, @@ -244,7 +252,6 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", full::XSv, full::YSv, full::ZSv, - full::Chi2Sv, full::XSvErr, full::YSvErr, full::ZSvErr, @@ -253,15 +260,24 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", full::ZDecVtxXi, full::XDecVtxLam, full::YDecVtxLam, - full::ZDecVtxLam, + full::ZDecVtxLam); + +DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", + hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec, + full::CandidateSelFlag, full::Sign, - full::E, - full::M, - full::P, - full::Pt, full::Y, full::Eta, full::Phi, + full::P, + full::Pt, + full::PtXi, + full::PtPi0, + full::PtPi1, + full::M, + full::InvMassXiPi0, + full::InvMassXiPi1, + full::Chi2Sv, full::Ct, full::DecayLength, full::DecayLengthNormalised, @@ -269,9 +285,10 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", full::DecayLengthXYNormalised, full::Cpa, full::CpaXY, - full::PtXi, - full::PtPi0, - full::PtPi1, + full::CpaXi, + full::CpaXYXi, + full::CpaLam, + full::CpaXYLam, full::ImpactParameterXi, full::ImpactParameterNormalisedXi, full::ImpactParameterPi0, @@ -279,44 +296,69 @@ DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullKfs, "AOD", "HFXICXI2PIFULKF", full::ImpactParameterPi1, full::ImpactParameterNormalisedPi1, full::MaxNormalisedDeltaIP, - full::CpaXi, - full::CpaXYXi, - full::CpaLam, - full::CpaXYLam, - full::InvMassXiPi0, - full::InvMassXiPi1, + // 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, + // 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, full::DcaPi0Pi1, full::DcaPi0Xi, full::DcaPi1Xi, - full::DcaXiDaughters, - hf_cand_xic_to_xi_pi_pi::FlagMcMatchRec); - -DECLARE_SOA_TABLE(HfCandXicToXiPiPiDauInds, "AOD", "HFXICXI2PIDAUIN", - full::XiId, - full::Pi0Id, - full::Pi1Id); - -DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullEvs, "AOD", "HFXICXI2PIFULEV", - collision::BCId, - collision::NumContrib, - collision::PosX, - collision::PosY, - collision::PosZ); + full::DcaXiDaughters); DECLARE_SOA_TABLE(HfCandXicToXiPiPiFullPs, "AOD", "HFXICXI2PIFULLP", - collision::BCId, 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); + +DECLARE_SOA_TABLE(HfCandXicToXiPiPiResiduals, "AOD", "HFXICXI2PIRESID", + full::PResidual, + full::PtResidual, + full::XPvResidual, + full::YPvResidual, + full::ZPvResidual, + full::XPvPull, + full::YPvPull, + full::ZPvPull, + full::XSvResidual, + full::YSvResidual, + full::ZSvResidual, + full::XSvPull, + full::YSvPull, + full::ZSvPull); } // namespace o2::aod /// Writes the full information in an output TTree @@ -325,13 +367,12 @@ struct HfTreeCreatorXicToXiPiPi { Produces rowCandidateLiteKf; Produces rowCandidateFull; Produces rowCandidateFullKf; - Produces rowCandidateDauIndices; - Produces rowCandidateFullEvents; Produces rowCandidateFullParticles; + Produces rowCandidateResiduals; - Configurable selectionFlagXic{"selectionXic", 1, "Selection Flag for Xic"}; + Configurable selectionFlagXic{"selectionFlagXic", 1, "Selection Flag for Xic"}; Configurable fillCandidateLiteTable{"fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"}; - Configurable fillCandidateDauIndexTable{"fillCandidateDauIndexTable", false, "Switch to fill table with Xic daughters track indices"}; + Configurable fillGenParticleTable{"fillGenParticleTable", false, "Switch to fill table with MC truth for generated particles"}; // parameters for production of training samples Configurable fillOnlySignal{"fillOnlySignal", false, "Flag to fill derived tables with signal for ML trainings"}; Configurable fillOnlyBackground{"fillOnlyBackground", false, "Flag to fill derived tables with background for ML trainings"}; @@ -342,7 +383,6 @@ struct HfTreeCreatorXicToXiPiPi { using SelectedCandidatesKf = soa::Filtered>; using SelectedCandidatesMc = soa::Filtered>; using SelectedCandidatesKfMc = soa::Filtered>; - using TracksWPid = soa::Join; Filter filterSelectCandidates = aod::hf_sel_candidate_xic::isSelXicToXiPiPi >= selectionFlagXic; @@ -355,26 +395,6 @@ struct HfTreeCreatorXicToXiPiPi { { } - template - void fillEvent(const T& collision) - { - rowCandidateFullEvents( - collision.bcId(), - collision.numContrib(), - collision.posX(), - collision.posY(), - collision.posZ()); - } - - template - void fillIndexTable(const T& candidate) - { - rowCandidateDauIndices( - candidate.cascadeId(), - candidate.pi0Id(), - candidate.pi1Id()); - } - template void fillCandidateTable(const T& candidate) { @@ -385,68 +405,56 @@ struct HfTreeCreatorXicToXiPiPi { if constexpr (!doKf) { if (fillCandidateLiteTable) { rowCandidateLite( + flagMc, candidate.isSelXicToXiPiPi(), - candidate.posX(), - candidate.posY(), - candidate.posZ(), - candidate.xSecondaryVertex(), - candidate.ySecondaryVertex(), - candidate.zSecondaryVertex(), - candidate.chi2PCA(), candidate.sign(), - candidate.e(o2::constants::physics::MassXiCPlus), - candidate.invMassXic(), - candidate.p(), - candidate.pt(), candidate.y(o2::constants::physics::MassXiCPlus), candidate.eta(), candidate.phi(), + candidate.p(), + candidate.pt(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.ptProng2(), + candidate.invMassXic(), + candidate.invMassXiPi0(), + candidate.invMassXiPi1(), + candidate.chi2PCA(), candidate.ct(o2::constants::physics::MassXiCPlus), candidate.decayLength(), + candidate.decayLengthNormalised(), candidate.decayLengthXY(), + candidate.decayLengthXYNormalised(), candidate.cpa(), candidate.cpaXY(), - candidate.ptProng0(), - candidate.ptProng1(), - candidate.ptProng2(), - candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.impactParameter2(), candidate.cosPaXi(), candidate.cosPaXYXi(), candidate.cosPaLambda(), candidate.cosPaXYLambda(), - flagMc); + candidate.impactParameter0(), + candidate.impactParameterNormalised0(), + candidate.impactParameter1(), + candidate.impactParameterNormalised1(), + candidate.impactParameter2(), + candidate.impactParameterNormalised2(), + candidate.maxNormalisedDeltaIP()); } else { rowCandidateFull( + flagMc, candidate.isSelXicToXiPiPi(), - candidate.posX(), - candidate.posY(), - candidate.posZ(), - candidate.xPvErr(), - candidate.yPvErr(), - candidate.zPvErr(), - candidate.xSecondaryVertex(), - candidate.ySecondaryVertex(), - candidate.zSecondaryVertex(), - candidate.chi2PCA(), - candidate.xSvErr(), - candidate.ySvErr(), - candidate.zSvErr(), - candidate.xDecayVtxXi(), - candidate.yDecayVtxXi(), - candidate.zDecayVtxXi(), - candidate.xDecayVtxLambda(), - candidate.yDecayVtxLambda(), - candidate.zDecayVtxLambda(), candidate.sign(), - candidate.e(o2::constants::physics::MassXiCPlus), - candidate.invMassXic(), - candidate.p(), - candidate.pt(), candidate.y(o2::constants::physics::MassXiCPlus), candidate.eta(), candidate.phi(), + candidate.p(), + candidate.pt(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.ptProng2(), + candidate.invMassXic(), + candidate.invMassXiPi0(), + candidate.invMassXiPi1(), + candidate.chi2PCA(), candidate.ct(o2::constants::physics::MassXiCPlus), candidate.decayLength(), candidate.decayLengthNormalised(), @@ -454,9 +462,10 @@ struct HfTreeCreatorXicToXiPiPi { candidate.decayLengthXYNormalised(), candidate.cpa(), candidate.cpaXY(), - candidate.ptProng0(), - candidate.ptProng1(), - candidate.ptProng2(), + candidate.cosPaXi(), + candidate.cosPaXYXi(), + candidate.cosPaLambda(), + candidate.cosPaXYLambda(), candidate.impactParameter0(), candidate.impactParameterNormalised0(), candidate.impactParameter1(), @@ -464,51 +473,69 @@ struct HfTreeCreatorXicToXiPiPi { candidate.impactParameter2(), candidate.impactParameterNormalised2(), candidate.maxNormalisedDeltaIP(), - candidate.cosPaXi(), - candidate.cosPaXYXi(), - candidate.cosPaLambda(), - candidate.cosPaXYLambda(), - candidate.invMassXiPi0(), - candidate.invMassXiPi1(), - flagMc); - } - } else { - if (fillCandidateLiteTable) { - rowCandidateLiteKf( - candidate.isSelXicToXiPiPi(), + // 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.chi2PCA(), + candidate.xSvErr(), + candidate.ySvErr(), + candidate.zSvErr(), + candidate.xDecayVtxXi(), + candidate.yDecayVtxXi(), + candidate.zDecayVtxXi(), + candidate.xDecayVtxLambda(), + candidate.yDecayVtxLambda(), + candidate.zDecayVtxLambda()); + } + } else { + if (fillCandidateLiteTable) { + rowCandidateLiteKf( + flagMc, + candidate.isSelXicToXiPiPi(), candidate.sign(), - candidate.e(o2::constants::physics::MassXiCPlus), - candidate.invMassXic(), - candidate.p(), - candidate.pt(), candidate.y(o2::constants::physics::MassXiCPlus), candidate.eta(), candidate.phi(), + candidate.p(), + candidate.pt(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.ptProng2(), + candidate.invMassXic(), + candidate.invMassXiPi0(), + candidate.invMassXiPi1(), + candidate.chi2PCA(), candidate.ct(o2::constants::physics::MassXiCPlus), candidate.decayLength(), + candidate.decayLengthNormalised(), candidate.decayLengthXY(), + candidate.decayLengthXYNormalised(), candidate.cpa(), candidate.cpaXY(), - candidate.ptProng0(), - candidate.ptProng1(), - candidate.ptProng2(), - candidate.impactParameter0(), - candidate.impactParameter1(), - candidate.impactParameter2(), candidate.cosPaXi(), candidate.cosPaXYXi(), candidate.cosPaLambda(), candidate.cosPaXYLambda(), + candidate.impactParameter0(), + candidate.impactParameterNormalised0(), + candidate.impactParameter1(), + candidate.impactParameterNormalised1(), + candidate.impactParameter2(), + candidate.impactParameterNormalised2(), + candidate.maxNormalisedDeltaIP(), + // KF-specific columns candidate.kfCascadeChi2(), candidate.kfV0Chi2(), + candidate.chi2TopoXicPlusToPVBeforeConstraint(), candidate.chi2TopoXicPlusToPV(), + candidate.chi2TopoXiToXicPlusBeforeConstraint(), candidate.chi2TopoXiToXicPlus(), candidate.dcaXYPi0Pi1(), candidate.dcaXYPi0Xi(), @@ -516,38 +543,24 @@ struct HfTreeCreatorXicToXiPiPi { candidate.dcaPi0Pi1(), candidate.dcaPi0Xi(), candidate.dcaPi1Xi(), - candidate.dcacascdaughters(), - flagMc); + candidate.dcacascdaughters()); } else { rowCandidateFullKf( + flagMc, candidate.isSelXicToXiPiPi(), - candidate.posX(), - candidate.posY(), - candidate.posZ(), - candidate.xPvErr(), - candidate.yPvErr(), - candidate.zPvErr(), - candidate.xSecondaryVertex(), - candidate.ySecondaryVertex(), - candidate.zSecondaryVertex(), - candidate.chi2PCA(), - candidate.xSvErr(), - candidate.ySvErr(), - candidate.zSvErr(), - candidate.xDecayVtxXi(), - candidate.yDecayVtxXi(), - candidate.zDecayVtxXi(), - candidate.xDecayVtxLambda(), - candidate.yDecayVtxLambda(), - candidate.zDecayVtxLambda(), candidate.sign(), - candidate.e(o2::constants::physics::MassXiCPlus), - candidate.invMassXic(), - candidate.p(), - candidate.pt(), candidate.y(o2::constants::physics::MassXiCPlus), candidate.eta(), candidate.phi(), + candidate.p(), + candidate.pt(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.ptProng2(), + candidate.invMassXic(), + candidate.invMassXiPi0(), + candidate.invMassXiPi1(), + candidate.chi2PCA(), candidate.ct(o2::constants::physics::MassXiCPlus), candidate.decayLength(), candidate.decayLengthNormalised(), @@ -555,9 +568,10 @@ struct HfTreeCreatorXicToXiPiPi { candidate.decayLengthXYNormalised(), candidate.cpa(), candidate.cpaXY(), - candidate.ptProng0(), - candidate.ptProng1(), - candidate.ptProng2(), + candidate.cosPaXi(), + candidate.cosPaXYXi(), + candidate.cosPaLambda(), + candidate.cosPaXYLambda(), candidate.impactParameter0(), candidate.impactParameterNormalised0(), candidate.impactParameter1(), @@ -565,15 +579,32 @@ struct HfTreeCreatorXicToXiPiPi { candidate.impactParameter2(), candidate.impactParameterNormalised2(), candidate.maxNormalisedDeltaIP(), - candidate.cosPaXi(), - candidate.cosPaXYXi(), - candidate.cosPaLambda(), - candidate.cosPaXYLambda(), - candidate.invMassXiPi0(), - candidate.invMassXiPi1(), + // 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(), + // KF-specific columns candidate.kfCascadeChi2(), candidate.kfV0Chi2(), + candidate.chi2TopoXicPlusToPVBeforeConstraint(), candidate.chi2TopoXicPlusToPV(), + candidate.chi2TopoXiToXicPlusBeforeConstraint(), candidate.chi2TopoXiToXicPlus(), candidate.dcaXYPi0Pi1(), candidate.dcaXYPi0Xi(), @@ -581,26 +612,14 @@ struct HfTreeCreatorXicToXiPiPi { candidate.dcaPi0Pi1(), candidate.dcaPi0Xi(), candidate.dcaPi1Xi(), - candidate.dcacascdaughters(), - flagMc); + candidate.dcacascdaughters()); } } } - void processData(aod::Collisions const& collisions, - SelectedCandidates const& candidates, - TracksWPid const&) + void processData(SelectedCandidates const& candidates) { - // Filling event properties - rowCandidateFullEvents.reserve(collisions.size()); - for (const auto& collision : collisions) { - fillEvent(collision); - } - // Filling candidate properties - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(candidates.size()); } else { @@ -608,33 +627,19 @@ 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; } } fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } - PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processData, "Process data", true); + PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processData, "Process data with DCAFitter reconstruction", true); - void processDataKf(aod::Collisions const& collisions, - SelectedCandidatesKf const& candidates, - TracksWPid const&) + void processDataKf(SelectedCandidatesKf const& candidates) { - // Filling event properties - rowCandidateFullEvents.reserve(collisions.size()); - for (const auto& collision : collisions) { - fillEvent(collision); - } - // Filling candidate properties - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(candidates.size()); } else { @@ -642,36 +647,23 @@ 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; } } fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } - PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processDataKf, "Process data with KF Particle reconstruction", false); + PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processDataKf, "Process data with KFParticle reconstruction", false); - void processMc(aod::Collisions const& collisions, - aod::McCollisions const&, - SelectedCandidatesMc const& candidates, - soa::Join const& particles, - TracksWPid const&) + void processMc(SelectedCandidatesMc const& candidates, + soa::Join const& particles) { - // Filling event properties - rowCandidateFullEvents.reserve(collisions.size()); - for (const auto& collision : collisions) { - fillEvent(collision); - } + std::vector arrDaughIndex; // Filling candidate properties if (fillOnlySignal) { - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(recSig.size()); } else { @@ -679,33 +671,21 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : recSig) { fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } else if (fillOnlyBackground) { - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(recBg.size()); } else { 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; } fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } else { - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(candidates.size()); } else { @@ -713,45 +693,43 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : candidates) { fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } - // Filling particle properties - 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)) { - rowCandidateFullParticles( - particle.mcCollision().bcId(), - particle.pt(), - particle.eta(), - particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCPlus), - particle.flagMcMatchGen()); - } + if (fillGenParticleTable) { + 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.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()); + } + } // loop over generated particles } } - PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processMc, "Process MC", false); + PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processMc, "Process MC with DCAFitter reconstruction", false); - void processMcKf(aod::Collisions const& collisions, - aod::McCollisions const&, - SelectedCandidatesKfMc const& candidates, - soa::Join const& particles, - TracksWPid const&) + void processMcKf(SelectedCandidatesKfMc const& candidates, + soa::Join const& particles) { - // Filling event properties - rowCandidateFullEvents.reserve(collisions.size()); - for (const auto& collision : collisions) { - fillEvent(collision); - } + std::vector arrDaughIndex; // Filling candidate properties if (fillOnlySignal) { - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(recSigKf.size()); } else { @@ -759,33 +737,21 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : recSigKf) { fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } else if (fillOnlyBackground) { - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(recBgKf.size()); } else { 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; } fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } else { - if (fillCandidateDauIndexTable) { - rowCandidateDauIndices.reserve(candidates.size()); - } if (fillCandidateLiteTable) { rowCandidateLite.reserve(candidates.size()); } else { @@ -793,27 +759,114 @@ struct HfTreeCreatorXicToXiPiPi { } for (const auto& candidate : candidates) { fillCandidateTable(candidate); - if (fillCandidateDauIndexTable) { - fillIndexTable(candidate); - } } } - // Filling particle properties - 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)) { - rowCandidateFullParticles( - particle.mcCollision().bcId(), - particle.pt(), - particle.eta(), - particle.phi(), - RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, o2::constants::physics::MassXiCPlus), - particle.flagMcMatchGen()); - } + if (fillGenParticleTable) { + 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.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()); + } + } // loop over generated particles } } PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processMcKf, "Process MC with KF Particle reconstruction", false); + + void processResiduals(SelectedCandidatesMc const&, + aod::TracksWMc const& tracks, + aod::McParticles const& particles) + { + rowCandidateResiduals.reserve(recSig.size()); + + recSig->bindExternalIndices(&tracks); + + std::vector arrDaughIndex; + int indexRecXic; + int8_t sign; + std::array pvResiduals; + std::array svResiduals; + std::array pvPulls; + std::array svPulls; + + for (const auto& candidate : recSig) { + arrDaughIndex.clear(); + indexRecXic = -1; + sign = 0; + pvResiduals = {-9999.9}; + svResiduals = {-9999.9}; + pvPulls = {-9999.9}; + svPulls = {-9999.9}; + + auto arrayDaughters = std::array{candidate.pi0_as(), // pi <- Xic + candidate.pi1_as(), // pi <- Xic + candidate.bachelor_as(), // pi <- cascade + 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) { + continue; + } + auto XicGen = particles.rawIteratorAt(indexRecXic); + RecoDecay::getDaughters(XicGen, &arrDaughIndex, std::array{+kXiMinus, +kPiPlus, +kPiPlus}, 2); + auto XicDaugh0 = 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(); + try { + pvPulls[0] = pvResiduals[0] / candidate.xPvErr(); + pvPulls[1] = pvResiduals[1] / candidate.yPvErr(); + pvPulls[2] = pvResiduals[2] / candidate.zPvErr(); + svPulls[0] = svResiduals[0] / candidate.xSvErr(); + svPulls[1] = svResiduals[1] / candidate.ySvErr(); + svPulls[2] = svResiduals[2] / candidate.zSvErr(); + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". Set values of vertex pulls to -9999.9."; + } + + // fill table + rowCandidateResiduals( + pResidual, + ptResidual, + pvResiduals[0], + pvResiduals[1], + pvResiduals[2], + pvPulls[0], + pvPulls[1], + pvPulls[2], + svResiduals[0], + svResiduals[1], + svResiduals[2], + svPulls[0], + svPulls[1], + svPulls[2]); + } // loop over reconstructed signal + } + PROCESS_SWITCH(HfTreeCreatorXicToXiPiPi, processResiduals, "Process Residuals and pulls for both DCAFitter and KFParticle reconstruction", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/Tasks/taskMcValidation.cxx b/PWGHF/Tasks/taskMcValidation.cxx index cc18c2d6924..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 @@ -111,13 +125,17 @@ struct HfTaskMcValidationGen { AxisSpec axisResiduals{100, -0.01, 0.01}; AxisSpec axisPt{100, 0., 50.}; AxisSpec axisY{100, -5., 5.}; - AxisSpec axisMesonSpecies{nMesonChannels, -0.5, static_cast(nMesonChannels) - 0.5}; - AxisSpec axisBaryonSpecies{nChannels - nMesonChannels, -0.5, static_cast(nChannels - nMesonChannels) - 0.5}; + AxisSpec axisCent{110, 0., 110.}; + 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{ "registry", - {{"hMomentumCheck", "Mom. Conservation (1 = true, 0 = false) (#it{#epsilon} = 1 MeV/#it{c}); Mom. Conservation result; entries", {HistType::kTH1F, {{2, -0.5, +1.5}}}}, + {{"hNevGen", "Generated events counter; Gen. events; entries", {HistType::kTH1F, {{1, -0.5, +0.5}}}}, + {"hMomentumCheck", "Mom. Conservation (1 = true, 0 = false) (#it{#epsilon} = 1 MeV/#it{c}); Mom. Conservation result; entries", {HistType::kTH1F, {{2, -0.5, +1.5}}}}, {"hPtDiffMotherDaughterGen", "Pt Difference Mother-Daughters; #Delta#it{p}_{T}^{gen} (GeV/#it{c}); entries", {HistType::kTH1F, {axisResiduals}}}, {"hPxDiffMotherDaughterGen", "Px Difference Mother-Daughters; #Delta#it{p}_{x}^{gen} (GeV/#it{c}); entries", {HistType::kTH1F, {axisResiduals}}}, {"hPyDiffMotherDaughterGen", "Py Difference Mother-Daughters; #Delta#it{p}_{y}^{gen} (GeV/#it{c}); entries", {HistType::kTH1F, {axisResiduals}}}, @@ -129,18 +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/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/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/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/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) { @@ -152,31 +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/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/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 @@ -191,15 +241,41 @@ 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) { if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { return; } + registry.fill(HIST("hNevGen"), 1); // Slice the collisions table to get the collision info for the current MC collision - float centrality{-1.f}; + 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); @@ -297,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)) { @@ -316,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) { @@ -364,44 +450,70 @@ 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); } else if (origin == RecoDecay::OriginType::NonPrompt) { 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/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/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); } } } @@ -423,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]); @@ -447,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]); @@ -471,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]); @@ -495,16 +619,19 @@ 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, 2>, nChannels> histPtReco; std::array, 4> histOriginTracks; std::shared_ptr histAmbiguousTracks, histTracks; std::shared_ptr histContributors; using HfCand2ProngWithMCRec = soa::Join; using HfCand3ProngWithMCRec = soa::Join; + using CandMcGen = soa::Join; using CollisionsWithMCLabels = soa::Join; using CollisionsWithMCLabelsAndCentFT0C = soa::Join; using CollisionsWithMCLabelsAndCentFT0M = soa::Join; @@ -513,6 +640,9 @@ struct HfTaskMcValidationRec { Partition tracksFilteredGlobalTrackWoDCA = requireGlobalTrackWoDCAInFilter(); Partition tracksInAcc = requireTrackCutInFilter(TrackSelectionFlags::kInAcceptanceTracks); + Preslice cand2ProngPerCollision = aod::hf_cand::collisionId; + Preslice cand3ProngPerCollision = aod::hf_cand::collisionId; + Service ccdb; HfEventSelection hfEvSel; // event selection and monitoring @@ -521,6 +651,8 @@ struct HfTaskMcValidationRec { AxisSpec axisEta{40, -1., 1.}; 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}; @@ -531,6 +663,7 @@ struct HfTaskMcValidationRec { HistogramRegistry registry{ "registry", {{"histNtracks", "Number of global tracks w/o DCA requirement;#it{N}_{tracks};entries", {HistType::kTH1F, {axisMult}}}, + {"hNevReco", "Reconstructed events counter; Reco. events; entries", {HistType::kTH1F, {{1, -0.5, +0.5}}}}, {"histXvtxReco", "Position of reco PV in #it{X};#it{X}^{reco} (cm);entries", {HistType::kTH1F, {axisDeltaVtx}}}, {"histYvtxReco", "Position of reco PV in #it{Y};#it{Y}^{reco} (cm);entries", {HistType::kTH1F, {axisDeltaVtx}}}, {"histZvtxReco", "Position of reco PV in #it{Z};#it{Z}^{reco} (cm);entries", {HistType::kTH1F, {{200, -20, 20.}}}}, @@ -563,8 +696,10 @@ struct HfTaskMcValidationRec { /// \param mother is mother particle /// \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) + 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()); @@ -586,7 +721,10 @@ struct HfTaskMcValidationRec { std::array momDau1 = {candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}; - histPtReco[whichHad][whichOrigin]->Fill(candidate.pt()); + 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()); @@ -628,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}); @@ -638,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) { - histPtReco[iHad][iOrigin] = registryMesons.add(Form("%s/histPtReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisPtD}); + 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}); @@ -655,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) { - histPtReco[iHad][iOrigin] = registryBaryons.add(Form("%s/histPtReco%s", particleNames[iHad].data(), originNames[iOrigin].data()), Form("Pt reco %s %s; #it{p}_{T}^{reco} (GeV/#it{c}); entries", originNames[iOrigin].data(), labels[iHad].data()), HistType::kTH1F, {axisPtD}); + 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.}}); @@ -696,6 +840,7 @@ struct HfTaskMcValidationRec { return; } + registry.fill(HIST("hNevReco"), 1); registry.fill(HIST("histXvtxReco"), collision.posX()); registry.fill(HIST("histYvtxReco"), collision.posY()); registry.fill(HIST("histZvtxReco"), collision.posZ()); @@ -899,116 +1044,146 @@ struct HfTaskMcValidationRec { } PROCESS_SWITCH(HfTaskMcValidationRec, processCollAssocWithCentFTOM, "Process collision-association information with centrality selection with FT0M, requires extra table from TrackToCollisionAssociation task (fillTableOfCollIdsPerTrack=true)", false); + template void processEff(HfCand2ProngWithMCRec const& cand2Prongs, HfCand3ProngWithMCRec const& cand3Prongs, aod::TracksWMc const&, aod::McParticles const& mcParticles, aod::McCollisions const&, - CollisionsWithMCLabels const& /*collisions*/) + aod::BCsWithTimestamps const&, + Coll const& collisions, + Preslice cand2ProngsPerCollision, + Preslice cand3ProngsPerCollision) { - // loop over 2-prong candidates - for (const auto& cand2Prong : cand2Prongs) { - - if (cand2Prong.collision_as().has_mcCollision()) { - auto mcCollision = cand2Prong.collision_as().mcCollision_as(); - if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { - continue; - } - } - - // determine which kind of candidate it is - bool isD0Sel = TESTBIT(cand2Prong.hfflag(), o2::aod::hf_cand_2prong::DecayType::D0ToPiK); - if (!isD0Sel) { - continue; - } - int whichHad = -1; - if (isD0Sel && TESTBIT(std::abs(cand2Prong.flagMcMatchRec()), hf_cand_2prong::DecayType::D0ToPiK)) { - whichHad = DzeroToKPi; + // loop over collisions + for (const auto& collision : collisions) { + // apply event selection + float centrality{105.f}; + int occupancy = collision.trackOccupancyInTimeRange(); + hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // only needed to update centrality, no bitmask selection applied + if (!collision.has_mcCollision()) { + return; } - int whichOrigin; - if (cand2Prong.originMcRec() == RecoDecay::OriginType::Prompt) { - whichOrigin = 0; - } else { - whichOrigin = 1; + auto mcCollision = collision.template mcCollision_as(); + if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { + return; } - if (whichHad >= 0) { - int indexParticle = -1; - if (cand2Prong.prong0_as().has_mcParticle()) { - indexParticle = RecoDecay::getMother(mcParticles, cand2Prong.prong0_as().mcParticle(), PDGArrayParticle[whichHad], true); - } - if (indexParticle < 0) { - continue; - } - auto mother = mcParticles.rawIteratorAt(indexParticle); - fillHisto(cand2Prong, mother, whichHad, whichOrigin); - } - } // end loop on 2-prong candidates + // group 2- and 3-prongs for collision + auto thisCollId = collision.globalIndex(); + auto grouped2ProngCandidates = cand2Prongs.sliceBy(cand2ProngsPerCollision, thisCollId); + auto grouped3ProngCandidates = cand3Prongs.sliceBy(cand3ProngsPerCollision, thisCollId); - // loop over 3-prong candidates - for (const auto& cand3Prong : cand3Prongs) { + // loop over 2-prong candidates + for (const auto& cand2Prong : grouped2ProngCandidates) { - if (cand3Prong.collision_as().has_mcCollision()) { - auto mcCollision = cand3Prong.collision_as().mcCollision_as(); - if (eventGeneratorType >= 0 && mcCollision.getSubGeneratorId() != eventGeneratorType) { + // determine which kind of candidate it is + bool isD0Sel = TESTBIT(cand2Prong.hfflag(), o2::aod::hf_cand_2prong::DecayType::D0ToPiK); + if (!isD0Sel) { continue; } - } - - // determine which kind of candidate it is - // FIXME: add D* and decays with cascades - bool isDPlusSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DplusToPiKPi); - bool isDsSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DsToKKPi); - bool isLcSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::LcToPKPi); - bool isXicSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::XicToPKPi); - if (!isDPlusSel && !isDsSel && !isLcSel && !isXicSel) { - continue; - } - int whichHad = -1; - if (isDPlusSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::DplusToPiKPi)) { - whichHad = DplusToPiKPi; - } else if (isDsSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::DsToKKPi)) { - if (cand3Prong.flagMcDecayChanRec() == hf_cand_3prong::DecayChannelDToKKPi::DsToPhiPi) { - whichHad = DsToPhiPiToKKPi; - } - if (cand3Prong.flagMcDecayChanRec() == hf_cand_3prong::DecayChannelDToKKPi::DsToK0starK) { - whichHad = DsToK0starKToKKPi; + int whichHad = -1; + if (isD0Sel && TESTBIT(std::abs(cand2Prong.flagMcMatchRec()), hf_cand_2prong::DecayType::D0ToPiK)) { + whichHad = DzeroToKPi; } - if (cand3Prong.flagMcDecayChanRec() == hf_cand_3prong::DecayChannelDToKKPi::DplusToPhiPi) { - whichHad = DplusToPhiPiToKKPi; + int whichOrigin; + if (cand2Prong.originMcRec() == RecoDecay::OriginType::Prompt) { + whichOrigin = 0; + } else { + whichOrigin = 1; } - } else if (isLcSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::LcToPKPi)) { - whichHad = LcToPKPi; - } else if (isXicSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::XicToPKPi)) { - whichHad = XiCplusToPKPi; - } - int whichOrigin; - if (cand3Prong.originMcRec() == RecoDecay::OriginType::Prompt) { - whichOrigin = 0; - } else { - whichOrigin = 1; - } - if (whichHad >= 0) { - int indexParticle = -1; - if (cand3Prong.prong0_as().has_mcParticle()) { - indexParticle = RecoDecay::getMother(mcParticles, cand3Prong.prong0_as().mcParticle(), PDGArrayParticle[whichHad], true); + if (whichHad >= 0) { + int indexParticle = -1; + indexParticle = RecoDecay::getMother(mcParticles, cand2Prong.template prong0_as().template mcParticle_as(), PDGArrayParticle[whichHad], true); + if (indexParticle < 0) { + continue; + } + auto mother = mcParticles.rawIteratorAt(indexParticle); + fillHisto(cand2Prong, mother, whichHad, whichOrigin, centrality, occupancy); } - if (indexParticle < 0) { + } // end loop on 2-prong candidates + + // loop over 3-prong candidates + for (const auto& cand3Prong : grouped3ProngCandidates) { + + // determine which kind of candidate it is + // FIXME: add D* and decays with cascades + bool isDPlusSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DplusToPiKPi); + bool isDsSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::DsToKKPi); + bool isLcSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::LcToPKPi); + bool isXicSel = TESTBIT(cand3Prong.hfflag(), hf_cand_3prong::DecayType::XicToPKPi); + if (!isDPlusSel && !isDsSel && !isLcSel && !isXicSel) { continue; } - auto mother = mcParticles.rawIteratorAt(indexParticle); - fillHisto(cand3Prong, mother, whichHad, whichOrigin); - std::array momDau2 = {cand3Prong.pxProng2(), - cand3Prong.pyProng2(), - cand3Prong.pzProng2()}; - histPtDau[whichHad][whichOrigin][2]->Fill(RecoDecay::pt(momDau2)); - histEtaDau[whichHad][whichOrigin][2]->Fill(RecoDecay::eta(momDau2)); - histImpactParameterDau[whichHad][whichOrigin][2]->Fill(cand3Prong.impactParameter2()); - } - } // end loop on 3-prong candidates + int whichHad = -1; + if (isDPlusSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::DplusToPiKPi)) { + whichHad = DplusToPiKPi; + } else if (isDsSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::DsToKKPi)) { + if (cand3Prong.flagMcDecayChanRec() == hf_cand_3prong::DecayChannelDToKKPi::DsToPhiPi) { + whichHad = DsToPhiPiToKKPi; + } + if (cand3Prong.flagMcDecayChanRec() == hf_cand_3prong::DecayChannelDToKKPi::DsToK0starK) { + whichHad = DsToK0starKToKKPi; + } + if (cand3Prong.flagMcDecayChanRec() == hf_cand_3prong::DecayChannelDToKKPi::DplusToPhiPi) { + whichHad = DplusToPhiPiToKKPi; + } + } else if (isLcSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::LcToPKPi)) { + whichHad = LcToPKPi; + } else if (isXicSel && TESTBIT(std::abs(cand3Prong.flagMcMatchRec()), hf_cand_3prong::DecayType::XicToPKPi)) { + whichHad = XiCplusToPKPi; + } + int whichOrigin; + if (cand3Prong.originMcRec() == RecoDecay::OriginType::Prompt) { + whichOrigin = 0; + } else { + whichOrigin = 1; + } + + if (whichHad >= 0) { + int indexParticle = -1; + if (cand3Prong.template prong0_as().has_mcParticle()) { + indexParticle = RecoDecay::getMother(mcParticles, cand3Prong.template prong0_as().template mcParticle_as(), PDGArrayParticle[whichHad], true); + } + if (indexParticle < 0) { + continue; + } + auto mother = mcParticles.rawIteratorAt(indexParticle); + fillHisto(cand3Prong, mother, whichHad, whichOrigin, centrality, occupancy); + std::array momDau2 = {cand3Prong.pxProng2(), + cand3Prong.pyProng2(), + cand3Prong.pzProng2()}; + histPtDau[whichHad][whichOrigin][2]->Fill(RecoDecay::pt(momDau2)); + histEtaDau[whichHad][whichOrigin][2]->Fill(RecoDecay::eta(momDau2)); + histImpactParameterDau[whichHad][whichOrigin][2]->Fill(cand3Prong.impactParameter2()); + } + } // end loop on 3-prong candidates + } // end loop on collisions + } + void processEffNoCent(HfCand2ProngWithMCRec const& cand2Prongs, + HfCand3ProngWithMCRec const& cand3Prongs, + aod::TracksWMc const& mcTracks, + aod::McParticles const& mcParticles, + aod::McCollisions const& mcCollisions, + aod::BCsWithTimestamps const& bcs, + CollisionsWithMCLabels const& collsWithLabels) + { + processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); + } + PROCESS_SWITCH(HfTaskMcValidationRec, processEffNoCent, "Compute charm-hadron efficiencies (not all of them are implemented), requires HF candidate creators w/o information on centrality", false); + + void processEffCentFT0C(HfCand2ProngWithMCRec const& cand2Prongs, + HfCand3ProngWithMCRec const& cand3Prongs, + aod::TracksWMc const& mcTracks, + aod::McParticles const& mcParticles, + aod::McCollisions const& mcCollisions, + aod::BCsWithTimestamps const& bcs, + CollisionsWithMCLabelsAndCentFT0C const& collsWithLabels) + { + processEff(cand2Prongs, cand3Prongs, mcTracks, mcParticles, mcCollisions, bcs, collsWithLabels, cand2ProngPerCollision, cand3ProngPerCollision); } - PROCESS_SWITCH(HfTaskMcValidationRec, processEff, "Compute charm-hadron efficiencies (not all of them are implemented), requires HF candidate creators", false); + PROCESS_SWITCH(HfTaskMcValidationRec, processEffCentFT0C, "Compute charm-hadron efficiencies (not all of them are implemented), requires HF candidate creators with information on centrality from FT0C", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 5c1c93505d4..d1ffe2038e2 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -24,8 +24,11 @@ #include "Framework/Configurable.h" #include "Framework/HistogramRegistry.h" #include "Framework/HistogramSpec.h" +#include "Framework/OutputObjHeader.h" +#include "Common/CCDB/EventSelectionParams.h" #include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" #include "PWGHF/Core/CentralityEstimation.h" namespace o2::hf_evsel @@ -93,6 +96,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable zPvPosMax{"zPvPosMax", 10.f, "Maximum PV posZ (cm)"}; 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"}; // histogram names static constexpr char nameHistCollisions[] = "hCollisions"; @@ -107,6 +111,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { // util to retrieve trigger mask in case of software triggers Zorro zorro; + o2::framework::OutputObj zorroSummary{"zorroSummary"}; int currentRun{-1}; /// \brief Adds collision monitoring histograms in the histogram registry. @@ -121,6 +126,11 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { hPosYAfterEvSel = registry.add(nameHistPosYAfterEvSel, "selected events;#it{y}_{prim. vtx.} (cm);entries", {o2::framework::HistType::kTH1D, {{200, -0.5, 0.5}}}); hNumPvContributorsAfterSel = registry.add(nameHistNumPvContributorsAfterSel, "selected events;#it{y}_{prim. vtx.} (cm);entries", {o2::framework::HistType::kTH1D, {{500, -0.5, 499.5}}}); setEventRejectionLabels(hCollisions, softwareTrigger); + + // we initialise the summary object + if (softwareTrigger.value != "") { + zorroSummary.setObject(zorro.getZorroSummary()); + } } /// \brief Applies event selection. @@ -209,8 +219,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { int runNumber = bc.runNumber(); if (runNumber != currentRun) { // We might need to update Zorro from CCDB if the run number changes - zorro.initCCDB(ccdb.service, runNumber, bc.timestamp(), softwareTrigger.value); + zorro.setCCDBpath(ccdbPathSoftwareTrigger); zorro.setBCtolerance(bcMarginForSoftwareTrigger); + zorro.initCCDB(ccdb.service, runNumber, bc.timestamp(), softwareTrigger.value); currentRun = runNumber; } zorro.populateHistRegistry(registry, runNumber); diff --git a/PWGHF/Utils/utilsPid.h b/PWGHF/Utils/utilsPid.h new file mode 100644 index 00000000000..c0cec3e0ce1 --- /dev/null +++ b/PWGHF/Utils/utilsPid.h @@ -0,0 +1,108 @@ +// 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 utilsPid.h +/// \brief PID utilities for HF analyses +/// +/// \author Mattia Faggin , CERN + +#ifndef PWGHF_UTILS_UTILSPID_H_ +#define PWGHF_UTILS_UTILSPID_H_ + +namespace o2::aod +{ + +namespace pid_tpc_tof_utils +{ + +enum HfProngSpecies : int { Pion = 0, + Kaon, + Proton }; + +/// Function to combine TPC and TOF NSigma +/// \param tiny switch between full and tiny (binned) PID tables +/// \param tpcNSigma is the (binned) NSigma separation in TPC (if tiny = true) +/// \param tofNSigma is the (binned) NSigma separation in TOF (if tiny = true) +/// \return combined NSigma of TPC and TOF +template +T1 combineNSigma(T1 tpcNSigma, T1 tofNSigma) +{ + static constexpr float defaultNSigmaTolerance = .1f; + static constexpr float defaultNSigma = -999.f + defaultNSigmaTolerance; // -999.f is the default value set in TPCPIDResponse.h and PIDTOF.h + + if constexpr (tiny) { + tpcNSigma *= aod::pidtpc_tiny::binning::bin_width; + tofNSigma *= aod::pidtof_tiny::binning::bin_width; + } + + if ((tpcNSigma > defaultNSigma) && (tofNSigma > defaultNSigma)) { // TPC and TOF + return std::sqrt(.5f * (tpcNSigma * tpcNSigma + tofNSigma * tofNSigma)); + } + if (tpcNSigma > defaultNSigma) { // only TPC + return std::abs(tpcNSigma); + } + if (tofNSigma > defaultNSigma) { // only TOF + return std::abs(tofNSigma); + } + return tofNSigma; // no TPC nor TOF +} + +/// @brief Function to fill tables with HF prong PID information +/// @tparam TRK datatype of the prong track +/// @tparam ROW datatype of the prong PID table to fill +/// @tparam specPid particle species +/// @param track prong track +/// @param rowPid cursor of the prong PID table to fill +template +void fillProngPid(TRK const& track, ROW& rowPid) +{ + + // get PID information for the daughter tracks + // TODO: add here the code for a possible PID post-calibrations in MC + float nSigTpc = -999.f; + float nSigTof = -999.f; + if constexpr (specPid == HfProngSpecies::Pion) { + // pion PID + if (track.hasTPC()) { + nSigTpc = track.tpcNSigmaPi(); + } + if (track.hasTOF()) { + nSigTof = track.tofNSigmaPi(); + } + } else if constexpr (specPid == HfProngSpecies::Kaon) { + // kaon PID + if (track.hasTPC()) { + nSigTpc = track.tpcNSigmaKa(); + } + if (track.hasTOF()) { + nSigTof = track.tofNSigmaKa(); + } + } else if constexpr (specPid == HfProngSpecies::Proton) { + // proton PID + if (track.hasTPC()) { + nSigTpc = track.tpcNSigmaPr(); + } + if (track.hasTOF()) { + nSigTof = track.tofNSigmaPr(); + } + } else { + LOG(fatal) << "Unsupported PID. Supported species in HF framework: HfProngSpecies::Pion, HfProngSpecies::Kaon, HfProngSpecies::Proton"; + } + + // fill candidate prong PID rows + rowPid(nSigTpc, nSigTof); +} + +} // namespace pid_tpc_tof_utils + +} // namespace o2::aod + +#endif // PWGHF_UTILS_UTILSPID_H_ diff --git a/PWGJE/Core/JetCandidateUtilities.h b/PWGJE/Core/JetCandidateUtilities.h index 43e66f82d66..37e5e53d96b 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" diff --git a/PWGJE/Core/JetDQUtilities.h b/PWGJE/Core/JetDQUtilities.h index fdd5ca9cbcd..e68a23494f6 100644 --- a/PWGJE/Core/JetDQUtilities.h +++ b/PWGJE/Core/JetDQUtilities.h @@ -52,7 +52,7 @@ namespace jetdqutilities template constexpr bool isDielectronCandidate() { - return std::is_same_v, CandidatesDielectronData::iterator> || std::is_same_v, CandidatesDielectronData::filtered_iterator> || std::is_same_v, CandidatesDielectronMCD::iterator> || std::is_same_v, CandidatesDielectronMCD::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesDielectronData::iterator> || std::is_same_v, o2::aod::CandidatesDielectronData::filtered_iterator> || std::is_same_v, o2::aod::CandidatesDielectronMCD::iterator> || std::is_same_v, o2::aod::CandidatesDielectronMCD::filtered_iterator>; } /** @@ -61,7 +61,7 @@ constexpr bool isDielectronCandidate() template constexpr bool isDielectronMcCandidate() { - return std::is_same_v, CandidatesDielectronMCP::iterator> || std::is_same_v, CandidatesDielectronMCP::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesDielectronMCP::iterator> || std::is_same_v, o2::aod::CandidatesDielectronMCP::filtered_iterator>; } /** diff --git a/PWGJE/Core/JetFindingUtilities.h b/PWGJE/Core/JetFindingUtilities.h index b624ba4a927..8efd9733e6e 100644 --- a/PWGJE/Core/JetFindingUtilities.h +++ b/PWGJE/Core/JetFindingUtilities.h @@ -53,20 +53,38 @@ namespace jetfindingutilities { +/** + * returns true if the object is from the JDummys table + */ +template +constexpr bool isDummy() +{ + return std::is_same_v, o2::aod::JDummys::iterator> || std::is_same_v, o2::aod::JDummys::filtered_iterator>; +} + +/** + * returns true if the table is a JDummys table + */ +template +constexpr bool isDummyTable() +{ + return isDummy() || isDummy(); +} + /** * returns true if the cluster is from an EMCAL table */ template constexpr bool isEMCALCluster() { - return std::is_same_v, JetClusters::iterator> || std::is_same_v, JetClusters::filtered_iterator> || std::is_same_v, JetClustersMCD::iterator> || std::is_same_v, JetClustersMCD::filtered_iterator>; + return std::is_same_v, o2::aod::JetClusters::iterator> || std::is_same_v, o2::aod::JetClusters::filtered_iterator> || std::is_same_v, o2::aod::JetClustersMCD::iterator> || std::is_same_v, o2::aod::JetClustersMCD::filtered_iterator>; } /** * returns true if the table is an EMCAL table */ template -constexpr bool isEMCALTable() +constexpr bool isEMCALClusterTable() { return isEMCALCluster() || isEMCALCluster(); } diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index 913231d1999..39ce84a879f 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" @@ -54,7 +53,7 @@ namespace jethfutilities template constexpr bool isD0Candidate() { - return std::is_same_v, CandidatesD0Data::iterator> || std::is_same_v, CandidatesD0Data::filtered_iterator> || std::is_same_v, CandidatesD0MCD::iterator> || std::is_same_v, CandidatesD0MCD::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesD0Data::iterator> || std::is_same_v, o2::aod::CandidatesD0Data::filtered_iterator> || std::is_same_v, o2::aod::CandidatesD0MCD::iterator> || std::is_same_v, o2::aod::CandidatesD0MCD::filtered_iterator>; } /** @@ -63,7 +62,7 @@ constexpr bool isD0Candidate() template constexpr bool isD0McCandidate() { - return std::is_same_v, CandidatesD0MCP::iterator> || std::is_same_v, CandidatesD0MCP::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesD0MCP::iterator> || std::is_same_v, o2::aod::CandidatesD0MCP::filtered_iterator>; } /** @@ -90,7 +89,7 @@ constexpr bool isD0McTable() template constexpr bool isLcCandidate() { - return std::is_same_v, CandidatesLcData::iterator> || std::is_same_v, CandidatesLcData::filtered_iterator> || std::is_same_v, CandidatesLcMCD::iterator> || std::is_same_v, CandidatesLcMCD::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesLcData::iterator> || std::is_same_v, o2::aod::CandidatesLcData::filtered_iterator> || std::is_same_v, o2::aod::CandidatesLcMCD::iterator> || std::is_same_v, o2::aod::CandidatesLcMCD::filtered_iterator>; } /** @@ -99,7 +98,7 @@ constexpr bool isLcCandidate() template constexpr bool isLcMcCandidate() { - return std::is_same_v, CandidatesLcMCP::iterator> || std::is_same_v, CandidatesLcMCP::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesLcMCP::iterator> || std::is_same_v, o2::aod::CandidatesLcMCP::filtered_iterator>; } /** @@ -126,7 +125,7 @@ constexpr bool isLcMcTable() template constexpr bool isBplusCandidate() { - return std::is_same_v, CandidatesBplusData::iterator> || std::is_same_v, CandidatesBplusData::filtered_iterator> || std::is_same_v, CandidatesBplusMCD::iterator> || std::is_same_v, CandidatesBplusMCD::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesBplusData::iterator> || std::is_same_v, o2::aod::CandidatesBplusData::filtered_iterator> || std::is_same_v, o2::aod::CandidatesBplusMCD::iterator> || std::is_same_v, o2::aod::CandidatesBplusMCD::filtered_iterator>; } /** @@ -135,7 +134,7 @@ constexpr bool isBplusCandidate() template constexpr bool isBplusMcCandidate() { - return std::is_same_v, CandidatesBplusMCP::iterator> || std::is_same_v, CandidatesBplusMCP::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesBplusMCP::iterator> || std::is_same_v, o2::aod::CandidatesBplusMCP::filtered_iterator>; } /** diff --git a/PWGJE/Core/JetMatchingUtilities.h b/PWGJE/Core/JetMatchingUtilities.h index b88ad32337c..90885ca737a 100644 --- a/PWGJE/Core/JetMatchingUtilities.h +++ b/PWGJE/Core/JetMatchingUtilities.h @@ -470,8 +470,10 @@ float getPtSum(T const& tracksBase, U const& clustersBase, V const& tracksTag, O template auto getConstituents(T const& jet, U const& /*constituents*/) { - if constexpr (jetfindingutilities::isEMCALTable()) { + 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 nullptr; } else { return jet.template tracks_as(); } @@ -492,8 +494,8 @@ void MatchPt(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::v auto jetTagTracks = getConstituents(jetTag, tracksTag); auto jetTagClusters = getConstituents(jetTag, clustersTag); - ptSumBase = getPtSum < jetfindingutilities::isEMCALTable() || jetfindingutilities::isEMCALTable(), jetsBaseIsMc, jetsTagIsMc > (jetBaseTracks, jetBaseClusters, jetTagTracks, jetTagClusters); - ptSumTag = getPtSum < jetfindingutilities::isEMCALTable() || jetfindingutilities::isEMCALTable(), jetsTagIsMc, jetsBaseIsMc > (jetTagTracks, jetTagClusters, jetBaseTracks, jetBaseClusters); + ptSumBase = getPtSum < jetfindingutilities::isEMCALClusterTable() || jetfindingutilities::isEMCALClusterTable(), jetsBaseIsMc, jetsTagIsMc > (jetBaseTracks, jetBaseClusters, jetTagTracks, jetTagClusters); + ptSumTag = getPtSum < jetfindingutilities::isEMCALClusterTable() || jetfindingutilities::isEMCALClusterTable(), jetsTagIsMc, jetsBaseIsMc > (jetTagTracks, jetTagClusters, jetBaseTracks, jetBaseClusters); if (ptSumBase > jetBase.pt() * minPtFraction) { baseToTagMatchingPt[jetBase.globalIndex()].push_back(jetTag.globalIndex()); } diff --git a/PWGJE/Core/JetSubstructureUtilities.h b/PWGJE/Core/JetSubstructureUtilities.h index cf67d789ead..cb714c1c5bf 100644 --- a/PWGJE/Core/JetSubstructureUtilities.h +++ b/PWGJE/Core/JetSubstructureUtilities.h @@ -59,7 +59,7 @@ fastjet::ClusterSequenceArea jetToPseudoJet(T const& jet, U const& /*tracks*/, V for (auto& jetConstituent : jet.template tracks_as()) { fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); } - if constexpr (std::is_same_v, JetClusters::iterator> || std::is_same_v, JetClusters::filtered_iterator>) { + if constexpr (std::is_same_v, o2::aod::JetClusters::iterator> || std::is_same_v, o2::aod::JetClusters::filtered_iterator>) { for (auto& jetClusterConstituent : jet.template clusters_as()) { fastjetutilities::fillClusters(jetClusterConstituent, jetConstituents, jetClusterConstituent.globalIndex()); } diff --git a/PWGJE/Core/JetTaggingUtilities.h b/PWGJE/Core/JetTaggingUtilities.h index ec427490b66..d6a4ee8f32b 100644 --- a/PWGJE/Core/JetTaggingUtilities.h +++ b/PWGJE/Core/JetTaggingUtilities.h @@ -384,23 +384,45 @@ bool trackAcceptanceWithDca(T const& track, float trackDcaXYMax, float trackDcaZ } /** - * retrun acceptance of prong about chi2 and error of decay length due to cut for high quality secondary vertex + * retrun acceptance of prong due to cut for high quality secondary vertex */ template -bool prongAcceptance(T const& prong, float prongChi2PCAMax, float prongsigmaLxyMax, bool doXYZ) +bool prongAcceptance(T const& prong, float prongChi2PCAMin, float prongChi2PCAMax, float prongsigmaLxyMax, float prongIPxyMin, float prongIPxyMax, bool doXYZ) { + if (prong.chi2PCA() < prongChi2PCAMin) + return false; if (prong.chi2PCA() > prongChi2PCAMax) return false; if (!doXYZ) { if (prong.errorDecayLengthXY() > prongsigmaLxyMax) return false; + if (std::abs(prong.impactParameterXY()) < prongIPxyMin) + return false; + if (std::abs(prong.impactParameterXY()) > prongIPxyMax) + return false; } else { if (prong.errorDecayLength() > prongsigmaLxyMax) return false; + // TODO + if (std::abs(prong.impactParameterXY()) < prongIPxyMin) + return false; + if (std::abs(prong.impactParameterXY()) > prongIPxyMax) + return false; } return true; } +/** + * retrun acceptance of secondary vertex due to cut for high quality secondary vertex + */ +template +bool svAcceptance(T const& sv, float svDispersionMax) +{ + if (sv.dispersion() > svDispersionMax) + return false; + return true; +} + /** * return geometric sign which is calculated scalar product between jet axis with DCA (track propagated to PV ) * positive and negative value are expected from primary vertex @@ -423,14 +445,19 @@ int getGeoSign(T const& jet, U const& jtrack) * in a vector in descending order. */ template > -void orderForIPJetTracks(T const& jet, U const& /*jtracks*/, float const& trackDcaXYMax, float const& trackDcaZMax, Vec& vecSignImpSig) +void orderForIPJetTracks(T const& jet, U const& /*jtracks*/, float const& trackDcaXYMax, float const& trackDcaZMax, Vec& vecSignImpSig, bool useIPxyz) { for (auto& jtrack : jet.template tracks_as()) { if (!trackAcceptanceWithDca(jtrack, trackDcaXYMax, trackDcaZMax)) continue; auto geoSign = getGeoSign(jet, jtrack); - auto varSignImpXYSig = geoSign * std::abs(jtrack.dcaXY()) / jtrack.sigmadcaXY(); - vecSignImpSig.push_back(varSignImpXYSig); + float varSignImpSig; + if (!useIPxyz) { + varSignImpSig = geoSign * std::abs(jtrack.dcaXY()) / jtrack.sigmadcaXY(); + } else { + varSignImpSig = geoSign * std::abs(jtrack.dcaXYZ()) / jtrack.sigmadcaXYZ(); + } + vecSignImpSig.push_back(varSignImpSig); } std::sort(vecSignImpSig.begin(), vecSignImpSig.end(), std::greater()); } @@ -439,13 +466,13 @@ void orderForIPJetTracks(T const& jet, U const& /*jtracks*/, float const& trackD * Checks if a jet is greater than the given tagging working point based on the signed impact parameter significances */ template -bool isGreaterThanTaggingPoint(T const& jet, U const& jtracks, float const& trackDcaXYMax, float const& trackDcaZMax, float const& taggingPoint = 1.0, int const& cnt = 1) +bool isGreaterThanTaggingPoint(T const& jet, U const& jtracks, float const& trackDcaXYMax, float const& trackDcaZMax, float const& taggingPoint = 1.0, int const& cnt = 1, bool useIPxyz = false) { if (cnt == 0) { return true; // untagged } std::vector vecSignImpSig; - orderForIPJetTracks(jet, jtracks, trackDcaXYMax, trackDcaZMax, vecSignImpSig); + orderForIPJetTracks(jet, jtracks, trackDcaXYMax, trackDcaZMax, vecSignImpSig, useIPxyz); if (vecSignImpSig.size() > static_cast::size_type>(cnt) - 1) { for (int i = 0; i < cnt; i++) { if (vecSignImpSig[i] < taggingPoint) { // tagger point set @@ -521,9 +548,9 @@ float getTrackProbability(T const& fResoFuncjet, U const& track, const float& mi * geometric sign. */ template -float getJetProbability(T const& fResoFuncjet, U const& jet, V const& jtracks, float const& trackDcaXYMax, float const& trackDcaZMax, const int& cnt, const float& tagPoint = 1.0, const float& minSignImpXYSig = -10) +float getJetProbability(T const& fResoFuncjet, U const& jet, V const& jtracks, float const& trackDcaXYMax, float const& trackDcaZMax, const int& cnt, const float& tagPoint = 1.0, const float& minSignImpXYSig = -10, bool useIPxy = true) { - if (!(isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPoint, cnt))) + if (!(isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPoint, cnt, useIPxy))) return -1; std::vector jetTracksPt; @@ -556,164 +583,37 @@ float getJetProbability(T const& fResoFuncjet, U const& jet, V const& jtracks, f } // For secaondy vertex method utilites -class bjetCandSV -{ - public: - bjetCandSV() = default; - - bjetCandSV(float xpv, float ypv, float zpv, float xsv, float ysv, float zsv, - float pxVal, float pyVal, float pzVal, float eVal, float mVal, float chi2Val, - float errDecayLength, float errDecayLengthXY, - float rSecVertex, float ptVal, float pVal, - std::array pVec, float etaVal, float phiVal, - float yVal, float decayLen, float decayLenXY, - float decayLenNorm, float decayLenXYNorm, - float cpaVal, float impParXY) - : m_xPVertex(xpv), m_yPVertex(ypv), m_zPVertex(zpv), m_xSecondaryVertex(xsv), m_ySecondaryVertex(ysv), m_zSecondaryVertex(zsv), m_px(pxVal), m_py(pyVal), m_pz(pzVal), m_e(eVal), m_m(mVal), m_chi2PCA(chi2Val), m_errorDecayLength(errDecayLength), m_errorDecayLengthXY(errDecayLengthXY), m_rSecondaryVertex(rSecVertex), m_pt(ptVal), m_p(pVal), m_pVector(pVec), m_eta(etaVal), m_phi(phiVal), m_y(yVal), m_decayLength(decayLen), m_decayLengthXY(decayLenXY), m_decayLengthNormalised(decayLenNorm), m_decayLengthXYNormalised(decayLenXYNorm), m_cpa(cpaVal), m_impactParameterXY(impParXY) - { - } - - float xPVertex() const { return m_xPVertex; } - float yPVertex() const { return m_yPVertex; } - float zPVertex() const { return m_zPVertex; } - - float xSecondaryVertex() const { return m_xSecondaryVertex; } - float ySecondaryVertex() const { return m_ySecondaryVertex; } - float zSecondaryVertex() const { return m_zSecondaryVertex; } - - float px() const { return m_px; } - float py() const { return m_py; } - float pz() const { return m_pz; } - float e() const { return m_e; } - float m() const { return m_m; } - float chi2PCA() const { return m_chi2PCA; } - - float errorDecayLength() const { return m_errorDecayLength; } - float errorDecayLengthXY() const { return m_errorDecayLengthXY; } - - float rSecondaryVertex() const { return m_rSecondaryVertex; } - float pt() const { return m_pt; } - float p() const { return m_p; } - - std::array pVector() const { return m_pVector; } - - float eta() const { return m_eta; } - float phi() const { return m_phi; } - float y() const { return m_y; } - - float decayLength() const { return m_decayLength; } - float decayLengthXY() const { return m_decayLengthXY; } - float decayLengthNormalised() const { return m_decayLengthNormalised; } - float decayLengthXYNormalised() const { return m_decayLengthXYNormalised; } - - float cpa() const { return m_cpa; } - float impactParameterXY() const { return m_impactParameterXY; } - - private: - float m_xPVertex, m_yPVertex, m_zPVertex; - float m_xSecondaryVertex, m_ySecondaryVertex, m_zSecondaryVertex; - float m_px, m_py, m_pz, m_e, m_m, m_chi2PCA; - float m_errorDecayLength, m_errorDecayLengthXY; - float m_rSecondaryVertex, m_pt, m_p; - std::array m_pVector; - float m_eta, m_phi, m_y; - float m_decayLength, m_decayLengthXY, m_decayLengthNormalised, m_decayLengthXYNormalised; - float m_cpa, m_impactParameterXY; -}; - template -bjetCandSV jetFromProngMaxDecayLength(const JetType& jet, float const& prongChi2PCAMax, float const& prongsigmaLxyMax, const bool& doXYZ = false) +typename ProngType::iterator jetFromProngMaxDecayLength(const JetType& jet, float const& prongChi2PCAMin, float const& prongChi2PCAMax, float const& prongsigmaLxyMax, float const& prongIPxyMin, float const& prongIPxyMax, const bool& doXYZ = false, bool* checkSv = nullptr) { - float xPVertex = 0.0f; - float yPVertex = 0.0f; - float zPVertex = 0.0f; - float xSecondaryVertex = 0.0f; - float ySecondaryVertex = 0.0f; - float zSecondaryVertex = 0.0f; - float px = 0.0f; - float py = 0.0f; - float pz = 0.0f; - float e = 0.0f; - float m = 0.0f; - float chi2PCA = 0.0f; - float errorDecayLength = 0.0f; - float errorDecayLengthXY = 0.0f; - - float rSecondaryVertex = 0.0f; - float pt = 0.0f; - float p = 0.0f; - std::array pVector = {0.0f, 0.0f, 0.0f}; - float eta = 0.0f; - float phi = 0.0f; - float y = 0.0f; - float decayLength = 0.0f; - float decayLengthXY = 0.0f; - float decayLengthNormalised = 0.0f; - float decayLengthXYNormalised = 0.0f; - float cpa = 0.0f; - float impactParameterXY = 0.0f; - + if (checkSv) + *checkSv = false; float maxSxy = -1.0f; - + typename ProngType::iterator bjetCand; for (const auto& prong : jet.template secondaryVertices_as()) { - float Sxy = -1.; + if (!prongAcceptance(prong, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, doXYZ)) + continue; + *checkSv = true; + float Sxy = -1.0f; if (!doXYZ) { Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); } else { Sxy = prong.decayLength() / prong.errorDecayLength(); } - if (!prongAcceptance(prong, prongChi2PCAMax, prongsigmaLxyMax, doXYZ)) - continue; - if (maxSxy < Sxy) { - maxSxy = Sxy; - - xPVertex = prong.xPVertex(); - yPVertex = prong.yPVertex(); - zPVertex = prong.zPVertex(); - xSecondaryVertex = prong.xSecondaryVertex(); - ySecondaryVertex = prong.ySecondaryVertex(); - zSecondaryVertex = prong.zSecondaryVertex(); - px = prong.px(); - py = prong.py(); - pz = prong.pz(); - e = prong.e(); - m = prong.m(); - chi2PCA = prong.chi2PCA(); - errorDecayLength = prong.errorDecayLength(); - errorDecayLengthXY = prong.errorDecayLengthXY(); - rSecondaryVertex = prong.rSecondaryVertex(); - pt = prong.pt(); - p = prong.p(); - pVector = prong.pVector(); - eta = prong.eta(); - phi = prong.phi(); - y = prong.y(); - decayLength = prong.decayLength(); - decayLengthXY = prong.decayLengthXY(); - decayLengthNormalised = prong.decayLengthNormalised(); - decayLengthXYNormalised = prong.decayLengthXYNormalised(); - cpa = prong.cpa(); - impactParameterXY = prong.impactParameterXY(); + bjetCand = prong; } } - - return bjetCandSV( - xPVertex, yPVertex, zPVertex, - xSecondaryVertex, ySecondaryVertex, zSecondaryVertex, - px, py, pz, e, m, chi2PCA, - errorDecayLength, errorDecayLengthXY, - rSecondaryVertex, pt, p, - pVector, eta, phi, - y, decayLength, decayLengthXY, - decayLengthNormalised, decayLengthXYNormalised, - cpa, impactParameterXY); + return bjetCand; } template -bool isTaggedJetSV(T const jet, U const& /*prongs*/, float const& prongChi2PCAMax, float const& prongsigmaLxyMax, float const& doXYZ = false, float const& tagPointForSV = 15.) +bool isTaggedJetSV(T const jet, U const& /*prongs*/, float const& prongChi2PCAMin, float const& prongChi2PCAMax, float const& prongsigmaLxyMax, float const& prongIPxyMin, float const& prongIPxyMax, float svDispersionMax, float const& doXYZ = false, float const& tagPointForSV = 15.) { - auto bjetCand = jetFromProngMaxDecayLength(jet, prongChi2PCAMax, prongsigmaLxyMax, doXYZ); + bool checkSv = false; + auto bjetCand = jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, doXYZ, &checkSv); + if (!(checkSv && svAcceptance(bjetCand, svDispersionMax))) + return false; if (!doXYZ) { auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); if (maxSxy < tagPointForSV) diff --git a/PWGJE/Core/JetUtilities.h b/PWGJE/Core/JetUtilities.h index dac55dfbaa1..f1db864ef25 100644 --- a/PWGJE/Core/JetUtilities.h +++ b/PWGJE/Core/JetUtilities.h @@ -141,7 +141,7 @@ std::tuple>, std::vector>> MatchCl template float deltaR(T const& A, U const& B) { - float dPhi = RecoDecay::constrainAngle(RecoDecay::constrainAngle(A.phi(), -M_PI) - RecoDecay::constrainAngle(B.phi(), -M_PI), -M_PI); + float dPhi = RecoDecay::constrainAngle(A.phi() - B.phi(), -M_PI); float dEta = A.eta() - B.eta(); return std::sqrt(dEta * dEta + dPhi * dPhi); @@ -150,7 +150,7 @@ float deltaR(T const& A, U const& B) template float deltaR(T const& eta1, U const& phi1, V const& eta2, W const& phi2) { - float dPhi = RecoDecay::constrainAngle(RecoDecay::constrainAngle(phi1, -M_PI) - RecoDecay::constrainAngle(phi2, -M_PI), -M_PI); + float dPhi = RecoDecay::constrainAngle(phi1 - phi2, -M_PI); float dEta = eta1 - eta2; return std::sqrt(dEta * dEta + dPhi * dPhi); diff --git a/PWGJE/Core/JetV0Utilities.h b/PWGJE/Core/JetV0Utilities.h index 9e25fb13461..3d12cd5d0a3 100644 --- a/PWGJE/Core/JetV0Utilities.h +++ b/PWGJE/Core/JetV0Utilities.h @@ -54,7 +54,7 @@ namespace jetv0utilities template constexpr bool isV0Candidate() { - return std::is_same_v, CandidatesV0Data::iterator> || std::is_same_v, CandidatesV0Data::filtered_iterator> || std::is_same_v, CandidatesV0MCD::iterator> || std::is_same_v, CandidatesV0MCD::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesV0Data::iterator> || std::is_same_v, o2::aod::CandidatesV0Data::filtered_iterator> || std::is_same_v, o2::aod::CandidatesV0MCD::iterator> || std::is_same_v, o2::aod::CandidatesV0MCD::filtered_iterator>; } /** @@ -63,7 +63,7 @@ constexpr bool isV0Candidate() template constexpr bool isV0McCandidate() { - return std::is_same_v, CandidatesV0MCP::iterator> || std::is_same_v, CandidatesV0MCP::filtered_iterator>; + return std::is_same_v, o2::aod::CandidatesV0MCP::iterator> || std::is_same_v, o2::aod::CandidatesV0MCP::filtered_iterator>; } /** @@ -82,7 +82,7 @@ constexpr bool isV0Table() template constexpr bool isV0McTable() { - return std::is_same_v, CandidatesV0MCP> || std::is_same_v, o2::soa::Filtered>; // note not optimal way but needed for jetfindingutilities::analyseParticles() + return std::is_same_v, o2::aod::CandidatesV0MCP> || std::is_same_v, o2::soa::Filtered>; // note not optimal way but needed for jetfindingutilities::analyseParticles() } /** diff --git a/PWGJE/DataModel/EMCALClusters.h b/PWGJE/DataModel/EMCALClusters.h index 0fbefea974f..60bb583cfca 100644 --- a/PWGJE/DataModel/EMCALClusters.h +++ b/PWGJE/DataModel/EMCALClusters.h @@ -27,35 +27,34 @@ 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 kV3NoSplit(ClusterAlgorithm_t::kV3, 0, 1, "kV3NoSplit", 0.5, 0.1, -10000, 10000, false, 0.); +const EMCALClusterDefinition kV3NoSplitLowSeed(ClusterAlgorithm_t::kV3, 1, 1, "kV3NoSplitLowSeed", 0.3, 0.1, -10000, 10000, false, 0.); +const EMCALClusterDefinition kV3NoSplitLowerSeed(ClusterAlgorithm_t::kV3, 2, 1, "kV3NoSplitLowerSeed", 0.2, 0.1, -10000, 10000, false, 0.); 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 kV3MostSplit(ClusterAlgorithm_t::kV3, 11, 1, "kV3MostSplit", 0.5, 0.1, -10000, 10000, true, 0.); +const EMCALClusterDefinition kV3LowSeed(ClusterAlgorithm_t::kV3, 12, 1, "kV3LowSeed", 0.3, 0.1, -10000, 10000, true, 0.03); +const EMCALClusterDefinition kV3MostSplitLowSeed(ClusterAlgorithm_t::kV3, 13, 1, "kV3MostSplitLowSeed", 0.3, 0.1, -10000, 10000, true, 0.); /// \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 { throw std::invalid_argument("Cluster definition name not recognized"); } diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index 33b8fdb4320..b3356fcc4a4 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -61,7 +61,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p [](float pt, float eta) -> float { return pt * std::cosh(eta); }); } // namespace jet -} // namespace o2::aod // Defines the jet table definition #define DECLARE_JET_TABLE(_collision_name_, _jet_type_, _name_, _description_) \ @@ -176,8 +175,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p DECLARE_JETMATCHING_TABLE(_jet_type_##EventWiseSubtracted, _jet_type_##_duplicatenumber_##EventWiseSubtracted, _shortname_ "JETEWS2" STRINGIFY(_duplicatenumber_)) \ DECLARE_JETMATCHING_TABLE(_jet_type__duplicatenumber_##EventWiseSubtracted, _jet_type_##EventWiseSubtracted, _shortname_ "JET" STRINGIFY(_duplicatenumber_) "2EWS") -namespace o2::aod -{ 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"); @@ -190,51 +187,61 @@ DECLARE_JET_TABLES_LEVELS(DielectronCharged, JTrackSub, Dielectrons, JDielectron // duplicate jet tables (added as needed for analyses) DECLARE_JET_DUPLICATE_TABLES_LEVELS(Charged, JTrackSub, HfD0Bases, HfD0PBases, "C", 1); -} // namespace o2::aod +#undef DECLARE_JET_TABLE +#undef DECLARE_CONSTITUENTS_TABLE +#undef DECLARE_JET_TABLES +#undef DECLARE_JETMATCHING_TABLE +#undef DECLARE_MCEVENTWEIGHT_TABLE +#undef DECLARE_JET_TABLES_LEVELS +#undef STRINGIFY +#undef DECLARE_JET_DUPLICATE_TABLES_LEVELS -using JetCollisions = o2::aod::JCollisions; +using JetCollisions = JCollisions; using JetCollision = JetCollisions::iterator; -using JetCollisionsMCD = o2::soa::Join; -using JetTracks = o2::aod::JTracks; -using JetTracksMCD = o2::soa::Join; -using JetTracksSub = o2::aod::JTrackSubs; -using JetClusters = o2::aod::JClusters; -using JetClustersMCD = o2::soa::Join; - -using JetMcCollisions = o2::aod::JMcCollisions; +using JetCollisionsMCD = o2::soa::Join; +using JetCollisionMCD = o2::soa::Join::iterator; +using JetTracks = JTracks; +using JetTracksMCD = o2::soa::Join; +using JetTracksSub = JTrackSubs; +using JetClusters = JClusters; +using JetClustersMCD = o2::soa::Join; + +using JetMcCollisions = JMcCollisions; using JetMcCollision = JetMcCollisions::iterator; -using JetParticles = o2::aod::JMcParticles; - -using CollisionsD0 = o2::soa::Join; -using CandidatesD0Data = o2::soa::Join; -using CandidatesD0MCD = o2::soa::Join; -using JetTracksSubD0 = o2::aod::JTrackD0Subs; -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 JetTracksSubLc = o2::aod::JTrackLcSubs; -using McCollisionsLc = o2::soa::Join; -using CandidatesLcMCP = o2::soa::Join; - -using CandidatesBplusData = o2::soa::Join; -using CandidatesBplusMCD = o2::soa::Join; -using JetTracksSubBplus = o2::aod::JTrackBplusSubs; -using CandidatesBplusMCP = o2::soa::Join; - -using CandidatesV0Data = o2::soa::Join; -using CandidatesV0MCD = o2::soa::Join; -// using V0Daughters = o2::aod::DauTrackExtras; -using McCollisionsV0 = o2::soa::Join; -using CandidatesV0MCP = o2::soa::Join; - -using CollisionsDielectron = o2::soa::Join; -using CandidatesDielectronData = o2::soa::Join; -using CandidatesDielectronMCD = o2::soa::Join; -using JetTracksSubDielectron = o2::aod::JTrackDielectronSubs; -using McCollisionsDielectron = o2::soa::Join; -using CandidatesDielectronMCP = o2::soa::Join; +using JetParticles = JMcParticles; + +using CollisionsD0 = o2::soa::Join; +using CandidatesD0Data = o2::soa::Join; +using CandidatesD0MCD = o2::soa::Join; +using JetTracksSubD0 = JTrackD0Subs; +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 JetTracksSubLc = JTrackLcSubs; +using McCollisionsLc = o2::soa::Join; +using CandidatesLcMCP = o2::soa::Join; + +using CandidatesBplusData = o2::soa::Join; +using CandidatesBplusMCD = o2::soa::Join; +using JetTracksSubBplus = JTrackBplusSubs; +using CandidatesBplusMCP = o2::soa::Join; + +using CandidatesV0Data = o2::soa::Join; +using CandidatesV0MCD = o2::soa::Join; +// using V0Daughters = DauTrackExtras; +using McCollisionsV0 = o2::soa::Join; +using CandidatesV0MCP = o2::soa::Join; + +using CollisionsDielectron = o2::soa::Join; +using CandidatesDielectronData = o2::soa::Join; +using CandidatesDielectronMCD = o2::soa::Join; +using JetTracksSubDielectron = JTrackDielectronSubs; +using McCollisionsDielectron = o2::soa::Join; +using CandidatesDielectronMCP = o2::soa::Join; + +} // namespace o2::aod #endif // PWGJE_DATAMODEL_JET_H_ 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..8641b3d612e 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_STAGED(JDielectronCollisionIds, "JDIELCOLLID", + jdielectronindices::JCollisionId); -DECLARE_SOA_TABLE(StoredJDielectronMcCollisionIds, "AOD1", "JDIELMCCOLLID", - jdielectronindices::JMcCollisionId, - o2::soa::Marker<1>); - -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 { diff --git a/PWGJE/DataModel/JetReducedDataHF.h b/PWGJE/DataModel/JetReducedDataHF.h index 13056e0f1fc..1c196c173d9 100644 --- a/PWGJE/DataModel/JetReducedDataHF.h +++ b/PWGJE/DataModel/JetReducedDataHF.h @@ -35,39 +35,20 @@ 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(JD0Ids, "AOD", "JD0ID", - jd0indices::JCollisionId, - jd0indices::Prong0Id, - jd0indices::Prong1Id); - -DECLARE_SOA_TABLE(StoredJD0Ids, "AOD1", "JD0ID", - jd0indices::JCollisionId, - jd0indices::Prong0Id, - jd0indices::Prong1Id, - 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_STAGED(JD0PIds, "JD0PID", + jd0indices::JMcCollisionId, + jd0indices::JMcParticleId); namespace jlcindices { @@ -79,41 +60,21 @@ 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(StoredJLcCollisionIds, "AOD1", "JLCCOLLID", - jlcindices::JCollisionId, - o2::soa::Marker<1>); - -DECLARE_SOA_TABLE(JLcMcCollisionIds, "AOD", "JLCMCCOLLID", - jlcindices::JMcCollisionId); - -DECLARE_SOA_TABLE(StoredJLcMcCollisionIds, "AOD1", "JLCMCCOLLID", - jlcindices::JMcCollisionId, - o2::soa::Marker<1>); - -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>); - -DECLARE_SOA_TABLE(JLcPIds, "AOD", "JLCPID", - jlcindices::JMcCollisionId, - jlcindices::JMcParticleId); - -DECLARE_SOA_TABLE(StoredJLcPIds, "AOD1", "JLCPID", - jlcindices::JMcCollisionId, - jlcindices::JMcParticleId, - o2::soa::Marker<1>); +DECLARE_SOA_TABLE_STAGED(JLcCollisionIds, "JLCCOLLID", + jlcindices::JCollisionId); + +DECLARE_SOA_TABLE_STAGED(JLcMcCollisionIds, "JLCMCCOLLID", + jlcindices::JMcCollisionId); + +DECLARE_SOA_TABLE_STAGED(JLcIds, "JLCID", + jlcindices::JCollisionId, + jlcindices::Prong0Id, + jlcindices::Prong1Id, + jlcindices::Prong2Id); + +DECLARE_SOA_TABLE_STAGED(JLcPIds, "JLCPID", + jlcindices::JMcCollisionId, + jlcindices::JMcParticleId); } // namespace o2::aod 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 51bbbe69f6b..2e5d03f46d0 100644 --- a/PWGJE/DataModel/JetSubstructure.h +++ b/PWGJE/DataModel/JetSubstructure.h @@ -32,6 +32,7 @@ namespace jetcollision DECLARE_SOA_COLUMN(PosZ, posZ, float); //! DECLARE_SOA_COLUMN(Centrality, centrality, float); //! DECLARE_SOA_COLUMN(EventSel, eventSel, uint8_t); //! +DECLARE_SOA_COLUMN(EventWeight, eventWeight, float); //! } // namespace jetcollision namespace jetsubstructure @@ -68,7 +69,7 @@ DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, int); //! DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_, dummy##_jet_type_, []() -> int { return 0; }); \ } \ \ - DECLARE_SOA_TABLE(_jet_type_##COs, "AOD", _jet_description_ "CO", jetcollision::PosZ, jetcollision::Centrality, jetcollision::EventSel, _name_##collisionoutput::Dummy##_jet_type_<>); \ + DECLARE_SOA_TABLE(_jet_type_##COs, "AOD", _jet_description_ "CO", jetcollision::PosZ, jetcollision::Centrality, jetcollision::EventSel, jetcollision::EventWeight, _name_##collisionoutput::Dummy##_jet_type_<>); \ using _jet_type_##CO = _jet_type_##COs::iterator; \ \ namespace _name_##jetoutput \ diff --git a/PWGJE/DataModel/JetTagging.h b/PWGJE/DataModel/JetTagging.h index 7229fabd6ce..cae674fd66f 100644 --- a/PWGJE/DataModel/JetTagging.h +++ b/PWGJE/DataModel/JetTagging.h @@ -52,6 +52,7 @@ DECLARE_SOA_COLUMN(Pz, pz, float); DECLARE_SOA_COLUMN(E, e, float); DECLARE_SOA_COLUMN(M, m, float); DECLARE_SOA_COLUMN(Chi2PCA, chi2PCA, float); +DECLARE_SOA_COLUMN(Dispersion, dispersion, float); DECLARE_SOA_COLUMN(ErrorDecayLength, errorDecayLength, float); DECLARE_SOA_COLUMN(ErrorDecayLengthXY, errorDecayLengthXY, float); DECLARE_SOA_DYNAMIC_COLUMN(RSecondaryVertex, rSecondaryVertex, [](float xVtxS, float yVtxS) -> float { return RecoDecay::sqrtSumOfSquares(xVtxS, yVtxS); }); @@ -89,6 +90,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(ImpactParameterXY, impactParameterXY, [](float xVtxP, SecondaryVertexParams::E, \ SecondaryVertexParams::M, \ SecondaryVertexParams::Chi2PCA, \ + SecondaryVertexParams::Dispersion, \ SecondaryVertexParams::ErrorDecayLength, \ SecondaryVertexParams::ErrorDecayLengthXY, \ SecondaryVertexParams::RSecondaryVertex, \ @@ -118,15 +120,17 @@ JETSV_TABLES_DEF(Charged, SecondaryVertex3Prong, "3PRONG"); JETSV_TABLES_DEF(Charged, SecondaryVertex2Prong, "2PRONG"); // Defines the jet substrcuture table definition -#define JETTAGGING_TABLE_DEF(_jet_type_, _name_, _description_) \ - namespace _name_##tagging \ - { \ - DECLARE_SOA_COLUMN(Origin, origin, int); \ - DECLARE_SOA_COLUMN(JetProb, jetProb, std::vector); \ - DECLARE_SOA_COLUMN(FlagtaggedjetIP, flagtaggedjetIP, bool); \ - DECLARE_SOA_COLUMN(FlagtaggedjetSV, flagtaggedjetSV, bool); \ - } \ - DECLARE_SOA_TABLE(_jet_type_##Tags, "AOD", _description_ "Tags", _name_##tagging::Origin, _name_##tagging::JetProb, _name_##tagging::FlagtaggedjetIP, _name_##tagging::FlagtaggedjetSV); +#define JETTAGGING_TABLE_DEF(_jet_type_, _name_, _description_) \ + namespace _name_##tagging \ + { \ + DECLARE_SOA_COLUMN(Origin, origin, int); \ + DECLARE_SOA_COLUMN(JetProb, jetProb, std::vector); \ + DECLARE_SOA_COLUMN(FlagtaggedjetIP, flagtaggedjetIP, bool); \ + DECLARE_SOA_COLUMN(FlagtaggedjetIPxyz, flagtaggedjetIPxyz, bool); \ + DECLARE_SOA_COLUMN(FlagtaggedjetSV, flagtaggedjetSV, bool); \ + DECLARE_SOA_COLUMN(FlagtaggedjetSVxyz, flagtaggedjetSVxyz, bool); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##Tags, "AOD", _description_ "Tags", _name_##tagging::Origin, _name_##tagging::JetProb, _name_##tagging::FlagtaggedjetIP, _name_##tagging::FlagtaggedjetIPxyz, _name_##tagging::FlagtaggedjetSV, _name_##tagging::FlagtaggedjetSVxyz); #define JETTAGGING_TABLES_DEF(_jet_type_, _description_) \ JETTAGGING_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_) \ diff --git a/PWGJE/JetFinders/jetfinder.cxx b/PWGJE/JetFinders/jetfinder.cxx index 3654e09ca20..61eb0fbacb4 100644 --- a/PWGJE/JetFinders/jetfinder.cxx +++ b/PWGJE/JetFinders/jetfinder.cxx @@ -129,9 +129,11 @@ struct JetFinderTask { double jetPtMinDouble = static_cast(jetPtMinInt); double jetPtMaxDouble = static_cast(jetPtMaxInt); - registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); - registry.add("hJetEWS", "sparse for data or mcd event-wise subtracted jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); - registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + if (fillTHnSparse) { + registry.add("hJet", "sparse for data or mcd jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJetEWS", "sparse for data or mcd event-wise subtracted jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + registry.add("hJetMCP", "sparse for mcp jets", {HistType::kTHnC, {{jetRadiiBins, ""}, {jetPtBinNumber, jetPtMinDouble, jetPtMaxDouble}, {40, -1.0, 1.0}, {18, 0.0, 7.0}}}); + } } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); @@ -142,82 +144,82 @@ struct JetFinderTask { 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)); - void processChargedJets(soa::Filtered::iterator const& collision, - soa::Filtered const& tracks) + void processChargedJets(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } inputParticles.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); - jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJet")), fillTHnSparse); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJet")) : std::shared_ptr(nullptr), fillTHnSparse); } PROCESS_SWITCH(JetFinderTask, processChargedJets, "Data and reco level jet finding for charged jets", false); - void processChargedEvtWiseSubJets(soa::Filtered::iterator const& collision, - soa::Filtered const& tracks) + void processChargedEvtWiseSubJets(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } inputParticles.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); - jetfindingutilities::findJets(jetFinder, inputParticles, jetEWSPtMin, jetEWSPtMax, jetRadius, jetAreaFractionMin, collision, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, registry.get(HIST("hJetEWS")), fillTHnSparse); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::findJets(jetFinder, inputParticles, jetEWSPtMin, jetEWSPtMax, jetRadius, jetAreaFractionMin, collision, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, fillTHnSparse ? registry.get(HIST("hJetEWS")) : std::shared_ptr(nullptr), fillTHnSparse); } PROCESS_SWITCH(JetFinderTask, processChargedEvtWiseSubJets, "Data and reco level jet finding for charged jets with event-wise constituent subtraction", false); - void processNeutralJets(soa::Filtered::iterator const& collision, - soa::Filtered const& clusters) + void processNeutralJets(soa::Filtered::iterator const& collision, + soa::Filtered const& clusters) { if ((doEMCALEventSelection && !jetderiveddatautilities::eventEMCAL(collision)) || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } inputParticles.clear(); jetfindingutilities::analyseClusters(inputParticles, &clusters); - jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJet")), fillTHnSparse); + jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJet")) : std::shared_ptr(nullptr), fillTHnSparse); } PROCESS_SWITCH(JetFinderTask, processNeutralJets, "Data and reco level jet finding for neutral jets", false); - void processFullJets(soa::Filtered::iterator const& collision, - soa::Filtered const& tracks, - soa::Filtered const& clusters) + void processFullJets(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks, + soa::Filtered const& clusters) { if ((doEMCALEventSelection && !jetderiveddatautilities::eventEMCAL(collision)) || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } inputParticles.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); jetfindingutilities::analyseClusters(inputParticles, &clusters); - jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJet")), fillTHnSparse); + jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, fillTHnSparse ? registry.get(HIST("hJet")) : std::shared_ptr(nullptr), fillTHnSparse); } PROCESS_SWITCH(JetFinderTask, processFullJets, "Data and reco level jet finding for full and neutral jets", false); - void processParticleLevelChargedJets(JetMcCollision const& collision, soa::Filtered const& particles) + void processParticleLevelChargedJets(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, registry.get(HIST("hJetMCP")), fillTHnSparse); + 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 processParticleLevelNeutralJets(JetMcCollision const& collision, soa::Filtered const& particles) + 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::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse); + 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); - void processParticleLevelFullJets(JetMcCollision const& collision, soa::Filtered const& particles) + void processParticleLevelFullJets(aod::JetMcCollision const& collision, soa::Filtered const& particles) { // TODO: MC event selection? inputParticles.clear(); - jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 0, particles, pdgDatabase); - jetfindingutilities::findJets(jetFinder, inputParticles, jetPtMin, jetPtMax, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse); + 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); } PROCESS_SWITCH(JetFinderTask, processParticleLevelFullJets, "Particle level full jet finding", false); diff --git a/PWGJE/JetFinders/jetfinderD0datacharged.cxx b/PWGJE/JetFinders/jetfinderD0datacharged.cxx index 7bdd6e87d9d..d26fb239ea3 100644 --- a/PWGJE/JetFinders/jetfinderD0datacharged.cxx +++ b/PWGJE/JetFinders/jetfinderD0datacharged.cxx @@ -15,7 +15,7 @@ #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 index 1471e00ffa3..afc97fad2b1 100644 --- a/PWGJE/JetFinders/jetfinderD0mcdcharged.cxx +++ b/PWGJE/JetFinders/jetfinderD0mcdcharged.cxx @@ -15,7 +15,7 @@ #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 index 27764256e04..a92690ebe2a 100644 --- a/PWGJE/JetFinders/jetfinderD0mcpcharged.cxx +++ b/PWGJE/JetFinders/jetfinderD0mcpcharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/JetFinders/jetfinderhf.cxx" -using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; +using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderDielectrondatacharged.cxx b/PWGJE/JetFinders/jetfinderDielectrondatacharged.cxx index 2e4e4070875..1703462a168 100644 --- a/PWGJE/JetFinders/jetfinderDielectrondatacharged.cxx +++ b/PWGJE/JetFinders/jetfinderDielectrondatacharged.cxx @@ -15,7 +15,7 @@ #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 index 69cca64919b..87b3a5b8013 100644 --- a/PWGJE/JetFinders/jetfinderDielectronmcdcharged.cxx +++ b/PWGJE/JetFinders/jetfinderDielectronmcdcharged.cxx @@ -15,7 +15,7 @@ #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 index 7a5da12fd87..b72e82ed53e 100644 --- a/PWGJE/JetFinders/jetfinderDielectronmcpcharged.cxx +++ b/PWGJE/JetFinders/jetfinderDielectronmcpcharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/JetFinders/jetfinderhf.cxx" -using JetFinderDielectronMCParticleLevelCharged = JetFinderHFTask; +using JetFinderDielectronMCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderLcdatacharged.cxx b/PWGJE/JetFinders/jetfinderLcdatacharged.cxx index 44af0addc98..bf522020db8 100644 --- a/PWGJE/JetFinders/jetfinderLcdatacharged.cxx +++ b/PWGJE/JetFinders/jetfinderLcdatacharged.cxx @@ -15,7 +15,7 @@ #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 index fa5e0aa2d86..410d51695b1 100644 --- a/PWGJE/JetFinders/jetfinderLcmcdcharged.cxx +++ b/PWGJE/JetFinders/jetfinderLcmcdcharged.cxx @@ -15,7 +15,7 @@ #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 index 4c018ce1cfe..9183edef828 100644 --- a/PWGJE/JetFinders/jetfinderLcmcpcharged.cxx +++ b/PWGJE/JetFinders/jetfinderLcmcpcharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/JetFinders/jetfinderhf.cxx" -using JetFinderLcMCParticleLevelCharged = JetFinderHFTask; +using JetFinderLcMCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderV0datacharged.cxx b/PWGJE/JetFinders/jetfinderV0datacharged.cxx index 671535d635f..b080f135c6b 100644 --- a/PWGJE/JetFinders/jetfinderV0datacharged.cxx +++ b/PWGJE/JetFinders/jetfinderV0datacharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/JetFinders/jetfinderv0.cxx" -using JetFinderV0DataCharged = JetFinderV0Task; +using JetFinderV0DataCharged = JetFinderV0Task; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderV0mcdcharged.cxx b/PWGJE/JetFinders/jetfinderV0mcdcharged.cxx index 6c06d061aed..b46ddeb1b28 100644 --- a/PWGJE/JetFinders/jetfinderV0mcdcharged.cxx +++ b/PWGJE/JetFinders/jetfinderV0mcdcharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/JetFinders/jetfinderv0.cxx" -using JetFinderV0MCDetectorLevelCharged = JetFinderV0Task; +using JetFinderV0MCDetectorLevelCharged = JetFinderV0Task; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderV0mcpcharged.cxx b/PWGJE/JetFinders/jetfinderV0mcpcharged.cxx index 53cc6f944f8..29f0fee1bd2 100644 --- a/PWGJE/JetFinders/jetfinderV0mcpcharged.cxx +++ b/PWGJE/JetFinders/jetfinderV0mcpcharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/JetFinders/jetfinderv0.cxx" -using JetFinderV0MCParticleLevelCharged = JetFinderV0Task; +using JetFinderV0MCParticleLevelCharged = JetFinderV0Task; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/JetFinders/jetfinderhf.cxx b/PWGJE/JetFinders/jetfinderhf.cxx index ac5a224676b..db62faee40d 100644 --- a/PWGJE/JetFinders/jetfinderhf.cxx +++ b/PWGJE/JetFinders/jetfinderhf.cxx @@ -221,12 +221,12 @@ struct JetFinderHFTask { jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse, true); } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetFinderHFTask, processDummy, "Dummy process function turned on by default", true); - void processChargedJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) + void processChargedJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) { for (typename CandidateTableData::iterator const& candidate : candidates) { // why can the type not be auto? try const auto analyseCharged(collision, tracks, candidate, jetsTable, constituentsTable, tracks, jetPtMin, jetPtMax); @@ -234,7 +234,7 @@ struct JetFinderHFTask { } PROCESS_SWITCH(JetFinderHFTask, processChargedJetsData, "charged hf jet finding on data", false); - void processChargedEvtWiseSubJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) + void processChargedEvtWiseSubJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) { for (typename CandidateTableData::iterator const& candidate : candidates) { analyseCharged(collision, jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perLcCandidate, perBplusCandidate, perDielectronCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks, jetEWSPtMin, jetEWSPtMax); @@ -242,7 +242,7 @@ struct JetFinderHFTask { } PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsData, "charged hf jet finding on data with event-wise constituent subtraction", false); - void processChargedJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) + void processChargedJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) { for (typename CandidateTableMCD::iterator const& candidate : candidates) { analyseCharged(collision, tracks, candidate, jetsTable, constituentsTable, tracks, jetPtMin, jetPtMax); @@ -250,7 +250,7 @@ struct JetFinderHFTask { } PROCESS_SWITCH(JetFinderHFTask, processChargedJetsMCD, "charged hf jet finding on MC detector level", false); - void processChargedEvtWiseSubJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) + void processChargedEvtWiseSubJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) { for (typename CandidateTableMCD::iterator const& candidate : candidates) { analyseCharged(collision, jetcandidateutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perLcCandidate, perBplusCandidate, perDielectronCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks, jetEWSPtMin, jetEWSPtMax); @@ -258,8 +258,8 @@ struct JetFinderHFTask { } PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsMCD, "charged hf jet finding on MC detector level with event-wise constituent subtraction", false); - void processChargedJetsMCP(JetMcCollision const& collision, - soa::Filtered const& particles, + void processChargedJetsMCP(aod::JetMcCollision const& collision, + soa::Filtered const& particles, CandidateTableMCP const& candidates) { for (typename CandidateTableMCP::iterator const& candidate : candidates) { diff --git a/PWGJE/JetFinders/jetfinderv0.cxx b/PWGJE/JetFinders/jetfinderv0.cxx index a83d06d9082..e36fb6235de 100644 --- a/PWGJE/JetFinders/jetfinderv0.cxx +++ b/PWGJE/JetFinders/jetfinderv0.cxx @@ -181,25 +181,25 @@ struct JetFinderV0Task { jetfindingutilities::findJets(jetFinder, inputParticles, minJetPt, maxJetPt, jetRadius, jetAreaFractionMin, collision, jetsTable, constituentsTable, registry.get(HIST("hJetMCP")), fillTHnSparse, true); } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetFinderV0Task, processDummy, "Dummy process function turned on by default", true); - void processChargedJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) + void processChargedJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) { analyseCharged(collision, tracks, candidates, jetsTable, constituentsTable, jetPtMin, jetPtMax); } PROCESS_SWITCH(JetFinderV0Task, processChargedJetsData, "charged hf jet finding on data", false); - void processChargedJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) + void processChargedJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) { analyseCharged(collision, tracks, candidates, jetsTable, constituentsTable, jetPtMin, jetPtMax); } PROCESS_SWITCH(JetFinderV0Task, processChargedJetsMCD, "charged hf jet finding on MC detector level", false); - void processChargedJetsMCP(JetMcCollision const& collision, - soa::Filtered const& particles, + void processChargedJetsMCP(aod::JetMcCollision const& collision, + soa::Filtered const& particles, CandidateTableMCP const& candidates) { analyseMCP(collision, particles, candidates, 1, jetPtMin, jetPtMax); diff --git a/PWGJE/TableProducer/emcalCorrectionTask.cxx b/PWGJE/TableProducer/emcalCorrectionTask.cxx index c0a63f1795a..968e7b86e8c 100644 --- a/PWGJE/TableProducer/emcalCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalCorrectionTask.cxx @@ -75,7 +75,6 @@ struct EmcalCorrectionTask { 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 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"}; @@ -88,6 +87,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 applyCellTimeShift{"applyCellTimeShift", 0, "apply shift to the cell time; 0 = off; 1 = const shift; 2 = eta-dependent shift"}; // Require EMCAL cells (CALO type 1) Filter emccellfilter = aod::calo::caloType == selectedCellType; @@ -109,6 +109,9 @@ struct EmcalCorrectionTask { // QA o2::framework::HistogramRegistry mHistManager{"EMCALCorrectionTaskQAHistograms"}; + // EMCal geometry + o2::emcal::Geometry* geometry; + void init(InitContext const&) { LOG(debug) << "Start init!"; @@ -125,7 +128,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"; } @@ -176,29 +179,32 @@ struct EmcalCorrectionTask { using o2HistType = o2::framework::HistType; using o2Axis = o2::framework::AxisSpec; o2Axis 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("hCellTowerID", "hCellTowerID", o2HistType::kTH1D, {{20000, 0, 20000}}); mHistManager.add("hCellEtaPhi", "hCellEtaPhi", o2HistType::kTH2F, {etaAxis, phiAxis}); // 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("hCellRowCol", "hCellRowCol;Column;Row", o2HistType::kTH2D, {{97, 0, 97}, {600, 0, 600}}); mHistManager.add("hClusterE", "hClusterE", o2HistType::kTH1F, {energyAxis}); 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::kTH1I, {{200, -0.5, 199.5, "N_{trk}"}}); - mHistManager.add("hCollisionType", "hCollisionType;;#it{count}", o2HistType::kTH1I, {{3, -0.5, 2.5}}); + 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::kTH1I, {{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"); @@ -258,7 +264,7 @@ struct EmcalCorrectionTask { } cellsBC.emplace_back(cell.cellNumber(), amplitude, - cell.time(), + cell.time() + getCellTimeShift(cell.cellNumber()), o2::emcal::intToChannelType(cell.cellType())); cellIndicesBC.emplace_back(cell.globalIndex()); } @@ -284,6 +290,7 @@ 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()}; @@ -376,7 +383,7 @@ struct EmcalCorrectionTask { } cellsBC.emplace_back(cell.cellNumber(), amplitude, - cell.time(), + cell.time() + getCellTimeShift(cell.cellNumber()), o2::emcal::intToChannelType(cell.cellType())); cellIndicesBC.emplace_back(cell.globalIndex()); cellLabels.emplace_back(cell.mcParticleIds(), cell.amplitudeA()); @@ -478,7 +485,7 @@ struct EmcalCorrectionTask { for (auto& cell : cellsInBC) { cellsBC.emplace_back(cell.cellNumber(), cell.amplitude(), - cell.time(), + cell.time() + getCellTimeShift(cell.cellNumber()), o2::emcal::intToChannelType(cell.cellType())); cellIndicesBC.emplace_back(cell.globalIndex()); } @@ -617,6 +624,7 @@ struct EmcalCorrectionTask { } // end of cells of cluser loop // fill histograms mHistManager.fill(HIST("hClusterE"), cluster.E()); + 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++) { @@ -669,7 +677,7 @@ struct EmcalCorrectionTask { clustercellsambiguous(clustersAmbiguous.lastIndex(), cellIndicesBC[cellindex]); } // end of cells of cluster loop - } // end of cluster loop + } // end of cluster loop } template @@ -719,18 +727,10 @@ struct EmcalCorrectionTask { 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())); - } + 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); @@ -789,6 +789,30 @@ struct EmcalCorrectionTask { return 1.f; } } + + // Apply shift of the cell time + // This has to be done to shift the cell time in MC (which is not calibrated to 0 due to the flight time of the particles to the EMCal surface (~15ns)) + float getCellTimeShift(const int16_t cellID) + { + if (isMC) { + if (applyCellTimeShift == 1) { // constant shift + LOG(debug) << "shift the cell time by 15ns"; + return -15.f; // roughly calculated by assuming particles travel with v=c (photons) and EMCal is 4.4m away from vertex + } else if (applyCellTimeShift == 2) { // 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 + float time = -sqrt(215.f + timeCol * timeCol); // 215 is 14.67ns^2 (time it takes to get the cell at eta = 0) + LOG(debug) << "shift the cell time by " << time << " applyCellTimeShift " << applyCellTimeShift; + return time; + } else { + return 0.f; + } + } else { // data + return 0.f; + } + } }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx index a749da6dcd3..396888fe1a7 100644 --- a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx +++ b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx @@ -84,12 +84,12 @@ struct eventWiseConstituentSubtractorTask { } } - void processCollisions(soa::Join::iterator const& collision, soa::Filtered const& tracks) + void processCollisions(soa::Join::iterator const& collision, soa::Filtered const& tracks) { inputParticles.clear(); tracksSubtracted.clear(); - jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, collision.rho(), collision.rhoM()); @@ -99,25 +99,25 @@ struct eventWiseConstituentSubtractorTask { } PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processCollisions, "Fill table of subtracted tracks for collisions", true); - void processD0Collisions(JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + 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 processLcCollisions(JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + 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(JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + 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 processDielectronCollisions(JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) + void processDielectronCollisions(aod::JetCollision const&, soa::Filtered const& tracks, soa::Join const& candidates) { analyseHF(tracks, candidates, trackSubtractedDielectronTable); } diff --git a/PWGJE/TableProducer/jetderiveddataproducer.cxx b/PWGJE/TableProducer/jetderiveddataproducer.cxx index 8c97f2b73bf..e0fcdc959ea 100644 --- a/PWGJE/TableProducer/jetderiveddataproducer.cxx +++ b/PWGJE/TableProducer/jetderiveddataproducer.cxx @@ -72,6 +72,7 @@ struct JetDerivedDataProducerTask { Produces jMcCollisionsParentIndexTable; Produces jTracksTable; Produces jTracksExtraTable; + Produces jTracksEMCalTable; Produces jTracksParentIndexTable; Produces jMcTracksLabelTable; Produces jMcParticlesTable; @@ -230,8 +231,8 @@ struct JetDerivedDataProducerTask { jTracksTable(track.collisionId(), track.pt(), track.eta(), track.phi(), jetderiveddatautilities::setTrackSelectionBit(track, track.dcaZ(), dcaZMax)); auto trackParCov = getTrackParCov(track); auto xyzTrack = trackParCov.getXYZGlo(); - float sigmaDCAXYZ; - float dcaXYZ = getDcaXYZ(track, &sigmaDCAXYZ); + float sigmaDCAXYZ2; + float dcaXYZ = getDcaXYZ(track, &sigmaDCAXYZ2); float dcaX = -99.0; float dcaY = -99.0; if (track.collisionId() >= 0) { @@ -240,7 +241,7 @@ struct JetDerivedDataProducerTask { dcaY = xyzTrack.Y() - collision.posY(); } - jTracksExtraTable(dcaX, dcaY, track.dcaZ(), track.dcaXY(), dcaXYZ, std::sqrt(track.sigmaDcaZ2()), std::sqrt(track.sigmaDcaXY2()), sigmaDCAXYZ, track.sigma1Pt()); // why is this getSigmaZY + jTracksExtraTable(dcaX, dcaY, track.dcaZ(), track.dcaXY(), dcaXYZ, std::sqrt(track.sigmaDcaZ2()), std::sqrt(track.sigmaDcaXY2()), std::sqrt(sigmaDCAXYZ2), track.sigma1Pt()); // why is this getSigmaZY jTracksParentIndexTable(track.globalIndex()); trackCollisionMapping[{track.globalIndex(), track.collisionId()}] = jTracksTable.lastIndex(); } @@ -257,9 +258,9 @@ struct JetDerivedDataProducerTask { jTracksTable(collision.globalIndex(), track.pt(), track.eta(), track.phi(), jetderiveddatautilities::setTrackSelectionBit(track, track.dcaZ(), dcaZMax)); jTracksParentIndexTable(track.globalIndex()); auto xyzTrack = trackParCov.getXYZGlo(); - float sigmaDCAXYZ; - float dcaXYZ = getDcaXYZ(track, &sigmaDCAXYZ); - jTracksExtraTable(xyzTrack.X() - collision.posX(), xyzTrack.Y() - collision.posY(), track.dcaZ(), track.dcaXY(), dcaXYZ, std::sqrt(track.sigmaDcaZ2()), std::sqrt(track.sigmaDcaXY2()), sigmaDCAXYZ, track.sigma1Pt()); // why is this getSigmaZY + float sigmaDCAXYZ2; + float dcaXYZ = getDcaXYZ(track, &sigmaDCAXYZ2); + jTracksExtraTable(xyzTrack.X() - collision.posX(), xyzTrack.Y() - collision.posY(), track.dcaZ(), track.dcaXY(), dcaXYZ, std::sqrt(track.sigmaDcaZ2()), std::sqrt(track.sigmaDcaXY2()), std::sqrt(sigmaDCAXYZ2), track.sigma1Pt()); // why is this getSigmaZY } else { auto bc = collision.bc_as>(); initCCDB(bc, runNumber, ccdb, doprocessCollisionsRun2 ? ccdbPathGrp : ccdbPathGrpMag, lut, doprocessCollisionsRun2); @@ -343,7 +344,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 +378,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); } diff --git a/PWGJE/TableProducer/jetderiveddatawriter.cxx b/PWGJE/TableProducer/jetderiveddatawriter.cxx index d8beca77b65..9b09530ce57 100644 --- a/PWGJE/TableProducer/jetderiveddatawriter.cxx +++ b/PWGJE/TableProducer/jetderiveddatawriter.cxx @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// \file jetderiveddatawriter.cxx -/// \brief Task to skim jet framework tables (JetCollisions, JetTracks, JetClusters, ...) +/// \brief Task to skim jet framework tables (aod::JetCollisions, aod::JetTracks, aod::JetClusters, ...) /// while adjusting indices accordingly /// /// \author Jochen Klein @@ -87,6 +87,7 @@ struct JetDerivedDataWriter { Produces storedJMcCollisionsParentIndexTable; Produces storedJTracksTable; Produces storedJTracksExtraTable; + Produces storedJTracksEMCalTable; Produces storedJTracksParentIndexTable; Produces storedJMcTracksLabelTable; Produces storedJMcParticlesTable; @@ -141,15 +142,16 @@ struct JetDerivedDataWriter { PresliceUnsorted> ParticlesPerMcCollision = aod::jmcparticle::mcCollisionId; Preslice> TracksPerCollision = aod::jtrack::collisionId; Preslice> ClustersPerCollision = aod::jcluster::collisionId; - Preslice> D0McCollisionsPerMcCollision = aod::jd0indices::mcCollisionId; - Preslice> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; - Preslice DielectronMcCollisionsPerMcCollision = aod::jdielectronindices::mcCollisionId; - Preslice D0CollisionsPerCollision = aod::jd0indices::collisionId; - Preslice LcCollisionsPerCollision = aod::jlcindices::collisionId; - Preslice DielectronCollisionsPerCollision = aod::jdielectronindices::collisionId; - Preslice D0sPerCollision = aod::jd0indices::collisionId; - Preslice LcsPerCollision = aod::jlcindices::collisionId; - Preslice DielectronsPerCollision = aod::jdielectronindices::collisionId; + Preslice> D0McCollisionsPerMcCollision = aod::jd0indices::mcCollisionId; + Preslice> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; + Preslice DielectronMcCollisionsPerMcCollision = aod::jdielectronindices::mcCollisionId; + Preslice D0CollisionsPerCollision = aod::jd0indices::collisionId; + Preslice LcCollisionsPerCollision = aod::jlcindices::collisionId; + Preslice DielectronCollisionsPerCollision = aod::jdielectronindices::collisionId; + Preslice D0sPerCollision = aod::jd0indices::collisionId; + Preslice LcsPerCollision = aod::jlcindices::collisionId; + Preslice DielectronsPerCollision = aod::jdielectronindices::collisionId; + Preslice EMCTrackPerTrack = aod::jemctrack::trackId; std::vector collisionFlag; std::vector McCollisionFlag; @@ -295,6 +297,11 @@ struct JetDerivedDataWriter { isTriggerObject = true; } } else { + if constexpr (std::is_same_v, aod::JTracks>) { + if (config.performTrackSelection && !(selectionObject.trackSel() & ~(1 << jetderiveddatautilities::JTrackSel::trackSign))) { + continue; + } + } if (selectionObject.pt() >= selectionObjectPtMin) { isTriggerObject = true; } @@ -356,7 +363,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, CollisionsD0 const& D0Collisions, CandidatesD0Data const& D0s, CollisionsLc const& LcCollisions, CandidatesLcData const& Lcs, CollisionsDielectron const& DielectronCollisions, 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::CollisionsDielectron const& DielectronCollisions, aod::CandidatesDielectronData const& Dielectrons) { std::map bcMapping; std::map trackMapping; @@ -410,6 +417,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); @@ -497,7 +507,7 @@ 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, CollisionsD0 const& D0Collisions, CandidatesD0MCD const& D0s, soa::Join const& D0McCollisions, CandidatesD0MCP const& D0Particles, CollisionsLc const& LcCollisions, CandidatesLcMCD const& Lcs, soa::Join const& LcMcCollisions, CandidatesLcMCP const& LcParticles, CollisionsDielectron const& DielectronCollisions, CandidatesDielectronMCD const& Dielectrons, McCollisionsDielectron const& DielectronMcCollisions, 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::CollisionsDielectron const& DielectronCollisions, aod::CandidatesDielectronMCD const& Dielectrons, aod::McCollisionsDielectron const& DielectronMcCollisions, aod::CandidatesDielectronMCP const& DielectronParticles) { std::map bcMapping; std::map paticleMapping; @@ -717,6 +727,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); @@ -826,7 +839,7 @@ struct JetDerivedDataWriter { const auto d0McCollisionsPerMcCollision = D0McCollisions.sliceBy(D0McCollisionsPerMcCollision, mcCollision.globalIndex()); for (const auto& d0McCollisionPerMcCollision : d0McCollisionsPerMcCollision) { // should just be one std::vector d0CollisionIDs; - for (auto const& d0CollisionPerMcCollision : d0McCollisionPerMcCollision.template hfCollBases_as()) { + for (auto const& d0CollisionPerMcCollision : d0McCollisionPerMcCollision.template hfCollBases_as()) { auto d0CollisionIndex = D0CollisionMapping.find(d0CollisionPerMcCollision.globalIndex()); if (d0CollisionIndex != D0CollisionMapping.end()) { d0CollisionIDs.push_back(d0CollisionIndex->second); @@ -840,7 +853,7 @@ struct JetDerivedDataWriter { const auto lcMcCollisionsPerMcCollision = LcMcCollisions.sliceBy(LcMcCollisionsPerMcCollision, mcCollision.globalIndex()); for (const auto& lcMcCollisionPerMcCollision : lcMcCollisionsPerMcCollision) { // should just be one std::vector lcCollisionIDs; - for (auto const& lcCollisionPerMcCollision : lcMcCollisionPerMcCollision.template hfCollBases_as()) { + for (auto const& lcCollisionPerMcCollision : lcMcCollisionPerMcCollision.template hfCollBases_as()) { auto lcCollisionIndex = LcCollisionMapping.find(lcCollisionPerMcCollision.globalIndex()); if (lcCollisionIndex != LcCollisionMapping.end()) { lcCollisionIDs.push_back(lcCollisionIndex->second); @@ -856,7 +869,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, McCollisionsD0 const& D0McCollisions, CandidatesD0MCP const& D0Particles, McCollisionsLc const& LcMcCollisions, CandidatesLcMCP const& LcParticles, McCollisionsDielectron const& DielectronMcCollisions, 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::McCollisionsDielectron const& DielectronMcCollisions, aod::CandidatesDielectronMCP const& DielectronParticles) { int particleTableIndex = 0; diff --git a/PWGJE/TableProducer/jeteventweightmcd.cxx b/PWGJE/TableProducer/jeteventweightmcd.cxx index 2525c9cc0ea..40ce7053b8a 100644 --- a/PWGJE/TableProducer/jeteventweightmcd.cxx +++ b/PWGJE/TableProducer/jeteventweightmcd.cxx @@ -32,21 +32,21 @@ struct JetEventWeightMCDTask { Produces mcDetectorLevelWeightsTable; Produces mcDetectorLevelEventWiseSubtractedWeightsTable; - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetEventWeightMCDTask, processDummy, "Dummy process", true); - void processMCDetectorLevelEventWeight(MCDetectorLevelJetTable const& jet, soa::Join const&, JetMcCollisions const&) + void processMCDetectorLevelEventWeight(MCDetectorLevelJetTable const& jet, soa::Join const&, aod::JetMcCollisions const&) { - auto collision = jet.template collision_as>(); + auto collision = jet.template collision_as>(); mcDetectorLevelWeightsTable(jet.globalIndex(), collision.mcCollision().weight()); } PROCESS_SWITCH(JetEventWeightMCDTask, processMCDetectorLevelEventWeight, "Fill event weight tables for detector level MC jets", false); - void processMCDetectorLevelEventWiseSubtractedEventWeight(MCDetectorLevelEventWiseSubtractedJetTable const& jet, soa::Join const&, JetMcCollisions const&) + void processMCDetectorLevelEventWiseSubtractedEventWeight(MCDetectorLevelEventWiseSubtractedJetTable const& jet, soa::Join const&, aod::JetMcCollisions const&) { - auto collision = jet.template collision_as>(); + auto collision = jet.template collision_as>(); mcDetectorLevelEventWiseSubtractedWeightsTable(jet.globalIndex(), collision.mcCollision().weight()); } PROCESS_SWITCH(JetEventWeightMCDTask, processMCDetectorLevelEventWiseSubtractedEventWeight, "Fill event weight tables for detector level MC jets", false); diff --git a/PWGJE/TableProducer/jeteventweightmcp.cxx b/PWGJE/TableProducer/jeteventweightmcp.cxx index 32083012d18..6a3a9742546 100644 --- a/PWGJE/TableProducer/jeteventweightmcp.cxx +++ b/PWGJE/TableProducer/jeteventweightmcp.cxx @@ -31,12 +31,12 @@ template mcParticleLevelWeightsTable; - void processDummy(JetMcCollisions const&) + void processDummy(aod::JetMcCollisions const&) { } PROCESS_SWITCH(JetEventWeightMCPTask, processDummy, "Dummy process", true); - void processMCParticleLevelEventWeight(MCParticleLevelJetTable const& jet, JetMcCollisions const&) + void processMCParticleLevelEventWeight(MCParticleLevelJetTable const& jet, aod::JetMcCollisions const&) { mcParticleLevelWeightsTable(jet.globalIndex(), jet.mcCollision().weight()); } diff --git a/PWGJE/TableProducer/jetmatchingduplicates.cxx b/PWGJE/TableProducer/jetmatchingduplicates.cxx index c56857475a8..3c6ef791d4f 100644 --- a/PWGJE/TableProducer/jetmatchingduplicates.cxx +++ b/PWGJE/TableProducer/jetmatchingduplicates.cxx @@ -53,12 +53,12 @@ struct JetMatchingDuplicates { { } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetMatchingDuplicates, processDummy, "Dummy process", true); - void processJets(JetCollisions const& collisions, + void processJets(aod::JetCollisions const& collisions, JetsBase const& jetsBase, JetsTag const& jetsTag, Tracks const& tracks, Candidates const& candidates) { diff --git a/PWGJE/TableProducer/jetmatchingmc.cxx b/PWGJE/TableProducer/jetmatchingmc.cxx index 434b93c3309..5ad292fcf8f 100644 --- a/PWGJE/TableProducer/jetmatchingmc.cxx +++ b/PWGJE/TableProducer/jetmatchingmc.cxx @@ -34,7 +34,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -template +template struct JetMatchingMc { Configurable doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"}; @@ -47,28 +47,28 @@ struct JetMatchingMc { Produces jetsTagtoBaseMatchingTable; // preslicing jet collections, only for Mc-based collection - static constexpr bool jetsBaseIsMc = o2::soa::relatedByIndex(); - static constexpr bool jetsTagIsMc = o2::soa::relatedByIndex(); + 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; + PresliceUnsorted CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; void init(InitContext const&) { } - void processDummy(JetMcCollisions const&) + void processDummy(aod::JetMcCollisions const&) { } PROCESS_SWITCH(JetMatchingMc, processDummy, "Dummy process", true); - void processJets(JetMcCollisions const& mcCollisions, JetCollisionsMCD const& collisions, + void processJets(aod::JetMcCollisions const& mcCollisions, aod::JetCollisionsMCD const& collisions, JetsBase const& jetsBase, JetsTag const& jetsTag, - JetTracksMCD const& tracks, - JetClustersMCD const& clusters, - JetParticles const& particles, + aod::JetTracksMCD const& tracks, + ClustersBase const& clusters, + aod::JetParticles const& particles, CandidatesBase const& candidatesBase, CandidatesTag const& candidatesTag) { @@ -111,50 +111,58 @@ using ChargedJetMatching = JetMatchingMc; + aod::JMcCollisions, + aod::JDummys>; using FullJetMatching = JetMatchingMc, soa::Join, aod::FullMCDetectorLevelJetsMatchedToFullMCParticleLevelJets, aod::FullMCParticleLevelJetsMatchedToFullMCDetectorLevelJets, aod::JCollisions, - aod::JMcCollisions>; + aod::JMcCollisions, + aod::JetClustersMCD>; using NeutralJetMatching = JetMatchingMc, soa::Join, aod::NeutralMCDetectorLevelJetsMatchedToNeutralMCParticleLevelJets, aod::NeutralMCParticleLevelJetsMatchedToNeutralMCDetectorLevelJets, aod::JCollisions, - aod::JMcCollisions>; + aod::JMcCollisions, + aod::JetClustersMCD>; using D0ChargedJetMatching = JetMatchingMc, soa::Join, aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCParticleLevelJets, aod::D0ChargedMCParticleLevelJetsMatchedToD0ChargedMCDetectorLevelJets, - CandidatesD0MCD, - CandidatesD0MCP>; + aod::CandidatesD0MCD, + aod::CandidatesD0MCP, + aod::JDummys>; using LcChargedJetMatching = JetMatchingMc, soa::Join, aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCParticleLevelJets, aod::LcChargedMCParticleLevelJetsMatchedToLcChargedMCDetectorLevelJets, - CandidatesLcMCD, - CandidatesLcMCP>; + aod::CandidatesLcMCD, + aod::CandidatesLcMCP, + aod::JDummys>; /*using BplusChargedJetMatching = JetMatchingMc, soa::Join, aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCParticleLevelJets, aod::BplusChargedMCParticleLevelJetsMatchedToBplusChargedMCDetectorLevelJets, - CandidatesBplusMCD, - CandidatesBplusMCP>;*/ + aod::CandidatesBplusMCD, + aod::CandidatesBplusMCP, + aod::JDummys>>;*/ using V0ChargedJetMatching = JetMatchingMc, soa::Join, aod::V0ChargedMCDetectorLevelJetsMatchedToV0ChargedMCParticleLevelJets, aod::V0ChargedMCParticleLevelJetsMatchedToV0ChargedMCDetectorLevelJets, - CandidatesV0MCD, - CandidatesV0MCP>; + aod::CandidatesV0MCD, + aod::CandidatesV0MCP, + aod::JDummys>; using DielectronChargedJetMatching = JetMatchingMc, soa::Join, aod::DielectronChargedMCDetectorLevelJetsMatchedToDielectronChargedMCParticleLevelJets, aod::DielectronChargedMCParticleLevelJetsMatchedToDielectronChargedMCDetectorLevelJets, - CandidatesDielectronMCD, - CandidatesDielectronMCP>; + aod::CandidatesDielectronMCD, + aod::CandidatesDielectronMCP, + aod::JDummys>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { std::vector tasks; diff --git a/PWGJE/TableProducer/jetmatchingmcsub.cxx b/PWGJE/TableProducer/jetmatchingmcsub.cxx index 81e2b6f41ce..819771a1088 100644 --- a/PWGJE/TableProducer/jetmatchingmcsub.cxx +++ b/PWGJE/TableProducer/jetmatchingmcsub.cxx @@ -53,15 +53,15 @@ struct JetMatchingMcSub { { } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetMatchingMcSub, processDummy, "Dummy process", true); - void processJets(JetCollisions const& collisions, + void processJets(aod::JetCollisions const& collisions, JetsBase const& jetsBase, JetsTag const& jetsTag, - JetTracks const& tracks, - JetTracksSub const& tracksSub, + aod::JetTracks const& tracks, + aod::JetTracksSub const& tracksSub, Candidates const& candidates) { @@ -103,22 +103,22 @@ using D0ChargedJetMatching = JetMatchingMcSub, aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCDetectorLevelEventWiseSubtractedJets, aod::D0ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToD0ChargedMCDetectorLevelJets, - CandidatesD0MCD>; + aod::CandidatesD0MCD>; using LcChargedJetMatching = JetMatchingMcSub, soa::Join, aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCDetectorLevelEventWiseSubtractedJets, aod::LcChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToLcChargedMCDetectorLevelJets, - CandidatesLcMCD>; + aod::CandidatesLcMCD>; /*using BplusChargedJetMatching = JetMatchingMcSub, soa::Join, aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCDetectorLevelEventWiseSubtractedJets, aod::BplusChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToBplusChargedMCDetectorLevelJets, - CandidatesBplusMCD>;*/ + aod::CandidatesBplusMCD>;*/ using DielectronChargedJetMatching = JetMatchingMcSub, soa::Join, aod::DielectronChargedMCDetectorLevelJetsMatchedToDielectronChargedMCDetectorLevelEventWiseSubtractedJets, aod::DielectronChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToDielectronChargedMCDetectorLevelJets, - CandidatesDielectronMCD>; + aod::CandidatesDielectronMCD>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/TableProducer/jetmatchingsub.cxx b/PWGJE/TableProducer/jetmatchingsub.cxx index 6a8b106d89a..de8fce87bbd 100644 --- a/PWGJE/TableProducer/jetmatchingsub.cxx +++ b/PWGJE/TableProducer/jetmatchingsub.cxx @@ -53,14 +53,14 @@ struct JetMatchingSub { { } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetMatchingSub, processDummy, "Dummy process", true); - void processJets(JetCollisions const& collisions, + void processJets(aod::JetCollisions const& collisions, JetsBase const& jetsBase, JetsTag const& jetsTag, - JetTracks const& tracks, TracksTag const& tracksSub, Candidates const& candidates) + aod::JetTracks const& tracks, TracksTag const& tracksSub, Candidates const& candidates) { // initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables @@ -103,25 +103,25 @@ using D0ChargedJetMatching = JetMatchingSub; + aod::CandidatesD0Data>; using LcChargedJetMatching = JetMatchingSub, soa::Join, aod::LcChargedJetsMatchedToLcChargedEventWiseSubtractedJets, aod::LcChargedEventWiseSubtractedJetsMatchedToLcChargedJets, aod::JTrackLcSubs, - CandidatesLcData>; + aod::CandidatesLcData>; /*using BplusChargedJetMatching = JetMatchingSub, soa::Join, aod::BplusChargedJetsMatchedToBplusChargedEventWiseSubtractedJets, aod::BplusChargedEventWiseSubtractedJetsMatchedToBplusChargedJets, aod::JTrackBplusSubs, - CandidatesBplusData>;*/ + aod::CandidatesBplusData>;*/ using DielectronChargedJetMatching = JetMatchingSub, soa::Join, aod::DielectronChargedJetsMatchedToDielectronChargedEventWiseSubtractedJets, aod::DielectronChargedEventWiseSubtractedJetsMatchedToDielectronChargedJets, aod::JTrackDielectronSubs, - CandidatesDielectronData>; + aod::CandidatesDielectronData>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { std::vector tasks; diff --git a/PWGJE/TableProducer/jettaggerhf.cxx b/PWGJE/TableProducer/jettaggerhf.cxx index 3d055f6901e..02c1f7aad8d 100644 --- a/PWGJE/TableProducer/jettaggerhf.cxx +++ b/PWGJE/TableProducer/jettaggerhf.cxx @@ -45,7 +45,11 @@ struct JetTaggerHFTask { Configurable trackDcaZMax{"trackDcaZMax", 2, "minimum DCA z acceptance for tracks [cm]"}; Configurable prongsigmaLxyMax{"prongsigmaLxyMax", 100, "maximum sigma of decay length of prongs on xy plane"}; Configurable prongsigmaLxyzMax{"prongsigmaLxyzMax", 100, "maximum sigma of decay length of prongs on xyz plane"}; - Configurable prongChi2PCAMax{"prongChi2PCAMax", 10, "maximum Chi2 PCA of decay length of prongs"}; + Configurable prongIPxyMin{"prongIPxyMin", 0.008, "maximum impact paramter of prongs on xy plane [cm]"}; + Configurable prongIPxyMax{"prongIpxyMax", 1, "minimum impact parmeter of prongs on xy plane [cm]"}; + Configurable prongChi2PCAMin{"prongChi2PCAMin", 4, "minimum Chi2 PCA of decay length of prongs"}; + Configurable prongChi2PCAMax{"prongChi2PCAMax", 100, "maximum Chi2 PCA of decay length of prongs"}; + Configurable svDispersionMax{"svDispersionMax", 1, "maximum dispersion of sv"}; // jet flavour definition Configurable maxDeltaR{"maxDeltaR", 0.25, "maximum distance of jet axis from flavour initiating parton"}; @@ -63,19 +67,19 @@ struct JetTaggerHFTask { Configurable> paramsResoFuncBeautyJetMC{"paramsResoFuncBeautyJetMC", std::vector{74901.583, -0.082, 0.874, 10.332, 0.941, 7.352, 0.097, 6.220, 0.022}, "parameters of gaus(0)+expo(3)+expo(5)+expo(7)))"}; Configurable> paramsResoFuncLfJetMC{"paramsResoFuncLfJetMC", std::vector{1539435.343, -0.061, 0.896, 13.272, 1.034, 5.884, 0.004, 7.843, 0.090}, "parameters of gaus(0)+expo(3)+expo(5)+expo(7)))"}; Configurable minSignImpXYSig{"minsIPs", -40.0, "minimum of signed impact parameter significance"}; + Configurable minIPCount{"minIPCount", 2, "Select at least N signed impact parameter significance in jets"}; // default 2 Configurable tagPointForIP{"tagPointForIP", 2.5, "tagging working point for IP"}; - Configurable minIPCount{"minSipCount", 2, "Select at least N signed impact parameter significance in jets"}; // default 2 + Configurable tagPointForIPxyz{"tagPointForIPxyz", 2.5, "tagging working point for IP xyz"}; // configuration about SV method - Configurable doSV{"doSV", false, "fill table for secondary vertex algorithm"}; - Configurable useXYZForTagging{"useXYZForTagging", false, "Enable tagging decision using full XYZ DCA for secondary vertex algorithm"}; - Configurable tagPointForSV{"tagPointForSV", 15, "tagging working point for SV"}; + Configurable tagPointForSV{"tagPointForSV", 40, "tagging working point for SV"}; + Configurable tagPointForSVxyz{"tagPointForSVxyz", 40, "tagging working point for SV xyz"}; // axis spec ConfigurableAxis binTrackProbability{"binTrackProbability", {100, 0.f, 1.f}, ""}; ConfigurableAxis binJetFlavour{"binJetFlavour", {6, -0.5, 5.5}, ""}; - using JetTagTracksData = soa::Join; - using JetTagTracksMCD = soa::Join; + using JetTagTracksData = soa::Join; + using JetTagTracksMCD = soa::Join; std::vector vecParamsData; std::vector vecParamsIncJetMC; @@ -193,15 +197,15 @@ struct JetTaggerHFTask { break; case 4: // TODO vecParamsData = (std::vector)paramsResoFuncData; - vecParamsCharmJetMC = {281446.003, -0.063, 0.894, 11.598, 0.943, 8.025, 0.130, 6.227, 0.027}; - vecParamsBeautyJetMC = {74839.065, -0.081, 0.875, 10.314, 0.939, 7.326, 0.101, 6.309, 0.024}; - vecParamsLfJetMC = {1531580.038, -0.062, -0.896, 13.267, 1.034, 5.866, 0.004, 7.836, 0.090}; - LOG(info) << "defined parameters of resolution function: PYTHIA8, JJ, LHC23d4"; + vecParamsCharmJetMC = {743719.121, -0.960, -0.240, 13.765, 1.314, 10.761, 0.293, 8.538, 0.052}; + vecParamsBeautyJetMC = {88888.418, 0.256, 1.003, 10.185, 0.740, 8.216, 0.147, 7.228, 0.040}; + vecParamsLfJetMC = {414860.372, -1.000, 0.285, 14.561, 1.464, 11.693, 0.339, 9.183, 0.052}; + LOG(info) << "defined parameters of resolution function: PYTHIA8, JJ, weighted, LHC24g4"; break; case 5: // TODO vecParamsData = (std::vector)paramsResoFuncData; - vecParamsIncJetMC = {1900387.527, -0.059, 0.895, 13.461, 1.004, 8.860, 0.098, 6.931, 0.011}; - LOG(info) << "defined parameters of resolution function: PYTHIA8, JJ, LHC23d4 & use inclusive distribution"; + vecParamsIncJetMC = {2211391.862, 0.360, 1.028, 13.019, 0.650, 11.151, 0.215, 9.462, 0.044}; + LOG(info) << "defined parameters of resolution function: PYTHIA8, JJ, weighted, LHC24g4 & use inclusive distribution"; useResoFuncFromIncJet = true; break; default: @@ -230,57 +234,65 @@ struct JetTaggerHFTask { } } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetTaggerHFTask, processDummy, "Dummy process", true); - void processData(JetCollision const& /*collision*/, JetTableData const& jets, JetTagTracksData const& jtracks) + void processData(aod::JetCollision const& /*collision*/, JetTableData const& jets, JetTagTracksData const& jtracks) { for (auto& jet : jets) { - bool flagtaggedjetIP = 0; - bool flagtaggedjetSV = 0; + bool flagtaggedjetIP = false; + bool flagtaggedjetIPxyz = false; + bool flagtaggedjetSV = false; + bool flagtaggedjetSVxyz = false; if (useJetProb) { calculateJetProbability(0, jet, jtracks, jetProb, false); if (trackProbQA) { evaluateTrackProbQA(0, jet, jtracks, false); } } - if (jettaggingutilities::isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount)) + if (jettaggingutilities::isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, false)) flagtaggedjetIP = true; - taggingTableData(0, jetProb, flagtaggedjetIP, flagtaggedjetSV); + if (jettaggingutilities::isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, true)) + flagtaggedjetIPxyz = true; + + taggingTableData(0, jetProb, flagtaggedjetIP, flagtaggedjetIPxyz, flagtaggedjetSV, flagtaggedjetSVxyz); } } PROCESS_SWITCH(JetTaggerHFTask, processData, "Fill tagging decision for data jets", false); - void processDataWithSV(JetCollision const& /*collision*/, soa::Join const& jets, JetTagTracksData const& jtracks, aod::DataSecondaryVertex3Prongs const& prongs) + void processDataWithSV(aod::JetCollision const& /*collision*/, soa::Join const& jets, JetTagTracksData const& jtracks, aod::DataSecondaryVertex3Prongs const& prongs) { for (auto& jet : jets) { - bool flagtaggedjetIP = 0; - bool flagtaggedjetSV = 0; + bool flagtaggedjetIP = false; + bool flagtaggedjetIPxyz = false; + bool flagtaggedjetSV = false; + bool flagtaggedjetSVxyz = false; if (useJetProb) { calculateJetProbability(0, jet, jtracks, jetProb, false); if (trackProbQA) { evaluateTrackProbQA(0, jet, jtracks, false); } } - if (jettaggingutilities::isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount)) + if (jettaggingutilities::isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, false)) flagtaggedjetIP = true; - if (!useXYZForTagging) { - flagtaggedjetSV = jettaggingutilities::isTaggedJetSV(jet, prongs, prongChi2PCAMax, prongsigmaLxyMax, useXYZForTagging, tagPointForSV); - } else { - flagtaggedjetSV = jettaggingutilities::isTaggedJetSV(jet, prongs, prongChi2PCAMax, prongsigmaLxyzMax, useXYZForTagging, tagPointForSV); - } - taggingTableData(0, jetProb, flagtaggedjetIP, flagtaggedjetSV); + if (jettaggingutilities::isGreaterThanTaggingPoint(jet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, true)) + flagtaggedjetIPxyz = true; + flagtaggedjetSV = jettaggingutilities::isTaggedJetSV(jet, prongs, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, svDispersionMax, false, tagPointForSV); + flagtaggedjetSVxyz = jettaggingutilities::isTaggedJetSV(jet, prongs, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, svDispersionMax, true, tagPointForSV); + taggingTableData(0, jetProb, flagtaggedjetIP, flagtaggedjetIPxyz, flagtaggedjetSV, flagtaggedjetSVxyz); } } PROCESS_SWITCH(JetTaggerHFTask, processDataWithSV, "Fill tagging decision for data jets", false); - void processMCD(JetCollision const& /*collision*/, JetTableMCD const& mcdjets, JetTagTracksMCD const& jtracks, JetParticles const& particles) + void processMCD(aod::JetCollision const& /*collision*/, JetTableMCD const& mcdjets, JetTagTracksMCD const& jtracks, aod::JetParticles const& particles) { for (auto& mcdjet : mcdjets) { - bool flagtaggedjetIP = 0; - bool flagtaggedjetSV = 0; + bool flagtaggedjetIP = false; + bool flagtaggedjetIPxyz = false; + bool flagtaggedjetSV = false; + bool flagtaggedjetSVxyz = false; typename JetTagTracksMCD::iterator hftrack; int origin = 0; if (removeGluonShower) @@ -293,18 +305,22 @@ struct JetTaggerHFTask { evaluateTrackProbQA(origin, mcdjet, jtracks); } } - if (jettaggingutilities::isGreaterThanTaggingPoint(mcdjet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount)) + if (jettaggingutilities::isGreaterThanTaggingPoint(mcdjet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, false)) flagtaggedjetIP = true; - taggingTableMCD(origin, jetProb, flagtaggedjetIP, flagtaggedjetSV); + if (jettaggingutilities::isGreaterThanTaggingPoint(mcdjet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, true)) + flagtaggedjetIPxyz = true; + taggingTableMCD(origin, jetProb, flagtaggedjetIP, flagtaggedjetIPxyz, flagtaggedjetSV, flagtaggedjetSVxyz); } } PROCESS_SWITCH(JetTaggerHFTask, processMCD, "Fill tagging decision for mcd jets", false); - void processMCDWithSV(JetCollision const& /*collision*/, soa::Join const& mcdjets, JetTagTracksMCD const& jtracks, aod::MCDSecondaryVertex3Prongs const& prongs, JetParticles const& particles) + void processMCDWithSV(aod::JetCollision const& /*collision*/, soa::Join const& mcdjets, JetTagTracksMCD const& jtracks, aod::MCDSecondaryVertex3Prongs const& prongs, aod::JetParticles const& particles) { for (auto& mcdjet : mcdjets) { - bool flagtaggedjetIP = 0; - bool flagtaggedjetSV = 0; + bool flagtaggedjetIP = false; + bool flagtaggedjetIPxyz = false; + bool flagtaggedjetSV = false; + bool flagtaggedjetSVxyz = false; typename JetTagTracksMCD::iterator hftrack; int origin = 0; if (removeGluonShower) @@ -317,24 +333,25 @@ struct JetTaggerHFTask { evaluateTrackProbQA(origin, mcdjet, jtracks); } } - if (jettaggingutilities::isGreaterThanTaggingPoint(mcdjet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount)) + if (jettaggingutilities::isGreaterThanTaggingPoint(mcdjet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, false)) flagtaggedjetIP = true; - if (!useXYZForTagging) { - flagtaggedjetSV = jettaggingutilities::isTaggedJetSV(mcdjet, prongs, prongChi2PCAMax, prongsigmaLxyMax, useXYZForTagging, tagPointForSV); - } else { - flagtaggedjetSV = jettaggingutilities::isTaggedJetSV(mcdjet, prongs, prongChi2PCAMax, prongsigmaLxyzMax, useXYZForTagging, tagPointForSV); - } - taggingTableMCD(origin, jetProb, flagtaggedjetIP, flagtaggedjetSV); + if (jettaggingutilities::isGreaterThanTaggingPoint(mcdjet, jtracks, trackDcaXYMax, trackDcaZMax, tagPointForIP, minIPCount, true)) + flagtaggedjetIPxyz = true; + flagtaggedjetSV = jettaggingutilities::isTaggedJetSV(mcdjet, prongs, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, svDispersionMax, false, tagPointForSV); + flagtaggedjetSVxyz = jettaggingutilities::isTaggedJetSV(mcdjet, prongs, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, svDispersionMax, true, tagPointForSV); + taggingTableMCD(origin, jetProb, flagtaggedjetIP, flagtaggedjetIPxyz, flagtaggedjetSV, flagtaggedjetSVxyz); } } PROCESS_SWITCH(JetTaggerHFTask, processMCDWithSV, "Fill tagging decision for mcd jets with sv", false); - void processMCP(JetMcCollision const& /*collision*/, JetTableMCP const& mcpjets, JetParticles const& particles) + void processMCP(aod::JetMcCollision const& /*collision*/, JetTableMCP const& mcpjets, aod::JetParticles const& particles) { for (auto& mcpjet : mcpjets) { - bool flagtaggedjetIP = 0; - bool flagtaggedjetSV = 0; - typename JetParticles::iterator hfparticle; + bool flagtaggedjetIP = false; + bool flagtaggedjetIPxyz = false; + bool flagtaggedjetSV = false; + bool flagtaggedjetSVxyz = false; + typename aod::JetParticles::iterator hfparticle; int origin = 0; // TODO if (removeGluonShower) { @@ -351,12 +368,12 @@ struct JetTaggerHFTask { jetProb.clear(); jetProb.reserve(maxOrder); jetProb.push_back(-1); - taggingTableMCP(origin, jetProb, flagtaggedjetIP, flagtaggedjetSV); + taggingTableMCP(origin, jetProb, flagtaggedjetIP, flagtaggedjetIPxyz, flagtaggedjetSV, flagtaggedjetSVxyz); } } PROCESS_SWITCH(JetTaggerHFTask, processMCP, "Fill tagging decision for mcp jets with sv", false); - void processTraining(JetCollision const& /*collision*/, JetTableMCD const& /*mcdjets*/, JetTagTracksMCD const& /*tracks*/) + void processTraining(aod::JetCollision const& /*collision*/, JetTableMCD const& /*mcdjets*/, JetTagTracksMCD const& /*tracks*/) { // To create table for ML } diff --git a/PWGJE/TableProducer/rhoEstimator.cxx b/PWGJE/TableProducer/rhoEstimator.cxx index 7a5be53476e..8f7bd8afc0e 100644 --- a/PWGJE/TableProducer/rhoEstimator.cxx +++ b/PWGJE/TableProducer/rhoEstimator.cxx @@ -71,16 +71,16 @@ 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); - void processChargedCollisions(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); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection, trackingEfficiency); auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); rhoChargedTable(rho, rhoM); } PROCESS_SWITCH(RhoEstimatorTask, processChargedCollisions, "Fill rho tables for collisions using charged tracks", true); - void processD0Collisions(JetCollision const&, soa::Filtered const& tracks, CandidatesD0Data const& candidates) + void processD0Collisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesD0Data const& candidates) { inputParticles.clear(); for (auto& candidate : candidates) { @@ -93,7 +93,7 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processD0Collisions, "Fill rho tables for collisions with D0 candidates", false); - void processLcCollisions(JetCollision const&, soa::Filtered const& tracks, CandidatesLcData const& candidates) + void processLcCollisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesLcData const& candidates) { inputParticles.clear(); for (auto& candidate : candidates) { @@ -106,7 +106,7 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processLcCollisions, "Fill rho tables for collisions with Lc candidates", false); - void processBplusCollisions(JetCollision const&, soa::Filtered const& tracks, CandidatesBplusData const& candidates) + void processBplusCollisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesBplusData const& candidates) { inputParticles.clear(); for (auto& candidate : candidates) { @@ -119,7 +119,7 @@ struct RhoEstimatorTask { } PROCESS_SWITCH(RhoEstimatorTask, processBplusCollisions, "Fill rho tables for collisions with Bplus candidates", false); - void processDielectronCollisions(JetCollision const&, soa::Filtered const& tracks, CandidatesDielectronData const& candidates) + void processDielectronCollisions(aod::JetCollision const&, soa::Filtered const& tracks, aod::CandidatesDielectronData const& candidates) { inputParticles.clear(); for (auto& candidate : candidates) { diff --git a/PWGJE/TableProducer/secondaryVertexReconstruction.cxx b/PWGJE/TableProducer/secondaryVertexReconstruction.cxx index 1474aafa873..5ed4799a80f 100644 --- a/PWGJE/TableProducer/secondaryVertexReconstruction.cxx +++ b/PWGJE/TableProducer/secondaryVertexReconstruction.cxx @@ -62,6 +62,8 @@ struct SecondaryVertexReconstruction { Configurable useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"}; Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; + Configurable maxRsv{"maxRsv", 999., "max. radius of the reconstruced SV"}; + Configurable maxZsv{"maxZsv", 999., "max. Z coordinates of the reconstruced SV"}; Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"}; Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations is chi2/chi2old > this"}; Configurable ptMinTrack{"ptMinTrack", -1., "min. track pT"}; @@ -94,6 +96,7 @@ struct SecondaryVertexReconstruction { registry.add("hFeNProngs", "n-prong Energy fraction carried by the SV from the jet;#it{f}_{E};nProngs;entries", {HistType::kTH2F, {{100, 0., 1.0}, nProngsBins}}); registry.add("hDcaXYNProngs", "DCAxy of n-prong candidate daughters;#it{p}_{T} (GeV/#it{c});#it{d}_{xy} (#mum);nProngs;entries", {HistType::kTH3F, {{100, 0., 20.}, {200, -500., 500.}, nProngsBins}}); registry.add("hDcaZNProngs", "DCAz of n-prong candidate daughters;#it{p}_{T} (GeV/#it{c});#it{d}_{z} (#mum);nProngs;entries", {HistType::kTH3F, {{100, 0., 20.}, {200, -500., 500.}, nProngsBins}}); + registry.add("hDispersion", "Vertex dispersion;#sigma_{vtx};nProngs;entries", {HistType::kTH2F, {{200, 0., 1.0}, nProngsBins}}); } df2.setPropagateToPCA(propagateToPCA); @@ -121,9 +124,9 @@ struct SecondaryVertexReconstruction { Filter trackCuts = (aod::jtrack::pt > ptMinTrack && aod::jtrack::eta > etaMinTrack && aod::jtrack::eta < etaMaxTrack); - using JetCollisionwPIs = soa::Join; - using JetTracksData = soa::Filtered>; - using JetTracksMCDwPIs = soa::Filtered>; + using JetCollisionwPIs = soa::Join; + using JetTracksData = soa::Filtered>; + using JetTracksMCDwPIs = soa::Filtered>; using OriginalTracks = soa::Join; template @@ -173,10 +176,26 @@ struct SecondaryVertexReconstruction { return; } - const auto& secondaryVertex = df.getPCACandidate(); + const auto& secondaryVertex = df.getPCACandidatePos(); + if (std::sqrt(secondaryVertex[0] * secondaryVertex[0] + secondaryVertex[1] * secondaryVertex[1]) > maxRsv || std::abs(secondaryVertex[2]) > maxZsv) { + return; + } + + float dispersion = 0.; + for (unsigned int inum = 0; inum < numProngs; ++inum) { + o2::dataformats::VertexBase sv(o2::math_utils::Point3D{secondaryVertex[0], secondaryVertex[1], secondaryVertex[2]}, std::array{0}); + o2::dataformats::DCA dcaSV; + auto& prong = df.getTrack(inum); + prong.propagateToDCA(sv, bz, &dcaSV); + dispersion += (dcaSV.getY() * dcaSV.getY() + dcaSV.getZ() * dcaSV.getZ()); + } + dispersion = std::sqrt(dispersion / numProngs); + auto chi2PCA = df.getChi2AtPCACandidate(); auto covMatrixPCA = df.calcPCACovMatrixFlat(); + registry.fill(HIST("hDispersion"), dispersion, numProngs); + // get track impact parameters // This modifies track momenta! auto primaryVertex = getPrimaryVertex(collision); @@ -215,7 +234,7 @@ struct SecondaryVertexReconstruction { arrayMomenta[0][0] + arrayMomenta[1][0] + arrayMomenta[2][0], arrayMomenta[0][1] + arrayMomenta[1][1] + arrayMomenta[2][1], arrayMomenta[0][2] + arrayMomenta[1][2] + arrayMomenta[2][2], - energySV, massSV, chi2PCA, errorDecayLength, errorDecayLengthXY); + energySV, massSV, chi2PCA, dispersion, errorDecayLength, errorDecayLengthXY); svIndices.push_back(sv3prongTableData.lastIndex()); } else if ((doprocessData2Prongs || doprocessData2ProngsExternalMagneticField) && numProngs == 2) { sv2prongTableData(analysisJet.globalIndex(), @@ -224,7 +243,7 @@ struct SecondaryVertexReconstruction { arrayMomenta[0][0] + arrayMomenta[1][0], arrayMomenta[0][1] + arrayMomenta[1][1], arrayMomenta[0][2] + arrayMomenta[1][2], - energySV, massSV, chi2PCA, errorDecayLength, errorDecayLengthXY); + energySV, massSV, chi2PCA, dispersion, errorDecayLength, errorDecayLengthXY); svIndices.push_back(sv2prongTableData.lastIndex()); } else if ((doprocessMCD3Prongs || doprocessMCD3ProngsExternalMagneticField) && numProngs == 3) { sv3prongTableMCD(analysisJet.globalIndex(), @@ -233,7 +252,7 @@ struct SecondaryVertexReconstruction { arrayMomenta[0][0] + arrayMomenta[1][0] + arrayMomenta[2][0], arrayMomenta[0][1] + arrayMomenta[1][1] + arrayMomenta[2][1], arrayMomenta[0][2] + arrayMomenta[1][2] + arrayMomenta[2][2], - energySV, massSV, chi2PCA, errorDecayLength, errorDecayLengthXY); + energySV, massSV, chi2PCA, dispersion, errorDecayLength, errorDecayLengthXY); svIndices.push_back(sv3prongTableMCD.lastIndex()); } else if ((doprocessMCD2Prongs || doprocessMCD2ProngsExternalMagneticField) && numProngs == 2) { sv2prongTableMCD(analysisJet.globalIndex(), @@ -242,7 +261,7 @@ struct SecondaryVertexReconstruction { arrayMomenta[0][0] + arrayMomenta[1][0], arrayMomenta[0][1] + arrayMomenta[1][1], arrayMomenta[0][2] + arrayMomenta[1][2], - energySV, massSV, chi2PCA, errorDecayLength, errorDecayLengthXY); + energySV, massSV, chi2PCA, dispersion, errorDecayLength, errorDecayLengthXY); svIndices.push_back(sv2prongTableMCD.lastIndex()); } else { LOG(error) << "No process specified\n"; diff --git a/PWGJE/Tasks/CMakeLists.txt b/PWGJE/Tasks/CMakeLists.txt index a9ac88c8f28..32f029a3b27 100644 --- a/PWGJE/Tasks/CMakeLists.txt +++ b/PWGJE/Tasks/CMakeLists.txt @@ -68,10 +68,18 @@ if(FastJet_FOUND) SOURCES v0jetspectra.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-v0qa + 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 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-hf-qa SOURCES jetfinderhfQA.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -176,5 +184,9 @@ if(FastJet_FOUND) SOURCES bjetTaggingML.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-spectra-ese + SOURCES jetSpectraEseTask.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) endif() diff --git a/PWGJE/Tasks/ChJetTriggerQATask.cxx b/PWGJE/Tasks/ChJetTriggerQATask.cxx index 8a7d95e7907..19e4df451ff 100644 --- a/PWGJE/Tasks/ChJetTriggerQATask.cxx +++ b/PWGJE/Tasks/ChJetTriggerQATask.cxx @@ -44,11 +44,16 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using filteredColl = soa::Filtered>::iterator; +using filteredColl = soa::Filtered>::iterator; using filteredJTracks = soa::Filtered>; using filteredJets = soa::Filtered>; using joinedTracks = soa::Join; +float DcaXYPtCut(float tracPt) +{ + return 0.0105f + 0.0350f / pow(tracPt, 1.1f); +} + // What this task should do // Event by event fill // 1) pT spectrum of tracks in TPC volume @@ -78,9 +83,11 @@ struct ChJetTriggerQATask { Configurable bAddSupplementHistosToOutput{"bAddAdditionalHistosToOutput", false, "add supplementary histos to the output"}; Configurable phiAngleRestriction{"phiAngleRestriction", 0.3, "angle to restrict track phi for plotting tpc momentum"}; + Configurable dcaXY_multFact{"dcaXY_multFact", 3., "mult factor to relax pT dependent dcaXY cut for quality tracks"}; + Configurable dcaZ_cut{"dcaZ_cut", 3., "cut on dcaZ for quality tracks"}; ConfigurableAxis dcaXY_Binning{"dcaXY_Binning", {100, -5., 5.}, ""}; - ConfigurableAxis dcaZ_Binning{"dcaZ_Binning", {100, -5., 5.}, ""}; + ConfigurableAxis dcaZ_Binning{"dcaZ_Binning", {100, -3., 3.}, ""}; float fiducialVolume; // 0.9 - jetR @@ -116,10 +123,11 @@ struct ChJetTriggerQATask { spectra.add("globalP_tpcglobalPDiff_phirestrict", "difference of global and TPC inner momentum vs global momentum with selection applied restricted phi", {HistType::kTH2F, {{100, 0., +100.}, {200, -100., +100.}}}); spectra.add("global1overP_tpcglobalPDiff_phirestrict", "difference of 1/p global and TPC inner momentum vs global momentum with selection applied restricted phi", {HistType::kTH2F, {{100, 0., +100.}, {500, -8., +8.}}}); - spectra.add("DCAx_track_Phi_pT", "track DCAx vs phi & pT of global tracks w. nITSClusters #ge 4", kTH3F, {dcaXY_Binning, {60, 0., TMath::TwoPi()}, {100, 0., 100.}}); - spectra.add("DCAy_track_Phi_pT", "track DCAy vs phi & pT of global tracks w. nITSClusters #ge 4", kTH3F, {dcaXY_Binning, {60, 0., TMath::TwoPi()}, {100, 0., 100.}}); - spectra.add("DCAz_track_Phi_pT", "track DCAz vs phi & pT of global tracks w. nITSClusters #ge 4", kTH3F, {dcaZ_Binning, {60, 0., TMath::TwoPi()}, {100, 0., 100.}}); - spectra.add("nITSClusters_TrackPt", "Number of ITS hits vs phi & pT of global tracks", kTH3F, {{7, 1., 8.}, {60, 0., TMath::TwoPi()}, {100, 0., 100.}}); + spectra.add("DCAxy_track_Phi_pT", "track DCAxy vs phi & pT of tracks w. nITSClusters #geq 4", kTH3F, {dcaXY_Binning, {60, 0., TMath::TwoPi()}, {100, 0., 100.}}); + spectra.add("DCAz_track_Phi_pT", "track DCAz vs phi & pT of tracks w. nITSClusters #geq 4", kTH3F, {dcaZ_Binning, {60, 0., TMath::TwoPi()}, {100, 0., 100.}}); + 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()}}}); // Supplementary plots if (bAddSupplementHistosToOutput) { @@ -192,13 +200,17 @@ struct ChJetTriggerQATask { spectra.fill(HIST("globalP_tpcglobalPDiff_withoutcuts_phirestrict"), track.p(), track.p() - originalTrack.tpcInnerParam()); } + spectra.fill(HIST("ptphiAllTracks"), track.pt(), track.phi()); + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } - if (originalTrack.itsNCls() >= 4) { // correspond to number of track hits in ITS layers - spectra.fill(HIST("DCAx_track_Phi_pT"), track.dcaX(), track.phi(), track.pt()); - spectra.fill(HIST("DCAy_track_Phi_pT"), track.dcaY(), track.phi(), track.pt()); + spectra.fill(HIST("ptphiQualityTracks"), track.pt(), track.phi()); + + bool bDcaCondition = (fabs(track.dcaZ()) < dcaZ_cut) && (fabs(track.dcaXY()) < dcaXY_multFact * DcaXYPtCut(track.pt())); + if (originalTrack.itsNCls() >= 4 && bDcaCondition) { // correspond to number of track hits in ITS layers + spectra.fill(HIST("DCAxy_track_Phi_pT"), track.dcaXY(), track.phi(), track.pt()); spectra.fill(HIST("DCAz_track_Phi_pT"), track.dcaZ(), track.phi(), track.pt()); } diff --git a/PWGJE/Tasks/FullJetTriggerQATask.cxx b/PWGJE/Tasks/FullJetTriggerQATask.cxx index 6b47c2b5c7e..99b76fcedb9 100644 --- a/PWGJE/Tasks/FullJetTriggerQATask.cxx +++ b/PWGJE/Tasks/FullJetTriggerQATask.cxx @@ -38,7 +38,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct JetTriggerQA { - using selectedClusters = o2::soa::Filtered; + using selectedClusters = o2::soa::Filtered; using fullJetInfos = soa::Join; using neutralJetInfos = soa::Join; using collisionWithTrigger = soa::Join::iterator; @@ -544,7 +544,7 @@ struct JetTriggerQA { } template - std::pair, std::vector> fillJetQA(const JetCollection& jets, JetTracks const& /*tracks*/, selectedClusters const& /*clusters*/, std::bitset /*hwtrg*/, const std::bitset& triggerstatus) + std::pair, std::vector> fillJetQA(const JetCollection& jets, aod::JetTracks const& /*tracks*/, selectedClusters const& /*clusters*/, std::bitset /*hwtrg*/, const std::bitset& triggerstatus) { auto isTrigger = [&triggerstatus](TriggerType_t triggertype) -> bool { return triggerstatus.test(triggertype); @@ -568,7 +568,7 @@ struct JetTriggerQA { // This gives us access to all jet substructure information // auto tracksInJet = jetTrackConstituents.sliceBy(perJetTrackConstituents, jet.globalIndex()); // for (const auto& trackList : tracksInJet) { - for (auto& track : jet.template tracks_as()) { + for (auto& track : jet.template tracks_as()) { auto trackPt = track.pt(); auto chargeFrag = track.px() * jet.px() + track.py() * jet.py() + track.pz() * jet.pz(); chargeFrag /= (jet.p() * jet.p()); @@ -647,12 +647,12 @@ struct JetTriggerQA { return std::make_pair(vecMaxJet, vecMaxJetNoFiducial); } - using JetCollisionsTable = soa::Join; + using JetCollisionsTable = soa::Join; template void runQA(collisionWithTrigger const& collision, JetCollection const& jets, - JetTracks const& tracks, + aod::JetTracks const& tracks, selectedClusters const& clusters) { std::bitset triggerstatus; @@ -826,7 +826,7 @@ struct JetTriggerQA { void processFullJets(collisionWithTrigger const& collision, fullJetInfos const& jets, - JetTracks const& tracks, + aod::JetTracks const& tracks, selectedClusters const& clusters) { runQA(collision, jets, tracks, clusters); @@ -835,7 +835,7 @@ struct JetTriggerQA { void processNeutralJets(collisionWithTrigger const& collision, neutralJetInfos const& jets, - JetTracks const& tracks, + aod::JetTracks const& tracks, selectedClusters const& clusters) { runQA(collision, jets, tracks, clusters); diff --git a/PWGJE/Tasks/PhotonIsolationQA.cxx b/PWGJE/Tasks/PhotonIsolationQA.cxx index e25d9e11094..2d21b63d508 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" @@ -38,7 +40,6 @@ #include "DataFormatsEMCAL/Cell.h" #include "DataFormatsEMCAL/Constants.h" #include "DataFormatsEMCAL/AnalysisCluster.h" - #include "CommonDataFormat/InteractionRecord.h" // \struct PhotonIsolationQA @@ -56,8 +57,7 @@ using namespace o2::framework::expressions; using myGlobTracks = o2::soa::Join; using collisionEvSelIt = o2::soa::Join; -using mcCells = o2::soa::Join; -using filteredMCCells = o2::soa::Filtered; +using collisionEvSelItMC = o2::aod::McCollisions; using MCClusters = o2::soa::Join; struct PhotonIsolationQA { @@ -67,6 +67,8 @@ struct PhotonIsolationQA { using o2HistType = HistType; using o2Axis = AxisSpec; + o2::emcal::Geometry* mGeometry = nullptr; + Configurable maxPosZ{"maxPosZ", 10.0f, "maximum z position of collision in cm"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; @@ -78,16 +80,26 @@ struct PhotonIsolationQA { Configurable maxNLM{"maxNLM", 2, "Maximal amount of local maxima per cluster"}; 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; // mc emcal cell + 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; + Preslice CellsPerCluster = aod::emcalclustercell::emcalclusterId; int eventSelection = -1; int trackSelection = -1; @@ -96,6 +108,9 @@ struct PhotonIsolationQA { eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + mGeometry = o2::emcal::Geometry::GetInstanceFromRunNumber(300000); + auto nCells = mGeometry->GetNCells(); + const o2Axis PosZ_Axis{100, -15, 15, "Z Positions (cm)"}; const o2Axis Num_Cluster_Axis{10, 0, 10, "N Clusters"}; const o2Axis Shower_Shape_Long_Axis{100, 0, 4, "#sigma^{2}_{long}"}; @@ -104,64 +119,72 @@ struct PhotonIsolationQA { const o2Axis Eta_Axis{100, -0.9, 0.9, "#eta"}; const o2Axis Energy_Axis{100, 0, 100, "E (GeV/c)"}; const o2Axis NCells_Axis{50, 0, 50, "N Cells"}; - const o2Axis Pt_Axis{100, 0, 100, "P_{T} (GeV/c)"}; - const o2Axis P_Axis{100, 0, 100, "P (GeV/c)"}; - const o2Axis RatioP_Axis{50, 0, 10, "E/P"}; - const o2Axis Num_Track_Axis{20, 0, 20, "N Tracks"}; + const o2Axis Num_Track_Axis{20, -0.5, 19.5, "N Tracks"}; const o2Axis PtIso_Axis{100, -10, 15, "P_{T, Iso} (GeV/c)"}; - const o2Axis Rho_Axis{100, 0, 100, "#rho (#frac{GeV/c}{A})"}; + const o2Axis Rho_Axis{200, 0, 200, "#rho (#frac{GeV/c}{A})"}; const o2Axis ABCD_Axis{5, 0, 5, "ABCD"}; - const o2Axis NLM_Axis{3, 0, 3, "NLM"}; - const o2Axis Fraction_Axis{50, 0, 2}; + const o2Axis NLM_Axis{50, -0.5, 49.5, "NLM"}; + const o2Axis PDG_Axis{20000, -10000.5, 9999.5, "PDG Code"}; + const o2Axis Status_Code_Axis{400, -200.5, 199.5, "Status Code"}; + const o2Axis BC_Axis{100, -0.5, 99.5, "Col per BC"}; + const o2Axis CellNumber_Axis{nCells, -0.5, nCells - 0.5, "Cell Number"}; + const o2Axis SM_Flag_Axis{2, -0.5, 1.5}; Data_Info.add("hPosZ", "Z Position of collision", o2HistType::kTH1F, {PosZ_Axis}); Data_Info.add("hNumClusters", "Number of cluster per collision", o2HistType::kTH1F, {Num_Cluster_Axis}); Data_Info.add("hClusterLocation", "Location of shower in eta phi plane", o2HistType::kTH2F, {{Eta_Axis}, {Phi_Axis}}); - Data_Info.add("hEnergy", "Energy of the cluster", o2HistType::kTH1F, {Energy_Axis}); Data_Info.add("hEnergy_ShowerShapeLong", "Energy vs Shower shape long axis", o2HistType::kTH2F, {{Energy_Axis}, {Shower_Shape_Long_Axis}}); Data_Info.add("hEnergy_ShowerShapeShort", "Energy vs Shower shape short axis", o2HistType::kTH2F, {{Energy_Axis}, {Shower_Shape_Short_Axis}}); - Data_Info.add("hEnergy_m02_m20", "Energy cluster Vs m02 vs m20", o2HistType::kTHnSparseL, {{Energy_Axis}, {Shower_Shape_Long_Axis}, {Shower_Shape_Short_Axis}}); + Data_Info.add("hEnergy_m02_m20", "Energy cluster Vs m02 vs m20", o2HistType::kTH3F, {{Energy_Axis}, {Shower_Shape_Long_Axis}, {Shower_Shape_Short_Axis}}); Data_Info.add("hEnergy_NCells", "Energy vs Number of cells in cluster", o2HistType::kTH2F, {{Energy_Axis}, {NCells_Axis}}); - Data_Info.add("hEvsNumTracks", "Energy of cluster vs matched tracks", o2HistType::kTH2F, {{Energy_Axis}, {Num_Track_Axis}}); - Data_Info.add("hTrackPt", "Pt of matched track", o2HistType::kTH1F, {Pt_Axis}); - Data_Info.add("hTrackEta", "Eta of matched track", o2HistType::kTH1F, {Eta_Axis}); - Data_Info.add("hTrackPhi", "Phi of matched track", o2HistType::kTH1F, {Phi_Axis}); - Data_Info.add("hRatioClusterETrackP", "Ratio between energy of cluster and P of tracks", o2HistType::kTH1F, {RatioP_Axis}); - Data_Info.add("hRatioClusterETrackPrackPt", "Ratio between E and P vs Pt of matched tracks", o2HistType::kTH2F, {{RatioP_Axis}, {Pt_Axis}}); Data_Info.add("hEvsPtIso", "Pt_Iso", o2HistType::kTH2F, {{Energy_Axis}, {PtIso_Axis}}); - Data_Info.add("hRho_Perpen_Cone", "Density of perpendicular cone", o2HistType::kTH1F, {Rho_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("hABCDControlRegion", "Yield Control Regions", o2HistType::kTH2F, {{ABCD_Axis}, {Energy_Axis}}); - Data_Info.add("hE_M02_M20_NLM_NCells_PtIso", "Energy vs M02 vs M20 vs NLM vs NCells vs PtIso", o2HistType::kTHnSparseL, {{Energy_Axis}, {Shower_Shape_Long_Axis}, {Shower_Shape_Short_Axis}, {NLM_Axis}, {NCells_Axis}, {PtIso_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", "Energy of the cluster", o2HistType::kTH1F, {Energy_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.add("hEnergy_m02_m20", "Energy cluster Vs m02 vs m20", o2HistType::kTHnSparseL, {{Energy_Axis}, {Shower_Shape_Long_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.add("hTrackPt", "Pt of matched track", o2HistType::kTH1F, {Pt_Axis}); - MC_Info.add("hTrackEta", "Eta of matched track", o2HistType::kTH1F, {Eta_Axis}); - MC_Info.add("hTrackPhi", "Phi of matched track", o2HistType::kTH1F, {Phi_Axis}); - MC_Info.add("hRatioClusterETrackP", "Ratio between energy of cluster and P of tracks", o2HistType::kTH1F, {RatioP_Axis}); - MC_Info.add("hRatioClusterETrackPrackPt", "Ratio between E and P vs Pt of matched tracks", o2HistType::kTH2F, {{RatioP_Axis}, {Pt_Axis}}); - MC_Info.add("hE_M02_M20_NLM_NCells_PtIso", "Energy vs M02 vs M20 vs NLM vs NCells vs PtIso", o2HistType::kTHnSparseL, {{Energy_Axis}, {Shower_Shape_Long_Axis}, {Shower_Shape_Short_Axis}, {NLM_Axis}, {NCells_Axis}, {PtIso_Axis}}); - + MC_Info.get(HIST("hEvsNumTracks"))->Sumw2(); MC_Info.add("hEvsPtIso", "Pt_Iso", o2HistType::kTH2F, {{Energy_Axis}, {PtIso_Axis}}); - MC_Info.add("hRho_Perpen_Cone", "Density of perpendicular cone", o2HistType::kTH1F, {Rho_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.add("hMcParticlesToCluster", "Energy of particles linked to mc cluster", o2HistType::kTH1F, {{100, 0, 100}}); - MC_Info.add("hMcParticleStatusCode", "generator status code of mc particle linked to mc cluster", o2HistType::kTH1F, {{200, 0, 200}}); - MC_Info.add("hMcParticleProcessCode", "physical process code of mc particle linked to mc cluster", o2HistType::kTH1F, {{200, 0, 200}}); + 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"}; for (size_t i = 0; i < bin_names.size(); i++) { @@ -174,9 +197,16 @@ struct PhotonIsolationQA { bool track_matching(const auto& cluster, o2::aod::EMCALMatchedTracks const& matched_tracks) { for (const auto& match : matched_tracks) { - double abs_pt = abs(match.track_as().pt()); - if ((cluster.energy() / abs_pt) < 1.75) { - return true; + double dphi = cluster.phi() - match.track_as().phi(); + if (abs(dphi) > M_PI) { + dphi = 2. * M_PI - abs(dphi); + } + double distance = sqrt(pow((cluster.eta() - match.track_as().eta()), 2) + pow(dphi, 2)); + if (distance < Track_matching_Radius) { + double abs_pt = abs(match.track_as().pt()); + if ((cluster.energy() / abs_pt) < 1.75) { + return true; + } } } return false; @@ -240,85 +270,188 @@ 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"), cluster.energy()); - 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()); + 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()); + } } } - void fillMatchedTrackHistos(HistogramRegistry registry, const auto& cluster, o2::aod::EMCALMatchedTracks const& matched_tracks) + // iterates over all mothers to check if photon originated from hard scattering (statuscode = abs(23)) + template + int getOriginalMotherIndex(const typename T::iterator& particle) { - for (const auto& match : matched_tracks) { - registry.fill(HIST("hTrackPt"), match.track_as().pt()); - registry.fill(HIST("hTrackEta"), match.track_as().eta()); - registry.fill(HIST("hTrackPhi"), match.track_as().phi()); - registry.fill(HIST("hRatioClusterETrackP"), cluster.energy() / abs(match.track_as().p())); - registry.fill(HIST("hRatioClusterETrackPrackPt"), cluster.energy() / abs(match.track_as().p()), match.track_as().pt()); + if (abs(particle.getGenStatusCode()) == 23) { + return particle.getGenStatusCode(); + } + auto mother = particle; + + while (mother.has_mothers()) { + mother = mother.template mothers_first_as(); + + MC_Info.fill(HIST("hMotherPDG"), mother.pdgCode()); + MC_Info.fill(HIST("hMotherStatusCode"), mother.getGenStatusCode()); + MC_Info.fill(HIST("hMotherStatusCodeVsPDG"), mother.getGenStatusCode(), mother.pdgCode()); + + int motherStatusCode = mother.getGenStatusCode(); + int motherPDGCode = mother.pdgCode(); + + if (abs(motherStatusCode) == 23 && motherPDGCode == 22) { + return motherStatusCode; + } } + return -1.0; } - // process monte carlo data - void processMC(selectedCollisions::iterator const& theCollision, selectedMCClusters const& mcclusters, aod::StoredMcParticles_001 const&, myGlobTracks const& tracks, o2::aod::EMCALClusterCells const& /*emccluscells*/, o2::aod::EMCALMatchedTracks const& matchedtracks) + // Calculates the number of local maxima within a cluster + std::pair CalculateNLM(const auto& ClusterCells) { - MC_Info.fill(HIST("hPosZ"), theCollision.posZ()); - - if (mcclusters.size() > 0) { - MC_Info.fill(HIST("hNumClusters"), mcclusters.size()); + std::vector> Cell_Info(ClusterCells.size(), std::vector(3)); + std::vector supermodules; + + int idx = 0; + for (auto& Cell : ClusterCells) { + auto [supermodule, module, phiInModule, etaInModule] = mGeometry->GetCellIndex(Cell.calo().cellNumber()); + auto [row, col] = mGeometry->GetCellPhiEtaIndexInSModule(supermodule, module, phiInModule, etaInModule); + supermodules.push_back(supermodule); + Cell_Info[idx++] = {static_cast(row), static_cast(col), Cell.calo().amplitude()}; } - for (auto& mccluster : mcclusters) { - auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, mccluster.globalIndex()); - fillclusterhistos(mccluster, MC_Info); - fillMatchedTrackHistos(MC_Info, mccluster, tracksofcluster); - MC_Info.fill(HIST("hEvsNumTracks"), mccluster.energy(), tracksofcluster.size()); - - if (!track_matching(mccluster, tracksofcluster)) { // no track with significant momentum is matched to cluster - double Pt_Cone = sum_Pt_tracks_in_cone(mccluster, tracks); - double Rho_Perpen_Cone = Rho_Perpendicular_Cone(mccluster, tracks); - 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"), Rho_Perpen_Cone); - MC_Info.fill(HIST("hShowerShape"), mccluster.m02(), mccluster.m20()); - MC_Info.fill(HIST("hSigmaLongvsPtIso"), mccluster.m02(), Pt_iso); - MC_Info.fill(HIST("hE_M02_M20_NLM_NCells_PtIso"), mccluster.energy(), mccluster.m02(), mccluster.m20(), mccluster.nlm(), mccluster.nCells(), Pt_iso); - fillABCDHisto(MC_Info, mccluster, Pt_iso); - // acces mc true info - auto ClusterParticles = mccluster.mcParticle_as(); - bool background = true; - for (auto& clusterparticle : ClusterParticles) { - if (clusterparticle.pdgCode() == 22) { - MC_Info.fill(HIST("hMcParticlesToCluster"), clusterparticle.e()); - MC_Info.fill(HIST("hMcParticleProcessCode"), clusterparticle.getProcess()); - MC_Info.fill(HIST("hMcParticleStatusCode"), clusterparticle.getGenStatusCode()); - if ((clusterparticle.getProcess() >= 21) && (clusterparticle.getProcess() <= 29)) - background = false; // Particles from the hardest subprocess + std::vector> local_max_vector(ClusterCells.size(), std::vector(3)); + for (size_t i = 0; i < Cell_Info.size(); ++i) { + float row = Cell_Info[i][0]; + float col = Cell_Info[i][1]; + float amp = Cell_Info[i][2]; + + bool updated; + do { + updated = false; + for (const auto& cell : Cell_Info) { + float dr = cell[0] - row; + float dc = cell[1] - col; + if (std::abs(dr) <= 1 && std::abs(dc) <= 1 && cell[2] > amp) { + row += dr; + col += dc; + amp = cell[2]; + updated = true; } } + } while (updated); + + local_max_vector[i] = {row, col, amp}; + } + + std::set uniqueRows; + for (const auto& localMax : local_max_vector) { + uniqueRows.insert(localMax[0]); + } + + int NLM = uniqueRows.size(); - if (background) { - if ((Pt_iso < 1.5) && (mccluster.m02() < 0.3) && (mccluster.m02() > 0.1)) { - MC_Info.fill(HIST("hABCDControlRegion"), 4.5, mccluster.energy()); + // flag = 0 if cluster falls in 1 supermodule. flag = 1 if cluster falls in multiple supermodules and will have automatically more local maxima + int flag = (std::unordered_set(supermodules.begin(), supermodules.end()).size() > 1) ? 1 : 0; + return std::make_pair(NLM, flag); + } + + // process monte carlo data + 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(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(), 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(), Collision.weight()); + } + + for (auto& mccluster : ClustersInCol) { + auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, mccluster.globalIndex()); + 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, 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) { + double Pt_Cone = sum_Pt_tracks_in_cone(mccluster, tracksInCol); + 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, 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(), Collision.weight()); + int first_mother_status_code = getOriginalMotherIndex(clusterparticle); + if (abs(first_mother_status_code) == 23) { + background = false; + MC_Info.fill(HIST("hPromtPhoton"), mccluster.energy(), mccluster.m02(), mccluster.nCells(), Pt_iso); + } + } + } + if (background) { + if ((Pt_iso < 1.5) && (mccluster.m02() < 0.3) && (mccluster.m02() > 0.1)) { + MC_Info.fill(HIST("hABCDControlRegion"), 4.5, mccluster.energy(), Collision.weight()); + } + } + } + } } } } @@ -327,30 +460,45 @@ struct PhotonIsolationQA { PROCESS_SWITCH(PhotonIsolationQA, processMC, "proces MC data", true); - void processData(selectedCollisions::iterator const& theCollision, selectedClusters const& clusters, o2::aod::EMCALClusterCells const& /*emccluscells*/, o2::aod::EMCALMatchedTracks const& matchedtracks, myGlobTracks const& alltracks) + void processData(aod::BCs const& bcs, selectedCollisions const& Collisions, selectedClusters const& clusters, o2::aod::EMCALMatchedTracks const& matchedtracks, myGlobTracks const& tracks, aod::Calos const&, aod::EMCALClusterCells const& ClusterCells) { - Data_Info.fill(HIST("hPosZ"), theCollision.posZ()); - - if (clusters.size() > 0) { - Data_Info.fill(HIST("hNumClusters"), clusters.size()); - } + for (auto bc : bcs) { + auto collisionsInBC = Collisions.sliceBy(collisionsPerBC, bc.globalIndex()); + Data_Info.fill(HIST("hCollperBC"), collisionsInBC.size()); + if (collisionsInBC.size() == 1) { + for (const auto& Collision : collisionsInBC) { + Data_Info.fill(HIST("hPosZ"), Collision.posZ()); + auto ClustersInCol = clusters.sliceBy(ClustersPerCol, Collision.globalIndex()); + auto tracksInCol = tracks.sliceBy(TracksPercollision, Collision.globalIndex()); + + if (ClustersInCol.size() > 0) { + Data_Info.fill(HIST("hNumClusters"), ClustersInCol.size()); + } - for (const auto& cluster : clusters) { - auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, cluster.globalIndex()); - fillclusterhistos(cluster, Data_Info); - fillMatchedTrackHistos(Data_Info, cluster, tracksofcluster); - Data_Info.fill(HIST("hEvsNumTracks"), cluster.energy(), tracksofcluster.size()); - - if (!track_matching(cluster, tracksofcluster)) { // no track with significant momentum is matched to cluster - double Pt_Cone = sum_Pt_tracks_in_cone(cluster, alltracks); - double Rho_Perpen_Cone = Rho_Perpendicular_Cone(cluster, alltracks); - double Pt_iso = Pt_Iso(Pt_Cone, Rho_Perpen_Cone); - Data_Info.fill(HIST("hEvsPtIso"), cluster.energy(), Pt_iso); - Data_Info.fill(HIST("hRho_Perpen_Cone"), Rho_Perpen_Cone); - Data_Info.fill(HIST("hShowerShape"), cluster.m02(), cluster.m20()); - Data_Info.fill(HIST("hSigmaLongvsPtIso"), cluster.m02(), Pt_iso); - Data_Info.fill(HIST("hE_M02_M20_NLM_NCells_PtIso"), cluster.energy(), cluster.m02(), cluster.m20(), cluster.nlm(), cluster.nCells(), Pt_iso); - fillABCDHisto(Data_Info, cluster, Pt_iso); + for (auto& cluster : ClustersInCol) { + auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, cluster.globalIndex()); + fillclusterhistos(cluster, Data_Info); + Data_Info.fill(HIST("hEvsNumTracks"), cluster.energy(), tracksofcluster.size()); + + auto CellsInCluster = ClusterCells.sliceBy(CellsPerCluster, cluster.globalIndex()); + auto [NLM, flag] = CalculateNLM(CellsInCluster); + Data_Info.fill(HIST("hEnergy_NLM_Flag"), cluster.energy(), NLM, flag); + Data_Info.fill(HIST("hNCells_NLM_Flag"), cluster.nCells(), NLM, flag); + + if (!track_matching(cluster, tracksofcluster)) { // no track with significant momentum is matched to cluster + if (NLM < maxNLM) { + double Pt_Cone = sum_Pt_tracks_in_cone(cluster, tracksInCol); + double Rho_Perpen_Cone = Rho_Perpendicular_Cone(cluster, tracksInCol); + double Pt_iso = Pt_Iso(Pt_Cone, Rho_Perpen_Cone); + + 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); + fillABCDHisto(Data_Info, cluster, Pt_iso); + } + } + } + } } } } diff --git a/PWGJE/Tasks/bjetTaggingML.cxx b/PWGJE/Tasks/bjetTaggingML.cxx index 3b28227ec2d..e1e9d9e03d0 100644 --- a/PWGJE/Tasks/bjetTaggingML.cxx +++ b/PWGJE/Tasks/bjetTaggingML.cxx @@ -70,6 +70,7 @@ struct BJetTaggingML { double mIPXY = 0.0; double mCPA = 0.0; double mChi2PCA = 0.0; + double mDispersion = 0.0; double mDecayLength2D = 0.0; double mDecayLength2DError = 0.0; double mDecayLength3D = 0.0; @@ -148,7 +149,7 @@ struct BJetTaggingML { registry.add("h2_SIPs2D_jetpT", "2D IP significance;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_SIPs3D_jetpT", "3D IP significance;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_LxyS_jetpT", "Decay length in XY;#it{p}_{T,jet} (GeV/#it{c});S#it{L}_{xy}", {HistType::kTH2F, {{200, 0., 200.}, {100, 0., 100.0}}}); - registry.add("h2_Dispersion_jetpT", "SV dispersion;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT", "SV dispersion;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); 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}}}); @@ -158,7 +159,7 @@ struct BJetTaggingML { 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}}}); - registry.add("h2_Dispersion_jetpT_bjet", "SV dispersion b-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT_bjet", "SV dispersion b-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); registry.add("h2_jetMass_jetpT_bjet", "Jet mass b-jets;#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_bjet", "Secondary vertex mass b-jets;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{SV} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 10.0}}}); @@ -166,7 +167,7 @@ struct BJetTaggingML { registry.add("h2_SIPs2D_jetpT_cjet", "2D IP significance c-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_SIPs3D_jetpT_cjet", "3D IP significance c-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_LxyS_jetpT_cjet", "Decay length in XY c-jets;#it{p}_{T,jet} (GeV/#it{c});S#it{L}_{xy}", {HistType::kTH2F, {{200, 0., 200.}, {100, 0., 100.0}}}); - registry.add("h2_Dispersion_jetpT_cjet", "SV dispersion c-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT_cjet", "SV dispersion c-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); registry.add("h2_jetMass_jetpT_cjet", "Jet mass c-jets;#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_cjet", "Secondary vertex mass c-jets;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{SV} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 10.0}}}); @@ -174,7 +175,7 @@ struct BJetTaggingML { registry.add("h2_SIPs2D_jetpT_lfjet", "2D IP significance lf-jet;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_SIPs3D_jetpT_lfjet", "3D IP significance lf-jet;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_LxyS_jetpT_lfjet", "Decay length in XY lf-jet;#it{p}_{T,jet} (GeV/#it{c});S#it{L}_{xy}", {HistType::kTH2F, {{200, 0., 200.}, {100, 0., 100.0}}}); - registry.add("h2_Dispersion_jetpT_lfjet", "SV dispersion lf-jet;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT_lfjet", "SV dispersion lf-jet;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); registry.add("h2_jetMass_jetpT_lfjet", "Jet mass lf-jet;#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_lfjet", "Secondary vertex mass lf-jet;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{SV} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 10.0}}}); @@ -214,9 +215,8 @@ struct BJetTaggingML { Filter jetFilter = (aod::jet::pt >= jetPtMin && aod::jet::pt <= jetPtMax && aod::jet::eta < jetEtaMax - aod::jet::r / 100.f && aod::jet::eta > jetEtaMin + aod::jet::r / 100.f); using FilteredCollision = soa::Filtered>; - using JetTrackswID = soa::Join; - using JetTracksMCDwID = soa::Join; - using OriginalTracks = soa::Join; + using JetTrackswID = soa::Join; + using JetTracksMCDwID = soa::Join; using DataJets = soa::Filtered>; std::vector> getInputsForML(bjetParams jetparams, std::vector& tracksParams, std::vector& svsParams) @@ -246,6 +246,7 @@ struct BJetTaggingML { svsInputFlat.push_back(svsParams[iconstit].mIPXY); svsInputFlat.push_back(svsParams[iconstit].mCPA); svsInputFlat.push_back(svsParams[iconstit].mChi2PCA); + svsInputFlat.push_back(svsParams[iconstit].mDispersion); svsInputFlat.push_back(svsParams[iconstit].mDecayLength2D); svsInputFlat.push_back(svsParams[iconstit].mDecayLength2DError); svsInputFlat.push_back(svsParams[iconstit].mDecayLength3D); @@ -288,25 +289,25 @@ struct BJetTaggingML { double energySV = candSV.e(); if (svsParams.size() < (svReductionFactor * myJet.template tracks_as().size())) { - svsParams.emplace_back(bjetSVParams{candSV.pt(), deltaRJetSV, massSV, energySV / myJet.energy(), candSV.impactParameterXY(), candSV.cpa(), candSV.chi2PCA(), candSV.decayLengthXY(), candSV.errorDecayLengthXY(), candSV.decayLength(), candSV.errorDecayLength()}); + svsParams.emplace_back(bjetSVParams{candSV.pt(), deltaRJetSV, massSV, energySV / myJet.energy(), candSV.impactParameterXY(), candSV.cpa(), candSV.chi2PCA(), candSV.dispersion(), candSV.decayLengthXY(), candSV.errorDecayLengthXY(), candSV.decayLength(), candSV.errorDecayLength()}); } registry.fill(HIST("h2_LxyS_jetpT"), myJet.pt(), candSV.decayLengthXY() / candSV.errorDecayLengthXY(), eventweight); - registry.fill(HIST("h2_Dispersion_jetpT"), myJet.pt(), candSV.chi2PCA(), eventweight); + registry.fill(HIST("h2_Dispersion_jetpT"), myJet.pt(), candSV.dispersion(), eventweight); registry.fill(HIST("h2_SVMass_jetpT"), myJet.pt(), massSV, eventweight); if (doprocessMCJets) { if (jetFlavor == 2) { registry.fill(HIST("h2_LxyS_jetpT_bjet"), myJet.pt(), candSV.decayLengthXY() / candSV.errorDecayLengthXY(), eventweight); - registry.fill(HIST("h2_Dispersion_jetpT_bjet"), myJet.pt(), candSV.chi2PCA(), eventweight); + registry.fill(HIST("h2_Dispersion_jetpT_bjet"), myJet.pt(), candSV.dispersion(), eventweight); registry.fill(HIST("h2_SVMass_jetpT_bjet"), myJet.pt(), massSV, eventweight); } else if (jetFlavor == 1) { registry.fill(HIST("h2_LxyS_jetpT_cjet"), myJet.pt(), candSV.decayLengthXY() / candSV.errorDecayLengthXY(), eventweight); - registry.fill(HIST("h2_Dispersion_jetpT_cjet"), myJet.pt(), candSV.chi2PCA(), eventweight); + registry.fill(HIST("h2_Dispersion_jetpT_cjet"), myJet.pt(), candSV.dispersion(), eventweight); registry.fill(HIST("h2_SVMass_jetpT_cjet"), myJet.pt(), massSV, eventweight); } else { registry.fill(HIST("h2_LxyS_jetpT_lfjet"), myJet.pt(), candSV.decayLengthXY() / candSV.errorDecayLengthXY(), eventweight); - registry.fill(HIST("h2_Dispersion_jetpT_lfjet"), myJet.pt(), candSV.chi2PCA(), eventweight); + registry.fill(HIST("h2_Dispersion_jetpT_lfjet"), myJet.pt(), candSV.dispersion(), eventweight); registry.fill(HIST("h2_SVMass_jetpT_lfjet"), myJet.pt(), massSV, eventweight); } } @@ -317,16 +318,15 @@ struct BJetTaggingML { void analyzeJetTrackInfo(AnyCollision const& /*collision*/, AnalysisJet const& analysisJet, AnyTracks const& /*allTracks*/, SecondaryVertices const& /*allSVs*/, std::vector& tracksParams, int jetFlavor = 0, double eventweight = 1.0) { - for (auto& jconstituent : analysisJet.template tracks_as()) { + for (auto& constituent : analysisJet.template tracks_as()) { - if (jconstituent.pt() < trackPtMin) { + if (constituent.pt() < trackPtMin) { continue; } - auto constituent = jconstituent.template track_as(); 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, jconstituent); + int sign = jettaggingutilities::getGeoSign(analysisJet, constituent); float RClosestSV = 10.; for (const auto& candSV : analysisJet.template secondaryVertices_as()) { @@ -336,26 +336,23 @@ struct BJetTaggingML { } } - float dcaXYZ(0.), sigmaDcaXYZ2(0.); - dcaXYZ = getDcaXYZ(constituent, &sigmaDcaXYZ2); - - registry.fill(HIST("h2_SIPs2D_jetpT"), analysisJet.pt(), sign * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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 (doprocessMCJets) { if (jetFlavor == 2) { - registry.fill(HIST("h2_SIPs2D_jetpT_bjet"), analysisJet.pt(), sign * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT_bjet"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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 * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT_cjet"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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 * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT_lfjet"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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); } } - tracksParams.emplace_back(bjetTrackParams{constituent.pt(), constituent.eta(), dotProduct, dotProduct / analysisJet.p(), deltaRJetTrack, TMath::Abs(constituent.dcaXY()) * sign, TMath::Sqrt(constituent.sigmaDcaXY2()), dcaXYZ * sign, TMath::Sqrt(sigmaDcaXYZ2), constituent.p() / analysisJet.p(), RClosestSV}); + tracksParams.emplace_back(bjetTrackParams{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(), RClosestSV}); } auto compare = [](bjetTrackParams& tr1, bjetTrackParams& tr2) { @@ -371,7 +368,7 @@ struct BJetTaggingML { } PROCESS_SWITCH(BJetTaggingML, processDummy, "Dummy process function turned on by default", true); - void processDataJets(FilteredCollision::iterator const& collision, DataJets const& alljets, JetTrackswID const& allTracks, OriginalTracks const& /*allOrigTracks*/, aod::DataSecondaryVertex3Prongs const& allSVs) + void processDataJets(FilteredCollision::iterator const& collision, DataJets const& alljets, JetTrackswID const& allTracks, aod::DataSecondaryVertex3Prongs const& allSVs) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -399,10 +396,12 @@ struct BJetTaggingML { analyzeJetSVInfo(analysisJet, allTracks, allSVs, SVsParams); analyzeJetTrackInfo(collision, analysisJet, allTracks, allSVs, tracksParams); + int nSVs = analysisJet.template secondaryVertices_as().size(); + registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), tracksParams.size()); - registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), SVsParams.size() < 250 ? SVsParams.size() : 249); + registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), nSVs < 250 ? nSVs : 249); - bjetParams jetparam = {analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), static_cast(tracksParams.size()), static_cast(SVsParams.size()), analysisJet.mass()}; + bjetParams jetparam = {analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), static_cast(tracksParams.size()), static_cast(nSVs), analysisJet.mass()}; tracksParams.resize(nJetConst); // resize to the number of inputs of the ML SVsParams.resize(nJetConst); // resize to the number of inputs of the ML @@ -426,7 +425,7 @@ struct BJetTaggingML { Preslice McParticlesPerCollision = aod::jmcparticle::mcCollisionId; Preslice McPJetsPerCollision = aod::jet::mcCollisionId; - void processMCJets(FilteredCollisionMCD::iterator const& collision, MCDJetTable const& MCDjets, MCPJetTable const& MCPjets, JetTracksMCDwID const& allTracks, JetParticles const& MCParticles, aod::MCDSecondaryVertex3Prongs const& allSVs, OriginalTracks const& /*origTracks*/) + void processMCJets(FilteredCollisionMCD::iterator const& collision, MCDJetTable const& MCDjets, MCPJetTable const& MCPjets, JetTracksMCDwID const& allTracks, aod::JetParticles const& MCParticles, aod::MCDSecondaryVertex3Prongs const& allSVs) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -473,10 +472,12 @@ struct BJetTaggingML { analyzeJetSVInfo(analysisJet, allTracks, allSVs, SVsParams, jetFlavor, eventWeight); analyzeJetTrackInfo(collision, analysisJet, allTracks, allSVs, tracksParams, jetFlavor, eventWeight); + int nSVs = analysisJet.template secondaryVertices_as().size(); + registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), tracksParams.size()); - registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), SVsParams.size() < 250 ? SVsParams.size() : 249); + registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), nSVs < 250 ? nSVs : 249); - bjetParams jetparam = {analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), static_cast(tracksParams.size()), static_cast(SVsParams.size()), analysisJet.mass()}; + bjetParams jetparam = {analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), static_cast(tracksParams.size()), static_cast(nSVs), analysisJet.mass()}; tracksParams.resize(nJetConst); // resize to the number of inputs of the ML SVsParams.resize(nJetConst); // resize to the number of inputs of the ML @@ -564,7 +565,7 @@ struct BJetTaggingML { Filter mccollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; using FilteredCollisionMCP = soa::Filtered; - void processMCTruthJets(FilteredCollisionMCP::iterator const& /*collision*/, MCPJetTable const& MCPjets, JetParticles const& MCParticles) + void processMCTruthJets(FilteredCollisionMCP::iterator const& /*collision*/, MCPJetTable const& MCPjets, aod::JetParticles const& MCParticles) { for (const auto& mcpjet : MCPjets) { diff --git a/PWGJE/Tasks/bjetTreeCreator.cxx b/PWGJE/Tasks/bjetTreeCreator.cxx index e09e5b6f8ee..2d60344085a 100644 --- a/PWGJE/Tasks/bjetTreeCreator.cxx +++ b/PWGJE/Tasks/bjetTreeCreator.cxx @@ -111,11 +111,11 @@ DECLARE_SOA_COLUMN(SVfE, svfe, float); //! The SV energy frac DECLARE_SOA_COLUMN(IPXY, ipxy, float); //! The SV 2D IP DECLARE_SOA_COLUMN(CPA, cpa, float); //! Cosine pointing angle between the SV direction and momentum DECLARE_SOA_COLUMN(Chi2PCA, chi2pca, float); //! Sum of (non-weighted) distances of the secondary vertex to its prongsm +DECLARE_SOA_COLUMN(Dispersion, dispersion, float); //! The SV dispersion DECLARE_SOA_COLUMN(DecayLength2D, lxy, float); //! The decay length of the SV in XY DECLARE_SOA_COLUMN(DecayLength2DError, lxysigma, float); //! The decay length of the SV in XY significance DECLARE_SOA_COLUMN(DecayLength3D, lxyz, float); //! The decay length of the SV in 3D DECLARE_SOA_COLUMN(DecayLength3DError, lxyzsigma, float); //! The decay length of the SV in 3d significance -// DECLARE_SOA_COLUMN(SVDispersion, svdispersion, float); //! The SV dispersion, unfortunately it cannot be calculated in O2 } // namespace SVInfo DECLARE_SOA_TABLE(bjetSVParams, "AOD", "BJETSVPARAM", @@ -128,6 +128,7 @@ DECLARE_SOA_TABLE(bjetSVParams, "AOD", "BJETSVPARAM", SVInfo::IPXY, SVInfo::CPA, SVInfo::Chi2PCA, + SVInfo::Dispersion, SVInfo::DecayLength2D, SVInfo::DecayLength2DError, SVInfo::DecayLength3D, @@ -186,6 +187,8 @@ struct BJetTreeCreator { Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; + Configurable maxConstSV{"maxConstSV", 999.0, "maximum number of SVs to be stored in the table"}; + Configurable svReductionFactor{"svReductionFactor", 1.0, "factor for how many SVs to keep"}; Configurable eventReductionFactor{"eventReductionFactor", 0.0, "Percentage of events to be removed"}; @@ -218,7 +221,7 @@ struct BJetTreeCreator { registry.add("h2_SIPs2D_jetpT", "2D IP significance;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_SIPs3D_jetpT", "3D IP significance;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_LxyS_jetpT", "Decay length in XY;#it{p}_{T,jet} (GeV/#it{c});S#it{L}_{xy}", {HistType::kTH2F, {{200, 0., 200.}, {100, 0., 100.0}}}); - registry.add("h2_Dispersion_jetpT", "SV dispersion;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT", "SV dispersion;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); 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}}}); @@ -226,21 +229,21 @@ struct BJetTreeCreator { 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}}}); - registry.add("h2_Dispersion_jetpT_bjet", "SV dispersion b-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT_bjet", "SV dispersion b-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); registry.add("h2_jetMass_jetpT_bjet", "Jet mass b-jets;#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_bjet", "Secondary vertex mass b-jets;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{SV} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 10.0}}}); registry.add("h2_SIPs2D_jetpT_cjet", "2D IP significance c-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_SIPs3D_jetpT_cjet", "3D IP significance c-jets;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_LxyS_jetpT_cjet", "Decay length in XY c-jets;#it{p}_{T,jet} (GeV/#it{c});S#it{L}_{xy}", {HistType::kTH2F, {{200, 0., 200.}, {100, 0., 100.0}}}); - registry.add("h2_Dispersion_jetpT_cjet", "SV dispersion c-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT_cjet", "SV dispersion c-jets;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); registry.add("h2_jetMass_jetpT_cjet", "Jet mass c-jets;#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_cjet", "Secondary vertex mass c-jets;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{SV} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 10.0}}}); registry.add("h2_SIPs2D_jetpT_lfjet", "2D IP significance lf-jet;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_SIPs3D_jetpT_lfjet", "3D IP significance lf-jet;#it{p}_{T,jet} (GeV/#it{c});IPs", {HistType::kTH2F, {{200, 0., 200.}, {100, -50.0, 50.0}}}); registry.add("h2_LxyS_jetpT_lfjet", "Decay length in XY lf-jet;#it{p}_{T,jet} (GeV/#it{c});S#it{L}_{xy}", {HistType::kTH2F, {{200, 0., 200.}, {100, 0., 100.0}}}); - registry.add("h2_Dispersion_jetpT_lfjet", "SV dispersion lf-jet;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 50.0}}}); + registry.add("h2_Dispersion_jetpT_lfjet", "SV dispersion lf-jet;#it{p}_{T,jet} (GeV/#it{c});Dispersion", {HistType::kTH2F, {{200, 0., 200.}, {100, 0, 0.5}}}); registry.add("h2_jetMass_jetpT_lfjet", "Jet mass lf-jet;#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_lfjet", "Secondary vertex mass lf-jet;#it{p}_{T,jet} (GeV/#it{c});#it{m}_{SV} (GeV/#it{c}^{2})", {HistType::kTH2F, {{200, 0., 200.}, {50, 0, 10.0}}}); @@ -265,9 +268,8 @@ struct BJetTreeCreator { Filter jetFilter = (aod::jet::pt >= jetPtMin && aod::jet::pt <= jetPtMax && aod::jet::eta < jetEtaMax - aod::jet::r / 100.f && aod::jet::eta > jetEtaMin + aod::jet::r / 100.f); using FilteredCollision = soa::Filtered>; - using JetTrackswID = soa::Filtered>; - using JetTracksMCDwID = soa::Filtered>; - using OriginalTracks = soa::Join; + using JetTrackswID = soa::Filtered>; + using JetTracksMCDwID = soa::Filtered>; using DataJets = soa::Filtered>; // Function to get the reduction factor based on jet pT @@ -316,9 +318,9 @@ struct BJetTreeCreator { double massSV = candSV.m(); double energySV = candSV.e(); - if (svIndices.size() < (svReductionFactor * myJet.template tracks_as().size())) { + if (svIndices.size() < (svReductionFactor * myJet.template tracks_as().size()) && svIndices.size() < maxConstSV) { if (produceTree) { - bjetSVParamsTable(bjetParamsTable.lastIndex() + 1, candSV.pt(), deltaRJetSV, massSV, energySV / myJet.energy(), candSV.impactParameterXY(), candSV.cpa(), candSV.chi2PCA(), candSV.decayLengthXY(), candSV.errorDecayLengthXY(), candSV.decayLength(), candSV.errorDecayLength()); + bjetSVParamsTable(bjetParamsTable.lastIndex() + 1, candSV.pt(), deltaRJetSV, massSV, energySV / myJet.energy(), candSV.impactParameterXY(), candSV.cpa(), candSV.chi2PCA(), candSV.dispersion(), candSV.decayLengthXY(), candSV.errorDecayLengthXY(), candSV.decayLength(), candSV.errorDecayLength()); } svIndices.push_back(bjetSVParamsTable.lastIndex()); } @@ -349,16 +351,15 @@ struct BJetTreeCreator { void analyzeJetTrackInfo(AnyCollision const& /*collision*/, AnalysisJet const& analysisJet, AnyTracks const& /*allTracks*/, SecondaryVertices const& /*allSVs*/, std::vector& trackIndices, int jetFlavor = 0, double eventweight = 1.0) { - for (auto& jconstituent : analysisJet.template tracks_as()) { + for (auto& constituent : analysisJet.template tracks_as()) { - if (jconstituent.pt() < trackPtMin) { + if (constituent.pt() < trackPtMin) { continue; } - auto constituent = jconstituent.template track_as(); 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, jconstituent); + int sign = jettaggingutilities::getGeoSign(analysisJet, constituent); float RClosestSV = 10.; for (const auto& candSV : analysisJet.template secondaryVertices_as()) { @@ -368,28 +369,24 @@ struct BJetTreeCreator { } } - float dcaXYZ(0.), sigmaDcaXYZ2(0.); - dcaXYZ = getDcaXYZ(constituent, &sigmaDcaXYZ2); - // jettaggingutilities::calculateDcaXYZ(dcaXYZ, sigmaDcaXYZ2, constituent.dcaXY(), constituent.dcaZ(), constituent.cYY(), constituent.cZY(), constituent.cZZ(), constituent.sigmaDcaXY2(), constituent.sigmaDcaZ2()); - - registry.fill(HIST("h2_SIPs2D_jetpT"), analysisJet.pt(), sign * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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 (doprocessMCJets) { if (jetFlavor == 2) { - registry.fill(HIST("h2_SIPs2D_jetpT_bjet"), analysisJet.pt(), sign * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT_bjet"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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 * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT_cjet"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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 * TMath::Abs(constituent.dcaXY()) / TMath::Sqrt(constituent.sigmaDcaXY2()), eventweight); - registry.fill(HIST("h2_SIPs3D_jetpT_lfjet"), analysisJet.pt(), sign * dcaXYZ / TMath::Sqrt(sigmaDcaXYZ2), eventweight); + 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); } } if (produceTree) { - bjetTracksParamsTable(bjetParamsTable.lastIndex() + 1, constituent.pt(), constituent.eta(), dotProduct, dotProduct / analysisJet.p(), deltaRJetTrack, TMath::Abs(constituent.dcaXY()) * sign, TMath::Sqrt(constituent.sigmaDcaXY2()), dcaXYZ * sign, TMath::Sqrt(sigmaDcaXYZ2), constituent.p() / analysisJet.p(), RClosestSV); + 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(), RClosestSV); } trackIndices.push_back(bjetTracksParamsTable.lastIndex()); } @@ -400,7 +397,7 @@ struct BJetTreeCreator { } PROCESS_SWITCH(BJetTreeCreator, processDummy, "Dummy process function turned on by default", true); - void processDataJets(FilteredCollision::iterator const& collision, DataJets const& alljets, JetTrackswID const& allTracks, OriginalTracks const& /*allOrigTracks*/, aod::DataSecondaryVertex3Prongs const& allSVs) + void processDataJets(FilteredCollision::iterator const& collision, DataJets const& alljets, JetTrackswID const& allTracks, aod::DataSecondaryVertex3Prongs const& allSVs) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || (static_cast(std::rand()) / RAND_MAX < eventReductionFactor)) { return; @@ -434,12 +431,14 @@ struct BJetTreeCreator { registry.fill(HIST("h2_jetMass_jetpT"), analysisJet.pt(), analysisJet.mass()); + int nSVs = analysisJet.template secondaryVertices_as().size(); + registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), tracksIndices.size()); - registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), SVsIndices.size() < 250 ? SVsIndices.size() : 249); + registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), nSVs < 250 ? nSVs : 249); if (produceTree) { bjetConstituentsTable(bjetParamsTable.lastIndex() + 1, tracksIndices, SVsIndices); - bjetParamsTable(analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), tracksIndices.size(), SVsIndices.size(), analysisJet.mass(), 0, analysisJet.r()); + bjetParamsTable(analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), tracksIndices.size(), nSVs, analysisJet.mass(), 0, analysisJet.r()); } } } @@ -452,7 +451,7 @@ struct BJetTreeCreator { Preslice McParticlesPerCollision = aod::jmcparticle::mcCollisionId; Preslice McPJetsPerCollision = aod::jet::mcCollisionId; - void processMCJets(FilteredCollisionMCD::iterator const& collision, MCDJetTable const& MCDjets, MCPJetTable const& MCPjets, JetTracksMCDwID const& allTracks, JetParticles const& MCParticles, aod::MCDSecondaryVertex3Prongs const& allSVs, OriginalTracks const& /*origTracks*/) + void processMCJets(FilteredCollisionMCD::iterator const& collision, MCDJetTable const& MCDjets, MCPJetTable const& MCPjets, JetTracksMCDwID const& allTracks, aod::JetParticles const& MCParticles, aod::MCDSecondaryVertex3Prongs const& allSVs) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || (static_cast(std::rand()) / RAND_MAX < eventReductionFactor)) { return; @@ -508,10 +507,12 @@ struct BJetTreeCreator { analyzeJetSVInfo(analysisJet, allTracks, allSVs, SVsIndices, jetFlavor, eventWeight); analyzeJetTrackInfo(collision, analysisJet, allTracks, allSVs, tracksIndices, jetFlavor, eventWeight); + int nSVs = analysisJet.template secondaryVertices_as().size(); + registry.fill(HIST("h2_jetMass_jetpT"), analysisJet.pt(), analysisJet.mass(), eventWeight); registry.fill(HIST("h2_nTracks_jetpT"), analysisJet.pt(), tracksIndices.size()); - registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), SVsIndices.size() < 250 ? SVsIndices.size() : 249); + registry.fill(HIST("h2_nSV_jetpT"), analysisJet.pt(), nSVs < 250 ? nSVs : 249); if (jetFlavor == 2) { registry.fill(HIST("h2_jetMass_jetpT_bjet"), analysisJet.pt(), analysisJet.mass(), eventWeight); @@ -541,7 +542,7 @@ struct BJetTreeCreator { if (produceTree) { bjetConstituentsTable(bjetParamsTable.lastIndex() + 1, tracksIndices, SVsIndices); - bjetParamsTable(analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), tracksIndices.size(), SVsIndices.size(), analysisJet.mass(), jetFlavor, analysisJet.r()); + bjetParamsTable(analysisJet.pt(), analysisJet.eta(), analysisJet.phi(), tracksIndices.size(), nSVs, analysisJet.mass(), jetFlavor, analysisJet.r()); } } } @@ -550,7 +551,7 @@ struct BJetTreeCreator { Filter mccollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; using FilteredCollisionMCP = soa::Filtered; - void processMCTruthJets(FilteredCollisionMCP::iterator const& /*collision*/, MCPJetTable const& MCPjets, JetParticles const& MCParticles) + void processMCTruthJets(FilteredCollisionMCP::iterator const& /*collision*/, MCPJetTable const& MCPjets, aod::JetParticles const& MCParticles) { for (const auto& mcpjet : MCPjets) { diff --git a/PWGJE/Tasks/emcclustermonitor.cxx b/PWGJE/Tasks/emcclustermonitor.cxx index b922e4cf068..1fc741ec410 100644 --- a/PWGJE/Tasks/emcclustermonitor.cxx +++ b/PWGJE/Tasks/emcclustermonitor.cxx @@ -109,7 +109,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,33 +121,6 @@ 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("clusterTM_dEtadPhi", "cluster trackmatching dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH3F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // dEta dPhi of only the Nth clostest track - mHistManager.add("clusterTM_dEtadPhi_ASide", "cluster trackmatching in A-Side dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest track in A-Aside - mHistManager.add("clusterTM_dEtadPhi_CSide", "cluster trackmatching in C-Side tracks dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest track in C-Side - mHistManager.add("clusterTM_PosdEtadPhi", "cluster trackmatching positive tracks dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest positive track - mHistManager.add("clusterTM_NegdEtadPhi", "cluster trackmatching negative tracks dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest negative track - mHistManager.add("clusterTM_PosdEtadPhi_Pl0_75", "cluster trackmatching positive tracks, p < 0.75 dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest positive track with p < 0.75 GeV/c - mHistManager.add("clusterTM_NegdEtadPhi_Pl0_75", "cluster trackmatching negative tracks, p < 0.75 dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest negative track with p < 0.75 GeV/c - mHistManager.add("clusterTM_PosdEtadPhi_0_75leqPl1_25", "cluster trackmatching positive tracks, 0.75 <= p < 1.25 dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest positive track with 0.75 <= p < 1.25 GeV/c - mHistManager.add("clusterTM_NegdEtadPhi_0_75leqPl1_25", "cluster trackmatching negative tracks, 0.75 <= p < 1.25 dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest negative track with 0.75 <= p < 1.25 GeV/c - mHistManager.add("clusterTM_PosdEtadPhi_Pgeq1_25", "cluster trackmatching positive tracks, p >= 1.25 dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest positive track with p >= 1.25 GeV/c - mHistManager.add("clusterTM_NegdEtadPhi_Pgeq1_25", "cluster trackmatching negative tracks, p >= 1.25 dEta/dPhi;d#it{#eta};d#it{#varphi} (rad)", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, -0.4, 0.4}}); // dEta dPhi of only the clostest negative track with p >= 1.25 GeV/c - mHistManager.add("clusterTM_dEtaPt", "cluster trackmatching dEta/#it{p}_{T};d#it{#eta};#it{p}_{T} (GeV/#it{c})", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, 0.0, 50.}}); // dEta vs pT of only the clostest track - mHistManager.add("clusterTM_PosdPhiPt", "cluster trackmatching positive tracks dPhi/#it{p}_{T};d#it{#varphi} (rad);#it{p}_{T} (GeV/#it{c})", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, 0.0, 50.}}); // dPhi vs pT of only the clostest positive track - mHistManager.add("clusterTM_NegdPhiPt", "cluster trackmatching negative tracks dPh/#it{p}_{T}i;d#it{#varphi} (rad);#it{p}_{T} (GeV/#it{c})", o2HistType::kTH2F, {{100, -0.4, 0.4}, {100, 0.0, 50.}}); // dPhi vs pT of only the clostest negative track - mHistManager.add("clusterTM_dEtaTN", "cluster trackmatching dEta/TN;d#it{#eta};#it{N}_{matched tracks}", o2HistType::kTH2F, {{100, -0.4, 0.4}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // dEta compared to the Nth closest track - mHistManager.add("clusterTM_dPhiTN", "cluster trackmatching dPhi/TN;d#it{#varphi} (rad);#it{N}_{matched tracks}", o2HistType::kTH2F, {{100, -0.4, 0.4}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // dPhi compared to the Nth closest track - mHistManager.add("clusterTM_dRTN", "cluster trackmatching dR/TN;d#it{R};#it{N}_{matched tracks}", o2HistType::kTH2F, {{100, 0.0, 0.4}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // dR compared to the Nth closest track - mHistManager.add("clusterTM_NTrack", "cluster trackmatching NMatchedTracks", o2HistType::kTH1I, {{11, -0.5, 10.5}}); // how many tracks are matched - mHistManager.add("clusterTM_dEtaTNAli", "cluster trackmatching dEta/TN;d#it{#eta};#it{N}_{matched tracks}", o2HistType::kTH2F, {{100, -0.06, 0.06}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // dEta compared to the Nth closest track with cuts from latest Pi0 Run2 analysis - mHistManager.add("clusterTM_dPhiTNAli", "cluster trackmatching dPhi/TN;d#it{#varphi} (rad);#it{N}_{matched tracks}", o2HistType::kTH2F, {{100, -0.1, 0.1}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // dPhi compared to the Nth closest track with cuts from latest Pi0 Run2 analysis - mHistManager.add("clusterTM_dRTNAli", "cluster trackmatching dR/TN;d#it{R};#it{N}_{matched tracks}", o2HistType::kTH2F, {{100, 0.0, 0.1}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // dR compared to the Nth closest track with cuts from latest Pi0 Run2 analysis - mHistManager.add("clusterTM_NTrackAli", "cluster trackmatching NMatchedTracks", o2HistType::kTH1I, {{11, -0.5, 10.5}}); // how many tracks are matched with cuts from latest Pi0 Run2 analysis - mHistManager.add("clusterTM_EoverP_E", "cluster E/p (dEtadPhi<0.05);#it{E}_{cluster}/#it{p}_{track};#it{E}_{cluster} (GeV)", o2HistType::kTH3F, {{500, 0, 10}, {200, 0, 100}, {MaxMatched, 0.5, MaxMatched + 0.5}}); // E/p vs p vs # matched track - mHistManager.add("clusterTM_EvsP", "cluster E/track p (dEtadPhi<0.05);#it{E}_{cluster} (GeV);#it{p}_{track} (GeV/#it{c})", o2HistType::kTH2F, {{500, 0, 10}, {200, 0, 100}}); // E vs p for closest track with dEta,dPhi<0.05 - mHistManager.add("clusterTM_EoverP_electron", "cluster E/electron p (dEtadPhi<0.05);#it{E}_{cluster} (GeV);#it{p}_{e^{#pm}} (GeV/#it{c})", o2HistType::kTH2F, {{500, 0, 10}, {200, 0, 100}}); // E over p vs track pT for closest electron/positron track with dEta,dPhi<0.05 - mHistManager.add("clusterTM_EoverP_hadron", "cluster E/hadron p (dEtadPhi<0.05);#it{E}_{cluster} (GeV);#it{p}_{e^{#pm}} (GeV/#it{c})", o2HistType::kTH2F, {{500, 0, 10}, {200, 0, 100}}); // E over p vs track pT for closest hadron track with dEta,dPhi<0.05 - mHistManager.add("clusterTM_EoverP_Pt", "cluster E/track vs track pT (dEtadPhi<0.05);#it{E}_{cluster}/#it{p}_{track};#it{p}_{T,track} (GeV/#it{c})", o2HistType::kTH2F, {{500, 0, 10}, {200, 0, 100}}); // E vs p vs track pTfor closest track with dEta,dPhi<0.05 // add histograms per supermodule for (int ism = 0; ism < 20; ++ism) { diff --git a/PWGJE/Tasks/emceventselectionqa.cxx b/PWGJE/Tasks/emceventselectionqa.cxx index b373371499f..de4228aa70e 100644 --- a/PWGJE/Tasks/emceventselectionqa.cxx +++ b/PWGJE/Tasks/emceventselectionqa.cxx @@ -41,7 +41,7 @@ struct EmcEventSelectionQA { using o2HistType = o2::framework::HistType; using o2Axis = o2::framework::AxisSpec; - o2Axis matchingAxis{3, -0.5, 2.5, "matchingStatus", "Matching status"}, // 0, no vertex,1 vertex found , 2 multiple vertices found + o2Axis matchingAxis{3, -0.5, 2.5, "Matching Status (0, 1, 2+ collisions)", "Matching status"}, // 0, no vertex,1 vertex found , 2 multiple vertices found bcAxis{4001, -0.5, 4000.5, "bcid", "BC ID"}; mHistManager.add("hCollisionMatching", "Collision Status", o2HistType::kTH1F, {matchingAxis}); @@ -72,6 +72,7 @@ struct EmcEventSelectionQA { mHistManager.add("hBCEmcalDJ2", "Bunch crossings with DJ2 trigger from CTP", o2HistType::kTH1F, {bcAxis}); mHistManager.add("hBCTVX", "Bunch crossings with FIT TVX trigger from CTP", o2HistType::kTH1F, {bcAxis}); mHistManager.add("hBCEmcalCellContent", "Bunch crossings with non-0 EMCAL cell content", o2HistType::kTH1F, {bcAxis}); + mHistManager.add("hBCCollisionCounter_TVX", "Number of BCs with a certain number of rec. colls", o2HistType::kTH2F, {bcAxis, matchingAxis}); initCollisionHistogram(mHistManager.get(HIST("hCollisionMatching")).get()); initCollisionHistogram(mHistManager.get(HIST("hCollisionMatchingReadout")).get()); @@ -162,10 +163,6 @@ struct EmcEventSelectionQA { } } - if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) { - mHistManager.fill(HIST("hBCTVX"), bcID); - } - // lookup number of cells for global BC of this BC // avoid iteration over cell table for speed reason auto found = cellGlobalBCs.find(bc.globalBC()); @@ -185,6 +182,12 @@ struct EmcEventSelectionQA { } else { collisionStatus = 2; } + + if (bc.selection_bit(aod::evsel::kIsTriggerTVX)) { + mHistManager.fill(HIST("hBCTVX"), bcID); + mHistManager.fill(HIST("hBCCollisionCounter_TVX"), bcID, collisionStatus); + } + if (collisionStatus >= 0) { mHistManager.fill(HIST("hCollisionMatching"), collisionStatus); if (isEMCALreadout) { diff --git a/PWGJE/Tasks/emctmmonitor.cxx b/PWGJE/Tasks/emctmmonitor.cxx index 3b6773e7127..3a191cba635 100644 --- a/PWGJE/Tasks/emctmmonitor.cxx +++ b/PWGJE/Tasks/emctmmonitor.cxx @@ -349,7 +349,6 @@ struct TrackMatchingMonitor { mHistManager.fill(HIST("clusterTM_EoverP_E"), eOverP, cluster.energy(), t); mHistManager.fill(HIST("clusterTM_dEtadPhi"), dEta, dPhi, t); mHistManager.fill(HIST("clusterEMatched"), cluster.energy(), t); - mHistManager.fill(HIST("clusterTM_dEtaPt"), dEta, pT, t); mHistManager.fill(HIST("clusterTM_EvsP"), cluster.energy(), abs_p, t); mHistManager.fill(HIST("clusterTM_EoverP_Pt"), eOverP, match.track_as().pt(), t); mHistManager.fill(HIST("clusterTM_NSigma"), NSigmaEl, match.track_as().pt(), t); diff --git a/PWGJE/Tasks/emcvertexselectionqa.cxx b/PWGJE/Tasks/emcvertexselectionqa.cxx index 9d3a33a2443..4a803adc24f 100644 --- a/PWGJE/Tasks/emcvertexselectionqa.cxx +++ b/PWGJE/Tasks/emcvertexselectionqa.cxx @@ -37,6 +37,15 @@ using FullTracksIU = soa::Join; struct EmcVertexSelectionQA { o2::framework::HistogramRegistry mHistManager{"EMCALVertexSelectionQAHistograms"}; + Configurable cfgZvtxMax{"cfgZvtxMax", 20.f, "max. Zvtx"}; + Configurable cfgRequireSel8{"cfgRequireSel8", false, "require sel8 in event cut"}; + Configurable cfgRequireFT0AND{"cfgRequireFT0AND", false, "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 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"}; + void init(o2::framework::InitContext const&) { using o2HistType = o2::framework::HistType; @@ -66,6 +75,10 @@ struct EmcVertexSelectionQA { mHistManager.add("hVertexRelDiffRobustStdDevDCA", "Relative Difference of Robust StdDev DCA to StdDev DCA of Vertex vs its Quality", o2HistType::kTH2F, {{200, 0, 2}, qualityAxis}); mHistManager.add("hVertexRelDiffRobustStdDevTrackTime", "Relative Difference of Robust Standard Deviation to Standard Deviation of Tracks Contributing to the Vertex vs its Quality", o2HistType::kTH2F, {{200, 0, 2}, qualityAxis}); + // Z vertex positions of two vertices in the same BC (to look for two collisions in the same BC with similar z-vertex positions) + mHistManager.add("hDoubleZVertex", "Z Vertex Position Correlation of two Collions in the same BC", o2HistType::kTH2F, {{300, -15., 15.}, {300, -15., 15.}}); + mHistManager.add("hZVertexDiff", "Difference Z Vertex Position of two Collions in the same BC", o2HistType::kTH1F, {{40000, -20., 20., "Z_{vtx 1}-Z_{vtx 2} (cm)"}}); + // Set axis labels and bin titles initVertexHistogram(mHistManager.get(HIST("hCollisionMatching")).get()); initVertexHistogram(mHistManager.get(HIST("hCollisionMatchingReadout")).get()); @@ -84,6 +97,8 @@ struct EmcVertexSelectionQA { mHistManager.get(HIST("hnVertexContributors")).get()->GetXaxis()->SetTitle("N_{contr} to Vtx 1"); mHistManager.get(HIST("hnVertexContributors")).get()->GetYaxis()->SetTitle("N_{contr} to Vtx 2"); + mHistManager.get(HIST("hDoubleZVertex")).get()->GetXaxis()->SetTitle("Z_{vtx 1} (cm)"); + mHistManager.get(HIST("hDoubleZVertex")).get()->GetYaxis()->SetTitle("Z_{vtx 2} (cm)"); } Preslice perCollision = aod::track::collisionId; @@ -91,23 +106,32 @@ struct EmcVertexSelectionQA { void process(bcEvSels const& bcs, collEventSels const& collisions, FullTracksIU const& tracks) { for (const auto& bc : bcs) { - bool isEMCALreadout = false; + bool isEMCALreadout = (bc.alias_bit(kTVXinEMC) || bc.alias_bit(kEMC7) || bc.alias_bit(kEG1) || bc.alias_bit(kEG2) || bc.alias_bit(kDG1) || bc.alias_bit(kDG2) || bc.alias_bit(kEJ1) || bc.alias_bit(kEJ2) || bc.alias_bit(kDJ1) || bc.alias_bit(kDJ2)); - if (bc.runNumber() > 300000) { - // in case of run3 not all BCs contain EMCAL data, require trigger selection also for min. bias - // in addition select also L0/L1 triggers as triggers with EMCAL in reaodut - if (bc.alias_bit(kTVXinEMC) || bc.alias_bit(kEMC7) || bc.alias_bit(kEG1) || bc.alias_bit(kEG2) || bc.alias_bit(kDG1) || bc.alias_bit(kDG2) || bc.alias_bit(kEJ1) || bc.alias_bit(kEJ2) || bc.alias_bit(kDJ1) || bc.alias_bit(kDJ2)) { - isEMCALreadout = true; - } - } else { - // run1/2: rely on trigger cluster, runlist must contain only runs with EMCAL in readout - // Select min. bias trigger and EMCAL L0/L1 triggers - if (bc.alias_bit(kINT7) || bc.alias_bit(kEMC7) || bc.alias_bit(kEG1) || bc.alias_bit(kEG2) || bc.alias_bit(kEJ1) || bc.alias_bit(kEJ2)) { - isEMCALreadout = true; - } + auto colsinbc = collisions.sliceBy(perFoundBC, bc.globalIndex()); + + bool isBCAccepted = true; + for (auto& col : colsinbc) { + if (cfgRequireSel8 && !col.sel8()) + isBCAccepted = false; + if (cfgRequireFT0AND && !col.selection_bit(o2::aod::evsel::kIsTriggerTVX)) + isBCAccepted = false; + if (col.posZ() < -cfgZvtxMax || col.posZ() > cfgZvtxMax) + isBCAccepted = false; + if (cfgRequireNoTFB && !col.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) + isBCAccepted = false; + if (cfgRequireNoITSROFB && !col.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) + isBCAccepted = false; + if (cfgRequireNoSameBunchPileup && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + isBCAccepted = false; + if (cfgRequireVertexITSTPC && !col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + isBCAccepted = false; + if (cfgRequireGoodZvtxFT0vsPV && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + isBCAccepted = false; } + if (!isBCAccepted) + continue; - auto colsinbc = collisions.sliceBy(perFoundBC, bc.globalIndex()); int collisionStatus = -1; if (!colsinbc.size()) { collisionStatus = 0; @@ -127,6 +151,7 @@ struct EmcVertexSelectionQA { if (collisionStatus > 0) { int nVtx = 0; int nVtxwithTOForTRDcontr = 0; + std::vector zVertexPositions; std::vector nVtxContributors; for (auto& col : colsinbc) { // Loop over all collisions/vertices int ivtxquality = 0; // 0: TPC/ITS contributor, 1: TRD contributor , 2: TOF contributor @@ -184,12 +209,16 @@ struct EmcVertexSelectionQA { nVtxwithTOForTRDcontr++; } nVtxContributors.push_back(nPVContributorTracks); + zVertexPositions.push_back(col.posZ()); } mHistManager.fill(HIST("hnVerticeswithTOForTRDcontr"), nVtx, nVtxwithTOForTRDcontr); if (collisionStatus == 2) { mHistManager.fill(HIST("hnVertexContributors"), nVtxContributors.at(0), nVtxContributors.at(1)); + mHistManager.fill(HIST("hDoubleZVertex"), zVertexPositions.at(0), zVertexPositions.at(1)); + mHistManager.fill(HIST("hZVertexDiff"), zVertexPositions.at(0) - zVertexPositions.at(1)); } nVtxContributors.clear(); + zVertexPositions.clear(); } } } diff --git a/PWGJE/Tasks/fulljetspectrapp.cxx b/PWGJE/Tasks/fulljetspectrapp.cxx index b93f05ca427..b683a6ef98c 100644 --- a/PWGJE/Tasks/fulljetspectrapp.cxx +++ b/PWGJE/Tasks/fulljetspectrapp.cxx @@ -356,14 +356,14 @@ struct FullJetSpectrapp { // } registry.fill(HIST("h2_jet_etaphi"), jet.eta(), jet.phi(), weight); - for (auto& cluster : jet.template clusters_as()) { + for (auto& cluster : jet.template clusters_as()) { registry.fill(HIST("h2_full_jet_neutralconstituents"), jet.pt(), jet.clustersIds().size(), weight); neutralEnergy += cluster.energy(); } auto NEF = neutralEnergy / jet.energy(); registry.fill(HIST("h2_full_jet_NEF"), jet.pt(), NEF, weight); - for (auto& jettrack : jet.template tracks_as()) { + for (auto& jettrack : jet.template tracks_as()) { registry.fill(HIST("h_Detjet_ntracks"), jettrack.pt(), weight); registry.fill(HIST("h2_full_jet_chargedconstituents"), jet.pt(), jet.tracksIds().size(), weight); registry.fill(HIST("h2_full_jettrack_pt"), jet.pt(), jettrack.pt(), weight); @@ -381,7 +381,7 @@ struct FullJetSpectrapp { { float neutralEnergy = 0.0; if (jet.r() == round(selectedJetsRadius * 100.0f)) { - for (auto& cluster : jet.template clusters_as()) { + for (auto& cluster : jet.template clusters_as()) { neutralEnergy += cluster.energy(); } auto NEF = neutralEnergy / jet.energy(); @@ -405,7 +405,7 @@ struct FullJetSpectrapp { // } registry.fill(HIST("h2_jet_etaphi_part"), jet.eta(), jet.phi(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { auto pdgParticle = pdgDatabase->GetParticle(constituent.pdgCode()); if (pdgParticle->Charge() == 0) { neutralconsts++; @@ -514,12 +514,12 @@ struct FullJetSpectrapp { } // else } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(FullJetSpectrapp, processDummy, "dummy task", true); - void processJetsData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, JetTracks const&, JetClusters const&) + void processJetsData(soa::Filtered::iterator const& collision, FullJetTableDataJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { registry.fill(HIST("h_collisions_unweighted"), 1.0); // total events bool eventAccepted = false; @@ -541,7 +541,7 @@ struct FullJetSpectrapp { if (!eventAccepted) { registry.fill(HIST("h_collisions_unweighted"), 6.0); // JetsData w/o kTVXinEMC for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { fillRejectedJetHistograms(jet, 1.0); } } @@ -555,7 +555,7 @@ struct FullJetSpectrapp { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillJetHistograms(jet, 1.0); @@ -563,7 +563,7 @@ struct FullJetSpectrapp { } PROCESS_SWITCH(FullJetSpectrapp, processJetsData, "Full Jets Data", false); - void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, JetTracks const&, JetClusters const&) + void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { registry.fill(HIST("h_collisions_unweighted"), 1.0); // total events bool eventAccepted = false; @@ -585,7 +585,7 @@ struct FullJetSpectrapp { if (!eventAccepted) { registry.fill(HIST("h_collisions_unweighted"), 7.0); // JetsMCD w/o kTVXinEMC for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { fillRejectedJetHistograms(jet, 1.0); } } @@ -599,7 +599,7 @@ struct FullJetSpectrapp { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillJetHistograms(jet, 1.0); @@ -607,7 +607,7 @@ struct FullJetSpectrapp { } PROCESS_SWITCH(FullJetSpectrapp, processJetsMCD, "Full Jets at Detector Level", false); - void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, JetTracks const&, JetClusters const&) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { registry.fill(HIST("h_collisions_weighted"), 1.0); // total events bool eventAccepted = false; @@ -629,7 +629,7 @@ struct FullJetSpectrapp { if (!eventAccepted) { registry.fill(HIST("h_collisions_weighted"), 5.0); // JetsMCDWeighted w/o kTVXinEMC for (auto const& jet : jets) { - if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax) || !isAcceptedJet(jet)) { fillRejectedJetHistograms(jet, jet.eventWeight()); } } @@ -643,7 +643,7 @@ struct FullJetSpectrapp { if (jet.phi() < jetPhiMin || jet.phi() > jetPhiMax) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } @@ -652,24 +652,24 @@ struct FullJetSpectrapp { } PROCESS_SWITCH(FullJetSpectrapp, processJetsMCDWeighted, "Full Jets at Detector Level on weighted events", false); - void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, JetParticles const&, JetMcCollisions const&) + void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, aod::JetParticles const&, aod::JetMcCollisions const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } fillMCPHistograms(jet, 1.0); } PROCESS_SWITCH(FullJetSpectrapp, processJetsMCP, "Full Jets at Particle Level", false); - void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, JetParticles const&) + void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, aod::JetParticles const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } @@ -677,7 +677,7 @@ struct FullJetSpectrapp { } PROCESS_SWITCH(FullJetSpectrapp, processJetsMCPWeighted, "Full Jets at Particle Level on weighted events", false); - void processTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& clusters) + void processTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, soa::Filtered const& clusters) { registry.fill(HIST("h_collisions_unweighted"), 1.0); // total events bool eventAccepted = false; @@ -713,7 +713,7 @@ struct FullJetSpectrapp { } PROCESS_SWITCH(FullJetSpectrapp, processTracks, "Full Jet tracks", false); - void processJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, JetTableMCDMatchedJoined const& mcdjets, JetTableMCPMatchedJoined const&, aod::JMcCollisions const&, JetTracks const&, JetClusters const&, JetParticles const&) + void processJetsMCPMCDMatched(soa::Filtered>::iterator const& collision, JetTableMCDMatchedJoined const& mcdjets, JetTableMCPMatchedJoined const&, aod::JMcCollisions const&, aod::JetTracks const&, aod::JetClusters const&, aod::JetParticles const&) { registry.fill(HIST("h_collisions_unweighted"), 1.0); // total events bool eventAccepted = false; @@ -757,7 +757,7 @@ struct FullJetSpectrapp { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { @@ -779,7 +779,7 @@ struct FullJetSpectrapp { } PROCESS_SWITCH(FullJetSpectrapp, processJetsMCPMCDMatched, "Full Jet finder MCP matched to MCD", false); - void processJetsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const& mcpjets, aod::JMcCollisions const&, JetTracks const&, JetClusters const&, JetParticles const&) + void processJetsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const& mcpjets, aod::JMcCollisions const&, aod::JetTracks const&, aod::JetClusters const&, aod::JetParticles const&) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions_weighted"), 1.0, eventWeight); // total events @@ -825,7 +825,7 @@ struct FullJetSpectrapp { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { @@ -850,8 +850,8 @@ struct FullJetSpectrapp { void processTracksWeighted(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, - soa::Filtered const& tracks, - soa::Filtered const& clusters) + soa::Filtered const& tracks, + soa::Filtered const& clusters) { bool eventAccepted = false; float eventWeight = collision.mcCollision().weight(); diff --git a/PWGJE/Tasks/gammajettreeproducer.cxx b/PWGJE/Tasks/gammajettreeproducer.cxx index d721ca725df..273205ccb7c 100644 --- a/PWGJE/Tasks/gammajettreeproducer.cxx +++ b/PWGJE/Tasks/gammajettreeproducer.cxx @@ -141,7 +141,7 @@ struct GammaJetTreeProducer { return true; } - double ch_iso_in_cone(const auto& cluster, JetTracks const& tracks, float radius = 0.4) + double ch_iso_in_cone(const auto& cluster, aod::JetTracks const& tracks, float radius = 0.4) { double iso = 0; for (auto track : tracks) { @@ -156,7 +156,7 @@ struct GammaJetTreeProducer { } return iso; } - double ch_perp_cone_rho(const auto& cluster, JetTracks const& tracks, float radius = 0.4) + double ch_perp_cone_rho(const auto& cluster, aod::JetTracks const& tracks, float radius = 0.4) { double ptSumLeft = 0; double ptSumRight = 0; @@ -191,7 +191,7 @@ struct GammaJetTreeProducer { // --------------------- // Processing functions // --------------------- - void processClearMaps(JetCollisions const&) + void processClearMaps(aod::JetCollisions const&) { collisionMapping.clear(); } @@ -202,7 +202,7 @@ struct GammaJetTreeProducer { // an integer instead Filter clusterDefinitionSelection = (o2::aod::jcluster::definition == mClusterDefinition); // Process clusters - void processClusters(soa::Join::iterator const& collision, selectedClusters const& clusters, JetTracks const& tracks) + void processClusters(soa::Join::iterator const& collision, selectedClusters const& clusters, aod::JetTracks const& tracks) { if (!isEventAccepted(collision)) { return; @@ -259,7 +259,7 @@ struct GammaJetTreeProducer { Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); // Process charged jets - void processChargedJets(soa::Join::iterator const& collision, soa::Filtered> const& chargedJets, JetTracks const&) + void processChargedJets(soa::Join::iterator const& collision, soa::Filtered> const& chargedJets, aod::JetTracks const&) { // event selection if (!isEventAccepted(collision)) { @@ -272,7 +272,7 @@ struct GammaJetTreeProducer { continue; ushort nconst = 0; // loop over constituents - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { mHistograms.fill(HIST("chjetpt_vs_constpt"), jet.pt(), constituent.pt()); nconst++; } diff --git a/PWGJE/Tasks/hffragmentationfunction.cxx b/PWGJE/Tasks/hffragmentationfunction.cxx index b080485d2ea..9284c66e6c1 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, float); 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 { @@ -153,21 +182,40 @@ struct HfFragmentationFunctionTask { using JetMCPTable = soa::Join; // slices for accessing proper HF mcdjets collision associated to mccollisions - PresliceUnsorted CollisionsPerMCCollision = aod::jmccollisionlb::mcCollisionId; + PresliceUnsorted CollisionsPerMCCollision = aod::jmccollisionlb::mcCollisionId; Preslice D0MCDJetsPerCollision = aod::jet::collisionId; Preslice D0MCPJetsPerMCCollision = aod::jet::mcCollisionId; // 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(JetCollision const&, + void processDataChargedSubstructure(aod::JetCollision const& collision, soa::Join const& jets, - CandidatesD0Data const&) + 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 @@ -195,15 +247,16 @@ struct HfFragmentationFunctionTask { // obtaining jet 3-vector TVector3 jetVector(jet.px(), jet.py(), jet.pz()); - for (auto& d0Candidate : jet.candidates_as()) { + for (auto& d0Candidate : jet.candidates_as()) { // 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,41 +271,76 @@ 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 + } // end of D0 candidates loop } // end of jets loop } // end of process function PROCESS_SWITCH(HfFragmentationFunctionTask, processDataChargedSubstructure, "charged HF jet substructure", false); - void processMcEfficiency(JetMcCollisions const& mccollisions, - JetCollisionsMCD const& collisions, + void processMcEfficiency(aod::JetMcCollisions const& mccollisions, + aod::JetCollisionsMCD const& collisions, JetMCDTable const& mcdjets, JetMCPTable const& mcpjets, - CandidatesD0MCD const&, - CandidatesD0MCP const&) + aod::CandidatesD0MCD 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(); + auto mcdd0cand = mcdjet.candidates_first_as(); + + if (mcdjet.has_matchedJetCand()) { + registry.fill(HIST("h_jet_counter"), 1.5); + } + + // reflection information for storage: +1 = D0, -1 = D0bar, 0 = neither + int matchedFrom = 0; + int decayChannel = 1 << aod::hf_cand_2prong::DecayType::D0ToPiK; + + 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; + } else { // matched to another kind of particle on truth level + matchedFrom = 0; + } // 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], // ML scores for bkg, prompt and non-prompt + matchedFrom, mcdd0cand.candidateSelFlag()); // check whether detector level candidate is a reflection, CandidateSelFlag == 0 -> selected as D0, CandidateSelFlag == 1 -> selected as D0bar } } @@ -260,12 +348,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(); + 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 +367,77 @@ struct HfFragmentationFunctionTask { } PROCESS_SWITCH(HfFragmentationFunctionTask, processMcEfficiency, "non-matched and matched MC HF and jets", false); - void processMcChargedMatched(JetMcCollision const&, - JetMCDTable const&, - JetMCPTable const& mcpjets, - CandidatesD0MCD const&, - CandidatesD0MCP const&) + void processMcChargedMatched(aod::JetMcCollisions const& mccollisions, + aod::JetCollisionsMCD const& collisions, + JetMCDTable const& mcdjets, + JetMCPTable const&, + aod::CandidatesD0MCD 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) { - // 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 + 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); + } + + // obtain leading HF candidate in jet + auto mcdd0cand = mcdjet.candidates_first_as(); + + // reflection information for storage: +1 = D0, -1 = D0bar, 0 = neither + int matchedFrom = 0; + int decayChannel = 1 << aod::hf_cand_2prong::DecayType::D0ToPiK; + + 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; + } else { // matched to another kind of particle on truth level + matchedFrom = 0; + } + + // 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], + matchedFrom, mcdd0cand.candidateSelFlag()); // check whether detector level candidate is a reflection, CandidateSelFlag == 0 -> selected as D0, CandidateSelFlag == 1 -> selected as D0bar + } + } } } } diff --git a/PWGJE/Tasks/jetChCorr.cxx b/PWGJE/Tasks/jetChCorr.cxx index 8d3cffd5346..43486b4567c 100644 --- a/PWGJE/Tasks/jetChCorr.cxx +++ b/PWGJE/Tasks/jetChCorr.cxx @@ -394,36 +394,36 @@ struct JetChCorr { } } - void processDummy(JetTracks const&) + void processDummy(aod::JetTracks const&) { } PROCESS_SWITCH(JetChCorr, processDummy, "Dummy process function turned on by default", true); - void processChargedJetsData(soa::Join::iterator const& jet, JetTracks const& tracks) + void processChargedJetsData(soa::Join::iterator const& jet, aod::JetTracks const& tracks) { analyseCharged(jet, tracks); } PROCESS_SWITCH(JetChCorr, processChargedJetsData, "charged jet substructure", false); void processChargedJetsEventWiseSubData(soa::Join::iterator const& jet, - JetTracksSub const& tracks) + aod::JetTracksSub const& tracks) { analyseCharged(jet, tracks); } PROCESS_SWITCH(JetChCorr, processChargedJetsEventWiseSubData, "eventwise-constituent subtracted charged jet substructure", false); void processChargedJetsMCD(typename soa::Join::iterator const& jet, - JetTracks const& tracks) + aod::JetTracks const& tracks) { analyseCharged(jet, tracks); } PROCESS_SWITCH(JetChCorr, processChargedJetsMCD, "charged jet substructure", false); void processChargedJetsMCP(typename soa::Join::iterator const& jet, - JetParticles const&) + aod::JetParticles const&) { jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { + for (auto& jetConstituent : jet.template tracks_as()) { fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); } jetReclustering(jet); diff --git a/PWGJE/Tasks/jetHadronRecoil.cxx b/PWGJE/Tasks/jetHadronRecoil.cxx index b9d8674251b..5b5c256526c 100644 --- a/PWGJE/Tasks/jetHadronRecoil.cxx +++ b/PWGJE/Tasks/jetHadronRecoil.cxx @@ -424,10 +424,10 @@ struct hJetAnalysis { } } - void processData(soa::Filtered::iterator const& collision, + void processData(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, - soa::Filtered const& tracks) + soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -440,10 +440,10 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processData, "process data", true); - void processMCD(soa::Filtered::iterator const& collision, + void processMCD(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, - soa::Filtered const& tracks) + soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -456,11 +456,11 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processMCD, "process MC detector level", false); - void processMCDWeighted(soa::Filtered>::iterator const& collision, + void processMCDWeighted(soa::Filtered>::iterator const& collision, aod::JMcCollisions const&, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, - soa::Filtered const& tracks) + soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -473,10 +473,10 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processMCDWeighted, "process MC detector level with event weights", false); - void processMCP(JetMcCollision const& collision, + void processMCP(aod::JetMcCollision const& collision, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, - JetParticles const& particles) + aod::JetParticles const& particles) { if (std::abs(collision.posZ()) > vertexZCut) { return; @@ -486,10 +486,10 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processMCP, "process MC particle level", false); - void processMCPWeighted(JetMcCollision const& collision, + void processMCPWeighted(aod::JetMcCollision const& collision, soa::Filtered> const& jets, soa::Filtered> const& jetsWTA, - JetParticles const& particles) + aod::JetParticles const& particles) { if (std::abs(collision.posZ()) > vertexZCut) { return; @@ -499,13 +499,13 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processMCPWeighted, "process MC particle level with event weights", false); - void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, + void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, - JetTracks const&, - JetParticles const&, - JetMcCollisions const&, + aod::JetTracks const&, + aod::JetParticles const&, + aod::JetMcCollisions const&, soa::Filtered> const& mcpjets) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { @@ -522,13 +522,13 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processJetsMCPMCDMatched, "process MC matched (inc jets)", false); - void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, + void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, - JetTracks const&, - JetParticles const&, - JetMcCollisions const&, + aod::JetTracks const&, + aod::JetParticles const&, + aod::JetMcCollisions const&, soa::Filtered> const& mcpjets) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { @@ -545,13 +545,13 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processJetsMCPMCDMatchedWeighted, "process MC matched with event weights (inc jets)", false); - void processRecoilJetsMCPMCDMatched(soa::Filtered::iterator const& collision, + void processRecoilJetsMCPMCDMatched(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, - JetTracks const& tracks, - JetParticles const&, - JetMcCollisions const&, + aod::JetTracks const& tracks, + aod::JetParticles const&, + aod::JetMcCollisions const&, soa::Filtered> const& mcpjets) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { @@ -577,13 +577,13 @@ struct hJetAnalysis { } PROCESS_SWITCH(hJetAnalysis, processRecoilJetsMCPMCDMatched, "process MC matched (recoil jets)", false); - void processRecoilJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, + void processRecoilJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, soa::Filtered> const& mcdjetsWTA, soa::Filtered> const& mcpjetsWTA, - JetTracks const& tracks, - JetParticles const&, - JetMcCollisions const&, + aod::JetTracks const& tracks, + aod::JetParticles const&, + aod::JetMcCollisions const&, soa::Filtered> const& mcpjets) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { diff --git a/PWGJE/Tasks/jetLundReclustering.cxx b/PWGJE/Tasks/jetLundReclustering.cxx index ef01fad490d..4b43b0ad2a2 100644 --- a/PWGJE/Tasks/jetLundReclustering.cxx +++ b/PWGJE/Tasks/jetLundReclustering.cxx @@ -112,15 +112,15 @@ struct JetLundReclustering { } // Dummy process - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetLundReclustering, processDummy, "Dummy process function, turned on by default", true); // Process function for charged jets - void processChargedJets(soa::Filtered::iterator const& collision, + void processChargedJets(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, - JetTracks const&) + aod::JetTracks const&) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -128,7 +128,7 @@ struct JetLundReclustering { for (const auto& jet : jets) { registry.fill(HIST("jet_PtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); jetConstituents.clear(); - for (auto& jetConstituent : jet.tracks_as()) { + for (auto& jetConstituent : jet.tracks_as()) { fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); } // Perform jet reclustering diff --git a/PWGJE/Tasks/jetSpectraEseTask.cxx b/PWGJE/Tasks/jetSpectraEseTask.cxx new file mode 100644 index 00000000000..96ecaba87b9 --- /dev/null +++ b/PWGJE/Tasks/jetSpectraEseTask.cxx @@ -0,0 +1,279 @@ +// 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 jetSpectraEseTask.cxx +/// \brief jet spectra analysis framework with ESE (19/08/2024) +/// +/// \author Joachim C. K. B. Hansen, Lund University + +#include + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" + +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +#include "Common/DataModel/EseTable.h" +#include "Common/DataModel/Qvectors.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +#include "Framework/runDataProcessing.h" + +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"}; + Configurable vertexZCut{"vertexZCut", 10.0, "vertex z cut"}; + Configurable> CentRange{"CentRange", {30, 50}, "centrality region of interest"}; + Configurable leadingJetPtCut{"fLeadingJetPtCut", 5.0, "leading jet pT cut"}; + + Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + + Configurable fColSwitch{"fColSwitch", 0, "collision switch"}; + + AxisSpec jetPtAxis = {binJetPt, "#it{p}_{T,jet}"}; + AxisSpec dPhiAxis = {bindPhi, "#Delta#phi"}; + AxisSpec eseAxis = {binESE, "#it{q}_{2}"}; + + AxisSpec cosAxis = {binCos, ""}; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + int eventSelection = -1; + int trackSelection = -1; + + void init(o2::framework::InitContext&) + { + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + + LOGF(info, "jetSpectraEse::init()"); + + switch (fColSwitch) { + case 0: + LOGF(info, "JetSpectraEseTask::init() - using data"); + 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"); + registry.add("h_mc_collisions", "event status;event status;entries", {HistType::kTH1F, {{10, 0.0, 10.0}}}); + registry.add("h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); + registry.add("h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("h_part_jet_pt_match", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); + registry.add("h_part_jet_eta_match", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_part_jet_phi_match", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("h_detector_jet_pt", "detector level jet pT;#it{p}_{T,jet det} (GeV/#it{c});entries", {HistType::kTH1F, {{jetPtAxis}}}); + registry.add("h_detector_jet_eta", "detector level jet #eta;#eta_{jet det};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_detector_jet_phi", "detector level jet #phi;#phi_{jet det};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}); + registry.add("h_matched_jets_pt_delta", "#it{p}_{T,jet part}; det - part", {HistType::kTH2F, {{jetPtAxis}, {200, -20., 20.0}}}); + registry.add("h_matched_jets_eta_delta", "#eta_{jet part}; det - part", {HistType::kTH2F, {{100, -1.0, 1.0}, {200, -20.0, 20.0}}}); + registry.add("h_matched_jets_phi_delta", "#phi_{jet part}; det - part", {HistType::kTH2F, {{80, -1.0, 7.}, {200, -20.0, 20.}}}); + registry.add("h_response_mat_match", "#it{p}_{T, jet det}; #it{p}_{T, jet part}", HistType::kTH2F, {jetPtAxis, jetPtAxis}); + break; + } + } + + Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f) && nabs(aod::jet::eta) < 0.9f - jetR; + Filter colFilter = nabs(aod::jcollision::posZ) < vertexZCut; + Filter mcCollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; + + void processESEDataCharged(soa::Join::iterator const& collision, + soa::Join const&, + soa::Filtered const& jets, + aod::JetTracks const& tracks) + { + float counter{0.5f}; + 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("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("hEventCounter"), counter++); + + if (!isAcceptedLeadTrack(tracks)) + return; + + 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("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("hdPhi"), dPhi); + registry.fill(HIST("hJetPtdPhiq2"), jetpT_bkgsub, dPhi, qPerc[0]); /* check the dphi */ + } + registry.fill(HIST("hEventCounter"), counter++); + } + PROCESS_SWITCH(JetSpectraEseTask, processESEDataCharged, "process ese collisions", true); + + void processMCParticleLevel(soa::Filtered::iterator const& jet) + { + registry.fill(HIST("h_part_jet_pt"), jet.pt()); + registry.fill(HIST("h_part_jet_eta"), jet.eta()); + registry.fill(HIST("h_part_jet_phi"), jet.phi()); + } + PROCESS_SWITCH(JetSpectraEseTask, processMCParticleLevel, "jets on particle level MC", false); + + using JetMCPTable = soa::Filtered>; + void processMCChargedMatched(soa::Filtered::iterator const& collision, + soa::Filtered> const& mcdjets, + JetMCPTable const&, + aod::JetTracks const&, + aod::JetParticles const&) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) + return; + + float counter{0.5f}; + registry.fill(HIST("h_mc_collisions"), counter++); + for (const auto& mcdjet : mcdjets) { + + registry.fill(HIST("h_detector_jet_pt"), mcdjet.pt()); + registry.fill(HIST("h_detector_jet_eta"), mcdjet.eta()); + registry.fill(HIST("h_detector_jet_phi"), mcdjet.phi()); + for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + + registry.fill(HIST("h_part_jet_pt_match"), mcpjet.pt()); + registry.fill(HIST("h_part_jet_eta_match"), mcpjet.eta()); + registry.fill(HIST("h_part_jet_phi_match"), mcpjet.phi()); + + registry.fill(HIST("h_matched_jets_pt_delta"), mcpjet.pt(), mcdjet.pt() - mcpjet.pt()); + registry.fill(HIST("h_matched_jets_phi_delta"), mcpjet.phi(), mcdjet.phi() - mcpjet.phi()); + registry.fill(HIST("h_matched_jets_eta_delta"), mcpjet.eta(), mcdjet.eta() - mcpjet.eta()); + + registry.fill(HIST("h_response_mat_match"), mcdjet.pt(), mcpjet.pt()); + } + } + registry.fill(HIST("h_mc_collisions"), counter++); + } + PROCESS_SWITCH(JetSpectraEseTask, processMCChargedMatched, "jet matched mcp and mcd", false); + + template + bool isAcceptedLeadTrack(T const& tracks) + { + double leadingTrackpT{0.0}; + for (const auto& track : tracks) { + if (track.pt() > leadingJetPtCut) { + if (track.pt() > leadingTrackpT) { + leadingTrackpT = track.pt(); + } + } + } + if (leadingTrackpT == 0.0) + return false; + 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/jetTutorial.cxx b/PWGJE/Tasks/jetTutorial.cxx index 0065726bae2..230aaa53aaa 100644 --- a/PWGJE/Tasks/jetTutorial.cxx +++ b/PWGJE/Tasks/jetTutorial.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// jet tutorial task for hands on tutorial session (09/11/2023) +// jet tutorial task for hands on tutorial session (16/11/2024) // /// \author Nima Zardoshti // @@ -26,6 +26,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetUtilities.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" #include "PWGJE/DataModel/Jet.h" @@ -45,12 +46,14 @@ struct JetTutorialTask { {"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_jet_pt_bkgsub", "jet pT bkg sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_jet_pt_rhosub", "jet pT bkg sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_jet_pt_constsub", "jet pT bkg sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, {"h_jet_ntracks", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}}, {"h_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}}, + {"h_jet_angularity_constsub", "jet angularity bkg sub;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}}, {"h_full_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_full_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, @@ -66,24 +69,37 @@ struct JetTutorialTask { {"h_matched_jets_eta", "#eta_{jet part}; #eta_{jet det}", {HistType::kTH2F, {{100, -1.0, 1.0}, {100, -1.0, 1.0}}}}, {"h_matched_jets_phi", "#phi_{jet part}; #phi_{jet det}", {HistType::kTH2F, {{80, -1.0, 7.}, {80, -1.0, 7.}}}}}}; + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable kappa{"kappa", 1.0, "angularity kappa"}; + Configurable alpha{"alpha", 1.0, "angularity alpha"}; + + 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"}; + int eventSelection = -1; int trackSelection = -1; + std::vector triggerMaskBits; void init(o2::framework::InitContext&) { eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); } Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); + Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + Filter mcCollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; + + Preslice> perMcCollisionJets = aod::jet::mcCollisionId; - void processCollisions(JetCollision const& collision, JetTracks const& tracks) + void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks) { registry.fill(HIST("h_collisions"), 0.5); @@ -100,9 +116,9 @@ struct JetTutorialTask { registry.fill(HIST("h_track_phi"), track.phi()); } } - PROCESS_SWITCH(JetTutorialTask, processCollisions, "process self contained collisions", true); + PROCESS_SWITCH(JetTutorialTask, processCollisions, "process JE collisions", false); - void processCollisionsWithExternalTracks(JetCollision const& collision, soa::Join const& tracks, soa::Join const&) + void processCollisionsWithExternalTracks(soa::Filtered::iterator const& collision, soa::Join const& tracks, soa::Join const&) { registry.fill(HIST("h_collisions"), 0.5); @@ -121,126 +137,167 @@ struct JetTutorialTask { registry.fill(HIST("h_track_chi2PerCluster"), originalTrack.tpcChi2NCl()); } } - PROCESS_SWITCH(JetTutorialTask, processCollisionsWithExternalTracks, "process non self contained collisions", true); + PROCESS_SWITCH(JetTutorialTask, processCollisionsWithExternalTracks, "process JE collisions with access to the original track table", false); - void processDataCharged(soa::Filtered::iterator const& jet) + void processDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) { - registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_eta"), jet.eta()); - registry.fill(HIST("h_jet_phi"), jet.phi()); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto& jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + } } - PROCESS_SWITCH(JetTutorialTask, processDataCharged, "jets data", true); + PROCESS_SWITCH(JetTutorialTask, processDataCharged, "charged jets in data", false); - void processMCDetectorLevelCharged(soa::Filtered::iterator const& jet) + void processMCDetectorLevelCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) { - registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_eta"), jet.eta()); - registry.fill(HIST("h_jet_phi"), jet.phi()); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto& jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + } } - PROCESS_SWITCH(JetTutorialTask, processMCDetectorLevelCharged, "jets on detector level MC", false); + PROCESS_SWITCH(JetTutorialTask, processMCDetectorLevelCharged, "charged jets in detector level MC", false); - void processMCParticleLevel(soa::Filtered::iterator const& jet) + void processMCDetectorLevelWeightedCharged(soa::Filtered::iterator const& collision, aod::JetMcCollisions const&, soa::Filtered const& jets) { - registry.fill(HIST("h_part_jet_pt"), jet.pt()); - registry.fill(HIST("h_part_jet_eta"), jet.eta()); - registry.fill(HIST("h_part_jet_phi"), jet.phi()); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto& jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt(), collision.mcCollision().weight()); + registry.fill(HIST("h_jet_eta"), jet.eta(), collision.mcCollision().weight()); + registry.fill(HIST("h_jet_phi"), jet.phi(), collision.mcCollision().weight()); + } } - PROCESS_SWITCH(JetTutorialTask, processMCParticleLevel, "jets on particle level MC", false); + PROCESS_SWITCH(JetTutorialTask, processMCDetectorLevelWeightedCharged, "charged jets in weighted detector level MC", false); - void processMCCharged(JetCollision const&, soa::Filtered const& mcdjets, soa::Filtered const& mcpjets) + void processMCParticleLevelCharged(soa::Filtered::iterator const& mcCollision, soa::Filtered const& jets) { + for (auto& jet : jets) { + registry.fill(HIST("h_part_jet_pt"), jet.pt(), mcCollision.weight()); + registry.fill(HIST("h_part_jet_eta"), jet.eta(), mcCollision.weight()); + registry.fill(HIST("h_part_jet_phi"), jet.phi(), mcCollision.weight()); + } + } + PROCESS_SWITCH(JetTutorialTask, processMCParticleLevelCharged, "charged jets in particle level MC", false); + + void processMCCharged(soa::Filtered::iterator const& collision, aod::JetMcCollisions const&, soa::Filtered const& mcdjets, soa::Filtered const& mcpjets) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } for (auto& mcdjet : mcdjets) { - registry.fill(HIST("h_jet_pt"), mcdjet.pt()); - registry.fill(HIST("h_jet_eta"), mcdjet.eta()); - registry.fill(HIST("h_jet_phi"), mcdjet.phi()); + registry.fill(HIST("h_jet_pt"), mcdjet.pt(), collision.mcCollision().weight()); + registry.fill(HIST("h_jet_eta"), mcdjet.eta(), collision.mcCollision().weight()); + registry.fill(HIST("h_jet_phi"), mcdjet.phi(), collision.mcCollision().weight()); } - for (auto& mcpjet : mcpjets) { - registry.fill(HIST("h_part_jet_pt"), mcpjet.pt()); - registry.fill(HIST("h_part_jet_eta"), mcpjet.eta()); - registry.fill(HIST("h_part_jet_phi"), mcpjet.phi()); + auto mcpjetsPerCollision = mcpjets.sliceBy(perMcCollisionJets, collision.mcCollisionId()); + for (auto& mcpjet : mcpjetsPerCollision) { + registry.fill(HIST("h_part_jet_pt"), mcpjet.pt(), collision.mcCollision().weight()); + registry.fill(HIST("h_part_jet_eta"), mcpjet.eta(), collision.mcCollision().weight()); + registry.fill(HIST("h_part_jet_phi"), mcpjet.phi(), collision.mcCollision().weight()); } } - PROCESS_SWITCH(JetTutorialTask, processMCCharged, "jets on detector and particle level MC", false); + PROCESS_SWITCH(JetTutorialTask, processMCCharged, "charged jets in detector and particle level MC", false); using JetMCPTable = soa::Filtered>; - void processMCChargedMatched(JetCollision const&, + void processMCMatchedCharged(soa::Filtered::iterator const& collision, soa::Filtered> const& mcdjets, JetMCPTable const&, - JetTracks const&, - JetParticles const&) + aod::JetTracks const&, + aod::JetParticles const&) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } for (const auto& mcdjet : mcdjets) { - for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - // for (auto& mcpjet : mcdjet.template matchedJetPt_as()) { - - registry.fill(HIST("h_matched_jets_pt"), mcpjet.pt(), mcdjet.pt()); - registry.fill(HIST("h_matched_jets_pt"), mcpjet.phi(), mcdjet.phi()); - registry.fill(HIST("h_matched_jets_pt"), mcpjet.eta(), mcdjet.eta()); + registry.fill(HIST("h_matched_jets_pt"), mcpjet.pt(), mcdjet.pt(), collision.mcCollision().weight()); + registry.fill(HIST("h_matched_jets_pt"), mcpjet.phi(), mcdjet.phi(), collision.mcCollision().weight()); + registry.fill(HIST("h_matched_jets_pt"), mcpjet.eta(), mcdjet.eta(), collision.mcCollision().weight()); } } } - PROCESS_SWITCH(JetTutorialTask, processMCChargedMatched, "jet finder QA matched mcp and mcd", false); + PROCESS_SWITCH(JetTutorialTask, processMCMatchedCharged, "matched detector and particle level charged jets", false); - void processDataChargedSubstructure(soa::Filtered>::iterator const& jet, JetTracks const&) + void processDataSubstructureCharged(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, aod::JetTracks const&) { - // add aditional selection on jet eta - registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_eta"), jet.eta()); - registry.fill(HIST("h_jet_phi"), jet.phi()); - registry.fill(HIST("h_jet_ntracks"), jet.tracksIds().size()); - double angularity = 0.0; - for (auto& jetConstituent : jet.tracks_as()) { - angularity += jetConstituent.pt() * TMath::Sqrt(TMath::Power(jet.phi() - jetConstituent.phi(), 2.0) + TMath::Power(jet.eta() - jetConstituent.eta(), 2.0)); - } - registry.fill(HIST("h_jet_angularity"), angularity / (jet.pt() * round(jet.r() / 100.0f))); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto& jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + registry.fill(HIST("h_jet_ntracks"), jet.tracksIds().size()); + double angularity = 0.0; + for (auto& jetConstituent : jet.tracks_as()) { + angularity += std::pow(jetConstituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, jetConstituent), alpha); + } + angularity /= (jet.pt() * (jet.r() / 100.f)); + registry.fill(HIST("h_jet_angularity"), angularity); + } } - PROCESS_SWITCH(JetTutorialTask, processDataChargedSubstructure, "jet substructure charged jets", false); + PROCESS_SWITCH(JetTutorialTask, processDataSubstructureCharged, "charged jet substructure", false); - void processMCParticleSubstructure(soa::Filtered>::iterator const& jet, JetParticles const&) + void processDataFull(soa::Filtered::iterator const&, soa::Filtered const& jets) { - double angularity = 0.0; - for (auto& jetConstituents : jet.tracks_as()) { - angularity += jetConstituents.pt() * TMath::Sqrt(TMath::Power(jet.phi() - jetConstituents.phi(), 2.0) + TMath::Power(jet.eta() - jetConstituents.eta(), 2.0)); + for (auto& jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); } - registry.fill(HIST("h_part_jet_angularity"), angularity / (jet.pt() * round(jet.r() / 100.0f))); } - PROCESS_SWITCH(JetTutorialTask, processMCParticleSubstructure, "jet substructure particle level full jets", false); + PROCESS_SWITCH(JetTutorialTask, processDataFull, "full jets in data", false); - void processDataFull(soa::Filtered::iterator const& jet) + void processDataSubstructureFull(soa::Filtered::iterator const&, soa::Filtered> const& jets, aod::JetTracks const&, aod::JetClusters const&) { - registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_eta"), jet.eta()); - registry.fill(HIST("h_jet_phi"), jet.phi()); - } - PROCESS_SWITCH(JetTutorialTask, processDataFull, "jets data", true); + for (auto& jet : jets) { + registry.fill(HIST("h_full_jet_pt"), jet.pt()); + registry.fill(HIST("h_full_jet_eta"), jet.eta()); + registry.fill(HIST("h_full_jet_phi"), jet.phi()); + registry.fill(HIST("h_full_jet_ntracks"), jet.tracksIds().size()); + registry.fill(HIST("h_full_jet_nclusters"), jet.clustersIds().size()); + double angularity = 0.0; + for (auto& jetConstituent : jet.tracks_as()) { + angularity += std::pow(jetConstituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, jetConstituent), alpha); + } - void processDataFullSubstructure(soa::Filtered>::iterator const& jet, JetTracks const&, JetClusters const&) - { - // add aditional selection on jet eta - registry.fill(HIST("h_full_jet_pt"), jet.pt()); - registry.fill(HIST("h_full_jet_eta"), jet.eta()); - registry.fill(HIST("h_full_jet_phi"), jet.phi()); - registry.fill(HIST("h_full_jet_ntracks"), jet.tracksIds().size()); - registry.fill(HIST("h_full_jet_nclusters"), jet.clustersIds().size()); - double angularity = 0.0; - for (auto& jetTrack : jet.tracks_as()) { - angularity += jetTrack.pt() * TMath::Sqrt(TMath::Power(jet.phi() - jetTrack.phi(), 2.0) + TMath::Power(jet.eta() - jetTrack.eta(), 2.0)); - } + for (auto& jetCluster : jet.tracks_as()) { + angularity += std::pow(jetCluster.energy(), kappa) * std::pow(jetutilities::deltaR(jet, jetCluster), alpha); + } - for (auto& jetCluster : jet.clusters_as()) { - angularity += jetCluster.energy() * TMath::Sqrt(TMath::Power(jet.phi() - jetCluster.phi(), 2.0) + TMath::Power(jet.eta() - jetCluster.eta(), 2.0)); + registry.fill(HIST("h_full_jet_angularity"), angularity / (jet.pt() * round(jet.r() * 100.0f))); } + } + PROCESS_SWITCH(JetTutorialTask, processDataSubstructureFull, "full jet substructure", false); - registry.fill(HIST("h_full_jet_angularity"), angularity / (jet.pt() * round(jet.r() * 100.0f))); + void processMCParticleLevelSubstructureFull(soa::Filtered::iterator const& mcCollision, soa::Filtered> const& jets, aod::JetParticles const&) + { + for (auto& jet : jets) { + double angularity = 0.0; + for (auto& jetConstituent : jet.tracks_as()) { + angularity += std::pow(jetConstituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, jetConstituent), alpha); + } + angularity /= (jet.pt() * (jet.r() / 100.f)); + registry.fill(HIST("h_part_jet_angularity"), angularity, mcCollision.weight()); + } } - PROCESS_SWITCH(JetTutorialTask, processDataFullSubstructure, "jet substructure full jets", false); + PROCESS_SWITCH(JetTutorialTask, processMCParticleLevelSubstructureFull, "full particle level jet substructure", false); - void processDataRecoil(JetCollision const& collision, soa::Filtered const& jets, JetTracks const& tracks) + void processRecoilDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets, aod::JetTracks const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + bool selectedEvent = false; double leadingTrackpT = 0.0; double leadingTrackPhi = 0.0; for (auto& track : tracks) { @@ -248,13 +305,15 @@ struct JetTutorialTask { if (track.pt() > leadingTrackpT) { leadingTrackpT = track.pt(); leadingTrackPhi = track.phi(); + selectedEvent = true; } } } - if (leadingTrackpT == 0.0) + if (!selectedEvent) { 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)) { + 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()); @@ -262,18 +321,67 @@ struct JetTutorialTask { } } } - PROCESS_SWITCH(JetTutorialTask, processDataRecoil, "hadron-recoil jets", false); + PROCESS_SWITCH(JetTutorialTask, processRecoilDataCharged, "hadron-recoil charged jets", false); + + void processDataRhoAreaSubtractedCharged(soa::Filtered>::iterator const& collision, soa::Filtered const& jets) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto jet : jets) { + registry.fill(HIST("h_jet_pt"), jet.pt()); + registry.fill(HIST("h_jet_pt_rhosub"), jet.pt() - (collision.rho() * jet.area())); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + } + } + PROCESS_SWITCH(JetTutorialTask, processDataRhoAreaSubtractedCharged, "charged rho-area subtracted jets", false); + + void processDataConstituentSubtractedCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto jet : jets) { + registry.fill(HIST("h_jet_pt_constsub"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + } + } + PROCESS_SWITCH(JetTutorialTask, processDataConstituentSubtractedCharged, "charged constituent subtracted jets", false); - /*void processDataBackgroundSubtracted(soa::Join::iterator const& collision, soa::Filtered const& jets) + void processDataConstituentSubtractedSubstructureCharged(soa::Filtered::iterator const& collision, soa::Filtered> const& jets, aod::JetTracksSub const&) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } for (auto jet : jets) { + registry.fill(HIST("h_jet_pt_constsub"), jet.pt()); + registry.fill(HIST("h_jet_eta"), jet.eta()); + registry.fill(HIST("h_jet_phi"), jet.phi()); + registry.fill(HIST("h_jet_ntracks"), jet.tracksIds().size()); + double angularity = 0.0; + for (auto& jetConstituent : jet.tracks_as()) { + angularity += std::pow(jetConstituent.pt(), kappa) * std::pow(jetutilities::deltaR(jet, jetConstituent), alpha); + } + angularity /= (jet.pt() * (jet.r() / 100.f)); + registry.fill(HIST("h_jet_angularity_constsub"), angularity); + } + } + PROCESS_SWITCH(JetTutorialTask, processDataConstituentSubtractedSubstructureCharged, "charged constituent subtracted jet substructure", false); + + void processDataTriggered(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection) || !jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } + for (auto& jet : jets) { registry.fill(HIST("h_jet_pt"), jet.pt()); - registry.fill(HIST("h_jet_pt_bkgsub"), jet.pt() - (collision.rho() * jet.area())); registry.fill(HIST("h_jet_eta"), jet.eta()); registry.fill(HIST("h_jet_phi"), jet.phi()); } } - PROCESS_SWITCH(JetTutorialTask, processDataBackgroundSubtracted, "baackground subtracted jets", false);*/ + PROCESS_SWITCH(JetTutorialTask, processDataTriggered, "jets triggered", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-tutorial"})}; } diff --git a/PWGJE/Tasks/jetTutorialSkeleton.cxx b/PWGJE/Tasks/jetTutorialSkeleton.cxx index ba5310ef535..70fc22ec736 100644 --- a/PWGJE/Tasks/jetTutorialSkeleton.cxx +++ b/PWGJE/Tasks/jetTutorialSkeleton.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// jet tutorial skeleton task for hands on tutorial session (09/11/2023) +// jet tutorial task for hands on tutorial session (16/11/2024) // /// \author Nima Zardoshti // @@ -26,6 +26,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetUtilities.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" #include "PWGJE/DataModel/Jet.h" @@ -45,12 +46,14 @@ struct JetTutorialSkeletonTask { {"h_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, - {"h_jet_pt_bkgsub", "jet pT bkg sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_jet_pt_rhosub", "jet pT bkg sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, + {"h_jet_pt_constsub", "jet pT bkg sub;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_part_jet_pt", "particle level jet pT;#it{p}_{T,jet part} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_part_jet_eta", "particle level jet #eta;#eta_{jet part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_part_jet_phi", "particle level jet #phi;#phi_{jet part};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, {"h_jet_ntracks", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{40, -0.5, 39.5}}}}, {"h_jet_angularity", "jet angularity ;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}}, + {"h_jet_angularity_constsub", "jet angularity bkg sub;#lambda_{1};entries", {HistType::kTH1F, {{5, 0.0, 0.5}}}}, {"h_full_jet_pt", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}}, {"h_full_jet_eta", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}}, {"h_full_jet_phi", "jet #phi;#phi_{jet};entries", {HistType::kTH1F, {{80, -1.0, 7.}}}}, @@ -66,92 +69,153 @@ struct JetTutorialSkeletonTask { {"h_matched_jets_eta", "#eta_{jet part}; #eta_{jet det}", {HistType::kTH2F, {{100, -1.0, 1.0}, {100, -1.0, 1.0}}}}, {"h_matched_jets_phi", "#phi_{jet part}; #phi_{jet det}", {HistType::kTH2F, {{80, -1.0, 7.}, {80, -1.0, 7.}}}}}}; + Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable jetPtMin{"jetPtMin", 5.0, "minimum jet pT cut"}; Configurable jetR{"jetR", 0.4, "jet resolution parameter"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable kappa{"kappa", 1.0, "angularity kappa"}; + Configurable alpha{"alpha", 1.0, "angularity alpha"}; + + 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"}; + int eventSelection = -1; int trackSelection = -1; + std::vector triggerMaskBits; void init(o2::framework::InitContext&) { eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(triggerMasks); } Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); + Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + Filter mcCollisionFilter = nabs(aod::jmccollision::posZ) < vertexZCut; - void processCollisions(aod::JCollision const&, aod::JTracks const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processCollisions, "process self contained collisions", true); + Preslice> perMcCollisionJets = aod::jet::mcCollisionId; - void processCollisionsWithExternalTracks(aod::JCollision const&, soa::Join const&, soa::Join const&) + void processDummy(aod::JDummys const&) { } - PROCESS_SWITCH(JetTutorialSkeletonTask, processCollisionsWithExternalTracks, "process non self contained collisions", true); + PROCESS_SWITCH(JetTutorialSkeletonTask, processDummy, "dummy process", false); - void processDataCharged(soa::Filtered::iterator const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processDataCharged, "jets data", true); + /* + void processCollisions(aod::JetCollision const& collision, aod::JetTracks const& tracks) + { - void processMCDetectorLevelCharged(soa::Filtered::iterator const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processMCDetectorLevelCharged, "jets on detector level MC", false); + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processCollisions, "process JE collisions", false); - void processMCParticleLevel(soa::Filtered::iterator const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleLevel, "jets on particle level MC", false); + void processCollisionsWithExternalTracks(soa::Filtered::iterator const& collision, soa::Join const& tracks, soa::Join const&) + { - void processMCCharged(aod::JCollisions const&, soa::Filtered const&, soa::Filtered const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processMCCharged, "jets on detector and particle level MC", false); - - using JetMCPTable = soa::Filtered>; - void processMCChargedMatched(aod::JCollision const&, - soa::Filtered> const&, - JetMCPTable const&, - aod::JTracks const&, - aod::JMcParticles const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processMCChargedMatched, "jet finder QA matched mcp and mcd", false); + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processCollisionsWithExternalTracks, "process JE collisions with access to the original track table", false); - void processDataChargedSubstructure(soa::Filtered>::iterator const&, aod::JTracks const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processDataChargedSubstructure, "jet substructure charged jets", false); + void processDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { - void processMCParticleSubstructure(soa::Filtered>::iterator const&, aod::JMcParticles const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleSubstructure, "jet substructure particle level full jets", false); + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataCharged, "charged jets in data", false); - void processDataFull(soa::Filtered::iterator const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processDataFull, "jets data", true); + void processMCDetectorLevelCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { - void processDataFullSubstructure(soa::Filtered>::iterator const&, aod::JTracks const&, aod::JClusters const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processDataFullSubstructure, "jet substructure full jets", false); + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCDetectorLevelCharged, "charged jets in detector level MC", false); - void processDataRecoil(aod::JCollision const&, soa::Filtered const&, aod::JTracks const&) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processDataRecoil, "hadron-recoil jets", false); + void processMCDetectorLevelWeightedCharged(soa::Filtered::iterator const& collision, aod::JetMcCollisions const& ,soa::Filtered const& jets) + { - /*void processDataBackgroundSubtracted(soa::Join::iterator const& collision, soa::Filtered const& jets) - { - } - PROCESS_SWITCH(JetTutorialSkeletonTask, processDataBackgroundSubtracted, "baackground subtracted jets", false);*/ + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCDetectorLevelWeightedCharged, "charged jets in weighted detector level MC", false); + + void processMCParticleLevelCharged(soa::Filtered::iterator const& mcCollision, soa::Filtered const& jets) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleLevelCharged, "charged jets in particle level MC", false); + + void processMCCharged(soa::Filtered::iterator const& collision, aod::JetMcCollisions const& , soa::Filtered const& mcdjets, soa::Filtered const& mcpjets) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCCharged, "charged jets in detector and particle level MC", false); + + + using JetMCPTable = soa::Filtered>; + void processMCMatchedCharged(soa::Filtered::iterator const& collision, + soa::Filtered> const& mcdjets, + JetMCPTable const&, + aod::JetTracks const&, + aod::JetParticles const&) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCMatchedCharged, "matched detector and particle level charged jets", false); + + void processDataSubstructureCharged(soa::Filtered::iterator const& collision, soa::Filtered>const& jets, aod::JetTracks const&) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataSubstructureCharged, "charged jet substructure", false); + + void processDataFull(soa::Filtered::iterator const& , soa::Filtered const& jets) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataFull, "full jets in data", false); + + void processDataSubstructureFull(soa::Filtered::iterator const& , soa::Filtered> const& jets, aod::JetTracks const&, aod::JetClusters const&) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataSubstructureFull, "full jet substructure", false); + + + void processMCParticleLevelSubstructureFull(soa::Filtered::iterator const& mcCollision, soa::Filtered> const& jets, aod::JetParticles const&) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processMCParticleLevelSubstructureFull, "full particle level jet substructure", false); + + + void processRecoilDataCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets, aod::JetTracks const& tracks) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processRecoilDataCharged, "hadron-recoil charged jets", false); + + void processDataRhoAreaSubtractedCharged(soa::Filtered>::iterator const& collision, soa::Filtered const& jets) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataRhoAreaSubtractedCharged, "charged rho-area subtracted jets", false); + + void processDataConstituentSubtractedCharged(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataConstituentSubtractedCharged, "charged constituent subtracted jets", false); + + + void processDataConstituentSubtractedSubstructureCharged(soa::Filtered::iterator const& collision, soa::Filtered>const& jets, aod::JetTracksSub const&) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataConstituentSubtractedSubstructureCharged, "charged constituent subtracted jet substructure", false); + + void processDataTriggered(soa::Filtered::iterator const& collision, soa::Filtered const& jets) + { + + } + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataTriggered, "jets triggered", false); + */ }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-tutorial-skeleton"})}; } diff --git a/PWGJE/Tasks/jetchargedv2.cxx b/PWGJE/Tasks/jetchargedv2.cxx new file mode 100644 index 00000000000..c3645ec47aa --- /dev/null +++ b/PWGJE/Tasks/jetchargedv2.cxx @@ -0,0 +1,556 @@ +// 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", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{40, 0.0, 40}}}); + registry.add("h_ptsum_sumpt", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, 0., TMath::TwoPi()}}}); + registry.add("h2_phi_track_eta", "phi vs track eta; #varphi; #eta (GeV/#it{c})", {HistType::kTH2F, {{100, -1.0, 1.0}, {160, 0., TMath::TwoPi()}}}); + registry.add("h2_phi_track_pt", "phi vs track pT; #varphi; #it{p}_{T,track} (GeV/#it{c})", {HistType::kTH2F, {{200, 0., 200.}, {160, 0., TMath::TwoPi()}}}); + registry.add("h2_centrality_phi_w_pt", "centrality vs jet #varphi; #varphi_{jet}; 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_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_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("histCentFull", "Centrality distribution for valid events", HistType::kTH1F, {axisCent}); + for (auto 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 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 + 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; + } + + //=====================< q-vector & evtpln check >=====================// + template + void fillHistosQvec(const T& vec, 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 (vec.qvecAmp()[DetId] > 1e-8) { + histosQA.fill(HIST("histQvecUncorV2"), vec.qvecRe()[DetInd], vec.qvecIm()[DetInd], vec.cent()); + histosQA.fill(HIST("histQvecRectrV2"), vec.qvecRe()[DetInd + 1], vec.qvecIm()[DetInd + 1], vec.cent()); + histosQA.fill(HIST("histQvecTwistV2"), vec.qvecRe()[DetInd + 2], vec.qvecIm()[DetInd + 2], vec.cent()); + histosQA.fill(HIST("histQvecFinalV2"), vec.qvecRe()[DetInd + 3], vec.qvecIm()[DetInd + 3], vec.cent()); + histosQA.fill(HIST("histEvtPlUncorV2"), helperEP.GetEventPlane(vec.qvecRe()[DetInd], vec.qvecIm()[DetInd], nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlRectrV2"), helperEP.GetEventPlane(vec.qvecRe()[DetInd + 1], vec.qvecIm()[DetInd + 1], nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlTwistV2"), helperEP.GetEventPlane(vec.qvecRe()[DetInd + 2], vec.qvecIm()[DetInd + 2], nmode), vec.cent()); + histosQA.fill(HIST("histEvtPlFinalV2"), helperEP.GetEventPlane(vec.qvecRe()[DetInd + 3], vec.qvecIm()[DetInd + 3], nmode), vec.cent()); + } + } + } + //=====================< q-vector & evtpln check | end >=====================// + 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 processSigmaPt(soa::Filtered> const& collisions, + soa::Join const& jets, + aod::JetTracks const& tracks) + { + double collnum = 1; + 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; + } + + //=====================< evt pln [n=2->\Psi_2, n=3->\Psi_3] >=====================// + for (auto 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()); + } + //< Psi_EP,2, JetPtCorr = Jet_pT-*A in-plane and out-of-plane >// + auto collJets = jets.sliceBy(JetsPerJCollision, collision.globalIndex()); // select the jet in collisions + 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 : collJets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + phiMinusPsi2 = jet.phi() - evtPl2; + Double_t jetPtCorr = 0.0; + jetPtCorr = jet.pt() - collision.rho() * jet.area(); + + 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 : collJets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(jet)) { + continue; + } + phiMinusPsi3 = jet.phi() - evtPl3; + Double_t jetPtCorr = 0.0; + jetPtCorr = jet.pt() - collision.rho() * jet.area(); + + 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); + } + } + } + } + //=====================< evt pln | end >=====================// + 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) && track.pt() >= 0.2 && track.pt() <= 5.) { + 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 + 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, "QA for charged tracks", true); + + void processRandomConeDataV2(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + soa::Filtered const& tracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + + for (auto 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) + { + registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + 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/jetfinderQA.cxx b/PWGJE/Tasks/jetfinderQA.cxx index edd974c71ed..efb303fbea8 100644 --- a/PWGJE/Tasks/jetfinderQA.cxx +++ b/PWGJE/Tasks/jetfinderQA.cxx @@ -150,9 +150,9 @@ struct JetFinderQATask { registry.add("h3_jet_r_jet_pt_track_eta", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, trackEtaAxis}}); registry.add("h3_jet_r_jet_pt_track_phi", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {160, -1.0, 7.}}}); registry.add("h3_jet_r_jet_pt_leadingtrack_pt", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c}); #it{p}_{T,leading track} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {200, 0.0, 200.0}}}); - registry.add("h_jet_phat", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0, 350}}}); - registry.add("h_jet_ptcut", "p_{T} cut;p_{T,jet} (GeV/#it{c});N;entries", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}); - registry.add("h_jet_phat_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0, 350}}}); + registry.add("h_jet_phat", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_jet_ptcut", "p_{T} cut;p_{T,jet} (GeV/#it{c});N;entries", {HistType::kTH2F, {{300, 0, 300}, {20, 0, 5}}}); + registry.add("h_jet_phat_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); registry.add("h3_centrality_occupancy_jet_pt", "centrality; occupancy; #it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH3F, {{120, -10.0, 110.0}, {60, 0, 30000}, jetPtAxis}}); } @@ -211,6 +211,8 @@ struct JetFinderQATask { registry.add("h2_centrality_rhorandomcone", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); registry.add("h2_centrality_rhorandomconerandomtrackdirection", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); registry.add("h2_centrality_rhorandomconewithoutleadingjet", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); + registry.add("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); + registry.add("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets", "; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);", {HistType::kTH2F, {{1100, 0., 110.}, {800, -400.0, 400.0}}}); } if (doprocessJetsMCP || doprocessJetsMCPWeighted) { @@ -225,9 +227,9 @@ struct JetFinderQATask { registry.add("h3_jet_r_part_jet_pt_part_track_pt_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#it{p}_{T,jet tracks}^{part} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {200, 0., 200.}}}); registry.add("h3_jet_r_part_jet_pt_part_track_eta_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#eta_{jet tracks}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, trackEtaAxis}}); registry.add("h3_jet_r_part_jet_pt_part_track_phi_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#varphi_{jet tracks}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {160, -1.0, 7.}}}); - registry.add("h_jet_phat_part", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0, 350}}}); - registry.add("h_jet_ptcut_part", "p_{T} cut;p_{T,jet}^{part} (GeV/#it{c});N;entries", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}); - registry.add("h_jet_phat_part_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0, 350}}}); + registry.add("h_jet_phat_part", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); + registry.add("h_jet_ptcut_part", "p_{T} cut;p_{T,jet}^{part} (GeV/#it{c});N;entries", {HistType::kTH2F, {{300, 0, 300}, {20, 0, 5}}}); + registry.add("h_jet_phat_part_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); } if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsSubMatched) { @@ -263,6 +265,7 @@ struct JetFinderQATask { registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {jetPtAxis, jetEtaAxis, jetEtaAxis}}); registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {jetPtAxis, {160, -1.0, 7.}, {160, -1.0, 7.}}}); registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {jetPtAxis, {200, -0.5, 199.5}, {200, -0.5, 199.5}}}); + registry.add("h3_ptcut_jet_pt_tag_jet_pt_base_matchedgeo", "N;#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{20, 0., 5.}, {300, 0., 300.}, {300, 0., 300.}}}); } if (doprocessTriggeredData) { @@ -325,7 +328,7 @@ 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; + PresliceUnsorted> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; template bool isAcceptedJet(U const& jet) @@ -363,6 +366,17 @@ struct JetFinderQATask { return true; } + template + bool trackIsInJet(T const& track, U const& jet) + { + for (auto const& constituentId : jet.tracksIds()) { + if (constituentId == track.globalIndex()) { + return true; + } + } + return false; + } + template void fillHistograms(T const& jet, float centrality, float occupancy, float weight = 1.0) { @@ -393,7 +407,7 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks"), jet.r() / 100.0, jet.pt(), jet.tracksIds().size(), weight); registry.fill(HIST("h3_jet_r_jet_pt_jet_area"), jet.r() / 100.0, jet.pt(), jet.area(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_eta"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); @@ -426,7 +440,7 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_jet_pt_jet_area_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.area(), weight); registry.fill(HIST("h3_jet_r_jet_pt_jet_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt(), jet.pt() - (rho * jet.area()), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.eta(), weight); @@ -455,7 +469,7 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.tracksIds().size(), weight); registry.fill(HIST("h3_jet_r_jet_pt_jet_area_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.area(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); @@ -486,7 +500,7 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_part_jet_eta_part_jet_phi_part"), jet.r() / 100.0, jet.eta(), jet.phi(), weight); registry.fill(HIST("h3_jet_r_part_jet_pt_part_jet_ntracks_part"), jet.r() / 100.0, jet.pt(), jet.tracksIds().size(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_pt_part"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_eta_part"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); @@ -515,6 +529,12 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + for (int N = 1; N < 21; N++) { + if (jetBase.pt() < N * 0.25 * pTHat && jetTag.pt() < N * 0.25 * pTHat) { + registry.fill(HIST("h3_ptcut_jet_pt_tag_jet_pt_base_matchedgeo"), N * 0.25, jetTag.pt(), jetBase.pt(), weight); + } + } + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeo"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeo"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); @@ -648,9 +668,29 @@ struct JetFinderQATask { } registry.fill(HIST("h2_centrality_rhorandomconewithoutleadingjet"), collision.centrality(), randomConePt - M_PI * randomConeR * randomConeR * collision.rho()); + + // randomised eta,phi for tracks, to assess part of fluctuations coming from statistically independently emitted particles, removing tracks from 2 leading jets + double randomConePtWithoutOneLeadJet = 0; + double randomConePtWithoutTwoLeadJet = 0; + for (auto const& track : tracks) { + if (jetderiveddatautilities::selectTrack(track, trackSelection)) { + float dPhi = RecoDecay::constrainAngle(randomNumber.Uniform(0.0, 2 * M_PI) - randomConePhi, static_cast(-M_PI)); // ignores actual phi of track + float dEta = randomNumber.Uniform(trackEtaMin, trackEtaMax) - randomConeEta; // ignores actual eta of track + if (TMath::Sqrt(dEta * dEta + dPhi * dPhi) < randomConeR) { + if (!trackIsInJet(track, jets.iteratorAt(0))) { + randomConePtWithoutOneLeadJet += track.pt(); + if (!trackIsInJet(track, jets.iteratorAt(1))) { + randomConePtWithoutTwoLeadJet += track.pt(); + } + } + } + } + } + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithoutoneleadingjets"), collision.centrality(), randomConePtWithoutOneLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); + registry.fill(HIST("h2_centrality_rhorandomconerandomtrackdirectionwithouttwoleadingjets"), collision.centrality(), randomConePtWithoutTwoLeadJet - M_PI * randomConeR * randomConeR * collision.rho()); } - void processJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracks const&) + void processJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::JetTracks const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -659,7 +699,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange()); @@ -667,9 +707,9 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsData, "jet finder QA data", false); - void processJetsRhoAreaSubData(soa::Filtered>::iterator const& collision, + void processJetsRhoAreaSubData(soa::Filtered>::iterator const& collision, soa::Join const& jets, - JetTracks const&) + aod::JetTracks const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -678,7 +718,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillRhoAreaSubtractedHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.rho()); @@ -686,9 +726,9 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsRhoAreaSubData, "jet finder QA for rho-area subtracted jets", false); - void processJetsRhoAreaSubMCD(soa::Filtered>::iterator const& collision, + void processJetsRhoAreaSubMCD(soa::Filtered>::iterator const& collision, soa::Join const& jets, - JetTracks const&) + aod::JetTracks const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -697,7 +737,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillRhoAreaSubtractedHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange(), collision.rho()); @@ -705,7 +745,7 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsRhoAreaSubMCD, "jet finder QA for rho-area subtracted mcd jets", false); - void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracksSub const&) + void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::JetTracksSub const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -714,7 +754,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); @@ -722,7 +762,7 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processEvtWiseConstSubJetsData, "jet finder QA for eventwise constituent-subtracted jets data", false); - void processEvtWiseConstSubJetsMCD(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracksSub const&) + void processEvtWiseConstSubJetsMCD(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::JetTracksSub const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -731,7 +771,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillEventWiseConstituentSubtractedHistograms(jet, collision.centrality()); @@ -739,10 +779,10 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processEvtWiseConstSubJetsMCD, "jet finder QA for eventwise constituent-subtracted mcd jets", false); - void processJetsSubMatched(soa::Filtered::iterator const& collision, + void processJetsSubMatched(soa::Filtered::iterator const& collision, soa::Join const& jets, soa::Join const&, - JetTracks const&, JetTracksSub const&) + aod::JetTracks const&, aod::JetTracksSub const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -751,7 +791,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillMatchedHistograms::iterator, soa::Join>(jet); @@ -759,7 +799,7 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsSubMatched, "jet finder QA matched unsubtracted and constituent subtracted jets", false); - void processJetsMCD(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracks const&) + void processJetsMCD(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::JetTracks const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -768,7 +808,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality(), collision.trackOccupancyInTimeRange()); @@ -776,7 +816,7 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsMCD, "jet finder QA mcd", false); - void processJetsMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracks const&) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::JetTracks const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -785,10 +825,10 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } - double pTHat = 10. / (std::pow(jet.eventWeight(), 1.0 / 6.0)); + double pTHat = 10. / (std::pow(jet.eventWeight(), 1.0 / pTHatExponent)); for (int N = 1; N < 21; N++) { if (jet.pt() < N * 0.25 * pTHat && jet.r() == round(selectedJetsRadius * 100.0f)) { registry.fill(HIST("h_jet_ptcut"), jet.pt(), N * 0.25, jet.eventWeight()); @@ -799,12 +839,12 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsMCDWeighted, "jet finder QA mcd with weighted events", false); - void processJetsMCP(soa::Join::iterator const& jet, JetParticles const&, JetMcCollisions const&, soa::Filtered const& collisions) + void processJetsMCP(soa::Join::iterator const& jet, aod::JetParticles const&, aod::JetMcCollisions const&, soa::Filtered const& collisions) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } if (checkMcCollisionIsMatched) { @@ -818,15 +858,15 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsMCP, "jet finder QA mcp", false); - void processJetsMCPWeighted(soa::Join::iterator const& jet, JetParticles const&, JetMcCollisions const&, soa::Filtered const& collisions) + void processJetsMCPWeighted(soa::Join::iterator const& jet, aod::JetParticles const&, aod::JetMcCollisions const&, soa::Filtered const& collisions) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } - double pTHat = 10. / (std::pow(jet.eventWeight(), 1.0 / 6.0)); + double pTHat = 10. / (std::pow(jet.eventWeight(), 1.0 / pTHatExponent)); for (int N = 1; N < 21; N++) { if (jet.pt() < N * 0.25 * pTHat && jet.r() == round(selectedJetsRadius * 100.0f)) { registry.fill(HIST("h_jet_ptcut_part"), jet.pt(), N * 0.25, jet.eventWeight()); @@ -843,10 +883,10 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsMCPWeighted, "jet finder QA mcp with weighted events", false); - void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, + void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, soa::Join const&, - JetTracks const&, JetParticles const&) + aod::JetTracks const&, aod::JetParticles const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -855,7 +895,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillMatchedHistograms::iterator, soa::Join>(mcdjet); @@ -863,10 +903,10 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsMCPMCDMatched, "jet finder QA matched mcp and mcd", false); - void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, + void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, soa::Join const&, - JetTracks const&, JetParticles const&) + aod::JetTracks const&, aod::JetParticles const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -875,7 +915,7 @@ struct JetFinderQATask { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillMatchedHistograms::iterator, soa::Join>(mcdjet, mcdjet.eventWeight()); @@ -883,15 +923,15 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsMCPMCDMatchedWeighted, "jet finder QA matched mcp and mcd with weighted events", false); - void processMCCollisionsWeighted(JetMcCollision const& collision) + void processMCCollisionsWeighted(aod::JetMcCollision const& collision) { registry.fill(HIST("h_collision_eventweight_part"), collision.weight()); } PROCESS_SWITCH(JetFinderQATask, processMCCollisionsWeighted, "collision QA for weighted events", false); - void processTriggeredData(soa::Join::iterator const& collision, + void processTriggeredData(soa::Join::iterator const& collision, soa::Join const& jets, - soa::Filtered const& tracks) + soa::Filtered const& tracks) { registry.fill(HIST("h_collision_trigger_events"), 0.5); // all events if (collision.posZ() > vertexZCut) { @@ -965,7 +1005,7 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 3.0); } - for (auto& constituent : jet.template tracks_as>()) { + for (auto& constituent : jet.template tracks_as>()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_MB"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_MB"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_MB"), jet.r() / 100.0, jet.pt(), constituent.phi()); @@ -1015,8 +1055,8 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processTriggeredData, "QA for charged jet trigger", false); - void processTracks(soa::Filtered::iterator const& collision, - soa::Filtered> const& tracks) + void processTracks(soa::Filtered::iterator const& collision, + soa::Filtered> const& tracks) { registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); @@ -1034,9 +1074,9 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processTracks, "QA for charged tracks", false); - void processTracksWeighted(soa::Join::iterator const& collision, - JetMcCollisions const&, - soa::Filtered> const& tracks) + void processTracksWeighted(soa::Join::iterator const& collision, + aod::JetMcCollisions const&, + soa::Filtered> const& tracks) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); @@ -1055,8 +1095,8 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processTracksWeighted, "QA for charged tracks weighted", false); - void processTracksSub(soa::Filtered::iterator const& collision, - soa::Filtered const& tracks) + void processTracksSub(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -1072,7 +1112,7 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processTracksSub, "QA for charged event-wise embedded subtracted tracks", false); - void processRho(soa::Filtered>::iterator const& collision, soa::Filtered const& tracks) + void processRho(soa::Filtered>::iterator const& collision, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -1094,13 +1134,13 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processRho, "QA for rho-area subtracted jets", false); - void processRandomConeData(soa::Filtered>::iterator const& collision, soa::Join const& jets, soa::Filtered const& tracks) + void processRandomConeData(soa::Filtered>::iterator const& collision, soa::Join const& jets, soa::Filtered const& tracks) { randomCone(collision, jets, tracks); } PROCESS_SWITCH(JetFinderQATask, processRandomConeData, "QA for random cone estimation of background fluctuations in data", false); - void processRandomConeMCD(soa::Filtered>::iterator const& collision, soa::Join const& jets, soa::Filtered const& tracks) + void processRandomConeMCD(soa::Filtered>::iterator const& collision, soa::Join const& jets, soa::Filtered const& tracks) { randomCone(collision, jets, tracks); } diff --git a/PWGJE/Tasks/jetfinderfullQA.cxx b/PWGJE/Tasks/jetfinderfullQA.cxx index b5ea2f3d80f..3899a335d4b 100644 --- a/PWGJE/Tasks/jetfinderfullQA.cxx +++ b/PWGJE/Tasks/jetfinderfullQA.cxx @@ -160,7 +160,7 @@ struct JetFinderFullQATask { registry.add("h3_jet_r_part_jet_pt_part_track_pt_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#it{p}_{T,jet tracks}^{part} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {200, 0., 200.}}}); registry.add("h3_jet_r_part_jet_pt_part_track_eta_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#eta_{jet tracks}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {500, -5.0, 5.0}}}); registry.add("h3_jet_r_part_jet_pt_part_track_phi_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#varphi_{jet tracks}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {160, -1.0, 7.}}}); - registry.add("h_jet_phat_part_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0, 350}}}); + registry.add("h_jet_phat_part_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); } if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted) { @@ -304,14 +304,14 @@ struct JetFinderFullQATask { registry.fill(HIST("h3_jet_r_jet_pt_jet_nclusters"), jet.r() / 100.0, jet.pt(), jet.clustersIds().size(), weight); registry.fill(HIST("h3_jet_r_jet_pt_jet_area"), jet.r() / 100.0, jet.pt(), jet.area(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_eta"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_phi"), jet.r() / 100.0, jet.pt(), constituent.phi(), weight); } - for (auto& cluster : jet.template clusters_as()) { + for (auto& cluster : jet.template clusters_as()) { double clusterpt = cluster.energy() / std::cosh(cluster.eta()); neutralEnergy += cluster.energy(); registry.fill(HIST("h3_jet_r_jet_pt_cluster_pt"), jet.r() / 100.0, jet.pt(), clusterpt, weight); @@ -345,7 +345,7 @@ struct JetFinderFullQATask { registry.fill(HIST("h3_jet_r_part_jet_eta_part_jet_phi_part"), jet.r() / 100.0, jet.eta(), jet.phi(), weight); registry.fill(HIST("h3_jet_r_part_jet_pt_part_jet_ntracks_part"), jet.r() / 100.0, jet.pt(), jet.tracksIds().size(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { auto pdgParticle = pdgDatabase->GetParticle(constituent.pdgCode()); if (pdgParticle->Charge() == 0) { neutralEnergy += constituent.e(); @@ -453,18 +453,18 @@ struct JetFinderFullQATask { } } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetFinderFullQATask, processDummy, "dummy task", true); - void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, JetTracks const&, JetClusters const&) + void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality()); @@ -472,13 +472,13 @@ struct JetFinderFullQATask { } PROCESS_SWITCH(JetFinderFullQATask, processJetsData, "jet finder HF QA data", false); - void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, JetTracks const&, JetClusters const&) + void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality()); @@ -486,13 +486,13 @@ struct JetFinderFullQATask { } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCD, "jet finder HF QA mcd", false); - void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, JetTracks const&, JetClusters const&) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, aod::JetTracks const&, aod::JetClusters const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality(), jet.eventWeight()); @@ -500,43 +500,43 @@ struct JetFinderFullQATask { } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); - void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, JetParticles const&) + void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, aod::JetParticles const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } fillMCPHistograms(jet); } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCP, "jet finder HF QA mcp", false); - void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, JetParticles const&) + void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, aod::JetParticles const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } fillMCPHistograms(jet, jet.eventWeight()); } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCPWeighted, "jet finder HF QA mcp on weighted events", false); - void processJetsMCPMCDMatched(JetCollision const&, + void processJetsMCPMCDMatched(aod::JetCollision const&, JetTableMCDMatchedJoined const& mcdjets, JetTableMCPMatchedJoined const&, - JetTracks const&, - JetClusters const&, - JetParticles const&) + aod::JetTracks const&, + aod::JetClusters const&, + aod::JetParticles const&) { for (const auto& mcdjet : mcdjets) { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillMatchedHistograms(mcdjet); @@ -544,19 +544,19 @@ struct JetFinderFullQATask { } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCPMCDMatched, "jet finder HF QA matched mcp and mcd", false); - void processJetsMCPMCDMatchedWeighted(JetCollision const&, + void processJetsMCPMCDMatchedWeighted(aod::JetCollision const&, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const&, - JetTracks const&, - JetClusters const&, - JetParticles const&) + aod::JetTracks const&, + aod::JetClusters const&, + aod::JetParticles const&) { for (const auto& mcdjet : mcdjets) { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillMatchedHistograms(mcdjet, mcdjet.eventWeight()); @@ -564,16 +564,16 @@ struct JetFinderFullQATask { } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCPMCDMatchedWeighted, "jet finder HF QA matched mcp and mcd on weighted events", false); - void processMCCollisionsWeighted(JetMcCollision const& collision) + void processMCCollisionsWeighted(aod::JetMcCollision const& collision) { registry.fill(HIST("h_collision_eventweight_part"), collision.weight()); } PROCESS_SWITCH(JetFinderFullQATask, processMCCollisionsWeighted, "collision QA for weighted events", false); - void processTracks(JetCollision const& collision, - soa::Filtered const& tracks, - soa::Filtered const& clusters) + void processTracks(aod::JetCollision const& collision, + soa::Filtered const& tracks, + soa::Filtered const& clusters) { registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h_centrality_collisions"), collision.centrality(), 0.5); @@ -588,8 +588,8 @@ struct JetFinderFullQATask { void processTracksWeighted(soa::Join::iterator const& collision, aod::JMcCollisions const&, - soa::Filtered const& tracks, - soa::Filtered const& clusters) + soa::Filtered const& tracks, + soa::Filtered const& clusters) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); diff --git a/PWGJE/Tasks/jetfinderhfQA.cxx b/PWGJE/Tasks/jetfinderhfQA.cxx index 13a185ce36b..9ac052bdebe 100644 --- a/PWGJE/Tasks/jetfinderhfQA.cxx +++ b/PWGJE/Tasks/jetfinderhfQA.cxx @@ -240,7 +240,7 @@ struct JetFinderHFQATask { registry.add("h3_jet_r_part_jet_pt_part_candidate_eta_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#eta_{candidate}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {500, -5.0, 5.0}}}); registry.add("h3_jet_r_part_jet_pt_part_candidate_phi_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#varphi{candidate}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {160, -1.0, 7.}}}); registry.add("h3_jet_r_part_jet_pt_part_candidate_y_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});y_{candidate}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, jetPtAxis, {500, -5.0, 5.0}}}); - registry.add("h_jet_phat_part_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{350, 0, 350}}}); + registry.add("h_jet_phat_part_weighted", "jet #hat{p};#hat{p} (GeV/#it{c});entries", {HistType::kTH1F, {{1000, 0, 1000}}}); } if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsSubMatched) { @@ -550,7 +550,7 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks"), jet.r() / 100.0, jet.pt(), jet.tracksIds().size() + jet.candidatesIds().size(), weight); registry.fill(HIST("h3_jet_r_jet_pt_jet_area"), jet.r() / 100.0, jet.pt(), jet.area(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_eta"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); @@ -600,7 +600,7 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_jet_pt_jet_area_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.area(), weight); registry.fill(HIST("h3_jet_r_jet_pt_jet_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt(), jet.pt() - (rho * jet.area()), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.eta(), weight); @@ -994,18 +994,18 @@ struct JetFinderHFQATask { } } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetFinderHFQATask, processDummy, "dummy task", true); - void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const&, JetTracks const&) + void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const&, aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality()); @@ -1013,16 +1013,16 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsData, "jet finder HF QA data", false); - void processJetsRhoAreaSubData(soa::Filtered::iterator const& collision, + void processJetsRhoAreaSubData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, soa::Join const&, - JetTracks const&) + aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } auto const candidate = jet.template candidates_first_as>(); @@ -1031,16 +1031,16 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsRhoAreaSubData, "jet finder HF QA for rho-area subtracted jets", false); - void processJetsRhoAreaSubMCD(soa::Filtered::iterator const& collision, + void processJetsRhoAreaSubMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, soa::Join const&, - JetTracks const&) + aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } auto const candidate = jet.template candidates_first_as>(); @@ -1049,7 +1049,7 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsRhoAreaSubMCD, "jet finder HF QA for rho-area subtracted mcd jets", false); - void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, JetTableDataSubJoined const& jets, CandidateTableData const&, JetTracksDataSub const&) + void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, JetTableDataSubJoined const& jets, CandidateTableData const&, JetTracksDataSub const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { @@ -1063,16 +1063,16 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processEvtWiseConstSubJetsData, "jet finder HF QA for eventwise constituent-subtracted jets data", false); - void processJetsSubMatched(soa::Filtered::iterator const&, + void processJetsSubMatched(soa::Filtered::iterator const&, JetTableDataMatchedJoined const& jets, JetTableDataSubMatchedJoined const&, - JetTracks const&, JetTracksDataSub const&, CandidateTableData const&) + aod::JetTracks const&, JetTracksDataSub const&, CandidateTableData const&) { for (const auto& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillMatchedHistograms(jet); @@ -1080,13 +1080,13 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsSubMatched, "jet finder HF QA matched unsubtracted and constituent subtracted jets", false); - void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, CandidateTableMCD const&, JetTracks const&) + void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, CandidateTableMCD const&, aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality()); @@ -1094,13 +1094,13 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCD, "jet finder HF QA mcd", false); - void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, CandidateTableMCD const&, JetTracks const&) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, CandidateTableMCD const&, aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality(), jet.eventWeight()); @@ -1108,35 +1108,35 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); - void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, JetParticles const&, CandidateTableMCP const&) + void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, aod::JetParticles const&, CandidateTableMCP const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } - fillMCPHistograms(jet); + fillMCPHistograms(jet); } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCP, "jet finder HF QA mcp", false); - void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, JetParticles const&, CandidateTableMCP const&) + void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, aod::JetParticles const&, CandidateTableMCP const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } - fillMCPHistograms(jet, jet.eventWeight()); + fillMCPHistograms(jet, jet.eventWeight()); } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPWeighted, "jet finder HF QA mcp on weighted events", false); - void processJetsMCPMCDMatched(soa::Filtered::iterator const&, + void processJetsMCPMCDMatched(soa::Filtered::iterator const&, JetTableMCDMatchedJoined const& mcdjets, JetTableMCPMatchedJoined const&, CandidateTableMCD const&, - JetTracks const&, JetParticles const&, + aod::JetTracks const&, aod::JetParticles const&, CandidateTableMCP const&) { @@ -1144,7 +1144,7 @@ struct JetFinderHFQATask { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillMatchedHistograms(mcdjet); @@ -1152,11 +1152,11 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPMCDMatched, "jet finder HF QA matched mcp and mcd", false); - void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const&, + void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const&, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const&, CandidateTableMCD const&, - JetTracks const&, JetParticles const&, + aod::JetTracks const&, aod::JetParticles const&, CandidateTableMCP const&) { @@ -1164,7 +1164,7 @@ struct JetFinderHFQATask { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillMatchedHistograms(mcdjet, mcdjet.eventWeight()); @@ -1172,16 +1172,16 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPMCDMatchedWeighted, "jet finder HF QA matched mcp and mcd on weighted events", false); - void processMCCollisionsWeighted(JetMcCollision const& collision) + void processMCCollisionsWeighted(aod::JetMcCollision const& collision) { registry.fill(HIST("h_collision_eventweight_part"), collision.weight()); } PROCESS_SWITCH(JetFinderHFQATask, processMCCollisionsWeighted, "collision QA for weighted events", false); - void processTriggeredData(soa::Join::iterator const& collision, + void processTriggeredData(soa::Join::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const&, - soa::Filtered const& tracks) + soa::Filtered const& tracks) { registry.fill(HIST("h_collision_trigger_events"), 0.5); // all events if (collision.posZ() > vertexZCut) { @@ -1255,7 +1255,7 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 3.0); } - for (auto& constituent : jet.template tracks_as>()) { + for (auto& constituent : jet.template tracks_as>()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_MB"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_MB"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_MB"), jet.r() / 100.0, jet.pt(), constituent.phi()); @@ -1332,10 +1332,10 @@ struct JetFinderHFQATask { PROCESS_SWITCH(JetFinderHFQATask, processTriggeredData, "QA for charged jet trigger", false); - void processHFTriggeredData(soa::Join::iterator const& collision, + void processHFTriggeredData(soa::Join::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const&, - soa::Filtered const&) + soa::Filtered const&) { int hfLowTrigger = -2; @@ -1461,8 +1461,8 @@ struct JetFinderHFQATask { PROCESS_SWITCH(JetFinderHFQATask, processHFTriggeredData, "QA for charged hf jet trigger", false); - void processTracks(soa::Filtered::iterator const& collision, - soa::Filtered const& tracks) + void processTracks(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) { registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); @@ -1475,9 +1475,9 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processTracks, "QA for charged tracks", false); - void processTracksWeighted(soa::Join::iterator const& collision, - JetMcCollisions const&, - soa::Filtered const& tracks) + void processTracksWeighted(soa::Join::iterator const& collision, + aod::JetMcCollisions const&, + soa::Filtered const& tracks) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); @@ -1491,7 +1491,7 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processTracksWeighted, "QA for charged tracks weighted", false); - void processTracksSub(soa::Filtered::iterator const& collision, + void processTracksSub(soa::Filtered::iterator const& collision, CandidateTableData const& candidates, soa::Filtered const& tracks) { @@ -1510,7 +1510,7 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processTracksSub, "QA for charged event-wise embedded subtracted tracks", false); - void processRho(JetCollision const& collision, soa::Join const& candidates, soa::Filtered const& tracks) + void processRho(aod::JetCollision const& collision, soa::Join const& candidates, soa::Filtered const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -1532,19 +1532,19 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processRho, "QA for rho-area subtracted jets", false); - void processRandomConeData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, soa::Join const& candidates, soa::Filtered const& tracks) + void processRandomConeData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, soa::Join const& candidates, soa::Filtered const& tracks) { randomCone(collision, jets, candidates, tracks); } PROCESS_SWITCH(JetFinderHFQATask, processRandomConeData, "QA for random cone estimation of background fluctuations in data", false); - void processRandomConeMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, soa::Join const& candidates, soa::Filtered const& tracks) + void processRandomConeMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, soa::Join const& candidates, soa::Filtered const& tracks) { randomCone(collision, jets, candidates, tracks); } PROCESS_SWITCH(JetFinderHFQATask, processRandomConeMCD, "QA for random cone estimation of background fluctuations in mcd", false); - void processCandidates(soa::Filtered::iterator const& collision, CandidateTableData const& candidates) + void processCandidates(soa::Filtered::iterator const& collision, CandidateTableData const& candidates) { for (auto const& candidate : candidates) { @@ -1557,10 +1557,10 @@ struct JetFinderHFQATask { PROCESS_SWITCH(JetFinderHFQATask, processCandidates, "HF candidate QA", false); }; -using JetFinderD0QATask = JetFinderHFQATask; -using JetFinderLcQATask = JetFinderHFQATask; -// using JetFinderBplusQATask = JetFinderHFQATask; -using JetFinderDielectronQATask = JetFinderHFQATask; +using JetFinderD0QATask = JetFinderHFQATask; +using JetFinderLcQATask = JetFinderHFQATask; +// using JetFinderBplusQATask = JetFinderHFQATask; +using JetFinderDielectronQATask = JetFinderHFQATask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/Tasks/jetfinderv0QA.cxx b/PWGJE/Tasks/jetfinderv0QA.cxx index 8f0152db0ee..b901db5d61d 100644 --- a/PWGJE/Tasks/jetfinderv0QA.cxx +++ b/PWGJE/Tasks/jetfinderv0QA.cxx @@ -224,7 +224,7 @@ struct JetFinderV0QATask { registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks"), jet.r() / 100.0, jet.pt(), jet.tracksIds().size() + jet.candidatesIds().size(), weight); registry.fill(HIST("h3_jet_r_jet_pt_jet_area"), jet.r() / 100.0, jet.pt(), jet.area(), weight); - for (auto& constituent : jet.template tracks_as()) { + for (auto& constituent : jet.template tracks_as()) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_track_eta"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); @@ -305,18 +305,18 @@ struct JetFinderV0QATask { } } - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(JetFinderV0QATask, processDummy, "dummy task", true); - void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const&, JetTracks const&) + void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const&, aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality()); @@ -324,13 +324,13 @@ struct JetFinderV0QATask { } PROCESS_SWITCH(JetFinderV0QATask, processJetsData, "jet finder HF QA data", false); - void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, CandidateTableMCD const&, JetTracks const&) + void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, CandidateTableMCD const&, aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality()); @@ -338,13 +338,13 @@ struct JetFinderV0QATask { } PROCESS_SWITCH(JetFinderV0QATask, processJetsMCD, "jet finder HF QA mcd", false); - void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, CandidateTableMCD const&, JetTracks const&) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, CandidateTableMCD const&, aod::JetTracks const&) { for (auto const& jet : jets) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistograms(jet, collision.centrality(), jet.eventWeight()); @@ -352,38 +352,38 @@ struct JetFinderV0QATask { } PROCESS_SWITCH(JetFinderV0QATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); - void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, JetParticles const&, CandidateTableMCP const&) + void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, aod::JetParticles const&, CandidateTableMCP const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } - fillMCPHistograms(jet); + fillMCPHistograms(jet); } PROCESS_SWITCH(JetFinderV0QATask, processJetsMCP, "jet finder HF QA mcp", false); - void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, JetParticles const&, CandidateTableMCP const&) + void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, aod::JetParticles const&, CandidateTableMCP const&) { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { return; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { return; } - fillMCPHistograms(jet, jet.eventWeight()); + fillMCPHistograms(jet, jet.eventWeight()); } PROCESS_SWITCH(JetFinderV0QATask, processJetsMCPWeighted, "jet finder HF QA mcp on weighted events", false); - void processMCCollisionsWeighted(JetMcCollision const& collision) + void processMCCollisionsWeighted(aod::JetMcCollision const& collision) { registry.fill(HIST("h_collision_eventweight_part"), collision.weight()); } PROCESS_SWITCH(JetFinderV0QATask, processMCCollisionsWeighted, "collision QA for weighted events", false); - void processTracks(soa::Filtered::iterator const& collision, - soa::Filtered const& tracks) + void processTracks(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) { registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); @@ -396,9 +396,9 @@ struct JetFinderV0QATask { } PROCESS_SWITCH(JetFinderV0QATask, processTracks, "QA for charged tracks", false); - void processTracksWeighted(soa::Join::iterator const& collision, - JetMcCollisions const&, - soa::Filtered const& tracks) + void processTracksWeighted(soa::Join::iterator const& collision, + aod::JetMcCollisions const&, + soa::Filtered const& tracks) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); @@ -412,7 +412,7 @@ struct JetFinderV0QATask { } PROCESS_SWITCH(JetFinderV0QATask, processTracksWeighted, "QA for charged tracks weighted", false); - void processCandidates(soa::Filtered::iterator const& collision, CandidateTableData const& candidates) + void processCandidates(soa::Filtered::iterator const& collision, CandidateTableData const& candidates) { for (auto const& candidate : candidates) { @@ -427,7 +427,7 @@ struct JetFinderV0QATask { PROCESS_SWITCH(JetFinderV0QATask, processCandidates, "HF candidate QA", false); }; -using JetFinderV0QA = JetFinderV0QATask; +using JetFinderV0QA = JetFinderV0QATask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/Tasks/jetfragmentation.cxx b/PWGJE/Tasks/jetfragmentation.cxx index d08a3935431..8f939d75f46 100644 --- a/PWGJE/Tasks/jetfragmentation.cxx +++ b/PWGJE/Tasks/jetfragmentation.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// jet V0 fragmentation +/// \brief Task for jet fragmentation into V0s // /// \author Gijs van Weelden // @@ -63,7 +63,7 @@ using MatchedMCPV0Jets = soa::Join; struct JetFragmentation { - HistogramRegistry registry{"registry"}; + HistogramRegistry registry{"registry"}; // CallSumw2 = false? Configurable evSel{"evSel", "sel8WithoutTimeFrameBorderCut", "choose event selection"}; Configurable vertexZCut{"vertexZCut", 10.f, "vertex z cut"}; @@ -115,6 +115,7 @@ struct JetFragmentation { ConfigurableAxis jetCount{"jetCount", {20, -.5f, 19.5f}, ""}; ConfigurableAxis trackCount{"trackCount", {1000, -.5f, 999.5f}, ""}; ConfigurableAxis v0Count{"v0Count", {50, -.5f, 49.5f}, ""}; + ConfigurableAxis v0Weight{"v0Weight", {50, 0.f, 10.0f}, ""}; ConfigurableAxis binV0Pt{"binV0Pt", {120, 0.0f, 60.0f}, ""}; ConfigurableAxis binV0Eta{"binV0Eta", {20, -1.f, 1.f}, ""}; @@ -128,6 +129,7 @@ struct JetFragmentation { ConfigurableAxis binV0DCAd{"binV0DCAd", {100, 0.0f, 10.0f}, ""}; ConfigurableAxis binK0SMass{"binK0SMass", {400, 0.400f, 0.600f}, "Inv. Mass (GeV/c^{2})"}; + ConfigurableAxis binK0SMassWide{"binK0SMassWide", {400, 0.400f, 0.800f}, "Inv. Mass (GeV/c^{2})"}; // Wider version for high pt ConfigurableAxis binLambdaMass{"binLambdaMass", {200, 1.015f, 1.215f}, "Inv. Mass (GeV/c^{2})"}; ConfigurableAxis binLambdaMassDiff{"binLambdaMassDiff", {200, -0.199f, 0.201f}, "M(#Lambda) - M(#bar{#Lambda})"}; ConfigurableAxis binLambdaMassRatio{"binLambdaMassRatio", {50, -0.05f, 4.95f}, "M(#bar{#Lambda}) / M(#Lambda)"}; @@ -155,7 +157,7 @@ struct JetFragmentation { Preslice V0sPerCollision = aod::v0data::collisionId; Preslice> McV0sPerCollision = aod::v0data::collisionId; Preslice PartJetsPerCollision = aod::jet::mcCollisionId; - Preslice JetParticlesPerCollision = aod::jmcparticle::mcCollisionId; + Preslice JetParticlesPerCollision = aod::jmcparticle::mcCollisionId; Preslice ParticlesPerCollision = aod::mcparticle::mcCollisionId; int eventSelection = -1; @@ -217,6 +219,7 @@ struct JetFragmentation { AxisSpec V0DCAdAxis = {binV0DCAd, "DCA daughters (cm^{2})"}; AxisSpec K0SMassAxis = {binK0SMass, "Inv. mass (GeV/#it{c}^{2})"}; + AxisSpec K0SWideAxis = {binK0SMassWide, "Inv. mass (GeV/#it{c}^{2})"}; AxisSpec LambdaMassAxis = {binLambdaMass, "Inv. mass (GeV/#it{c}^{2})"}; AxisSpec LambdaMassDiffAxis = {binLambdaMassDiff, "M(#Lambda) - M(#bar{#Lambda})"}; AxisSpec LambdaMassRatioAxis = {binLambdaMassRatio, "M(#bar{#Lambda}) / M(#Lambda)"}; @@ -239,7 +242,7 @@ struct JetFragmentation { registry.add("data/collision/collisionVtxZ", "Collision vertex z (cm)", HistType::kTH1D, {binVtxZ}); registry.add("data/tracks/trackPtEtaPhi", "trackPtEtaPhi", HistType::kTH3D, {trackPtAxis, etaAxis, phiAxis}); } - if (doprocessDataRun3 || doprocessDataV0Frag || doprocessDataV0JetsFrag) { + if (doprocessDataRun3 || doprocessDataV0Frag || doprocessDataV0JetsFrag || doprocessDataV0JetsFragWithWeights) { registry.add("data/jets/jetPtEtaPhi", "Jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {jetPtAxis, etaAxis, phiAxis}); } if (doprocessDataRun3 || doprocessDataV0Frag) { @@ -253,13 +256,17 @@ struct JetFragmentation { registry.add("data/jets/jetPtZTheta", "Jet #it{p}_{T}, z, #theta", HistType::kTH3D, {jetPtAxis, zAxis, thetaAxis}); } // doprocessDataRun3 || doprocessDataV0Frag - if (doprocessDataV0 || doprocessDataV0Frag || doprocessDataV0JetsFrag) { + if (doprocessDataV0 || doprocessDataV0Frag || doprocessDataV0JetsFrag || doprocessDataV0JetsFragWithWeights || doprocessDataV0PerpCone) { registry.add("data/V0/nV0sEvent", "nV0sEvent", HistType::kTH1D, {v0Count}); + // TODO: Does this make sense? + registry.add("data/V0/nV0sEventWeighted", "nV0s per event (weighted)", HistType::kTH1D, {v0Count}); + registry.get(HIST("data/V0/nV0sEventWeighted"))->Sumw2(); // Unidentified registry.add("data/V0/V0PtEtaPhi", "V0PtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); registry.add("data/V0/V0PtCtau", "V0PtCtau", HistType::kTHnSparseD, {V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); registry.add("data/V0/V0PtMass", "V0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/V0/V0PtMassWide", "V0PtMassWide", HistType::kTHnSparseD, {V0PtAxis, K0SWideAxis, LambdaMassAxis, LambdaMassAxis}); registry.add("data/V0/V0PtLambdaMasses", "V0PtLambdaMasses", HistType::kTHnSparseD, {V0PtAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); registry.add("data/V0/V0PtRadiusCosPA", "V0PtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); registry.add("data/V0/V0PtDCAposneg", "V0PtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); @@ -295,13 +302,14 @@ struct JetFragmentation { registry.add("data/jets/V0/jetCorrectedPtV0TrackProj", "jetCorrectedPtV0TrackProj", HistType::kTH2D, {jetPtAxis, zAxis}); } - if (doprocessDataV0Frag || doprocessDataV0JetsFrag) { + if (doprocessDataV0Frag || doprocessDataV0JetsFrag || doprocessDataV0JetsFragWithWeights) { registry.add("data/jets/V0/jetPtV0TrackProj", "jetPtV0TrackProj", HistType::kTH2D, {jetPtAxis, zAxis}); registry.add("data/jets/V0/jetPtnV0nK0SnLambdanAntiLambda", "jetPtnV0nK0SnLambdanAntiLambda", HistType::kTHnSparseD, {jetPtAxis, v0Count, v0Count, v0Count, v0Count}); registry.add("data/jets/V0/jetPtV0PtEtaPhi", "jetPtV0PtEtaPhi", HistType::kTHnSparseD, {jetPtAxis, V0PtAxis, V0EtaAxis, V0PhiAxis}); registry.add("data/jets/V0/jetPtV0PtCtau", "jetPtV0PtCtau", HistType::kTHnSparseD, {jetPtAxis, V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); registry.add("data/jets/V0/jetPtV0PtMass", "jetPtV0PtMass", HistType::kTHnSparseD, {jetPtAxis, V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/V0/jetPtV0PtMassWide", "jetPtV0PtMassWide", HistType::kTHnSparseD, {jetPtAxis, V0PtAxis, K0SWideAxis, LambdaMassAxis, LambdaMassAxis}); registry.add("data/jets/V0/jetPtV0PtLambdaMasses", "jetPtV0PtLambdaMasses", HistType::kTHnSparseD, {jetPtAxis, V0PtAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); registry.add("data/jets/V0/jetPtV0PtRadiusCosPA", "jetPtV0PtRadiusCosPA", HistType::kTHnSparseD, {jetPtAxis, V0PtAxis, V0RadiusAxis, V0CosPAAxis}); registry.add("data/jets/V0/jetPtV0PtDCAposneg", "jetPtV0PtDCAposneg", HistType::kTHnSparseD, {jetPtAxis, V0PtAxis, V0DCApAxis, V0DCAnAxis}); @@ -309,6 +317,7 @@ struct JetFragmentation { registry.add("data/jets/V0/jetPtV0TrackProjCtau", "jetPtV0TrackProjCtau", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); registry.add("data/jets/V0/jetPtV0TrackProjMass", "jetPtV0TrackProjMass", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/V0/jetPtV0TrackProjMassWide", "jetPtV0TrackProjMassWide", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SWideAxis, LambdaMassAxis, LambdaMassAxis}); registry.add("data/jets/V0/jetPtV0TrackProjLambdaMasses", "jetPtV0TrackProjLambdaMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); registry.add("data/jets/V0/jetPtV0TrackProjRadiusCosPA", "jetPtV0TrackProjRadiusCosPA", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0RadiusAxis, V0CosPAAxis}); registry.add("data/jets/V0/jetPtV0TrackProjDCAposneg", "jetPtV0TrackProjDCAposneg", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0DCApAxis, V0DCAnAxis}); @@ -371,6 +380,53 @@ struct JetFragmentation { registry.add("data/jets/V0/jetPtK0STrackProjDCAposneg", "Jet #it{p}_{T}, #it{z}_{K^{0}_{S}}, DCA#pm", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0DCApAxis, V0DCAnAxis}); } // doprocessDataV0Frag || doprocessDataV0JetsFrag + if (doprocessDataV0JetsFragWithWeights) { + // FIXME: These hists need Sumw2 + registry.add("data/jets/weighted/jetPtEtaPhi", "Jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {jetPtAxis, etaAxis, phiAxis}); + registry.add("data/jets/weighted/V0/jetPtnV0nK0SnLambdanAntiLambda", "jetPtnV0nK0SnLambdanAntiLambda", HistType::kTHnSparseD, {jetPtAxis, v0Weight, v0Weight, v0Weight, v0Weight}); + + registry.add("data/jets/weighted/V0/jetPtV0TrackProjCtau", "jetPtV0TrackProjCtau", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("data/jets/weighted/V0/jetPtV0TrackProjMass", "jetPtV0TrackProjMass", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtV0TrackProjMassWide", "jetPtV0TrackProjMassWide", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SWideAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtV0TrackProjLambdaMasses", "jetPtV0TrackProjLambdaMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); + registry.add("data/jets/weighted/V0/jetPtV0TrackProjRadiusCosPA", "jetPtV0TrackProjRadiusCosPA", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("data/jets/weighted/V0/jetPtV0TrackProjDCAposneg", "jetPtV0TrackProjDCAposneg", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("data/jets/weighted/V0/jetPtV0TrackProjDCAd", "jetPtV0TrackProjDCAd", HistType::kTH3D, {jetPtAxis, zAxis, V0DCAdAxis}); + // K0S + registry.add("data/jets/weighted/V0/jetPtK0STrackProjCtau", "Jet #it{p}_{T}, #it{z}_{K^{0}_{S}}, c#tau", HistType::kTH3D, {jetPtAxis, zAxis, V0CtauAxis}); + registry.add("data/jets/weighted/V0/jetPtK0STrackProjMass", "Jet #it{p}_{T}, #it{z}_{K^{0}_{S}}, mass", HistType::kTH3D, {jetPtAxis, zAxis, K0SMassAxis}); + registry.add("data/jets/weighted/V0/jetPtK0STrackProjAllMasses", "jetPtK0STrackProjAllMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtK0STrackProjRadius", "Jet #it{p}_{T}, #it{z}_{K^{0}_{S}}, radius", HistType::kTH3D, {jetPtAxis, zAxis, V0RadiusAxis}); + registry.add("data/jets/weighted/V0/jetPtK0STrackProjCosPA", "Jet #it{p}_{T}, #it{z}_{K^{0}_{S}}, cosPA", HistType::kTH3D, {jetPtAxis, zAxis, V0CosPAAxis}); + registry.add("data/jets/weighted/V0/jetPtK0STrackProjDCAd", "Jet #it{p}_{T}, #it{z}_{K^{0}_{S}}, DCA daughters", HistType::kTH3D, {jetPtAxis, zAxis, V0DCAdAxis}); + registry.add("data/jets/weighted/V0/jetPtK0STrackProjDCAposneg", "Jet #it{p}_{T}, #it{z}_{K^{0}_{S}}, DCA#pm", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0DCApAxis, V0DCAnAxis}); + // Lambda + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjCtau", "Jet #it{p}_{T}, #it{z}_{#Lambda^{0}}, c#tau", HistType::kTH3D, {jetPtAxis, zAxis, V0CtauAxis}); + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjMass", "Jet #it{p}_{T}, #it{z}_{#Lambda^{0}}, mass", HistType::kTH3D, {jetPtAxis, zAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjAllMasses", "jetPtLambdaTrackProjAllMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjLambdaMasses", "jetPtLambdaTrackProjLambdaMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjRadius", "Jet #it{p}_{T}, #it{z}_{#Lambda^{0}}, radius", HistType::kTH3D, {jetPtAxis, zAxis, V0RadiusAxis}); + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjCosPA", "Jet #it{p}_{T}, #it{z}_{#Lambda^{0}}, cosPA", HistType::kTH3D, {jetPtAxis, zAxis, V0CosPAAxis}); + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjDCAd", "Jet #it{p}_{T}, #it{z}_{#Lambda^{0}}, DCA daughters", HistType::kTH3D, {jetPtAxis, zAxis, V0DCAdAxis}); + registry.add("data/jets/weighted/V0/jetPtLambdaTrackProjDCAposneg", "Jet #it{p}_{T}, #it{z}_{#Lambda^{0}}, DCA#pm", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0DCApAxis, V0DCAnAxis}); + // AntiLambda + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjCtau", "Jet #it{p}_{T}, #it{z}_{#bar{#Lambda}^{0}}, c#tau", HistType::kTH3D, {jetPtAxis, zAxis, V0CtauAxis}); + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjMass", "Jet #it{p}_{T}, #it{z}_{#bar{#Lambda}^{0}}, mass", HistType::kTH3D, {jetPtAxis, zAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjAllMasses", "jetPtAntiLambdaTrackProjAllMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjLambdaMasses", "jetPtAntiLambdaTrackProjLambdaMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjRadius", "Jet #it{p}_{T}, #it{z}_{#bar{#Lambda}^{0}}, radius", HistType::kTH3D, {jetPtAxis, zAxis, V0RadiusAxis}); + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjCosPA", "Jet #it{p}_{T}, #it{z}_{#bar{#Lambda}^{0}}, cosPA", HistType::kTH3D, {jetPtAxis, zAxis, V0CosPAAxis}); + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjDCAd", "Jet #it{p}_{T}, #it{z}_{#bar{#Lambda}^{0}}, DCA daughters", HistType::kTH3D, {jetPtAxis, zAxis, V0DCAdAxis}); + registry.add("data/jets/weighted/V0/jetPtAntiLambdaTrackProjDCAposneg", "Jet #it{p}_{T}, #it{z}_{#bar{#Lambda}^{0}}, DCA#pm", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0DCApAxis, V0DCAnAxis}); + // Background + registry.add("data/jets/weighted/V0/jetPtBkgTrackProjCtau", "jetPtBkgTrackProjCtau", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("data/jets/weighted/V0/jetPtBkgTrackProjMass", "jetPtBkgTrackProjMass", HistType::kTHnSparseD, {jetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/jets/weighted/V0/jetPtBkgTrackProjLambdaMasses", "jetPtBkgTrackProjLambdaMasses", HistType::kTHnSparseD, {jetPtAxis, zAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); + registry.add("data/jets/weighted/V0/jetPtBkgTrackProjRadiusCosPA", "jetPtBkgTrackProjRadiusCosPA", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("data/jets/weighted/V0/jetPtBkgTrackProjDCAposneg", "jetPtBkgTrackProjDCAposneg", HistType::kTHnSparseD, {jetPtAxis, zAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("data/jets/weighted/V0/jetPtBkgTrackProjDCAd", "jetPtBkgTrackProjDCAd", HistType::kTH3D, {jetPtAxis, zAxis, V0DCAdAxis}); + } + if (doprocessMcP || doprocessMcMatchedV0JetsFrag) { registry.add("particle-level/jets/partJetPtEtaPhi", "Particle level jet #it{p}_{T}, #eta, #phi", HistType::kTH3D, {partJetPtAxis, partEtaAxis, partPhiAxis}); } @@ -486,8 +542,10 @@ struct JetFragmentation { registry.add("matching/jets/missPartJetPtZTheta", "Misses", HistType::kTH3D, {partJetPtAxis, partZAxis, partThetaAxis}); } // doprocessMcMatched - if (doprocessMcMatchedV0 || doprocessMcMatchedV0Frag || doprocessMcMatchedV0JetsFrag) { + if (doprocessMcMatchedV0 || doprocessMcMatchedV0Frag || doprocessMcMatchedV0JetsFrag || doprocessMcV0MatchedPerpCone) { registry.add("matching/V0/nV0sEvent", "nV0sDet per event", HistType::kTH1D, {v0Count}); + registry.add("matching/V0/nV0sEventWeighted", "nV0sDet per event (weighted)", HistType::kTH1D, {v0Count}); + registry.get(HIST("matching/V0/nV0sEventWeighted"))->Sumw2(); } // doprocessMcMatchedV0 || doprocessMcMatchedV0Frag if (doprocessMcMatchedV0 || doprocessMcMatchedV0JetsFrag) { @@ -729,14 +787,260 @@ struct JetFragmentation { } // doprocessMcMatchedV0Frag if (doprocessMcMatchedV0JetsFrag) { + registry.add("matching/V0/fakeV0PtEtaPhi", "fakeV0PtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("matching/V0/fakeV0PtCtau", "fakeV0PtCtau", HistType::kTHnSparseD, {V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("matching/V0/fakeV0PtMass", "fakeV0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/V0/fakeV0PtLambdaMasses", "fakeV0PtLambdaMasses", HistType::kTHnSparseD, {V0PtAxis, LambdaMassDiffAxis, LambdaMassRatioAxis, LambdaMassRelDiffAxis}); + registry.add("matching/V0/fakeV0PtRadiusCosPA", "fakeV0PtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("matching/V0/fakeV0PtDCAposneg", "fakeV0PtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("matching/V0/fakeV0PtDCAd", "fakeV0PtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("matching/V0/fakeV0PosTrackPtEtaPhi", "fakeV0PosTrackPtEtaPhi", HistType::kTH3D, {trackPtAxis, etaAxis, phiAxis}); + registry.add("matching/V0/fakeV0NegTrackPtEtaPhi", "fakeV0NegTrackPtEtaPhi", HistType::kTH3D, {trackPtAxis, etaAxis, phiAxis}); + registry.add("matching/V0/V0PosPartPtRatioPtRelDiffPt", "V0PosPartPtRatioRelDiffPt", HistType::kTH3D, {trackPtAxis, ptRatioAxis, ptTrackRelDiffAxis}); registry.add("matching/V0/V0NegPartPtRatioPtRelDiffPt", "V0NegPartPtRatioRelDiffPt", HistType::kTH3D, {trackPtAxis, ptRatioAxis, ptTrackRelDiffAxis}); registry.add("matching/jets/V0/partJetPtDetJetPtPartV0PtPosPtRatioPtRelDiffPt", "V0PtPosPartPtRatioRelDiffPt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0PtAxis, trackPtAxis, ptRatioAxis, ptTrackRelDiffAxis}); registry.add("matching/jets/V0/partJetPtDetJetPtPartV0PtNegPtRatioPtRelDiffPt", "V0PtNegPartPtRatioRelDiffPt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0PtAxis, trackPtAxis, ptRatioAxis, ptTrackRelDiffAxis}); - } + + registry.add("matching/V0/nonedecayedFakeV0PtMass", "nonedecayedFakeV0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/V0/doubledecayedFakeV0PtMass", "doubledecayedFakeV0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/V0/decayedK0SV0PtMass", "decayedK0SV0PtMass", HistType::kTHnSparseD, {V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/V0/decayedLambdaV0PtMass", "decayedLambdaV0PtMass", HistType::kTHnSparseD, {V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/V0/decayedAntiLambdaV0PtMass", "decayedAntiLambdaV0PtMass", HistType::kTHnSparseD, {V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/V0/decayedOtherPtV0PtMass", "decayedOtherPtV0PtMass", HistType::kTHnSparseD, {V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + + registry.add("matching/jets/V0/nonedecayedFakeV0PtMass", "nonedecayedFakeV0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/nonedecayedFakeV0TrackProjMass", "nonedecayedFakeV0TrackProjMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/doubledecayedFakeV0PtMass", "doubledecayedFakeV0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/doubledecayedFakeV0TrackProjMass", "doubledecayedFakeV0TrackProjMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, zAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedK0SV0PtMass", "decayedK0SV0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedK0SV0TrackProjMass", "decayedK0SV0TrackProjMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, partZAxis, detZAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedLambdaV0PtMass", "decayedLambdaV0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedLambdaV0TrackProjMass", "decayedLambdaV0TrackProjMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, partZAxis, detZAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedAntiLambdaV0PtMass", "decayedAntiLambdaV0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedAntiLambdaV0TrackProjMass", "decayedAntiLambdaV0TrackProjMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, partZAxis, detZAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedOtherPtV0PtMass", "decayedOtherPtV0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0partPtAxis, V0detPtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/jets/V0/decayedOtherPtV0TrackProjMass", "decayedOtherPtV0TrackProjMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, partZAxis, detZAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + } // doprocessMcMatchedV0JetsFrag + + if (doprocessDataV0PerpCone) { + registry.add("data/PC/JetPtEtaV0Pt", "JetPtEtaV0Pt", HistType::kTH3D, {jetPtAxis, etaAxis, V0PtAxis}); + registry.add("data/PC/V0PtEtaPhi", "V0 #it{p}_{T}, #eta, #phi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("data/PC/V0PtCtau", "V0PtCtau", HistType::kTHnSparseD, {V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("data/PC/V0PtMass", "V0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/PC/V0PtMassWide", "V0PtMassWide", HistType::kTHnSparseD, {V0PtAxis, K0SWideAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("data/PC/V0PtRadiusCosPA", "V0PtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("data/PC/V0PtDCAposneg", "V0PtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("data/PC/V0PtDCAd", "V0PtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("data/PC/JetPtEtaLambda0Pt", "JetPtEtaLambda0Pt", HistType::kTH3D, {jetPtAxis, etaAxis, V0PtAxis}); + registry.add("data/PC/JetPtLambda0PtMass", "JetPtLambda0PtMass", HistType::kTH3D, {jetPtAxis, V0PtAxis, LambdaMassAxis}); + registry.add("data/PC/LambdaPtEtaPhi", "LambdaPtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("data/PC/LambdaPtCtauMass", "LambdaPtCtauMass", HistType::kTH3D, {V0PtAxis, V0CtauAxis, LambdaMassAxis}); + registry.add("data/PC/LambdaPtRadiusCosPA", "LambdaPtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("data/PC/LambdaPtDCAposneg", "LambdaPtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("data/PC/LambdaPtDCAd", "LambdaPtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("data/PC/JetPtEtaAntiLambda0Pt", "JetPtEtaAntiLambda0Pt", HistType::kTH3D, {jetPtAxis, etaAxis, V0PtAxis}); + registry.add("data/PC/JetPtAntiLambda0PtMass", "JetPtAntiLambda0PtMass", HistType::kTH3D, {jetPtAxis, V0PtAxis, LambdaMassAxis}); + registry.add("data/PC/antiLambdaPtEtaPhi", "antiLambdaPtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("data/PC/antiLambdaPtCtauMass", "antiLambdaPtCtauMass", HistType::kTH3D, {V0PtAxis, V0CtauAxis, LambdaMassAxis}); + registry.add("data/PC/antiLambdaPtRadiusCosPA", "antiLambdaPtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("data/PC/antiLambdaPtDCAposneg", "antiLambdaPtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("data/PC/antiLambdaPtDCAd", "antiLambdaPtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("data/PC/JetPtEtaK0SPt", "JetPtEtaK0SPt", HistType::kTH3D, {jetPtAxis, etaAxis, V0PtAxis}); + registry.add("data/PC/JetPtK0SPtMass", "JetPtK0SPtMass", HistType::kTH3D, {jetPtAxis, V0PtAxis, K0SMassAxis}); + registry.add("data/PC/K0SPtEtaPhi", "K0SPtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("data/PC/K0SPtCtauMass", "K0SPtCtauMass", HistType::kTH3D, {V0PtAxis, V0CtauAxis, K0SMassAxis}); + registry.add("data/PC/K0SPtRadiusCosPA", "K0SPtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("data/PC/K0SPtDCAposneg", "K0SPtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("data/PC/K0SPtDCAd", "K0SPtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("data/PC/nV0sConePtEta", "nV0sConePtEta", HistType::kTH3D, {v0Count, jetPtAxis, etaAxis}); + registry.add("data/PC/ConePtEtaPhi", "ConePtEtaPhi", HistType::kTH3D, {jetPtAxis, etaAxis, phiAxis}); + registry.add("data/PC/JetPtEtaConePt", "JetPtEtaConePt", HistType::kTH3D, {jetPtAxis, etaAxis, jetPtAxis}); + } // doprocessDataV0PerpCone + + if (doprocessMcV0PerpCone) { + registry.add("mcd/PC/jetPtEtaFakeV0Pt", "JetPtEtaFakeV0Pt", HistType::kTH3D, {detJetPtAxis, etaAxis, V0PtAxis}); + registry.add("mcd/PC/fakeV0PtEtaPhi", "fakeV0PtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("mcd/PC/fakeV0PtCtau", "fakeV0PtCtau", HistType::kTHnSparseD, {V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("mcd/PC/fakeV0PtMass", "fakeV0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("mcd/PC/fakeV0PtRadiusCosPA", "fakeV0PtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("mcd/PC/fakeV0PtDCAposneg", "fakeV0PtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("mcd/PC/fakeV0PtDCAd", "fakeV0PtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + registry.add("mcd/PC/jetPtEtaMatchedV0Pt", "JetPtEtaMatchedV0Pt", HistType::kTH3D, {detJetPtAxis, etaAxis, V0PtAxis}); + + registry.add("mcd/PC/matchedV0PtEtaPhi", "matchedV0PtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("mcd/PC/matchedV0PtCtau", "matchedV0PtCtau", HistType::kTHnSparseD, {V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("mcd/PC/matchedV0PtMass", "matchedV0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("mcd/PC/matchedV0PtRadiusCosPA", "matchedV0PtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("mcd/PC/matchedV0PtDCAposneg", "matchedV0PtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("mcd/PC/matchedV0PtDCAd", "matchedV0PtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("mcd/PC/matchedJetPtK0SPtMass", "matchedJetPtK0SPtMass", HistType::kTH3D, {detJetPtAxis, V0PtAxis, K0SMassAxis}); + registry.add("mcd/PC/matchedJetPtLambda0PtMass", "matchedJetPtLambda0PtMass", HistType::kTH3D, {detJetPtAxis, V0PtAxis, LambdaMassAxis}); + registry.add("mcd/PC/matchedJetPtAntiLambda0PtMass", "matchedJetPtAntiLambda0PtMass", HistType::kTH3D, {detJetPtAxis, V0PtAxis, LambdaMassAxis}); + registry.add("mcd/PC/matchednV0sConePtEta", "matchednV0sConePtEta", HistType::kTH3D, {v0Count, detJetPtAxis, etaAxis}); + registry.add("mcd/PC/matchedConePtEtaPhi", "matchedConePtEtaPhi", HistType::kTH3D, {detJetPtAxis, etaAxis, phiAxis}); + registry.add("mcd/PC/matchedJetPtEtaConePt", "matchedJetPtEtaConePt", HistType::kTH3D, {detJetPtAxis, etaAxis, detJetPtAxis}); + + registry.add("mcd/PC/fakenV0sConePtEta", "fakenV0sConePtEta", HistType::kTH3D, {v0Count, detJetPtAxis, etaAxis}); + registry.add("mcd/PC/fakeConePtEtaPhi", "fakeConePtEtaPhi", HistType::kTH3D, {detJetPtAxis, etaAxis, phiAxis}); + registry.add("mcd/PC/fakeJetPtEtaConePt", "fakeJetPtEtaConePt", HistType::kTH3D, {detJetPtAxis, etaAxis, detJetPtAxis}); + } // doprocessMcV0PerpCone + + if (doprocessMcV0MatchedPerpCone) { + registry.add("matching/PC/jetPtEtaFakeV0Pt", "JetPtEtaFakeV0Pt", HistType::kTH3D, {detJetPtAxis, etaAxis, V0PtAxis}); + registry.add("matching/PC/jetsPtFakeV0Pt", "jetsPtFakeV0Pt", HistType::kTH3D, {partJetPtAxis, detJetPtAxis, V0PtAxis}); + registry.add("matching/PC/fakeV0PtEtaPhi", "fakeV0PtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("matching/PC/fakeV0PtCtau", "fakeV0PtCtau", HistType::kTHnSparseD, {V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("matching/PC/fakeV0PtMass", "fakeV0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/PC/fakeV0PtRadiusCosPA", "fakeV0PtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("matching/PC/fakeV0PtDCAposneg", "fakeV0PtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("matching/PC/fakeV0PtDCAd", "fakeV0PtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("matching/PC/jetPtEtaMatchedV0Pt", "jetPtEtaMatchedV0Pt", HistType::kTH3D, {detJetPtAxis, etaAxis, V0PtAxis}); + registry.add("matching/PC/jetsPtMatchedV0Pt", "jetsPtMatchedV0Pt", HistType::kTH3D, {partJetPtAxis, detJetPtAxis, V0PtAxis}); + registry.add("matching/PC/matchedV0PtEtaPhi", "matchedV0PtEtaPhi", HistType::kTH3D, {V0PtAxis, V0EtaAxis, V0PhiAxis}); + registry.add("matching/PC/matchedV0PtCtau", "matchedV0PtCtau", HistType::kTHnSparseD, {V0PtAxis, V0CtauAxis, V0CtauAxis, V0CtauAxis}); + registry.add("matching/PC/matchedV0PtMass", "matchedV0PtMass", HistType::kTHnSparseD, {V0PtAxis, K0SMassAxis, LambdaMassAxis, LambdaMassAxis}); + registry.add("matching/PC/matchedV0PtRadiusCosPA", "matchedV0PtRadiusCosPA", HistType::kTH3D, {V0PtAxis, V0RadiusAxis, V0CosPAAxis}); + registry.add("matching/PC/matchedV0PtDCAposneg", "matchedV0PtDCAposneg", HistType::kTH3D, {V0PtAxis, V0DCApAxis, V0DCAnAxis}); + registry.add("matching/PC/matchedV0PtDCAd", "matchedV0PtDCAd", HistType::kTH2D, {V0PtAxis, V0DCAdAxis}); + + registry.add("matching/PC/matchedJetPtK0SPtMass", "matchedJetPtK0SPtMass", HistType::kTH3D, {detJetPtAxis, V0PtAxis, K0SMassAxis}); + registry.add("matching/PC/matchedJetsPtK0SPtMass", "matchedJetsPtK0SPtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0PtAxis, K0SMassAxis}); + registry.add("matching/PC/matchedJetPtLambda0PtMass", "matchedJetPtLambda0PtMass", HistType::kTH3D, {detJetPtAxis, V0PtAxis, LambdaMassAxis}); + registry.add("matching/PC/matchedJetsPtLambda0PtMass", "matchedJetsPtLambda0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0PtAxis, LambdaMassAxis}); + registry.add("matching/PC/matchedJetPtAntiLambda0PtMass", "matchedJetPtAntiLambda0PtMass", HistType::kTH3D, {detJetPtAxis, V0PtAxis, LambdaMassAxis}); + registry.add("matching/PC/matchedJetsPtAntiLambda0PtMass", "matchedJetsPtAntiLambda0PtMass", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, V0PtAxis, LambdaMassAxis}); + + registry.add("matching/PC/matchednV0sConePtEta", "matchednV0sConePtEta", HistType::kTH3D, {v0Count, detJetPtAxis, etaAxis}); + registry.add("matching/PC/matchedConePtEtaPhi", "matchedConePtEtaPhi", HistType::kTH3D, {detJetPtAxis, etaAxis, phiAxis}); + registry.add("matching/PC/matchedJetPtEtaConePt", "matchedJetPtEtaConePt", HistType::kTH3D, {detJetPtAxis, etaAxis, detJetPtAxis}); + registry.add("matching/PC/matchedJetsPtEtaConePt", "matchedJetsPtEtaConePt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, etaAxis, detJetPtAxis}); + + registry.add("matching/PC/fakenV0sConePtEta", "fakenV0sConePtEta", HistType::kTH3D, {v0Count, detJetPtAxis, etaAxis}); + registry.add("matching/PC/fakeConePtEtaPhi", "fakeConePtEtaPhi", HistType::kTH3D, {detJetPtAxis, etaAxis, phiAxis}); + registry.add("matching/PC/fakeJetPtEtaConePt", "fakeJetPtEtaConePt", HistType::kTH3D, {detJetPtAxis, etaAxis, detJetPtAxis}); + registry.add("matching/PC/fakeJetsPtEtaConePt", "fakeJetsPtEtaConePt", HistType::kTHnSparseD, {partJetPtAxis, detJetPtAxis, etaAxis, detJetPtAxis}); + } // doprocessMcV0MatchedPerpCone } // init + // TODO: This should contain a lookup table or function containing the various V0 weights + // Returns a std::vector of weights for a particle + template + std::vector getV0SignalWeight(C const& coll, V const& v0) + { + // 0: bkg, 1: K0S, 2: Lambda, 3: AntiLambda + std::vector w(4, 0.); + double purity = 0.8; // TODO: need getter to set this + + bool isK = IsK0SCandidate(coll, v0); + bool isL = IsLambdaCandidate(coll, v0); + bool isAL = IsAntiLambdaCandidate(coll, v0); + + // FIXME: Competing Mass Cut will change this approach. Only one signal type per particle + // Candidate for a single particle + switch (isK + isL + isAL) { + case 0: + break; + case 1: + w[1] = static_cast(isK) * purity; + w[2] = static_cast(isL) * purity; + w[3] = static_cast(isAL) * purity; + break; + case 2: + w[1] = static_cast(isK) * (2. / 3.) * purity; + w[2] = (isK ? 2. / 3. : 0.5) * purity; + w[3] = (isK ? 2. / 3. : 0.5) * purity; + break; + case 3: + w[1] = 0.5 * purity; + w[2] = 0.25 * purity; + w[3] = 0.25 * purity; + break; + } + w[0] = 1. - (w[1] + w[2] + w[3]); + return w; + } // getV0SignalWeight + // Converts state from uint32_t to std::vector containing the particle classes for that weight + std::vector convertState(uint32_t state, int nParticles, int nClasses = 4) + { + std::vector v(nParticles, nClasses); + int nStates = pow(nClasses, nParticles); + int nBitsPerParticle = round(log2(nClasses)); + int nBitsPerInt = sizeof(uint32_t) * 8; + + // Check if the input configuration is parseable + if ((nClasses & (nClasses - 1)) != 0) { + // It's likely possible to make this work for non-power of 2 classes, but it's not needed and therefore not implemented + LOGF(warning, "Number of classes (%d) must be a power of 2", nClasses); + return v; + } + if (nStates <= 0) { + LOGF(warning, "Illegal number of states (%d)! %s", nStates, (nStates == 0) ? "" : "Max = 2^31"); + return v; + } + if (nParticles * nBitsPerParticle > nBitsPerInt) { + LOGF(warning, "Number of bits required to parse the state (%d * %d = %d) is too large for %d bits per int!", nParticles, nBitsPerParticle, nParticles * nBitsPerParticle, nBitsPerInt); + return v; + } + if (state >= (uint32_t)nStates) { + LOGF(warning, "Illegal state! State %d >= %d", state, nStates); + return v; + } + + for (int ip = 0; ip < nParticles; ip++) { + double value = 0; + int startBit = ip * nBitsPerParticle; + for (int ib = 0; ib < nBitsPerParticle; ib++) { + int bit = startBit + ib; + int bitVal = ((state & (1 << bit)) > 0); + value += bitVal * TMath::Power(2, ib); + } + v[ip] = value; + } + return v; + } // convertState + // Returns the corrected values for z and ptjet for a given state + std::vector correctedValues(std::vector state, std::vector values) + { + // Assumes values = (z1, z2, ..., zn, ptjet) + std::vector v(values); + double r = 0; + int nParticles = state.size(); + + if (values.size() != (uint32_t)(nParticles + 1)) { + LOGF(warning, "Number of values (%d) must be equal to the number of particles (%d) + 1!", values.size(), nParticles); + return v; + } + for (int ip = 0; ip < nParticles; ip++) { + if (state[ip] == 0) { + r += values[ip]; + } + } + for (int ip = 0; ip < nParticles; ip++) { + if (state[ip] == 0) { + v[ip] = values[ip] / (1 - r); + } + } + v[nParticles] = values[nParticles] * (1 - r); + return v; + } + double stateWeight(std::vector state, std::vector> weights) + { + double w = 1.; + for (int ip = 0; (uint32_t)ip < state.size(); ip++) { + w *= weights[ip][state[ip]]; + } + return w; + } + template bool JetContainsV0s(JetType const& jet) { @@ -745,6 +1049,8 @@ struct JetFragmentation { template bool V0sAreMatched(T const& v0, U const& particle, V const& /*tracks*/) { + // FIXME: Can we use matchedV0Particle instead? + // https://github.com/AliceO2Group/O2Physics/blob/31ba54647675645b4669001e3ae9a99614f26d36/PWGJE/Core/JetV0Utilities.h#L131 auto negId = v0.template negTrack_as().mcParticleId(); auto posId = v0.template posTrack_as().mcParticleId(); auto daughters = particle.daughtersIds(); @@ -877,7 +1183,7 @@ struct JetFragmentation { } // TODO: Can probably be made simpler/shorter by using V0MCLabels - template + template // Not used for V0 jets void fillMcMatchedV0Histograms(CollisionType const& collision, V0Type const& v0, trackType const&, particleType const&, double weight = 1.) { auto negTrack = v0.template negTrack_as(); @@ -899,18 +1205,18 @@ struct JetFragmentation { if (particleMotherOfNeg.isPhysicalPrimary() && particleMotherOfNeg == particleMotherOfPos) { double ptPartV0 = particleMotherOfNeg.pt(); int pdg = particleMotherOfNeg.pdgCode(); - registry.fill(HIST("matching/V0/V0PartPtDetPt"), ptPartV0, v0.pt()); - registry.fill(HIST("matching/V0/V0PartPtRatioPtRelDiffPt"), ptPartV0, v0.pt() / ptPartV0, (v0.pt() - ptPartV0) / ptPartV0); + registry.fill(HIST("matching/V0/V0PartPtDetPt"), ptPartV0, v0.pt(), weight); + registry.fill(HIST("matching/V0/V0PartPtRatioPtRelDiffPt"), ptPartV0, v0.pt() / ptPartV0, (v0.pt() - ptPartV0) / ptPartV0, weight); - if (pdg == 310) { // K0S - registry.fill(HIST("matching/V0/K0SPtEtaPhi"), ptPartV0, v0.pt(), v0.eta(), v0.phi()); + if (TMath::Abs(pdg) == 310) { // K0S + registry.fill(HIST("matching/V0/K0SPtEtaPhi"), ptPartV0, v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/K0SPtCtauMass"), ptPartV0, v0.pt(), ctauK0s, v0.mK0Short(), weight); registry.fill(HIST("matching/V0/K0SPtRadiusCosPA"), ptPartV0, v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); registry.fill(HIST("matching/V0/K0SPtDCAposneg"), ptPartV0, v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); registry.fill(HIST("matching/V0/K0SPtDCAd"), ptPartV0, v0.pt(), v0.dcaV0daughters(), weight); registry.fill(HIST("matching/V0/K0SPtMass"), ptPartV0, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); } else if (pdg == 3122) { // Lambda - registry.fill(HIST("matching/V0/LambdaPtEtaPhi"), ptPartV0, v0.pt(), v0.eta(), v0.phi()); + registry.fill(HIST("matching/V0/LambdaPtEtaPhi"), ptPartV0, v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/LambdaPtCtauMass"), ptPartV0, v0.pt(), ctauLambda, v0.mLambda(), weight); registry.fill(HIST("matching/V0/LambdaPtRadiusCosPA"), ptPartV0, v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); registry.fill(HIST("matching/V0/LambdaPtDCAposneg"), ptPartV0, v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); @@ -921,7 +1227,7 @@ struct JetFragmentation { double reflectedMass = ReflectedMass(v0, true); registry.fill(HIST("matching/V0/Lambda0Reflection"), ptPartV0, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); } else if (pdg == -3122) { // AntiLambda - registry.fill(HIST("matching/V0/antiLambdaPtEtaPhi"), ptPartV0, v0.pt(), v0.eta(), v0.phi()); + registry.fill(HIST("matching/V0/antiLambdaPtEtaPhi"), ptPartV0, v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/antiLambdaPtCtauMass"), ptPartV0, v0.pt(), ctauAntiLambda, v0.mAntiLambda(), weight); registry.fill(HIST("matching/V0/antiLambdaPtRadiusCosPA"), ptPartV0, v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); registry.fill(HIST("matching/V0/antiLambdaPtDCAposneg"), ptPartV0, v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); @@ -933,38 +1239,42 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/antiLambda0Reflection"), ptPartV0, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); } } // if mothers match - } // for mothers of pos - } // for mothers of neg + } // for mothers of pos + } // for mothers of neg } template - void fillDataJetHistograms(T const& jet) + void fillDataJetHistograms(T const& jet, double weight = 1.) { - registry.fill(HIST("data/jets/jetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); + registry.fill(HIST("data/jets/jetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); } - template - void fillDataFragHistograms(T const& jet) + void fillDataJetHistogramsWithWeights(double jetpt, double jeteta, double jetphi, double weight = 1.) { - for (const auto& track : jet.template tracks_as()) { + registry.fill(HIST("data/jets/weighted/jetPtEtaPhi"), jetpt, jeteta, jetphi, weight); + } + template // Not used for V0 jets + void fillDataFragHistograms(T const& jet, double weight = 1.) + { + for (const auto& track : jet.template tracks_as()) { double chargeFrag = -1., trackProj = -1., xi = -1., theta = -1.; chargeFrag = ChargeFrag(jet, track); trackProj = TrackProj(jet, track); theta = Theta(jet, track); xi = Xi(jet, track); - registry.fill(HIST("data/jets/jetPtTrackPt"), jet.pt(), track.pt()); - registry.fill(HIST("data/jets/jetTrackPtEtaPhi"), track.pt(), track.eta(), track.phi()); - registry.fill(HIST("data/jets/jetPtFrag"), jet.pt(), chargeFrag); - registry.fill(HIST("data/jets/jetPtTrackProj"), jet.pt(), trackProj); - registry.fill(HIST("data/jets/jetPtXi"), jet.pt(), xi); - registry.fill(HIST("data/jets/jetPtTheta"), jet.pt(), theta); - registry.fill(HIST("data/jets/jetPtXiTheta"), jet.pt(), xi, theta); - registry.fill(HIST("data/jets/jetPtZTheta"), jet.pt(), trackProj, theta); + registry.fill(HIST("data/jets/jetPtTrackPt"), jet.pt(), track.pt(), weight); + registry.fill(HIST("data/jets/jetTrackPtEtaPhi"), track.pt(), track.eta(), track.phi(), weight); + registry.fill(HIST("data/jets/jetPtFrag"), jet.pt(), chargeFrag, weight); + registry.fill(HIST("data/jets/jetPtTrackProj"), jet.pt(), trackProj, weight); + registry.fill(HIST("data/jets/jetPtXi"), jet.pt(), xi, weight); + registry.fill(HIST("data/jets/jetPtTheta"), jet.pt(), theta, weight); + registry.fill(HIST("data/jets/jetPtXiTheta"), jet.pt(), xi, theta, weight); + registry.fill(HIST("data/jets/jetPtZTheta"), jet.pt(), trackProj, theta, weight); } } template - void fillDataV0Histograms(CollisionType const& collision, V0Type const& V0s) + void fillDataV0Histograms(CollisionType const& collision, V0Type const& V0s, double weight = 1.) { for (const auto& v0 : V0s) { double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; @@ -975,44 +1285,45 @@ struct JetFragmentation { double massRatio = v0.mAntiLambda() / v0.mLambda(); double massRelDiff = (v0.mLambda() - v0.mAntiLambda()) / v0.mLambda(); - registry.fill(HIST("data/V0/V0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); - registry.fill(HIST("data/V0/V0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda); - registry.fill(HIST("data/V0/V0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/V0/V0PtLambdaMasses"), v0.pt(), massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/V0/V0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA()); - registry.fill(HIST("data/V0/V0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - registry.fill(HIST("data/V0/V0PtDCAd"), v0.pt(), v0.dcaV0daughters()); + registry.fill(HIST("data/V0/V0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/V0/V0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("data/V0/V0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/V0/V0PtMassWide"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/V0/V0PtLambdaMasses"), v0.pt(), massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/V0/V0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/V0/V0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/V0/V0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); - registry.fill(HIST("data/V0/V0CutVariation"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), v0.v0radius(), ctauK0s, v0.v0cosPA(), TMath::Abs(v0.dcapostopv()), TMath::Abs(v0.dcanegtopv()), v0.dcaV0daughters()); + registry.fill(HIST("data/V0/V0CutVariation"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), v0.v0radius(), ctauK0s, v0.v0cosPA(), TMath::Abs(v0.dcapostopv()), TMath::Abs(v0.dcanegtopv()), v0.dcaV0daughters(), weight); if (IsLambdaCandidate(collision, v0)) { - registry.fill(HIST("data/V0/LambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); - registry.fill(HIST("data/V0/LambdaPtCtauMass"), v0.pt(), ctauLambda, v0.mLambda()); - registry.fill(HIST("data/V0/LambdaPtLambdaMasses"), v0.pt(), massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/V0/LambdaPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA()); - registry.fill(HIST("data/V0/LambdaPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - registry.fill(HIST("data/V0/LambdaPtDCAd"), v0.pt(), v0.dcaV0daughters()); + registry.fill(HIST("data/V0/LambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/V0/LambdaPtCtauMass"), v0.pt(), ctauLambda, v0.mLambda(), weight); + registry.fill(HIST("data/V0/LambdaPtLambdaMasses"), v0.pt(), massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/V0/LambdaPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/V0/LambdaPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/V0/LambdaPtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); } if (IsAntiLambdaCandidate(collision, v0)) { - registry.fill(HIST("data/V0/antiLambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); - registry.fill(HIST("data/V0/antiLambdaPtCtauMass"), v0.pt(), ctauAntiLambda, v0.mAntiLambda()); - registry.fill(HIST("data/V0/antiLambdaPtLambdaMasses"), v0.pt(), massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/V0/antiLambdaPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA()); - registry.fill(HIST("data/V0/antiLambdaPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - registry.fill(HIST("data/V0/antiLambdaPtDCAd"), v0.pt(), v0.dcaV0daughters()); + registry.fill(HIST("data/V0/antiLambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/V0/antiLambdaPtCtauMass"), v0.pt(), ctauAntiLambda, v0.mAntiLambda(), weight); + registry.fill(HIST("data/V0/antiLambdaPtLambdaMasses"), v0.pt(), massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/V0/antiLambdaPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/V0/antiLambdaPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/V0/antiLambdaPtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); } if (IsK0SCandidate(collision, v0)) { - registry.fill(HIST("data/V0/K0SPtEtaPhi"), v0.pt(), v0.eta(), v0.phi()); - registry.fill(HIST("data/V0/K0SPtCtauMass"), v0.pt(), ctauK0s, v0.mK0Short()); - registry.fill(HIST("data/V0/K0SPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA()); - registry.fill(HIST("data/V0/K0SPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - registry.fill(HIST("data/V0/K0SPtDCAd"), v0.pt(), v0.dcaV0daughters()); + registry.fill(HIST("data/V0/K0SPtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/V0/K0SPtCtauMass"), v0.pt(), ctauK0s, v0.mK0Short(), weight); + registry.fill(HIST("data/V0/K0SPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/V0/K0SPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/V0/K0SPtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); } } // for v0 } template - void fillDataV0FragHistograms(CollisionType const& collision, JetType const& jet, V0Type const& v0) + void fillDataV0FragHistograms(CollisionType const& collision, JetType const& jet, V0Type const& v0, double weight = 1.) { double trackProj = TrackProj(jet, v0); double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; @@ -1023,76 +1334,133 @@ struct JetFragmentation { double massRatio = v0.mAntiLambda() / v0.mLambda(); double massRelDiff = (v0.mLambda() - v0.mAntiLambda()) / v0.mLambda(); - registry.fill(HIST("data/jets/V0/jetPtV0PtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi()); - registry.fill(HIST("data/jets/V0/jetPtV0PtCtau"), jet.pt(), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda); - registry.fill(HIST("data/jets/V0/jetPtV0PtMass"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtV0PtLambdaMasses"), jet.pt(), v0.pt(), massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/jets/V0/jetPtV0PtRadiusCosPA"), jet.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtV0PtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - registry.fill(HIST("data/jets/V0/jetPtV0PtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters()); - - registry.fill(HIST("data/jets/V0/jetPtV0TrackProj"), jet.pt(), trackProj); - registry.fill(HIST("data/jets/V0/jetPtV0TrackProjCtau"), jet.pt(), trackProj, ctauK0s, ctauLambda, ctauAntiLambda); - registry.fill(HIST("data/jets/V0/jetPtV0TrackProjMass"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtV0TrackProjLambdaMasses"), jet.pt(), trackProj, massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/jets/V0/jetPtV0TrackProjRadiusCosPA"), jet.pt(), trackProj, v0.v0radius(), v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtV0TrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv()); - registry.fill(HIST("data/jets/V0/jetPtV0TrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters()); + registry.fill(HIST("data/jets/V0/jetPtV0PtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0PtCtau"), jet.pt(), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("data/jets/V0/jetPtV0PtMass"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0PtMassWide"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0PtLambdaMasses"), jet.pt(), v0.pt(), massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/jets/V0/jetPtV0PtRadiusCosPA"), jet.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0PtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0PtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters(), weight); + + registry.fill(HIST("data/jets/V0/jetPtV0TrackProj"), jet.pt(), trackProj, weight); + registry.fill(HIST("data/jets/V0/jetPtV0TrackProjCtau"), jet.pt(), trackProj, ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("data/jets/V0/jetPtV0TrackProjMass"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0TrackProjMassWide"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0TrackProjLambdaMasses"), jet.pt(), trackProj, massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/jets/V0/jetPtV0TrackProjRadiusCosPA"), jet.pt(), trackProj, v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0TrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/jets/V0/jetPtV0TrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters(), weight); if (IsK0SCandidate(collision, v0)) { - registry.fill(HIST("data/jets/V0/jetPtK0SPtCtau"), jet.pt(), v0.pt(), ctauK0s); - registry.fill(HIST("data/jets/V0/jetPtK0SPtMass"), jet.pt(), v0.pt(), v0.mK0Short()); - registry.fill(HIST("data/jets/V0/jetPtK0SPtAllMasses"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtK0SPtRadius"), jet.pt(), v0.pt(), v0.v0radius()); - registry.fill(HIST("data/jets/V0/jetPtK0SPtCosPA"), jet.pt(), v0.pt(), v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtK0SPtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters()); - registry.fill(HIST("data/jets/V0/jetPtK0SPtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - - registry.fill(HIST("data/jets/V0/jetPtK0STrackProjCtau"), jet.pt(), trackProj, ctauK0s); - registry.fill(HIST("data/jets/V0/jetPtK0STrackProjMass"), jet.pt(), trackProj, v0.mK0Short()); - registry.fill(HIST("data/jets/V0/jetPtK0STrackProjAllMasses"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtK0STrackProjRadius"), jet.pt(), trackProj, v0.v0radius()); - registry.fill(HIST("data/jets/V0/jetPtK0STrackProjCosPA"), jet.pt(), trackProj, v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtK0STrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters()); - registry.fill(HIST("data/jets/V0/jetPtK0STrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv()); + registry.fill(HIST("data/jets/V0/jetPtK0SPtCtau"), jet.pt(), v0.pt(), ctauK0s, weight); + registry.fill(HIST("data/jets/V0/jetPtK0SPtMass"), jet.pt(), v0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0SPtAllMasses"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0SPtRadius"), jet.pt(), v0.pt(), v0.v0radius(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0SPtCosPA"), jet.pt(), v0.pt(), v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0SPtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0SPtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + + registry.fill(HIST("data/jets/V0/jetPtK0STrackProjCtau"), jet.pt(), trackProj, ctauK0s, weight); + registry.fill(HIST("data/jets/V0/jetPtK0STrackProjMass"), jet.pt(), trackProj, v0.mK0Short(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0STrackProjAllMasses"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0STrackProjRadius"), jet.pt(), trackProj, v0.v0radius(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0STrackProjCosPA"), jet.pt(), trackProj, v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0STrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/V0/jetPtK0STrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); } if (IsLambdaCandidate(collision, v0)) { - registry.fill(HIST("data/jets/V0/jetPtLambdaPtCtau"), jet.pt(), v0.pt(), ctauLambda); - registry.fill(HIST("data/jets/V0/jetPtLambdaPtMass"), jet.pt(), v0.pt(), v0.mLambda()); - registry.fill(HIST("data/jets/V0/jetPtLambdaPtAllMasses"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtLambdaPtLambdaMasses"), jet.pt(), v0.pt(), massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/jets/V0/jetPtLambdaPtRadius"), jet.pt(), v0.pt(), v0.v0radius()); - registry.fill(HIST("data/jets/V0/jetPtLambdaPtCosPA"), jet.pt(), v0.pt(), v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtLambdaPtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters()); - registry.fill(HIST("data/jets/V0/jetPtLambdaPtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjCtau"), jet.pt(), trackProj, ctauLambda); - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjMass"), jet.pt(), trackProj, v0.mLambda()); - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjAllMasses"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjLambdaMasses"), jet.pt(), trackProj, massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjRadius"), jet.pt(), trackProj, v0.v0radius()); - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjCosPA"), jet.pt(), trackProj, v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters()); - registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv()); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtCtau"), jet.pt(), v0.pt(), ctauLambda, weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtMass"), jet.pt(), v0.pt(), v0.mLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtAllMasses"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtLambdaMasses"), jet.pt(), v0.pt(), massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtRadius"), jet.pt(), v0.pt(), v0.v0radius(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtCosPA"), jet.pt(), v0.pt(), v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaPtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjCtau"), jet.pt(), trackProj, ctauLambda, weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjMass"), jet.pt(), trackProj, v0.mLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjAllMasses"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjLambdaMasses"), jet.pt(), trackProj, massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjRadius"), jet.pt(), trackProj, v0.v0radius(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjCosPA"), jet.pt(), trackProj, v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/V0/jetPtLambdaTrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); } if (IsAntiLambdaCandidate(collision, v0)) { - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtCtau"), jet.pt(), v0.pt(), ctauAntiLambda); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtMass"), jet.pt(), v0.pt(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtAllMasses"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtLambdaMasses"), jet.pt(), v0.pt(), massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtRadius"), jet.pt(), v0.pt(), v0.v0radius()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtCosPA"), jet.pt(), v0.pt(), v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv()); - - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjCtau"), jet.pt(), trackProj, ctauAntiLambda); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjMass"), jet.pt(), trackProj, v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjAllMasses"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjLambdaMasses"), jet.pt(), trackProj, massDiff, massRatio, massRelDiff); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjRadius"), jet.pt(), trackProj, v0.v0radius()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjCosPA"), jet.pt(), trackProj, v0.v0cosPA()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters()); - registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv()); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtCtau"), jet.pt(), v0.pt(), ctauAntiLambda, weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtMass"), jet.pt(), v0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtAllMasses"), jet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtLambdaMasses"), jet.pt(), v0.pt(), massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtRadius"), jet.pt(), v0.pt(), v0.v0radius(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtCosPA"), jet.pt(), v0.pt(), v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtDCAd"), jet.pt(), v0.pt(), v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaPtDCAposneg"), jet.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjCtau"), jet.pt(), trackProj, ctauAntiLambda, weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjMass"), jet.pt(), trackProj, v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjAllMasses"), jet.pt(), trackProj, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjLambdaMasses"), jet.pt(), trackProj, massDiff, massRatio, massRelDiff, weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjRadius"), jet.pt(), trackProj, v0.v0radius(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjCosPA"), jet.pt(), trackProj, v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjDCAd"), jet.pt(), trackProj, v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/V0/jetPtAntiLambdaTrackProjDCAposneg"), jet.pt(), trackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); + } + } + template + void fillDataV0FragHistogramsWithWeights(C const& collision, J const& jet, std::vector state, std::vector values, double weight) + { + // TODO: Add other histograms + double jetpt = values[values.size() - 1]; + int ip = 0; + for (const auto& v0 : jet.template candidates_as()) { + double z = values[ip]; + ip++; + + double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short; + double ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar; + + switch (state[ip]) { + case 0: // Background + registry.fill(HIST("data/jets/weighted/V0/jetPtBkgTrackProjCtau"), jetpt, z, ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtBkgTrackProjMass"), jetpt, z, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtBkgTrackProjRadiusCosPA"), jetpt, z, v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtBkgTrackProjDCAposneg"), jetpt, z, v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtBkgTrackProjDCAd"), jetpt, z, v0.dcaV0daughters(), weight); + break; + case 1: // K0S + registry.fill(HIST("data/jets/weighted/V0/jetPtK0STrackProjCtau"), jetpt, z, ctauK0s, weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtK0STrackProjAllMasses"), jetpt, z, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtK0STrackProjRadius"), jetpt, z, v0.v0radius(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtK0STrackProjCosPA"), jetpt, z, v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtK0STrackProjDCAd"), jetpt, z, v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtK0STrackProjDCAposneg"), jetpt, z, v0.dcapostopv(), v0.dcanegtopv(), weight); + break; + case 2: // Lambda + registry.fill(HIST("data/jets/weighted/V0/jetPtLambdaTrackProjCtau"), jetpt, z, ctauLambda, weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtLambdaTrackProjAllMasses"), jetpt, z, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtLambdaTrackProjRadius"), jetpt, z, v0.v0radius(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtLambdaTrackProjCosPA"), jetpt, z, v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtLambdaTrackProjDCAd"), jetpt, z, v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtLambdaTrackProjDCAposneg"), jetpt, z, v0.dcapostopv(), v0.dcanegtopv(), weight); + break; + case 3: // AntiLambda + registry.fill(HIST("data/jets/weighted/V0/jetPtAntiLambdaTrackProjCtau"), jetpt, z, ctauAntiLambda, weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtAntiLambdaTrackProjAllMasses"), jetpt, z, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtAntiLambdaTrackProjRadius"), jetpt, z, v0.v0radius(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtAntiLambdaTrackProjCosPA"), jetpt, z, v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtAntiLambdaTrackProjDCAd"), jetpt, z, v0.dcaV0daughters(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtAntiLambdaTrackProjDCAposneg"), jetpt, z, v0.dcapostopv(), v0.dcanegtopv(), weight); + break; + } + registry.fill(HIST("data/jets/weighted/V0/jetPtV0TrackProjCtau"), jetpt, z, ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtV0TrackProjMass"), jetpt, z, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtV0TrackProjMassWide"), jetpt, z, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtV0TrackProjRadiusCosPA"), jetpt, z, v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtV0TrackProjDCAposneg"), jetpt, z, v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/jets/weighted/V0/jetPtV0TrackProjDCAd"), jetpt, z, v0.dcaV0daughters(), weight); } } @@ -1116,7 +1484,7 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/matchPartJetPtRelDiffPt"), partJet.pt(), (detJet.pt() - partJet.pt()) / partJet.pt(), weight); } - template + template // Not used for V0 jets void fillMatchingHistogramsConstituent(DetJet const& detJet, PartJet const& partJet, Track const& track, Particle const& particle, double weight = 1.) { double detChargeFrag = -1., detTrackProj = -1., detTheta = -1., detXi = -1.; @@ -1174,7 +1542,7 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/matchDetJetPtZThetaPartJetPtZTheta"), detJet.pt(), detTrackProj, detTheta, partJet.pt(), partTrackProj, partTheta, weight); } - template + template // Not used for V0 jets void fillMatchingFakeOrMiss(Jet const& jet, Constituent const& constituent, bool isFake, double weight = 1.) { double chargeFrag = -1., trackProj = -1., theta = -1., xi = -1.; @@ -1207,7 +1575,7 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/missJetPtV0TrackProj"), jet.pt(), trackProj, weight); registry.fill(HIST("matching/jets/V0/missJetPtV0PtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi(), weight); - if (v0.pdgCode() == 310) { // K0S + if (TMath::Abs(v0.pdgCode()) == 310) { // K0S registry.fill(HIST("matching/jets/V0/missJetPtK0SPtEtaPhi"), jet.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/jets/V0/missJetPtK0STrackProj"), jet.pt(), trackProj, weight); } else if (v0.pdgCode() == 3122) { // Lambda @@ -1303,6 +1671,174 @@ struct JetFragmentation { } } + // Combinatorial background for inclusive V0s + template + void fillMatchingV0FakeHistograms(T const& coll, U const& v0, double weight = 1.) + { + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassK0Short; + + registry.fill(HIST("matching/V0/fakeV0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("matching/V0/fakeV0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("matching/V0/fakeV0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("matching/V0/fakeV0PtLambdaMasses"), v0.pt(), v0.mLambda() - v0.mAntiLambda(), v0.mAntiLambda() / v0.mLambda(), (v0.mLambda() - v0.mAntiLambda()) / v0.mLambda(), weight); + registry.fill(HIST("matching/V0/fakeV0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("matching/V0/fakeV0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("matching/V0/fakeV0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + } + // Check if V0 was missed because daughter decayed + template + void fillMatchingV0DecayedHistograms(V const& v0, double weight = 1.) + { + // Check if decayed daughter + auto posTrack = v0.template posTrack_as(); + auto negTrack = v0.template negTrack_as(); + + auto posPart = posTrack.template mcParticle_as(); + auto negPart = negTrack.template mcParticle_as(); + + auto posMom = posPart.template mothers_first_as(); + auto negMom = negPart.template mothers_first_as(); + + bool posDecayed = false; + bool negDecayed = false; + + // This should not happen. They should have been matched + if (posMom == negMom) { + registry.fill(HIST("matching/V0/nonedecayedFakeV0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + return; + } + + if (posMom.has_mothers()) { + auto posGrandMom = posMom.template mothers_first_as(); + if (posGrandMom == negMom) { + posDecayed = true; + } + } + if (negMom.has_mothers()) { + auto negGrandMom = negMom.template mothers_first_as(); + if (negGrandMom == posMom) { + negDecayed = true; + } + } + + // This shouldn't happen + if (posDecayed && negDecayed) { + registry.fill(HIST("matching/V0/doubledecayedFakeV0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + return; + } + if (posDecayed || negDecayed) { + double pt = posDecayed ? negMom.pt() : posMom.pt(); + int pdg = posDecayed ? negMom.pdgCode() : posMom.pdgCode(); + + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("matching/V0/decayedK0SV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } else if (pdg == 3122) { + registry.fill(HIST("matching/V0/decayedLambdaV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } else if (pdg == -3122) { + registry.fill(HIST("matching/V0/decayedAntiLambdaV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } else { + registry.fill(HIST("matching/V0/decayedOtherPtV0PtMass"), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } + } + } + // Check if V0 was missed because daughter decayed + template + void fillMatchingV0DecayedHistograms(V const& partJet, W const& detJet, X const& v0, double weight = 1.) + { + // Check if decayed daughter + auto posTrack = v0.template posTrack_as(); + auto negTrack = v0.template negTrack_as(); + + auto posPart = posTrack.template mcParticle_as(); + auto negPart = negTrack.template mcParticle_as(); + + auto posMom = posPart.template mothers_first_as(); + auto negMom = negPart.template mothers_first_as(); + + bool posDecayed = false; + bool negDecayed = false; + + double zv0 = TrackProj(detJet, v0); + + // This should not happen. They should have been matched + if (posMom == negMom) { + registry.fill(HIST("matching/jets/V0/nonedecayedFakeV0PtMass"), partJet.pt(), detJet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("matching/jets/V0/nonedecayedFakeV0TrackProjMass"), partJet.pt(), detJet.pt(), zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + return; + } + + if (posMom.has_mothers()) { + auto posGrandMom = posMom.template mothers_first_as(); + if (posGrandMom == negMom) { + posDecayed = true; + } + } + if (negMom.has_mothers()) { + auto negGrandMom = negMom.template mothers_first_as(); + if (negGrandMom == posMom) { + negDecayed = true; + } + } + + // This shouldn't happen + if (posDecayed && negDecayed) { + registry.fill(HIST("matching/jets/V0/doubledecayedFakeV0PtMass"), partJet.pt(), detJet.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("matching/jets/V0/doubledecayedFakeV0TrackProjMass"), partJet.pt(), detJet.pt(), zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + return; + } + if (posDecayed || negDecayed) { + double pt = posDecayed ? negMom.pt() : posMom.pt(); + int pdg = posDecayed ? negMom.pdgCode() : posMom.pdgCode(); + + double z = 0.; + bool partIsInJet = false; + for (auto const& part : partJet.template candidates_as()) { + if (posDecayed && (part == negMom)) { + partIsInJet = true; + z = TrackProj(partJet, part); + break; + } + if (negDecayed && (part == posMom)) { + partIsInJet = true; + z = TrackProj(partJet, part); + break; + } + } + + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("matching/jets/V0/decayedK0SV0PtMass"), partJet.pt(), detJet.pt(), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + if (partIsInJet) { + registry.fill(HIST("matching/jets/V0/decayedK0SV0TrackProjMass"), partJet.pt(), detJet.pt(), z, zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } + } else if (pdg == 3122) { + registry.fill(HIST("matching/jets/V0/decayedLambdaV0PtMass"), partJet.pt(), detJet.pt(), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + if (partIsInJet) { + registry.fill(HIST("matching/jets/V0/decayedLambdaV0TrackProjMass"), partJet.pt(), detJet.pt(), z, zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } + } else if (pdg == -3122) { + registry.fill(HIST("matching/jets/V0/decayedAntiLambdaV0PtMass"), partJet.pt(), detJet.pt(), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + if (partIsInJet) { + registry.fill(HIST("matching/jets/V0/decayedAntiLambdaV0TrackProjMass"), partJet.pt(), detJet.pt(), z, zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } + } else { + registry.fill(HIST("matching/jets/V0/decayedOtherPtV0PtMass"), partJet.pt(), detJet.pt(), pt, v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + if (partIsInJet) { + registry.fill(HIST("matching/jets/V0/decayedOtherPtV0TrackProjMass"), partJet.pt(), detJet.pt(), z, zv0, v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + } + } + } + } + template + void fillMatchingFakeV0DauHistograms(U const& v0, double weight = 1.) + { + auto negTrack = v0.template negTrack_as(); + auto posTrack = v0.template posTrack_as(); + registry.fill(HIST("matching/V0/fakeV0PosTrackPtEtaPhi"), posTrack.pt(), posTrack.eta(), posTrack.phi(), weight); + registry.fill(HIST("matching/V0/fakeV0NegTrackPtEtaPhi"), negTrack.pt(), negTrack.eta(), negTrack.phi(), weight); + } + // Reconstructed signal for inclusive V0s template void fillMatchingV0Histograms(CollisionType const& collision, V0Type const& v0, particleType const& particle, double weight = 1.) { @@ -1310,18 +1846,18 @@ struct JetFragmentation { double ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar; double ctauK0s = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short; - registry.fill(HIST("matching/V0/V0PartPtDetPt"), particle.pt(), v0.pt()); - registry.fill(HIST("matching/V0/V0PartPtRatioPtRelDiffPt"), particle.pt(), v0.pt() / particle.pt(), (v0.pt() - particle.pt()) / particle.pt()); + registry.fill(HIST("matching/V0/V0PartPtDetPt"), particle.pt(), v0.pt(), weight); + registry.fill(HIST("matching/V0/V0PartPtRatioPtRelDiffPt"), particle.pt(), v0.pt() / particle.pt(), (v0.pt() - particle.pt()) / particle.pt(), weight); if (TMath::Abs(particle.pdgCode()) == 310) { // K0S - registry.fill(HIST("matching/V0/K0SPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi()); + registry.fill(HIST("matching/V0/K0SPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/K0SPtCtauMass"), particle.pt(), v0.pt(), ctauK0s, v0.mK0Short(), weight); registry.fill(HIST("matching/V0/K0SPtRadiusCosPA"), particle.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); registry.fill(HIST("matching/V0/K0SPtDCAposneg"), particle.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); registry.fill(HIST("matching/V0/K0SPtDCAd"), particle.pt(), v0.pt(), v0.dcaV0daughters(), weight); registry.fill(HIST("matching/V0/K0SPtMass"), particle.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); } else if (particle.pdgCode() == 3122) { // Lambda - registry.fill(HIST("matching/V0/LambdaPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi()); + registry.fill(HIST("matching/V0/LambdaPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/LambdaPtCtauMass"), particle.pt(), v0.pt(), ctauLambda, v0.mLambda(), weight); registry.fill(HIST("matching/V0/LambdaPtRadiusCosPA"), particle.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); registry.fill(HIST("matching/V0/LambdaPtDCAposneg"), particle.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); @@ -1332,7 +1868,7 @@ struct JetFragmentation { double reflectedMass = ReflectedMass(v0, true); registry.fill(HIST("matching/V0/Lambda0Reflection"), particle.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); } else if (particle.pdgCode() == -3122) { // AntiLambda - registry.fill(HIST("matching/V0/antiLambdaPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi()); + registry.fill(HIST("matching/V0/antiLambdaPtEtaPhi"), particle.pt(), v0.pt(), v0.eta(), v0.phi(), weight); registry.fill(HIST("matching/V0/antiLambdaPtCtauMass"), particle.pt(), v0.pt(), ctauAntiLambda, v0.mAntiLambda(), weight); registry.fill(HIST("matching/V0/antiLambdaPtRadiusCosPA"), particle.pt(), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); registry.fill(HIST("matching/V0/antiLambdaPtDCAposneg"), particle.pt(), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); @@ -1344,9 +1880,9 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/antiLambda0Reflection"), particle.pt(), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), reflectedMass, weight); } } - + // Reconstructed signal for inclusive V0s: daughters template - void fillMatchingV0DauHistograms(V0Type const& v0, ParticleType const& /*particle*/, double weight = 1.) + void fillMatchingV0DauHistograms(V0Type const& v0, ParticleType const& /* pv0 */, double weight = 1.) { auto negTrack = v0.template negTrack_as(); auto posTrack = v0.template posTrack_as(); @@ -1355,6 +1891,7 @@ struct JetFragmentation { registry.fill(HIST("matching/V0/V0PosPartPtRatioPtRelDiffPt"), posPart.pt(), posTrack.pt() / posPart.pt(), (posTrack.pt() - posPart.pt()) / posPart.pt(), weight); registry.fill(HIST("matching/V0/V0NegPartPtRatioPtRelDiffPt"), negPart.pt(), negTrack.pt() / negPart.pt(), (negTrack.pt() - negPart.pt()) / negPart.pt(), weight); } + // Reconstructed signal for in-jet V0s: daughters template void fillMatchingV0DauJetHistograms(DetJetType const& detJet, PartJetType const& partJet, V0Type const& v0, ParticleType const& particle, double weight = 1.) { @@ -1362,10 +1899,10 @@ struct JetFragmentation { auto posTrack = v0.template posTrack_as(); auto negPart = negTrack.template mcParticle_as(); auto posPart = posTrack.template mcParticle_as(); - registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtPosPtRatioPtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), posTrack.pt(), posTrack.pt() / posPart.pt(), (posTrack.pt() - posPart.pt()) / posPart.pt(), weight); - registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtNegPtRatioPtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), negTrack.pt(), negTrack.pt() / negPart.pt(), (negTrack.pt() - negPart.pt()) / negPart.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtPosPtRatioPtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), posPart.pt(), posTrack.pt() / posPart.pt(), (posTrack.pt() - posPart.pt()) / posPart.pt(), weight); + registry.fill(HIST("matching/jets/V0/partJetPtDetJetPtPartV0PtNegPtRatioPtRelDiffPt"), partJet.pt(), detJet.pt(), particle.pt(), negPart.pt(), negTrack.pt() / negPart.pt(), (negTrack.pt() - negPart.pt()) / negPart.pt(), weight); } - + // Reconstructed signal for in-jet V0s template void fillMatchingV0FragHistograms(CollisionType const& collision, DetJetType const& detJet, PartJetType const& partJet, V0Type const& v0, ParticleType const& particle, double weight = 1.) { @@ -1403,7 +1940,7 @@ struct JetFragmentation { registry.fill(HIST("matching/jets/V0/partJetPtV0TrackProjDetJetPtV0TrackProjDCAposneg"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcapostopv(), v0.dcanegtopv(), weight); registry.fill(HIST("matching/jets/V0/partJetPtV0TrackProjDetJetPtV0TrackProjDCAd"), partJet.pt(), partTrackProj, detJet.pt(), detTrackProj, v0.dcaV0daughters(), weight); - if (particle.pdgCode() == 310) { // K0S + if (TMath::Abs(particle.pdgCode()) == 310) { // K0S registry.fill(HIST("matching/jets/V0/matchDetJetPtK0STrackProjPartJetPtK0STrackProj"), detJet.pt(), detTrackProj, partJet.pt(), partTrackProj, weight); registry.fill(HIST("matching/jets/V0/partJetPtK0SPtDetJetPtK0SPt"), partJet.pt(), particle.pt(), detJet.pt(), v0.pt(), weight); @@ -1502,10 +2039,10 @@ struct JetFragmentation { { registry.fill(HIST("detector-level/jets/detJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); } - template + template // Not used for V0 jets void fillMCDFragHistograms(Jet const& jet, double weight = 1.) { - for (const auto& track : jet.template tracks_as()) { + for (const auto& track : jet.template tracks_as()) { double chargeFrag = -1., trackProj = -1., theta = -1., xi = -1.; chargeFrag = ChargeFrag(jet, track); trackProj = TrackProj(jet, track); @@ -1528,10 +2065,10 @@ struct JetFragmentation { { registry.fill(HIST("particle-level/jets/partJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); } - template + template // Not used for V0 jets void fillMCPFragHistograms(Jet const& jet, double weight = 1.) { - for (const auto& track : jet.template tracks_as()) { + for (const auto& track : jet.template tracks_as()) { double chargeFrag = -1., trackProj = -1., theta = -1., xi = -1.; chargeFrag = ChargeFrag(jet, track); trackProj = TrackProj(jet, track); @@ -1549,13 +2086,236 @@ struct JetFragmentation { } } - void processDummy(JetTracks const&) {} + template + void fillDataPerpConeHists(T const& coll, U const& jet, V const& v0s, double weight = 1.) + { + double perpConeR = jet.r() * 1e-2; + double conePhi[2] = {RecoDecay::constrainAngle(jet.phi() - M_PI / 2, -M_PI), + RecoDecay::constrainAngle(jet.phi() + M_PI / 2, -M_PI)}; + double conePt[2] = {0., 0.}; + int nV0sinCone[2] = {0, 0}; + for (const auto& v0 : v0s) { + // Need to check if v0 passed jet finder selection/preselector cuts + bool v0InCones = false; + double dEta = v0.eta() - jet.eta(); + double dPhi[2] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -M_PI), + RecoDecay::constrainAngle(v0.phi() - conePhi[1], -M_PI)}; + for (int i = 0; i < 2; i++) { + if (TMath::Sqrt(dEta * dEta + dPhi[i] * dPhi[i]) < perpConeR) { + conePt[i] += v0.pt(); + nV0sinCone[i]++; + v0InCones = true; + } + } + if (!v0InCones) { + continue; + } + + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassK0Short; + + registry.fill(HIST("data/PC/JetPtEtaV0Pt"), jet.pt(), jet.eta(), v0.pt(), weight); + registry.fill(HIST("data/PC/V0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/PC/V0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("data/PC/V0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/PC/V0PtMassWide"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("data/PC/V0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/PC/V0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/PC/V0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + + if (IsLambdaCandidate(coll, v0)) { + registry.fill(HIST("data/PC/JetPtLambda0PtMass"), jet.pt(), v0.pt(), v0.mLambda(), weight); + + registry.fill(HIST("data/PC/JetPtEtaLambda0Pt"), jet.pt(), jet.eta(), v0.pt(), weight); + registry.fill(HIST("data/PC/LambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/PC/LambdaPtCtauMass"), v0.pt(), ctauLambda, v0.mLambda(), weight); + registry.fill(HIST("data/PC/LambdaPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/PC/LambdaPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/PC/LambdaPtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + } + if (IsAntiLambdaCandidate(coll, v0)) { + registry.fill(HIST("data/PC/JetPtAntiLambda0PtMass"), jet.pt(), v0.pt(), v0.mAntiLambda(), weight); + + registry.fill(HIST("data/PC/JetPtEtaAntiLambda0Pt"), jet.pt(), jet.eta(), v0.pt(), weight); + registry.fill(HIST("data/PC/antiLambdaPtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/PC/antiLambdaPtCtauMass"), v0.pt(), ctauAntiLambda, v0.mAntiLambda(), weight); + registry.fill(HIST("data/PC/antiLambdaPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/PC/antiLambdaPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/PC/antiLambdaPtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + } + if (IsK0SCandidate(coll, v0)) { + registry.fill(HIST("data/PC/JetPtK0SPtMass"), jet.pt(), v0.pt(), v0.mK0Short(), weight); + + registry.fill(HIST("data/PC/JetPtEtaK0SPt"), jet.pt(), jet.eta(), v0.pt(), weight); + registry.fill(HIST("data/PC/K0SPtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("data/PC/K0SPtCtauMass"), v0.pt(), ctauK0s, v0.mK0Short(), weight); + registry.fill(HIST("data/PC/K0SPtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("data/PC/K0SPtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("data/PC/K0SPtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + } + } + // Fill hist for Ncones: nv0s, conePt, coneEta, conePhi + for (int i = 0; i < 2; i++) { + registry.fill(HIST("data/PC/nV0sConePtEta"), nV0sinCone[i], conePt[i], jet.eta(), weight); + registry.fill(HIST("data/PC/ConePtEtaPhi"), conePt[i], jet.eta(), conePhi[i], weight); + registry.fill(HIST("data/PC/JetPtEtaConePt"), jet.pt(), jet.eta(), conePt[i], weight); + } + } + + // Version for MCD jets + template + void fillMcPerpConeHists(T const& coll, U const& mcdjet, V const& v0s, W const& /* V0 particles */, double weight = 1.) + { + double perpConeR = mcdjet.r() * 1e-2; + double conePhi[2] = {RecoDecay::constrainAngle(mcdjet.phi() - M_PI / 2, -M_PI), + RecoDecay::constrainAngle(mcdjet.phi() + M_PI / 2, -M_PI)}; + double coneMatchedPt[2] = {0., 0.}; + double coneFakePt[2] = {0., 0.}; + int nMatchedV0sinCone[2] = {0, 0}; + int nFakeV0sinCone[2] = {0, 0}; + + for (const auto& v0 : v0s) { + double dEta = v0.eta() - mcdjet.eta(); + double dPhi[2] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -M_PI), + RecoDecay::constrainAngle(v0.phi() - conePhi[1], -M_PI)}; + for (int i = 0; i < 2; i++) { + if (TMath::Sqrt(dEta * dEta + dPhi[i] * dPhi[i]) > perpConeR) { + continue; + } + + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassK0Short; + + if (!v0.has_mcParticle()) { // The V0 is combinatorial background + coneFakePt[i] += v0.pt(); + nFakeV0sinCone[i]++; + registry.fill(HIST("mcd/PC/jetPtEtaFakeV0Pt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + + registry.fill(HIST("mcd/PC/fakeV0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("mcd/PC/fakeV0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("mcd/PC/fakeV0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("mcd/PC/fakeV0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("mcd/PC/fakeV0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("mcd/PC/fakeV0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + } else { + coneMatchedPt[i] += v0.pt(); + nMatchedV0sinCone[i]++; + registry.fill(HIST("mcd/PC/jetPtEtaMatchedV0Pt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + + registry.fill(HIST("mcd/PC/matchedV0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("mcd/PC/matchedV0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("mcd/PC/matchedV0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("mcd/PC/matchedV0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("mcd/PC/matchedV0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("mcd/PC/matchedV0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + + auto particle = v0.template mcParticle_as(); + if (TMath::Abs(particle.pdgCode()) == 310) { // K0S + registry.fill(HIST("mcd/PC/matchedJetPtK0SPtMass"), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); + } else if (particle.pdgCode() == 3122) { // Lambda + registry.fill(HIST("mcd/PC/matchedJetPtLambda0PtMass"), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); + } else if (particle.pdgCode() == -3122) { + registry.fill(HIST("mcd/PC/matchedJetPtAntiLambda0PtMass"), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); + } + } // if v0 has mcParticle + } // for cone + } // for v0s + for (int i = 0; i < 2; i++) { + registry.fill(HIST("mcd/PC/matchednV0sConePtEta"), nMatchedV0sinCone[i], coneMatchedPt[i], mcdjet.eta(), weight); + registry.fill(HIST("mcd/PC/matchedConePtEtaPhi"), coneMatchedPt[i], mcdjet.eta(), conePhi[i], weight); + registry.fill(HIST("mcd/PC/matchedJetPtEtaConePt"), mcdjet.pt(), mcdjet.eta(), coneMatchedPt[i], weight); + + registry.fill(HIST("mcd/PC/fakenV0sConePtEta"), nFakeV0sinCone[i], coneFakePt[i], mcdjet.eta(), weight); + registry.fill(HIST("mcd/PC/fakeConePtEtaPhi"), coneFakePt[i], mcdjet.eta(), conePhi[i], weight); + registry.fill(HIST("mcd/PC/fakeJetPtEtaConePt"), mcdjet.pt(), mcdjet.eta(), coneFakePt[i], weight); + } + } + // Version for matched jets + template + void fillMcPerpConeHists(T const& coll, U const& mcdjet, V const& mcpjet, W const& v0s, X const& /* V0 particles */, double weight = 1.) + { + double perpConeR = mcdjet.r() * 1e-2; + double conePhi[2] = {RecoDecay::constrainAngle(mcdjet.phi() - M_PI / 2, -M_PI), + RecoDecay::constrainAngle(mcdjet.phi() + M_PI / 2, -M_PI)}; + double coneMatchedPt[2] = {0., 0.}; + double coneFakePt[2] = {0., 0.}; + int nMatchedV0sinCone[2] = {0, 0}; + int nFakeV0sinCone[2] = {0, 0}; + + for (const auto& v0 : v0s) { + double dEta = v0.eta() - mcdjet.eta(); + double dPhi[2] = {RecoDecay::constrainAngle(v0.phi() - conePhi[0], -M_PI), + RecoDecay::constrainAngle(v0.phi() - conePhi[1], -M_PI)}; + for (int i = 0; i < 2; i++) { + if (TMath::Sqrt(dEta * dEta + dPhi[i] * dPhi[i]) > perpConeR) { + continue; + } + + double ctauLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0; + double ctauAntiLambda = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassLambda0Bar; + double ctauK0s = v0.distovertotmom(coll.posX(), coll.posY(), coll.posZ()) * o2::constants::physics::MassK0Short; + + if (!v0.has_mcParticle()) { // The V0 is combinatorial background + coneFakePt[i] += v0.pt(); + nFakeV0sinCone[i]++; + registry.fill(HIST("matching/PC/jetPtEtaFakeV0Pt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("matching/PC/jetsPtFakeV0Pt"), mcpjet.pt(), mcdjet.pt(), v0.pt(), weight); + + registry.fill(HIST("matching/PC/fakeV0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("matching/PC/fakeV0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("matching/PC/fakeV0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("matching/PC/fakeV0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("matching/PC/fakeV0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("matching/PC/fakeV0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + } else { + coneMatchedPt[i] += v0.pt(); + nMatchedV0sinCone[i]++; + registry.fill(HIST("matching/PC/jetPtEtaMatchedV0Pt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("matching/PC/jetsPtMatchedV0Pt"), mcpjet.pt(), mcdjet.pt(), v0.pt(), weight); + + registry.fill(HIST("matching/PC/matchedV0PtEtaPhi"), v0.pt(), v0.eta(), v0.phi(), weight); + registry.fill(HIST("matching/PC/matchedV0PtCtau"), v0.pt(), ctauK0s, ctauLambda, ctauAntiLambda, weight); + registry.fill(HIST("matching/PC/matchedV0PtMass"), v0.pt(), v0.mK0Short(), v0.mLambda(), v0.mAntiLambda(), weight); + registry.fill(HIST("matching/PC/matchedV0PtRadiusCosPA"), v0.pt(), v0.v0radius(), v0.v0cosPA(), weight); + registry.fill(HIST("matching/PC/matchedV0PtDCAposneg"), v0.pt(), v0.dcapostopv(), v0.dcanegtopv(), weight); + registry.fill(HIST("matching/PC/matchedV0PtDCAd"), v0.pt(), v0.dcaV0daughters(), weight); + + auto particle = v0.template mcParticle_as(); + if (TMath::Abs(particle.pdgCode()) == 310) { // K0S + registry.fill(HIST("matching/PC/matchedJetPtK0SPtMass"), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); + registry.fill(HIST("matching/PC/matchedJetsPtK0SPtMass"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); + } else if (particle.pdgCode() == 3122) { // Lambda + registry.fill(HIST("matching/PC/matchedJetPtLambda0PtMass"), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); + registry.fill(HIST("matching/PC/matchedJetsPtLambda0PtMass"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); + } else if (particle.pdgCode() == -3122) { + registry.fill(HIST("matching/PC/matchedJetPtAntiLambda0PtMass"), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); + registry.fill(HIST("matching/PC/matchedJetsPtAntiLambda0PtMass"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); + } + } // if v0 has mcParticle + } // for cone + } // for v0s + for (int i = 0; i < 2; i++) { + registry.fill(HIST("matching/PC/matchednV0sConePtEta"), nMatchedV0sinCone[i], coneMatchedPt[i], mcdjet.eta(), weight); + registry.fill(HIST("matching/PC/matchedConePtEtaPhi"), coneMatchedPt[i], mcdjet.eta(), conePhi[i], weight); + registry.fill(HIST("matching/PC/matchedJetPtEtaConePt"), mcdjet.pt(), mcdjet.eta(), coneMatchedPt[i], weight); + registry.fill(HIST("matching/PC/matchedJetsPtEtaConePt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), coneMatchedPt[i], weight); + + registry.fill(HIST("matching/PC/fakenV0sConePtEta"), nFakeV0sinCone[i], coneFakePt[i], mcdjet.eta(), weight); + registry.fill(HIST("matching/PC/fakeConePtEtaPhi"), coneFakePt[i], mcdjet.eta(), conePhi[i], weight); + registry.fill(HIST("matching/PC/fakeJetPtEtaConePt"), mcdjet.pt(), mcdjet.eta(), coneFakePt[i], weight); + registry.fill(HIST("matching/PC/fakeJetsPtEtaConePt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), coneFakePt[i], weight); + } + } + + void processDummy(aod::JetTracks const&) {} PROCESS_SWITCH(JetFragmentation, processDummy, "Dummy process function turned on by default", true); - void processMcD(soa::Filtered::iterator const& collision, - JetMcCollisions const&, + void processMcD(soa::Filtered::iterator const& collision, + aod::JetMcCollisions const&, MCDJetsWithConstituents const&, - JetTracks const& tracks) + aod::JetTracks const& tracks) { if (!collision.has_mcCollision()) { return; @@ -1580,9 +2340,9 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processMcD, "Monte Carlo detector level", false); - void processMcP(JetMcCollision const& mcCollision, + void processMcP(aod::JetMcCollision const& mcCollision, MCPJetsWithConstituents const& jets, - JetParticles const& particles) + aod::JetParticles const& particles) { double nJets = 0, nTracks = 0; double weight = mcCollision.weight(); @@ -1601,9 +2361,9 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processMcP, "Monte Carlo particle level", false); - void processDataRun3(soa::Filtered::iterator const& collision, + void processDataRun3(soa::Filtered::iterator const& collision, ChargedJetsWithConstituents const& jets, - JetTracks const& tracks) + aod::JetTracks const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -1628,12 +2388,12 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processDataRun3, "Run 3 Data", false); - void processMcMatched(soa::Filtered::iterator const& collision, + void processMcMatched(soa::Filtered::iterator const& collision, MatchedMCDJetsWithConstituents const&, - JetTracksMCD const&, - JetMcCollisions const&, + aod::JetTracksMCD const&, + aod::JetMcCollisions const&, MatchedMCPJetsWithConstituents const& allMcPartJets, - JetParticles const&) + aod::JetParticles const&) { if (!collision.has_mcCollision()) { return; @@ -1648,52 +2408,52 @@ struct JetFragmentation { for (auto& partJet : detJet.template matchedJetGeo_as()) { fillMatchingHistogramsJet(detJet, partJet, weight); - for (const auto& track : detJet.tracks_as()) { + for (const auto& track : detJet.tracks_as()) { bool isTrackMatched = false; if (!track.has_mcParticle()) { isFake = true; fillMatchingFakeOrMiss(detJet, track, isFake, weight); continue; } - for (const auto& particle : partJet.tracks_as()) { - if (particle.globalIndex() == track.template mcParticle_as().globalIndex()) { + for (const auto& particle : partJet.tracks_as()) { + if (particle.globalIndex() == track.template mcParticle_as().globalIndex()) { isTrackMatched = true; fillMatchingHistogramsConstituent(detJet, partJet, track, particle, weight); break; // No need to inspect other particles - } // if track has mcParticle and particle is in matched jet - } // for particle in matched partJet + } // if track has mcParticle and particle is in matched jet + } // for particle in matched partJet if (!isTrackMatched) { isFake = true; fillMatchingFakeOrMiss(detJet, track, isFake, weight); } // if track is not matched - } // for detJet tracks + } // for detJet tracks } if (!detJet.has_matchedJetGeo()) { isFake = true; registry.fill(HIST("matching/jets/fakeDetJetPtEtaPhi"), detJet.pt(), detJet.eta(), detJet.phi(), weight); - for (const auto& track : detJet.tracks_as()) { + for (const auto& track : detJet.tracks_as()) { fillMatchingFakeOrMiss(detJet, track, isFake, weight); } } // if detJet does not have a match - } // for det jet + } // for det jet for (const auto& partJet : mcPartJets) { for (const auto& detJet : partJet.template matchedJetGeo_as()) { // Check if the matched detector level jet is outside the allowed eta range if ((detJet.eta() <= matchedDetJetEtaMin) || (detJet.eta() >= matchedDetJetEtaMax)) { - for (const auto& particle : partJet.tracks_as()) { + for (const auto& particle : partJet.tracks_as()) { isFake = false; fillMatchingFakeOrMiss(partJet, particle, isFake, weight); } continue; } // If the jets are properly matched, we can check the particles - for (const auto& particle : partJet.tracks_as()) { + for (const auto& particle : partJet.tracks_as()) { bool isParticleMatched = false; - for (const auto& track : detJet.tracks_as()) { + for (const auto& track : detJet.tracks_as()) { if (!track.has_mcParticle()) { continue; } - if (particle.globalIndex() == track.template mcParticle_as().globalIndex()) { + if (particle.globalIndex() == track.template mcParticle_as().globalIndex()) { isParticleMatched = true; } } @@ -1703,15 +2463,15 @@ struct JetFragmentation { fillMatchingFakeOrMiss(partJet, particle, isFake, weight); } } // for particle - } // for matched det jet + } // for matched det jet if (!partJet.has_matchedJetGeo()) { isFake = false; registry.fill(HIST("matching/jets/missPartJetPtEtaPhi"), partJet.pt(), partJet.eta(), partJet.phi(), weight); - for (const auto& particle : partJet.tracks_as()) { + for (const auto& particle : partJet.tracks_as()) { fillMatchingFakeOrMiss(partJet, particle, isFake, weight); } } // if no matched jet - } // for part jet + } // for part jet } PROCESS_SWITCH(JetFragmentation, processMcMatched, "Monte Carlo particle and detector level", false); @@ -1738,13 +2498,13 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processMcMatchedV0, "Monte Carlo V0", false); - void processMcMatchedV0Frag(soa::Filtered>::iterator const& jcoll, + void processMcMatchedV0Frag(soa::Filtered>::iterator const& jcoll, MatchedMCDJetsWithConstituents const&, - JetTracksMCD const&, + aod::JetTracksMCD const&, soa::Join const& allV0s, - JetMcCollisions const&, + aod::JetMcCollisions const&, MatchedMCPJetsWithConstituents const& allMcPartJets, - JetParticles const&, + aod::JetParticles const&, aod::McCollisions const&, aod::McParticles const& allMcParticles, aod::Collisions const&) @@ -1756,7 +2516,7 @@ struct JetFragmentation { return; } double weight = jcoll.mcCollision().weight(); - // This is necessary, because jets are linked to JetCollisions, but V0s are linked to Collisions + // This is necessary, because jets are linked to aod::JetCollisions, but V0s are linked to Collisions const auto& collision = jcoll.collision_as(); const auto& v0s = allV0s.sliceBy(V0sPerCollision, collision.globalIndex()); const auto& mcPartJets = allMcPartJets.sliceBy(PartJetsPerCollision, jcoll.mcCollision().globalIndex()); @@ -1768,6 +2528,7 @@ struct JetFragmentation { isV0Used[i] = false; } registry.fill(HIST("matching/V0/nV0sEvent"), kNV0s); + registry.fill(HIST("matching/V0/nV0sEventWeighted"), kNV0s, weight); int kNParticles = mcParticles.size(); bool isParticleUsed[kNParticles]; @@ -1829,8 +2590,8 @@ struct JetFragmentation { isV0Used[iv0] = true; fillMatchingV0Fake(collision, detJet, v0, weight); } // v0 loop - } // if no matched jet - } // det jet loop + } // if no matched jet + } // det jet loop for (const auto& partJet : mcPartJets) { int iparticle = -1; for (const auto& particle : mcParticles) { @@ -1877,13 +2638,13 @@ struct JetFragmentation { } } } // v0 loop - } // detJet loop + } // detJet loop if (!isParticleUsed[iparticle]) { isParticleUsed[iparticle] = true; fillMatchingV0Miss(partJet, particle, weight); } } // particle loop - } // part jet loop + } // part jet loop } PROCESS_SWITCH(JetFragmentation, processMcMatchedV0Frag, "Monte Carlo V0 fragmentation", false); @@ -1898,16 +2659,16 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processDataV0, "Data V0", false); - void processDataV0Frag(soa::Filtered>::iterator const& jcoll, + void processDataV0Frag(soa::Filtered>::iterator const& jcoll, ChargedJetsWithConstituents const& jets, - JetTracks const&, + aod::JetTracks const&, aod::Collisions const&, aod::V0Datas const& allV0s) { if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { return; } - // This is necessary, because jets are linked to JetCollisions, but V0s are linked to Collisions + // This is necessary, because jets are linked to aod::JetCollisions, but V0s are linked to Collisions const auto& collision = jcoll.collision_as(); const auto& v0s = allV0s.sliceBy(V0sPerCollision, collision.globalIndex()); @@ -1978,8 +2739,10 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processDataV0Frag, "Data V0 fragmentation", false); + // + // // ---------------- V0 jets ---------------- - void processDataV0JetsFrag(soa::Filtered::iterator const& jcoll, soa::Join const& v0jets, CandidatesV0Data const& v0s) + void processDataV0JetsFrag(soa::Filtered::iterator const& jcoll, soa::Join const& v0jets, aod::CandidatesV0Data const& v0s) { if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { return; @@ -1998,7 +2761,7 @@ struct JetFragmentation { fillDataJetHistograms(jet); int nV0inJet = 0, nLambdainJet = 0, nAntiLambdainJet = 0, nK0SinJet = 0; - for (const auto& v0 : jet.candidates_as()) { + for (const auto& v0 : jet.candidates_as()) { nV0inJet++; fillDataV0FragHistograms(jcoll, jet, v0); if (IsK0SCandidate(jcoll, v0)) { @@ -2016,7 +2779,74 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processDataV0JetsFrag, "Data V0 jets fragmentation", false); - void processMcMatchedV0JetsFrag(soa::Filtered::iterator const& jcoll, JetMcCollisions const&, MatchedMCDV0JetsWithConstituents const& v0jetsMCD, MatchedMCPV0JetsWithConstituents const& v0jetsMCP, soa::Join const& v0s, CandidatesV0MCP const& pv0s, JetTracksMCD const& jTracks, JetParticles const&) + void processDataV0JetsFragWithWeights(soa::Filtered::iterator const& jcoll, soa::Join const& v0jets, aod::CandidatesV0Data const& v0s) + { + if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { + return; + } + registry.fill(HIST("data/V0/nV0sEvent"), v0s.size()); + fillDataV0Histograms(jcoll, v0s); + + for (const auto& jet : v0jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) { + continue; + } + // Double check if the jet contains V0s + if (!JetContainsV0s(jet)) { + continue; + } + fillDataJetHistograms(jet); + + std::vector values; + std::vector> weights; + int nParticles = 0; + int nClasses = 4; // Should be set globally? Maybe just a global constant? + for (const auto& v0 : jet.candidates_as()) { + nParticles++; + fillDataV0FragHistograms(jcoll, jet, v0); + double z = TrackProj(jet, v0); + std::vector w = getV0SignalWeight(jcoll, v0); + values.push_back(z); + weights.push_back(w); + } + values.push_back(jet.pt()); + + int nStates = TMath::Power(nClasses, nParticles); + for (int M = 0; M < nStates; M++) { + std::vector state = convertState(M, nParticles, nClasses); + std::vector corrected = correctedValues(state, values); + double ws = stateWeight(state, weights); + double jetpt = corrected[nParticles]; + fillDataJetHistogramsWithWeights(jetpt, jet.eta(), jet.phi(), ws); + fillDataV0FragHistogramsWithWeights(jcoll, jet, state, corrected, ws); + } + // TODO: Fill nV0 hist + // TODO: Fill weighted nV0 hist? + } + } + PROCESS_SWITCH(JetFragmentation, processDataV0JetsFragWithWeights, "Data V0 jets fragmentation with weights", false); + + void processDataV0PerpCone(soa::Filtered::iterator const& jcoll, aod::V0ChargedJets const& v0jets, aod::CandidatesV0Data const& v0s) + { + if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { + return; + } + if (v0s.size() == 0) { + return; + } + registry.fill(HIST("data/V0/nV0sEvent"), v0s.size()); + fillDataV0Histograms(jcoll, v0s); + + for (const auto& jet : v0jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) { + continue; + } + fillDataPerpConeHists(jcoll, jet, v0s); + } + } + PROCESS_SWITCH(JetFragmentation, processDataV0PerpCone, "Perpendicular cone V0s in data", false); + + void processMcMatchedV0JetsFrag(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0JetsWithConstituents const& v0jetsMCD, MatchedMCPV0JetsWithConstituents const& v0jetsMCP, soa::Join const& v0s, aod::CandidatesV0MCP const& pv0s, aod::JetTracksMCD const& jTracks, aod::JetParticles const&) { if (!jcoll.has_mcCollision()) { return; @@ -2026,13 +2856,19 @@ struct JetFragmentation { } double weight = jcoll.mcCollision().weight(); registry.fill(HIST("matching/V0/nV0sEvent"), v0s.size()); + registry.fill(HIST("matching/V0/nV0sEventWeighted"), v0s.size(), weight); // TODO: This is not very efficient for (const auto& v0 : v0s) { + if (!v0.has_mcParticle()) { + fillMatchingV0FakeHistograms(jcoll, v0, weight); + fillMatchingFakeV0DauHistograms(v0, weight); + continue; + } for (const auto& pv0 : pv0s) { if (V0sAreMatched(v0, pv0, jTracks)) { fillMatchingV0Histograms(jcoll, v0, pv0, weight); - fillMatchingV0DauHistograms(v0, pv0, weight); + fillMatchingV0DauHistograms(v0, pv0, weight); } } } @@ -2049,7 +2885,7 @@ struct JetFragmentation { int nV0inJet = 0, nLambdainJet = 0, nAntiLambdainJet = 0, nK0SinJet = 0; if (!detJet.has_matchedJetGeo()) { - for (const auto& detV0 : detJet.candidates_as>()) { + for (const auto& detV0 : detJet.candidates_as>()) { fillMatchingV0Fake(jcoll, detJet, detV0, weight); } continue; @@ -2057,18 +2893,19 @@ struct JetFragmentation { for (const auto& partJet : detJet.template matchedJetGeo_as()) { fillMatchingHistogramsJet(detJet, partJet, weight); - for (const auto& detV0 : detJet.candidates_as>()) { + for (const auto& detV0 : detJet.candidates_as>()) { if (!detV0.has_mcParticle()) { fillMatchingV0Fake(jcoll, detJet, detV0, weight); + fillMatchingV0DecayedHistograms(partJet, detJet, detV0, weight); continue; } bool isV0Matched = false; - for (const auto& partV0 : partJet.template candidates_as()) { + for (const auto& partV0 : partJet.template candidates_as()) { if (V0sAreMatched(detV0, partV0, jTracks)) { isV0Matched = true; nV0inJet++; fillMatchingV0FragHistograms(jcoll, detJet, partJet, detV0, partV0, weight); - fillMatchingV0DauJetHistograms(detJet, partJet, detV0, partV0, weight); + fillMatchingV0DauJetHistograms(detJet, partJet, detV0, partV0, weight); if (TMath::Abs(partV0.pdgCode()) == 310) { nK0SinJet++; @@ -2079,7 +2916,7 @@ struct JetFragmentation { } break; } // if matched - } // partV0 loop + } // partV0 loop if (!isV0Matched) { fillMatchingV0Fake(jcoll, detJet, detV0, weight); @@ -2087,7 +2924,7 @@ struct JetFragmentation { } // detV0 loop registry.fill(HIST("matching/jets/V0/jetPtnV0MatchednK0SnLambdanAntiLambda"), partJet.pt(), nV0inJet, nK0SinJet, nLambdainJet, nAntiLambdainJet, weight); } // Matched partJet loop - } // detJet loop + } // detJet loop for (const auto& partJet : v0jetsMCP) { if (!JetContainsV0s(partJet)) { @@ -2096,7 +2933,7 @@ struct JetFragmentation { fillMCPJetHistograms(partJet, weight); if (!partJet.has_matchedJetGeo()) { - for (const auto& partV0 : partJet.candidates_as()) { + for (const auto& partV0 : partJet.candidates_as()) { fillMatchingV0Miss(partJet, partV0, weight); } continue; @@ -2108,9 +2945,9 @@ struct JetFragmentation { continue; } isJetMatched = true; - for (const auto& partV0 : partJet.candidates_as()) { + for (const auto& partV0 : partJet.candidates_as()) { bool isV0Matched = false; - for (const auto& detV0 : detJet.candidates_as>()) { + for (const auto& detV0 : detJet.candidates_as>()) { if (V0sAreMatched(detV0, partV0, jTracks)) { isV0Matched = true; break; @@ -2120,17 +2957,62 @@ struct JetFragmentation { fillMatchingV0Miss(partJet, partV0, weight); } } // partV0 loop - } // detJet loop + } // detJet loop // To account for matched jets where the detector level jet is outside of the eta range (cut applied within this task) if (!isJetMatched) { - for (const auto& partV0 : partJet.candidates_as()) { + for (const auto& partV0 : partJet.candidates_as()) { fillMatchingV0Miss(partJet, partV0, weight); } } } // partJet loop } PROCESS_SWITCH(JetFragmentation, processMcMatchedV0JetsFrag, "Matched V0 jets fragmentation", false); + + void processMcV0PerpCone(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0Jets const& v0jets, soa::Join const& v0s, aod::McParticles const& particles) + { + if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { + return; + } + if (v0s.size() == 0) { + return; + } + double weight = jcoll.mcCollision().weight(); + registry.fill(HIST("mcd/V0/nV0sEvent"), v0s.size()); + registry.fill(HIST("mcd/V0/nV0sEventWeighted"), v0s.size(), weight); + + for (const auto& mcdjet : v0jets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, -99., -99., v0EtaMin, v0EtaMax)) { + continue; + } + fillMcPerpConeHists(jcoll, mcdjet, v0s, particles, weight); + } + } + PROCESS_SWITCH(JetFragmentation, processMcV0PerpCone, "Perpendicular cone V0s in MC", false); + + void processMcV0MatchedPerpCone(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0Jets const& v0jets, MatchedMCPV0Jets const&, soa::Join const& v0s, aod::McParticles const& particles) + { + if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { + return; + } + if (v0s.size() == 0) { + return; + } + double weight = jcoll.mcCollision().weight(); + registry.fill(HIST("matching/V0/nV0sEvent"), v0s.size()); + registry.fill(HIST("matching/V0/nV0sEventWeighted"), v0s.size(), weight); + + for (const auto& mcdjet : v0jets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, -99., -99., v0EtaMin, v0EtaMax)) { + continue; + } + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + fillMcPerpConeHists(jcoll, mcdjet, mcpjet, v0s, particles, weight); + break; // Make sure we only do this once + } + } + } + PROCESS_SWITCH(JetFragmentation, processMcV0MatchedPerpCone, "Perpendicular cone V0s in MC, matched jets", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGJE/Tasks/jetmatchingqa.cxx b/PWGJE/Tasks/jetmatchingqa.cxx index e4ec72d1e44..e752b47e2a5 100644 --- a/PWGJE/Tasks/jetmatchingqa.cxx +++ b/PWGJE/Tasks/jetmatchingqa.cxx @@ -77,12 +77,12 @@ struct JetMatchingQA { { } - void processDummy(JetMcCollisions const&) + void processDummy(aod::JetMcCollisions const&) { } PROCESS_SWITCH(JetMatchingQA, processDummy, "Dummy process", true); - void processMCD(JetCollision const&, JetParticles const&, JetTracksMCD const&, + void processMCD(aod::JetCollision const&, aod::JetParticles const&, aod::JetTracksMCD const&, BaseJetCollection const& djets, TagJetCollection const&) { for (const auto& djet : djets) { @@ -106,13 +106,13 @@ struct JetMatchingQA { registry.fill(HIST("h_jet_match_hf_Nconst"), pjet.tracksIds().size(), djet.tracksIds().size()); double pjet_pt_lead = 0.; - for (auto& mcparticle : pjet.template tracks_as()) { + for (auto& mcparticle : pjet.template tracks_as()) { if (mcparticle.pt() > pjet_pt_lead) { pjet_pt_lead = mcparticle.pt(); } } double djet_pt_lead = 0.; - for (auto& track : djet.template tracks_as()) { + for (auto& track : djet.template tracks_as()) { if (track.pt() > djet_pt_lead) { djet_pt_lead = track.pt(); } @@ -134,13 +134,13 @@ struct JetMatchingQA { registry.fill(HIST("h_jet_match_geo_Nconst"), pjet.tracksIds().size(), djet.tracksIds().size()); double pjet_pt_lead = 0.; - for (auto& mcparticle : pjet.template tracks_as()) { + for (auto& mcparticle : pjet.template tracks_as()) { if (mcparticle.pt() > pjet_pt_lead) { pjet_pt_lead = mcparticle.pt(); } } double djet_pt_lead = 0.; - for (auto& track : djet.template tracks_as()) { + for (auto& track : djet.template tracks_as()) { if (track.pt() > djet_pt_lead) { djet_pt_lead = track.pt(); } @@ -161,13 +161,13 @@ struct JetMatchingQA { registry.fill(HIST("h_jet_match_pt_Nconst"), pjet.tracksIds().size(), djet.tracksIds().size()); double pjet_pt_lead = 0.; - for (auto& mcparticle : pjet.template tracks_as()) { + for (auto& mcparticle : pjet.template tracks_as()) { if (mcparticle.pt() > pjet_pt_lead) { pjet_pt_lead = mcparticle.pt(); } } double djet_pt_lead = 0.; - for (auto& track : djet.template tracks_as()) { + for (auto& track : djet.template tracks_as()) { if (track.pt() > djet_pt_lead) { djet_pt_lead = track.pt(); } @@ -178,7 +178,7 @@ struct JetMatchingQA { } PROCESS_SWITCH(JetMatchingQA, processMCD, "QA on detector-level jets", false); - void processMCP(JetMcCollision const&, + void processMCP(aod::JetMcCollision const&, TagJetCollection const& pjets, BaseJetCollection const&) { for (const auto& pjet : pjets) { diff --git a/PWGJE/Tasks/jetplanarflow.cxx b/PWGJE/Tasks/jetplanarflow.cxx index 03ba20f5031..9c2769978ca 100644 --- a/PWGJE/Tasks/jetplanarflow.cxx +++ b/PWGJE/Tasks/jetplanarflow.cxx @@ -273,14 +273,14 @@ struct JetPlanarFlowTask { } } - void processDummy(JetTracks const&) + void processDummy(aod::JetTracks const&) { } PROCESS_SWITCH(JetPlanarFlowTask, processDummy, "Dummy process function turned on by default", true); - void processChargedJetsData(soa::Filtered::iterator const& collision, + void processChargedJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, - JetTracks const& tracks) + aod::JetTracks const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -296,9 +296,9 @@ struct JetPlanarFlowTask { } PROCESS_SWITCH(JetPlanarFlowTask, processChargedJetsData, "charged jet analysis", false); - void processChargedRhoAreaSubtractedJetsData(soa::Filtered>::iterator const& collision, + void processChargedRhoAreaSubtractedJetsData(soa::Filtered>::iterator const& collision, soa::Join const& jets, - JetTracks const& tracks) + aod::JetTracks const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -314,9 +314,9 @@ struct JetPlanarFlowTask { } PROCESS_SWITCH(JetPlanarFlowTask, processChargedRhoAreaSubtractedJetsData, "charged rho-area subtracted jet analysis", false); - void processChargedJetsEventWiseSubData(soa::Filtered::iterator const& collision, + void processChargedJetsEventWiseSubData(soa::Filtered::iterator const& collision, soa::Join const& jets, - JetTracksSub const& tracks) + aod::JetTracksSub const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -332,9 +332,9 @@ struct JetPlanarFlowTask { } PROCESS_SWITCH(JetPlanarFlowTask, processChargedJetsEventWiseSubData, "charged event-wise subtracted jet analysis", false); - void processChargedJetsMCD(soa::Filtered::iterator const& collision, + void processChargedJetsMCD(soa::Filtered::iterator const& collision, soa::Join const& jets, - JetTracks const& tracks) + aod::JetTracks const& tracks) { if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; @@ -350,9 +350,9 @@ struct JetPlanarFlowTask { } PROCESS_SWITCH(JetPlanarFlowTask, processChargedJetsMCD, "charged detector level jet analysis", false); - void processChargedJetsMCP(JetMcCollisions const& collision, + void processChargedJetsMCP(aod::JetMcCollisions const& collision, soa::Join const& jets, - JetParticles const& particles) + aod::JetParticles const& particles) { for (auto const& jet : jets) { diff --git a/PWGJE/Tasks/jetsubstructure.cxx b/PWGJE/Tasks/jetsubstructure.cxx index ebf9d4c34f2..b99d2b6ed33 100644 --- a/PWGJE/Tasks/jetsubstructure.cxx +++ b/PWGJE/Tasks/jetsubstructure.cxx @@ -197,37 +197,37 @@ struct JetSubstructureTask { outputTable(energyMotherVec, ptLeadingVec, ptSubLeadingVec, thetaVec, nSub[0], nSub[1], nSub[2], pairPtVec, pairEnergyVec, pairThetaVec, angularity); } - void processDummy(JetTracks const&) + void processDummy(aod::JetTracks const&) { } PROCESS_SWITCH(JetSubstructureTask, processDummy, "Dummy process function turned on by default", true); void processChargedJetsData(soa::Join::iterator const& jet, - JetTracks const& tracks) + aod::JetTracks const& tracks) { analyseCharged(jet, tracks, jetSubstructureDataTable); } PROCESS_SWITCH(JetSubstructureTask, processChargedJetsData, "charged jet substructure", false); void processChargedJetsEventWiseSubData(soa::Join::iterator const& jet, - JetTracksSub const& tracks) + aod::JetTracksSub const& tracks) { analyseCharged(jet, tracks, jetSubstructureDataSubTable); } PROCESS_SWITCH(JetSubstructureTask, processChargedJetsEventWiseSubData, "eventwise-constituent subtracted charged jet substructure", false); void processChargedJetsMCD(typename soa::Join::iterator const& jet, - JetTracks const& tracks) + aod::JetTracks const& tracks) { analyseCharged(jet, tracks, jetSubstructureMCDTable); } PROCESS_SWITCH(JetSubstructureTask, processChargedJetsMCD, "charged jet substructure", false); void processChargedJetsMCP(typename soa::Join::iterator const& jet, - JetParticles const& particles) + aod::JetParticles const& particles) { jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { + for (auto& jetConstituent : jet.template tracks_as()) { fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); } nSub = jetsubstructureutilities::getNSubjettiness(jet, particles, particles, particles, 2, fastjet::contrib::CA_Axes(), true, zCut, beta); diff --git a/PWGJE/Tasks/jetsubstructurehf.cxx b/PWGJE/Tasks/jetsubstructurehf.cxx index 47bda670c42..c20515e9618 100644 --- a/PWGJE/Tasks/jetsubstructurehf.cxx +++ b/PWGJE/Tasks/jetsubstructurehf.cxx @@ -241,14 +241,14 @@ struct JetSubstructureHFTask { outputTable(energyMotherVec, ptLeadingVec, ptSubLeadingVec, thetaVec, nSub[0], nSub[1], nSub[2], pairPtVec, pairEnergyVec, pairThetaVec, angularity); } - void processDummy(JetTracks const&) + 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, - JetTracks const& tracks) + aod::JetTracks const& tracks) { analyseCharged(jet, tracks, candidates, jetSubstructureDataTable); } @@ -264,18 +264,18 @@ struct JetSubstructureHFTask { void processChargedJetsMCD(typename JetTableMCD::iterator const& jet, CandidateTable const& candidates, - JetTracks const& tracks) + aod::JetTracks const& tracks) { analyseCharged(jet, tracks, candidates, jetSubstructureMCDTable); } PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsMCD, "HF jet substructure on data", false); void processChargedJetsMCP(typename JetTableMCP::iterator const& jet, - JetParticles const& particles, + aod::JetParticles const& particles, CandidateTableMCP const& candidates) { jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { + for (auto& jetConstituent : jet.template tracks_as()) { fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); } for (auto& jetHFCandidate : jet.template candidates_as()) { @@ -289,10 +289,10 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsMCP, "HF jet substructure on MC particle level", false); }; -using JetSubstructureD0 = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, CandidatesD0Data, CandidatesD0MCP, aod::D0CJetSSs, aod::D0CMCDJetSSs, aod::D0CMCPJetSSs, aod::D0CEWSJetSSs, aod::JTrackD0Subs>; -using JetSubstructureLc = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, CandidatesLcData, CandidatesLcMCP, aod::LcCJetSSs, aod::LcCMCDJetSSs, aod::LcCMCPJetSSs, aod::LcCEWSJetSSs, aod::JTrackLcSubs>; -// using JetSubstructureBplus = JetSubstructureHFTask,soa::Join,soa::Join,soa::Join, CandidatesBplusData, CandidatesBplusMCP, aod::BplusCJetSSs,aod::BplusCMCDJetSSs,aod::BplusCMCPJetSSs, aod::BplusCEWSJetSSs, aod::JTrackBplusSubs>; -using JetSubstructureDielectron = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, CandidatesDielectronData, CandidatesDielectronMCP, aod::DielectronCJetSSs, aod::DielectronCMCDJetSSs, aod::DielectronCMCPJetSSs, aod::DielectronCEWSJetSSs, aod::JTrackDielectronSubs>; +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) { diff --git a/PWGJE/Tasks/jetsubstructurehfoutput.cxx b/PWGJE/Tasks/jetsubstructurehfoutput.cxx index 291d123d9d8..a822d22b4f7 100644 --- a/PWGJE/Tasks/jetsubstructurehfoutput.cxx +++ b/PWGJE/Tasks/jetsubstructurehfoutput.cxx @@ -81,6 +81,8 @@ struct JetSubstructureHFOutputTask { Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track pseudorapidity"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track pseudorapidity"}; + // need to add selection on pThat to post processing + std::map jetMappingData; std::map jetMappingDataSub; std::map jetMappingMCD; @@ -95,13 +97,13 @@ struct JetSubstructureHFOutputTask { std::vector collisionFlag; std::vector mcCollisionFlag; - PresliceUnsorted> CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; - PresliceOptional D0CollisionsPerCollision = aod::jd0indices::collisionId; - PresliceOptional LcCollisionsPerCollision = aod::jlcindices::collisionId; - PresliceOptional DielectronCollisionsPerCollision = aod::jdielectronindices::collisionId; - PresliceOptional> D0McCollisionsPerMcCollision = aod::jd0indices::mcCollisionId; - PresliceOptional> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; - PresliceOptional DielectronMcCollisionsPerMcCollision = aod::jdielectronindices::mcCollisionId; + PresliceUnsorted> CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; + PresliceOptional D0CollisionsPerCollision = aod::jd0indices::collisionId; + PresliceOptional LcCollisionsPerCollision = aod::jlcindices::collisionId; + PresliceOptional DielectronCollisionsPerCollision = aod::jdielectronindices::collisionId; + PresliceOptional> D0McCollisionsPerMcCollision = aod::jd0indices::mcCollisionId; + PresliceOptional> LcMcCollisionsPerMcCollision = aod::jlcindices::mcCollisionId; + PresliceOptional DielectronMcCollisionsPerMcCollision = aod::jdielectronindices::mcCollisionId; void init(InitContext const&) { @@ -138,7 +140,7 @@ struct JetSubstructureHFOutputTask { } template - void analyseCharged(T const& collision, U const& jets, V const& /*candidates*/, M& collisionOutputTable, N& jetOutputTable, O& jetSubstructureOutputTable, std::map& jetMap, std::map& candidateMap, float jetPtMin) + void analyseCharged(T const& collision, U const& jets, V const& /*candidates*/, M& collisionOutputTable, N& jetOutputTable, O& jetSubstructureOutputTable, std::map& jetMap, std::map& candidateMap, float jetPtMin, float eventWeight) { int nJetInCollision = 0; @@ -160,7 +162,7 @@ struct JetSubstructureHFOutputTask { } if constexpr (!isMCP) { if (nJetInCollision == 0) { - collisionOutputTable(collision.posZ(), collision.centrality(), collision.eventSel()); + collisionOutputTable(collision.posZ(), collision.centrality(), collision.eventSel(), eventWeight); collisionIndex = collisionOutputTable.lastIndex(); } nJetInCollision++; @@ -359,7 +361,7 @@ struct JetSubstructureHFOutputTask { } } - void processClearMaps(JetCollisions const&) + void processClearMaps(aod::JetCollisions const&) { candidateMapping.clear(); candidateCollisionMapping.clear(); @@ -373,7 +375,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processClearMaps, "process function that clears all the maps in each dataframe", true); - void processOutputCollisionsData(JetCollisions const& collisions, + void processOutputCollisionsData(aod::JetCollisions const& collisions, JetTableData const& jets, CandidateCollisionTable const& canidateCollisions, CandidateTable const& candidates) @@ -382,7 +384,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCollisionsData, "hf collision output data", false); - void processOutputCollisionsDataSub(JetCollisions const& collisions, + void processOutputCollisionsDataSub(aod::JetCollisions const& collisions, JetTableDataSub const& jets, CandidateCollisionTable const& canidateCollisions, CandidateTable const& candidates) @@ -391,8 +393,8 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCollisionsDataSub, "hf collision output data eventwise constituent subtracted", false); - void processOutputCollisionsMc(soa::Join const& collisions, - JetMcCollisions const& mcCollisions, + void processOutputCollisionsMc(soa::Join const& collisions, + aod::JetMcCollisions const& mcCollisions, JetTableMCD const& jetsMCD, JetTableMCP const& jetsMCP, CandidateCollisionTable const& canidateCollisions, @@ -404,7 +406,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCollisionsMc, "hf collision output MC", false); - void processOutputCollisionsMCPOnly(JetMcCollisions const& mcCollisions, + void processOutputCollisionsMCPOnly(aod::JetMcCollisions const& mcCollisions, JetTableMCP const& jetsMCP, CandidateMcCollisionTable const& canidateMcCollisions, CandidateTableMCP const& candidatesMCP) @@ -413,7 +415,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCollisionsMCPOnly, "hf collision output MCP only", false); - void processOutputCandidatesData(JetCollision const&, + void processOutputCandidatesData(aod::JetCollision const&, JetTableData const& jets, CandidateTable const& candidates) { @@ -421,7 +423,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCandidatesData, "hf candidate output data", false); - void processOutputCandidatesDataSub(JetCollision const&, + void processOutputCandidatesDataSub(aod::JetCollision const&, JetTableDataSub const& jets, CandidateTable const& candidates) { @@ -429,7 +431,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCandidatesDataSub, "hf candidate output data eventwise constituent subtracted", false); - void processOutputCandidatesMCD(JetCollision const&, + void processOutputCandidatesMCD(aod::JetCollision const&, JetTableMCD const& jets, CandidateTableMCD const& candidates) { @@ -438,7 +440,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCandidatesMCD, "hf candidate output MCD", false); - void processOutputCandidatesMCP(JetMcCollision const&, + void processOutputCandidatesMCP(aod::JetMcCollision const&, JetTableMCP const& jets, CandidateTableMCP const& candidates) { @@ -446,19 +448,19 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputCandidatesMCP, "hf candidate output MCP", false); - void processOutputJetsData(JetCollision const& collision, + void processOutputJetsData(aod::JetCollision const& collision, JetTableData const& jets, CandidateTable const& candidates) { - analyseCharged(collision, jets, candidates, collisionOutputTableData, jetOutputTableData, jetSubstructureOutputTableData, jetMappingData, candidateMapping, jetPtMinData); + analyseCharged(collision, jets, candidates, collisionOutputTableData, jetOutputTableData, jetSubstructureOutputTableData, jetMappingData, candidateMapping, jetPtMinData, 1.0); } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputJetsData, "hf jet substructure output Data", false); - void processOutputJetsDataSub(JetCollision const& collision, + void processOutputJetsDataSub(aod::JetCollision const& collision, JetTableDataSub const& jets, CandidateTable const& candidates) { - analyseCharged(collision, jets, candidates, collisionOutputTableDataSub, jetOutputTableDataSub, jetSubstructureOutputTableDataSub, jetMappingDataSub, candidateMapping, jetPtMinDataSub); + analyseCharged(collision, jets, candidates, collisionOutputTableDataSub, jetOutputTableDataSub, jetSubstructureOutputTableDataSub, jetMappingDataSub, candidateMapping, jetPtMinDataSub, 1.0); } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputJetsDataSub, "hf jet substructure output event-wise subtracted Data", false); @@ -470,19 +472,20 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputMatchingData, "jet matching output Data", false); - void processOutputJetsMCD(JetCollision const& collision, + void processOutputJetsMCD(aod::JetCollisionMCD const& collision, + aod::JetMcCollisions const&, JetTableMCD const& jets, CandidateTableMCD const& candidates) { - analyseCharged(collision, jets, candidates, collisionOutputTableMCD, jetOutputTableMCD, jetSubstructureOutputTableMCD, jetMappingMCD, candidateMapping, jetPtMinMCD); + analyseCharged(collision, jets, candidates, collisionOutputTableMCD, jetOutputTableMCD, jetSubstructureOutputTableMCD, jetMappingMCD, candidateMapping, jetPtMinMCD, collision.mcCollision().weight()); } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputJetsMCD, "hf jet substructure output MCD", false); - void processOutputJetsMCP(JetMcCollision const& collision, + void processOutputJetsMCP(aod::JetMcCollision const& collision, JetTableMCP const& jets, CandidateTableMCP const& candidates) { - analyseCharged(collision, jets, candidates, collisionOutputTableMCP, jetOutputTableMCP, jetSubstructureOutputTableMCP, jetMappingMCP, candidateMappingMCP, jetPtMinMCP); + analyseCharged(collision, jets, candidates, collisionOutputTableMCP, jetOutputTableMCP, jetSubstructureOutputTableMCP, jetMappingMCP, candidateMappingMCP, jetPtMinMCP, collision.weight()); } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputJetsMCP, "hf jet substructure output MCP", false); @@ -494,10 +497,10 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputMatchingMC, "jet matching output MC", false); }; -using JetSubstructureOutputD0 = JetSubstructureHFOutputTask, CandidatesD0Data, CandidatesD0MCD, 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, CandidatesLcData, CandidatesLcMCD, 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, CandidatesBplusData, CandidatesBplusMCD, 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>; +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) { diff --git a/PWGJE/Tasks/jetsubstructureoutput.cxx b/PWGJE/Tasks/jetsubstructureoutput.cxx index a5ce1525c31..695afef9e35 100644 --- a/PWGJE/Tasks/jetsubstructureoutput.cxx +++ b/PWGJE/Tasks/jetsubstructureoutput.cxx @@ -111,7 +111,7 @@ struct JetSubstructureOutputTask { } template - void analyseCharged(T const& collision, U const& jets, V& collisionOutputTable, M& jetOutputTable, N& jetSubstructureOutputTable, std::map& jetMapping, float jetPtMin) + void analyseCharged(T const& collision, U const& jets, V& collisionOutputTable, M& jetOutputTable, N& jetSubstructureOutputTable, std::map& jetMapping, float jetPtMin, float eventWeight) { int nJetInCollision = 0; int32_t collisionIndex = -1; @@ -126,7 +126,7 @@ struct JetSubstructureOutputTask { if (jet.r() == round(jetRadiiValue * 100.0f)) { if constexpr (!isMc) { if (nJetInCollision == 0) { - collisionOutputTable(collision.posZ(), collision.centrality(), collision.eventSel()); + collisionOutputTable(collision.posZ(), collision.centrality(), collision.eventSel(), eventWeight); collisionIndex = collisionOutputTable.lastIndex(); } nJetInCollision++; @@ -179,7 +179,7 @@ struct JetSubstructureOutputTask { } } - void processClearMaps(JetCollisions const&) + void processClearMaps(aod::JetCollisions const&) { jetMappingData.clear(); jetMappingDataSub.clear(); @@ -188,17 +188,17 @@ struct JetSubstructureOutputTask { } PROCESS_SWITCH(JetSubstructureOutputTask, processClearMaps, "process function that clears all the maps in each dataframe", true); - void processOutputData(JetCollision const& collision, + void processOutputData(aod::JetCollision const& collision, soa::Join const& jets) { - analyseCharged(collision, jets, collisionOutputTableData, jetOutputTableData, jetSubstructureOutputTableData, jetMappingData, jetPtMinData); + analyseCharged(collision, jets, collisionOutputTableData, jetOutputTableData, jetSubstructureOutputTableData, jetMappingData, jetPtMinData, 1.0); } PROCESS_SWITCH(JetSubstructureOutputTask, processOutputData, "jet substructure output Data", false); - void processOutputDataSub(JetCollision const& collision, + void processOutputDataSub(aod::JetCollision const& collision, soa::Join const& jets) { - analyseCharged(collision, jets, collisionOutputTableDataSub, jetOutputTableDataSub, jetSubstructureOutputTableDataSub, jetMappingDataSub, jetPtMinDataSub); + analyseCharged(collision, jets, collisionOutputTableDataSub, jetOutputTableDataSub, jetSubstructureOutputTableDataSub, jetMappingDataSub, jetPtMinDataSub, 1.0); } PROCESS_SWITCH(JetSubstructureOutputTask, processOutputDataSub, "jet substructure output event-wise subtracted Data", false); @@ -210,17 +210,17 @@ struct JetSubstructureOutputTask { } PROCESS_SWITCH(JetSubstructureOutputTask, processOutputMatchingData, "jet matching output Data", false); - void processOutputMCD(JetCollision const& collision, + void processOutputMCD(aod::JetCollisionMCD const& collision, aod::JetMcCollisions const&, soa::Join const& jets) { - analyseCharged(collision, jets, collisionOutputTableMCD, jetOutputTableMCD, jetSubstructureOutputTableMCD, jetMappingMCD, jetPtMinMCD); + analyseCharged(collision, jets, collisionOutputTableMCD, jetOutputTableMCD, jetSubstructureOutputTableMCD, jetMappingMCD, jetPtMinMCD, collision.mcCollision().weight()); } PROCESS_SWITCH(JetSubstructureOutputTask, processOutputMCD, "jet substructure output MCD", false); - void processOutputMCP(JetMcCollision const& collision, + void processOutputMCP(aod::JetMcCollision const& collision, soa::Join const& jets) { - analyseCharged(collision, jets, collisionOutputTableMCP, jetOutputTableMCP, jetSubstructureOutputTableMCP, jetMappingMCP, jetPtMinMCP); + analyseCharged(collision, jets, collisionOutputTableMCP, jetOutputTableMCP, jetSubstructureOutputTableMCP, jetMappingMCP, jetPtMinMCP, collision.weight()); } PROCESS_SWITCH(JetSubstructureOutputTask, processOutputMCP, "jet substructure output MCP", false); diff --git a/PWGJE/Tasks/jettaggerhfQA.cxx b/PWGJE/Tasks/jettaggerhfQA.cxx index 9bbe0f41cef..d3bc15e3d5b 100644 --- a/PWGJE/Tasks/jettaggerhfQA.cxx +++ b/PWGJE/Tasks/jettaggerhfQA.cxx @@ -44,6 +44,7 @@ struct JetTaggerHFQA { Configurable fillIPz{"fillIPz", false, "process of z plane of dca"}; Configurable fillIPxyz{"fillIPxyz", false, "process of xyz plane of dca"}; Configurable fillTrackCounting{"fillTrackCounting", false, "process of track counting method"}; + Configurable fillGeneralSVQA{"fillGeneralSVQA", true, "process of general QA for sv"}; // Cut configuration Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; @@ -55,9 +56,13 @@ struct JetTaggerHFQA { Configurable trackDcaZMax{"trackDcaZMax", 2, "minimum DCA z acceptance for tracks [cm]"}; Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; - Configurable prongChi2PCAMax{"prongChi2PCAMax", 10, "maximum Chi2 PCA of decay length of prongs"}; + Configurable prongChi2PCAMin{"prongChi2PCAMin", 1, "minimum Chi2 PCA of decay length of prongs"}; + Configurable prongChi2PCAMax{"prongChi2PCAMax", 100, "maximum Chi2 PCA of decay length of prongs"}; Configurable prongsigmaLxyMax{"prongsigmaLxyMax", 100, "maximum sigma of decay length of prongs on xy plane"}; Configurable prongsigmaLxyzMax{"prongsigmaLxyzMax", 100, "maximum sigma of decay length of prongs on xyz plane"}; + Configurable prongIPxyMin{"prongIPxyMin", 0.008, "maximum impact paramter of prongs on xy plane"}; + Configurable prongIPxyMax{"prongIPxyMax", 1, "minimum impact parmeter of prongs on xy plane"}; + Configurable svDispersionMax{"svDispersionMax", 1, "maximum dispersion of sv"}; Configurable numFlavourSpecies{"numFlavourSpecies", 6, "number of jet flavour species"}; Configurable numOrder{"numOrder", 6, "number of ordering"}; Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; @@ -65,6 +70,7 @@ struct JetTaggerHFQA { Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; 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 leadingConstituentPtMax{"leadingConstituentPtMax", 9999.0, "maximum pT selection on jet constituent"}; Configurable checkMcCollisionIsMatched{"checkMcCollisionIsMatched", false, "0: count whole MCcollisions, 1: select MCcollisions which only have their correspond collisions"}; Configurable trackOccupancyInTimeRangeMax{"trackOccupancyInTimeRangeMax", 999999, "maximum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; Configurable trackOccupancyInTimeRangeMin{"trackOccupancyInTimeRangeMin", -999999, "minimum occupancy of tracks in neighbouring collisions in a given time range; only applied to reconstructed collisions (data and mcd jets), not mc collisions (mcp jets)"}; @@ -233,7 +239,7 @@ struct JetTaggerHFQA { registry.add("h2_jet_phi_part_flavour", "", {HistType::kTH2F, {{phiAxis}, {jetFlavourAxis}}}); } - if (doprocessIPsMCPMCDMatched) { + if (doprocessIPsMCPMCDMatched || doprocessIPsMCPMCDMatchedWeighted) { registry.add("h3_jet_pt_jet_pt_part_matchedgeo_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {jetPtAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_jet_pt_part_matchedgeo_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {jetPtAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_flavour_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {jetFlavourAxis}, {jetFlavourAxis}}}); @@ -278,70 +284,109 @@ struct JetTaggerHFQA { registry.add("h3_jet_pt_JP_N3_flavour", "jet pt jet probability flavour N3", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_neg_log_JP_N3_flavour", "jet pt log jet probability flavour N3", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityLogAxis}, {jetFlavourAxis}}}); } + if (doprocessJPMCPMCDMatched || doprocessJPMCPMCDMatchedWeighted) { + registry.add("h3_jet_pt_JP_flavour_run2", "jet pt jet probability flavour untagged", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_neg_log_JP_flavour_run2", "jet pt log jet probability flavour untagged", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityLogAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_JP_N1_flavour_run2", "jet pt jet probability flavour N1", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_neg_log_JP_N1_flavour_run2", "jet pt log jet probability flavour N1", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityLogAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_JP_N2_flavour_run2", "jet pt jet probability flavour N2", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_neg_log_JP_N2_flavour_run2", "jet pt log jet probability flavour N2", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityLogAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_JP_N3_flavour_run2", "jet pt jet probability flavour N3", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_neg_log_JP_N3_flavour_run2", "jet pt log jet probability flavour N3", {HistType::kTH3F, {{jetPtAxis}, {JetProbabilityLogAxis}, {jetFlavourAxis}}}); + } if (doprocessSV2ProngData) { - registry.add("h_2prong_nprongs", "", {HistType::kTH1F, {{nprongsAxis}}}); - registry.add("h2_jet_pt_2prong_Lxy", "", {HistType::kTH2F, {{jetPtAxis}, {LxyAxis}}}); - registry.add("h2_jet_pt_2prong_sigmaLxy", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyAxis}}}); - registry.add("h2_jet_pt_2prong_Sxy", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); - registry.add("h2_jet_pt_2prong_Lxyz", "", {HistType::kTH2F, {{jetPtAxis}, {LxyzAxis}}}); - registry.add("h2_jet_pt_2prong_sigmaLxyz", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyzAxis}}}); - registry.add("h2_jet_pt_2prong_Sxyz", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); + if (fillGeneralSVQA) { + registry.add("h_2prong_nprongs", "", {HistType::kTH1F, {{nprongsAxis}}}); + registry.add("h2_jet_pt_2prong_Lxy", "", {HistType::kTH2F, {{jetPtAxis}, {LxyAxis}}}); + registry.add("h2_jet_pt_2prong_sigmaLxy", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyAxis}}}); + registry.add("h2_jet_pt_2prong_Sxy", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); + registry.add("h2_jet_pt_2prong_Lxyz", "", {HistType::kTH2F, {{jetPtAxis}, {LxyzAxis}}}); + registry.add("h2_jet_pt_2prong_sigmaLxyz", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyzAxis}}}); + registry.add("h2_jet_pt_2prong_Sxyz", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); + } registry.add("h2_jet_pt_2prong_Sxy_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); registry.add("h2_jet_pt_2prong_Sxyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); registry.add("h2_jet_pt_2prong_mass_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); + registry.add("h2_jet_pt_2prong_mass_xyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); + registry.add("h2_taggedjet_pt_2prong_Sxy_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); + registry.add("h2_taggedjet_pt_2prong_Sxyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); + registry.add("h2_taggedjet_pt_2prong_mass_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); + registry.add("h2_taggedjet_pt_2prong_mass_xyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); } if (doprocessSV3ProngData) { - registry.add("h_3prong_nprongs", "", {HistType::kTH1F, {{nprongsAxis}}}); - registry.add("h2_jet_pt_3prong_Lxy", "", {HistType::kTH2F, {{jetPtAxis}, {LxyAxis}}}); - registry.add("h2_jet_pt_3prong_sigmaLxy", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyAxis}}}); - registry.add("h2_jet_pt_3prong_Sxy", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); - registry.add("h2_jet_pt_3prong_Lxyz", "", {HistType::kTH2F, {{jetPtAxis}, {LxyzAxis}}}); - registry.add("h2_jet_pt_3prong_sigmaLxyz", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyzAxis}}}); - registry.add("h2_jet_pt_3prong_Sxyz", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); + if (fillGeneralSVQA) { + registry.add("h_3prong_nprongs", "", {HistType::kTH1F, {{nprongsAxis}}}); + registry.add("h2_jet_pt_3prong_Lxy", "", {HistType::kTH2F, {{jetPtAxis}, {LxyAxis}}}); + registry.add("h2_jet_pt_3prong_sigmaLxy", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyAxis}}}); + registry.add("h2_jet_pt_3prong_Sxy", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); + registry.add("h2_jet_pt_3prong_Lxyz", "", {HistType::kTH2F, {{jetPtAxis}, {LxyzAxis}}}); + registry.add("h2_jet_pt_3prong_sigmaLxyz", "", {HistType::kTH2F, {{jetPtAxis}, {sigmaLxyzAxis}}}); + registry.add("h2_jet_pt_3prong_Sxyz", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); + } registry.add("h2_jet_pt_3prong_Sxy_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); registry.add("h2_jet_pt_3prong_Sxyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); registry.add("h2_jet_pt_3prong_mass_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); + registry.add("h2_jet_pt_3prong_mass_xyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); + registry.add("h2_taggedjet_pt_3prong_Sxy_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyAxis}}}); + registry.add("h2_taggedjet_pt_3prong_Sxyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {SxyzAxis}}}); + registry.add("h2_taggedjet_pt_3prong_mass_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); + registry.add("h2_taggedjet_pt_3prong_mass_xyz_N1", "", {HistType::kTH2F, {{jetPtAxis}, {massAxis}}}); } if (doprocessSV2ProngMCD || doprocessSV2ProngMCDWeighted) { - registry.add("h2_2prong_nprongs_flavour", "", {HistType::kTH2F, {{nprongsAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_Lxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_sigmaLxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_Sxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_Lxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyzAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_sigmaLxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyzAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_Sxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); + if (fillGeneralSVQA) { + registry.add("h2_2prong_nprongs_flavour", "", {HistType::kTH2F, {{nprongsAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_Lxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_sigmaLxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_Sxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_Lxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyzAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_sigmaLxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyzAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_Sxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); + } registry.add("h3_jet_pt_2prong_Sxy_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_2prong_Sxyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_2prong_mass_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_mass_xyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_2prong_Sxy_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_2prong_Sxyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_2prong_mass_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_taggedjet_pt_2prong_mass_xyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); } if (doprocessSV3ProngMCD || doprocessSV3ProngMCDWeighted) { - registry.add("h2_3prong_nprongs_flavour", "", {HistType::kTH2F, {{nprongsAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_3prong_Lxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_3prong_sigmaLxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_3prong_Sxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_3prong_Lxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyzAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_3prong_sigmaLxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyzAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_3prong_Sxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); + if (fillGeneralSVQA) { + registry.add("h2_3prong_nprongs_flavour", "", {HistType::kTH2F, {{nprongsAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_Lxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_sigmaLxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_Sxy_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_Lxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {LxyzAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_sigmaLxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyzAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_Sxyz_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); + } registry.add("h3_jet_pt_3prong_Sxy_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_3prong_Sxyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_3prong_mass_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_mass_xyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_3prong_Sxy_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_3prong_Sxyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_3prong_mass_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); } if (doprocessSV2ProngMCPMCDMatched || doprocessSV2ProngMCPMCDMatchedWeighted) { - registry.add("h3_jet_pt_2prong_Lxy_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {LxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_sigmaLxy_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_Sxy_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_Lxyz_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {LxyzAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_sigmaLxyz_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyzAxis}, {jetFlavourAxis}}}); - registry.add("h3_jet_pt_2prong_Sxyz_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); + if (fillGeneralSVQA) { + registry.add("h3_jet_pt_2prong_Lxy_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {LxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_sigmaLxy_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_Sxy_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_Lxyz_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {LxyzAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_sigmaLxyz_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {sigmaLxyzAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_Sxyz_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); + } + registry.add("h3_taggedjet_pt_2prong_Sxy_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); + registry.add("h3_taggedjet_pt_2prong_Sxyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); + registry.add("h3_taggedjet_pt_2prong_mass_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_taggedjet_pt_2prong_mass_xyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_2prong_Sxy_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_2prong_Sxyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_2prong_mass_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_2prong_mass_xyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); } if (doprocessSV3ProngMCPMCDMatched || doprocessSV3ProngMCPMCDMatchedWeighted) { registry.add("h3_jet_pt_3prong_Lxy_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {LxyAxis}, {jetFlavourAxis}}}); @@ -353,19 +398,21 @@ struct JetTaggerHFQA { registry.add("h3_jet_pt_3prong_Sxy_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_3prong_Sxyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); registry.add("h3_jet_pt_3prong_mass_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_jet_pt_3prong_mass_xyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_3prong_Sxy_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_3prong_Sxyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {SxyzAxis}, {jetFlavourAxis}}}); registry.add("h3_taggedjet_pt_3prong_mass_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); + registry.add("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour_run2", "", {HistType::kTH3F, {{jetPtAxis}, {massAxis}, {jetFlavourAxis}}}); } } // 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); - PresliceUnsorted> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; - Preslice particlesPerCollision = aod::jmcparticle::mcCollisionId; + PresliceUnsorted> CollisionsPerMCPCollision = aod::jmccollisionlb::mcCollisionId; + Preslice particlesPerCollision = aod::jmcparticle::mcCollisionId; - using JetTagTracksData = soa::Join; - using JetTagTracksMCD = soa::Join; + using JetTagTracksData = soa::Join; + using JetTagTracksMCD = soa::Join; std::function&, const std::vector&)> sortImp = [](const std::vector& a, const std::vector& b) { @@ -380,18 +427,30 @@ struct JetTaggerHFQA { return false; } } - if (leadingConstituentPtMin > -98.0) { - bool isMinleadingConstituent = false; - for (auto& constituent : jet.template tracks_as()) { - if (constituent.pt() >= leadingConstituentPtMin) { - isMinleadingConstituent = true; - break; + bool checkConstituentPt = true; + bool checkConstituentMinPt = (leadingConstituentPtMin > -98.0); + bool checkConstituentMaxPt = (leadingConstituentPtMax < 9998.0); + if (!checkConstituentMinPt && !checkConstituentMaxPt) { + checkConstituentPt = false; + } + + if (checkConstituentPt) { + bool isMinLeadingConstituent = !checkConstituentMinPt; + bool isMaxLeadingConstituent = true; + + for (const auto& constituent : jet.template tracks_as()) { + double pt = constituent.pt(); + + if (checkConstituentMinPt && pt >= leadingConstituentPtMin) { + isMinLeadingConstituent = true; + } + if (checkConstituentMaxPt && pt > leadingConstituentPtMax) { + isMaxLeadingConstituent = false; } } - if (!isMinleadingConstituent) { - return false; - } + return isMinLeadingConstituent && isMaxLeadingConstituent; } + return true; } @@ -564,11 +623,11 @@ struct JetTaggerHFQA { if (fillIPxyz) { float varImpXYZ, varSignImpXYZ, varImpXYZSig, varSignImpXYZSig; float dcaXYZ = track.dcaXYZ(); - float sigmadcaXYZ2 = track.sigmadcaXYZ(); + float sigmadcaXYZ = track.sigmadcaXYZ(); varImpXYZ = dcaXYZ * jettaggingutilities::cmTomum; varSignImpXYZ = geoSign * std::abs(dcaXYZ) * jettaggingutilities::cmTomum; - varImpXYZSig = dcaXYZ / std::sqrt(sigmadcaXYZ2); - varSignImpXYZSig = geoSign * std::abs(dcaXYZ) / std::sqrt(sigmadcaXYZ2); + varImpXYZSig = dcaXYZ / sigmadcaXYZ; + varSignImpXYZSig = geoSign * std::abs(dcaXYZ) / sigmadcaXYZ; registry.fill(HIST("h3_jet_pt_impact_parameter_xyz_flavour"), mcdjet.pt(), varImpXYZ, jetflavour, eventWeight); registry.fill(HIST("h3_jet_pt_sign_impact_parameter_xyz_flavour"), mcdjet.pt(), varSignImpXYZ, jetflavour, eventWeight); registry.fill(HIST("h3_jet_pt_impact_parameter_xyz_significance_flavour"), mcdjet.pt(), varImpXYZSig, jetflavour, eventWeight); @@ -679,7 +738,7 @@ struct JetTaggerHFQA { std::vector vecImpXY[numberOfJetFlavourSpecies], vecSignImpXY[numberOfJetFlavourSpecies], vecImpXYSig[numberOfJetFlavourSpecies], vecSignImpXYSig[numberOfJetFlavourSpecies]; int jetflavour = mcdjet.origin(); if (jetflavour == JetTaggingSpecies::none) - jetflavour = JetTaggingSpecies::lightflavour; + jetflavour = JetTaggingSpecies::lightflavour; // TODO int jetflavourRun2Def = -1; // if (!mcdjet.has_matchedJetGeo()) continue; for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { @@ -775,6 +834,32 @@ struct JetTaggerHFQA { registry.fill(HIST("h3_jet_pt_neg_log_JP_N3_flavour"), mcdjet.pt(), -1 * TMath::Log(mcdjet.jetProb()[3]), mcdjet.origin(), eventWeight); } + template + void fillHistogramJPMatched(T const& mcdjet, U const&, V const& particlesPerColl, float eventWeight = 1.0) + { + float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); + if (mcdjet.pt() > pTHatMaxMCD * pTHat) { + return; + } + int jetflavour = mcdjet.origin(); + if (jetflavour == JetTaggingSpecies::none) + jetflavour = JetTaggingSpecies::lightflavour; // TODO + int jetflavourRun2Def = -1; + for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + jetflavourRun2Def = jettaggingutilities::getJetFlavor(mcpjet, particlesPerColl); + } + if (jetflavourRun2Def < 0) + return; + registry.fill(HIST("h3_jet_pt_JP_flavour_run2"), mcdjet.pt(), mcdjet.jetProb()[0], jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_neg_log_JP_flavour_run2"), mcdjet.pt(), -1 * TMath::Log(mcdjet.jetProb()[0]), jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_JP_N1_flavour_run2"), mcdjet.pt(), mcdjet.jetProb()[1], jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_neg_log_JP_N1_flavour_run2"), mcdjet.pt(), -1 * TMath::Log(mcdjet.jetProb()[1]), jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_JP_N2_flavour_run2"), mcdjet.pt(), mcdjet.jetProb()[2], jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_neg_log_JP_N2_flavour_run2"), mcdjet.pt(), -1 * TMath::Log(mcdjet.jetProb()[2]), jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_JP_N3_flavour_run2"), mcdjet.pt(), mcdjet.jetProb()[3], jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_neg_log_JP_N3_flavour_run2"), mcdjet.pt(), -1 * TMath::Log(mcdjet.jetProb()[3]), jetflavourRun2Def, eventWeight); + } + template void fillHistogramSV2ProngData(T const& jet, U const& /*prongs*/) { @@ -783,25 +868,46 @@ struct JetTaggerHFQA { if (jet.pt() > pTHatMaxMCD * pTHat) { return; } - registry.fill(HIST("h_2prong_nprongs"), jet.template secondaryVertices_as().size()); - for (const auto& prong : jet.template secondaryVertices_as()) { - auto Lxy = prong.decayLengthXY(); - auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); - auto Lxyz = prong.decayLength(); - auto Sxyz = prong.decayLength() / prong.errorDecayLength(); - registry.fill(HIST("h2_jet_pt_2prong_Lxy"), jet.pt(), Lxy); - registry.fill(HIST("h2_jet_pt_2prong_Sxy"), jet.pt(), Sxy); - registry.fill(HIST("h2_jet_pt_2prong_Lxyz"), jet.pt(), Lxyz); - registry.fill(HIST("h2_jet_pt_2prong_Sxyz"), jet.pt(), Sxyz); - registry.fill(HIST("h2_jet_pt_2prong_sigmaLxy"), jet.pt(), prong.errorDecayLengthXY()); - registry.fill(HIST("h2_jet_pt_2prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); - } - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMax, prongsigmaLxyMax); - auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); - auto bjetCandForXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMax, prongsigmaLxyzMax, true); - auto maxSxyz = bjetCandForXYZ.decayLength() / bjetCandForXYZ.errorDecayLength(); - registry.fill(HIST("h2_jet_pt_2prong_Sxy_N1"), jet.pt(), maxSxy); - registry.fill(HIST("h2_jet_pt_2prong_Sxyz_N1"), jet.pt(), maxSxyz); + if (jet.template secondaryVertices_as().size() < 1) + return; + if (fillGeneralSVQA) { + registry.fill(HIST("h_2prong_nprongs"), jet.template secondaryVertices_as().size()); + for (const auto& prong : jet.template secondaryVertices_as()) { + auto Lxy = prong.decayLengthXY(); + auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); + auto Lxyz = prong.decayLength(); + auto Sxyz = prong.decayLength() / prong.errorDecayLength(); + registry.fill(HIST("h2_jet_pt_2prong_Lxy"), jet.pt(), Lxy); + registry.fill(HIST("h2_jet_pt_2prong_Sxy"), jet.pt(), Sxy); + registry.fill(HIST("h2_jet_pt_2prong_Lxyz"), jet.pt(), Lxyz); + registry.fill(HIST("h2_jet_pt_2prong_Sxyz"), jet.pt(), Sxyz); + registry.fill(HIST("h2_jet_pt_2prong_sigmaLxy"), jet.pt(), prong.errorDecayLengthXY()); + registry.fill(HIST("h2_jet_pt_2prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); + } + } + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("h2_jet_pt_2prong_Sxy_N1"), jet.pt(), maxSxy); + registry.fill(HIST("h2_jet_pt_2prong_mass_N1"), jet.pt(), massSV); + if (jet.flagtaggedjetSV()) { + registry.fill(HIST("h2_taggedjet_pt_2prong_Sxy_N1"), jet.pt(), maxSxy); + registry.fill(HIST("h2_taggedjet_pt_2prong_mass_N1"), jet.pt(), massSV); + } + } + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h2_jet_pt_2prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_jet_pt_2prong_mass_xyz_N1"), jet.pt(), massSV); + if (jet.flagtaggedjetSVxyz()) { + registry.fill(HIST("h2_taggedjet_pt_2prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_taggedjet_pt_2prong_mass_xyz_N1"), jet.pt(), massSV); + } + } } template @@ -812,25 +918,46 @@ struct JetTaggerHFQA { if (jet.pt() > pTHatMaxMCD * pTHat) { return; } - registry.fill(HIST("h_3prong_nprongs"), jet.template secondaryVertices_as().size()); - for (const auto& prong : jet.template secondaryVertices_as()) { - auto Lxy = prong.decayLengthXY(); - auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); - auto Lxyz = prong.decayLength(); - auto Sxyz = prong.decayLength() / prong.errorDecayLength(); - registry.fill(HIST("h2_jet_pt_3prong_Lxy"), jet.pt(), Lxy); - registry.fill(HIST("h2_jet_pt_3prong_Sxy"), jet.pt(), Sxy); - registry.fill(HIST("h2_jet_pt_3prong_Lxyz"), jet.pt(), Lxyz); - registry.fill(HIST("h2_jet_pt_3prong_Sxyz"), jet.pt(), Sxyz); - registry.fill(HIST("h2_jet_pt_3prong_sigmaLxy"), jet.pt(), prong.errorDecayLengthXY()); - registry.fill(HIST("h2_jet_pt_3prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); - } - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMax, prongsigmaLxyMax); - auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); - auto bjetCandForXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMax, prongsigmaLxyzMax, true); - auto maxSxyz = bjetCandForXYZ.decayLength() / bjetCandForXYZ.errorDecayLength(); - registry.fill(HIST("h2_jet_pt_3prong_Sxy_N1"), jet.pt(), maxSxy); - registry.fill(HIST("h2_jet_pt_3prong_Sxyz_N1"), jet.pt(), maxSxyz); + if (jet.template secondaryVertices_as().size() < 1) + return; + if (fillGeneralSVQA) { + registry.fill(HIST("h_3prong_nprongs"), jet.template secondaryVertices_as().size()); + for (const auto& prong : jet.template secondaryVertices_as()) { + auto Lxy = prong.decayLengthXY(); + auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); + auto Lxyz = prong.decayLength(); + auto Sxyz = prong.decayLength() / prong.errorDecayLength(); + registry.fill(HIST("h2_jet_pt_3prong_Lxy"), jet.pt(), Lxy); + registry.fill(HIST("h2_jet_pt_3prong_Sxy"), jet.pt(), Sxy); + registry.fill(HIST("h2_jet_pt_3prong_Lxyz"), jet.pt(), Lxyz); + registry.fill(HIST("h2_jet_pt_3prong_Sxyz"), jet.pt(), Sxyz); + registry.fill(HIST("h2_jet_pt_3prong_sigmaLxy"), jet.pt(), prong.errorDecayLengthXY()); + registry.fill(HIST("h2_jet_pt_3prong_sigmaLxyz"), jet.pt(), prong.errorDecayLength()); + } + } + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("h2_jet_pt_3prong_Sxy_N1"), jet.pt(), maxSxy); + registry.fill(HIST("h2_jet_pt_3prong_mass_N1"), jet.pt(), massSV); + if (jet.flagtaggedjetSV()) { + registry.fill(HIST("h2_taggedjet_pt_3prong_Sxy_N1"), jet.pt(), maxSxy); + registry.fill(HIST("h2_taggedjet_pt_3prong_mass_N1"), jet.pt(), massSV); + } + } + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(jet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h2_jet_pt_3prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_jet_pt_3prong_mass_xyz_N1"), jet.pt(), massSV); + if (jet.flagtaggedjetSVxyz()) { + registry.fill(HIST("h2_taggedjet_pt_3prong_Sxyz_N1"), jet.pt(), maxSxyz); + registry.fill(HIST("h2_taggedjet_pt_3prong_mass_xyz_N1"), jet.pt(), massSV); + } + } } template @@ -841,34 +968,46 @@ struct JetTaggerHFQA { return; } auto origin = mcdjet.origin(); - registry.fill(HIST("h2_2prong_nprongs_flavour"), mcdjet.template secondaryVertices_as().size(), origin, eventWeight); if (mcdjet.template secondaryVertices_as().size() < 1) return; - for (const auto& prong : mcdjet.template secondaryVertices_as()) { - auto Lxy = prong.decayLengthXY(); - auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); - auto Lxyz = prong.decayLength(); - auto Sxyz = prong.decayLength() / prong.errorDecayLength(); - registry.fill(HIST("h3_jet_pt_2prong_Lxy_flavour"), mcdjet.pt(), Lxy, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Sxy_flavour"), mcdjet.pt(), Sxy, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Lxyz_flavour"), mcdjet.pt(), Lxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Sxyz_flavour"), mcdjet.pt(), Sxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_sigmaLxy_flavour"), mcdjet.pt(), prong.errorDecayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); - } - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyMax); - auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); - auto massSV = bjetCand.m(); - auto bjetCandForXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyzMax, true); - auto maxSxyz = bjetCandForXYZ.decayLength() / bjetCandForXYZ.errorDecayLength(); - registry.fill(HIST("h3_jet_pt_2prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); - if (!mcdjet.flagtaggedjetSV()) - return; - registry.fill(HIST("h3_taggedjet_pt_2prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_2prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (fillGeneralSVQA) { + registry.fill(HIST("h2_2prong_nprongs_flavour"), mcdjet.template secondaryVertices_as().size(), origin, eventWeight); + for (const auto& prong : mcdjet.template secondaryVertices_as()) { + auto Lxy = prong.decayLengthXY(); + auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); + auto Lxyz = prong.decayLength(); + auto Sxyz = prong.decayLength() / prong.errorDecayLength(); + registry.fill(HIST("h3_jet_pt_2prong_Lxy_flavour"), mcdjet.pt(), Lxy, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_Sxy_flavour"), mcdjet.pt(), Sxy, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_Lxyz_flavour"), mcdjet.pt(), Lxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_Sxyz_flavour"), mcdjet.pt(), Sxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_sigmaLxy_flavour"), mcdjet.pt(), prong.errorDecayLengthXY(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); + } + } + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("h3_jet_pt_2prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (mcdjet.flagtaggedjetSV()) { + registry.fill(HIST("h3_taggedjet_pt_2prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_2prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + } + } + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCandXYZ, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h3_jet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (mcdjet.flagtaggedjetSVxyz()) { + registry.fill(HIST("h3_taggedjet_pt_2prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_2prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + } + } } template @@ -898,52 +1037,80 @@ struct JetTaggerHFQA { registry.fill(HIST("h3_jet_pt_2prong_sigmaLxy_flavour_run2"), mcdjet.pt(), prong.errorDecayLengthXY(), jetflavourRun2Def, eventWeight); registry.fill(HIST("h3_jet_pt_2prong_sigmaLxyz_flavour_run2"), mcdjet.pt(), prong.errorDecayLength(), jetflavourRun2Def, eventWeight); } - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyMax); - auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); - auto massSV = bjetCand.m(); - auto bjetCandForXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyzMax, true); - auto maxSxyz = bjetCandForXYZ.decayLength() / bjetCandForXYZ.errorDecayLength(); - registry.fill(HIST("h3_jet_pt_2prong_Sxy_N1_flavour_run2"), mcdjet.pt(), maxSxy, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_Sxyz_N1_flavour_run2"), mcdjet.pt(), maxSxyz, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_2prong_mass_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("h3_jet_pt_2prong_Sxy_N1_flavour_run2"), mcdjet.pt(), maxSxy, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_mass_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + if (mcdjet.flagtaggedjetSV()) { + registry.fill(HIST("h3_taggedjet_pt_2prong_Sxy_N1_flavour_run2"), mcdjet.pt(), maxSxy, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_2prong_mass_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + } + } + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h3_jet_pt_2prong_Sxyz_N1_flavour_run2"), mcdjet.pt(), maxSxyz, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_2prong_mass_xyz_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + if (mcdjet.flagtaggedjetSVxyz()) { + registry.fill(HIST("h3_taggedjet_pt_2prong_Sxyz_N1_flavour_run2"), mcdjet.pt(), maxSxyz, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_2prong_mass_xyz_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + } + } } template void fillHistogramSV3ProngMCD(T const& mcdjet, U const& /*prongs*/, float eventWeight = 1.0) { + // std::cout << "weight: " << eventWeight << std::endl; float pTHat = 10. / (std::pow(eventWeight, 1.0 / pTHatExponent)); if (mcdjet.pt() > pTHatMaxMCD * pTHat) { return; } auto origin = mcdjet.origin(); - registry.fill(HIST("h2_3prong_nprongs_flavour"), mcdjet.template secondaryVertices_as().size(), origin); if (mcdjet.template secondaryVertices_as().size() < 1) return; - for (const auto& prong : mcdjet.template secondaryVertices_as()) { - auto Lxy = prong.decayLengthXY(); - auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); - auto Lxyz = prong.decayLength(); - auto Sxyz = prong.decayLength() / prong.errorDecayLength(); - registry.fill(HIST("h3_jet_pt_3prong_Lxy_flavour"), mcdjet.pt(), Lxy, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxy_flavour"), mcdjet.pt(), Sxy, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Lxyz_flavour"), mcdjet.pt(), Lxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxyz_flavour"), mcdjet.pt(), Sxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_sigmaLxy_flavour"), mcdjet.pt(), prong.errorDecayLengthXY(), origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); - } - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyMax); - auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); - auto massSV = bjetCand.m(); - auto bjetCandForXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyzMax, true); - auto maxSxyz = bjetCandForXYZ.decayLength() / bjetCandForXYZ.errorDecayLength(); - registry.fill(HIST("h3_jet_pt_3prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); - if (!mcdjet.flagtaggedjetSV()) - return; - registry.fill(HIST("h3_taggedjet_pt_3prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_3prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (fillGeneralSVQA) { + registry.fill(HIST("h2_3prong_nprongs_flavour"), mcdjet.template secondaryVertices_as().size(), origin); + for (const auto& prong : mcdjet.template secondaryVertices_as()) { + auto Lxy = prong.decayLengthXY(); + auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); + auto Lxyz = prong.decayLength(); + auto Sxyz = prong.decayLength() / prong.errorDecayLength(); + registry.fill(HIST("h3_jet_pt_3prong_Lxy_flavour"), mcdjet.pt(), Lxy, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Sxy_flavour"), mcdjet.pt(), Sxy, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Lxyz_flavour"), mcdjet.pt(), Lxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Sxyz_flavour"), mcdjet.pt(), Sxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_sigmaLxy_flavour"), mcdjet.pt(), prong.errorDecayLengthXY(), origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_sigmaLxyz_flavour"), mcdjet.pt(), prong.errorDecayLength(), origin, eventWeight); + } + } + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("h3_jet_pt_3prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (mcdjet.flagtaggedjetSV()) { + registry.fill(HIST("h3_taggedjet_pt_3prong_Sxy_N1_flavour"), mcdjet.pt(), maxSxy, origin, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_3prong_mass_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + } + } + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCandXYZ.m(); + registry.fill(HIST("h3_jet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + if (mcdjet.flagtaggedjetSV()) { + registry.fill(HIST("h3_taggedjet_pt_3prong_Sxyz_N1_flavour"), mcdjet.pt(), maxSxyz, origin, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour"), mcdjet.pt(), massSV, origin, eventWeight); + } + } } template @@ -961,31 +1128,43 @@ struct JetTaggerHFQA { return; if (mcdjet.template secondaryVertices_as().size() < 1) return; - for (const auto& prong : mcdjet.template secondaryVertices_as()) { - auto Lxy = prong.decayLengthXY(); - auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); - auto Lxyz = prong.decayLength(); - auto Sxyz = prong.decayLength() / prong.errorDecayLength(); - registry.fill(HIST("h3_jet_pt_3prong_Lxy_flavour_run2"), mcdjet.pt(), Lxy, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxy_flavour_run2"), mcdjet.pt(), Sxy, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Lxyz_flavour_run2"), mcdjet.pt(), Lxyz, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxyz_flavour_run2"), mcdjet.pt(), Sxyz, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_sigmaLxy_flavour_run2"), mcdjet.pt(), prong.errorDecayLengthXY(), jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_sigmaLxyz_flavour_run2"), mcdjet.pt(), prong.errorDecayLength(), jetflavourRun2Def, eventWeight); - } - auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyMax); - auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); - auto massSV = bjetCand.m(); - auto bjetCandForXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMax, prongsigmaLxyzMax, true); - auto maxSxyz = bjetCandForXYZ.decayLength() / bjetCandForXYZ.errorDecayLength(); - registry.fill(HIST("h3_jet_pt_3prong_Sxy_N1_flavour_run2"), mcdjet.pt(), maxSxy, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_Sxyz_N1_flavour_run2"), mcdjet.pt(), maxSxyz, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_jet_pt_3prong_mass_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); - if (!mcdjet.flagtaggedjetSV()) - return; - registry.fill(HIST("h3_taggedjet_pt_3prong_Sxy_N1_flavour_run2"), mcdjet.pt(), maxSxy, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_3prong_Sxyz_N1_flavour_run2"), mcdjet.pt(), maxSxyz, jetflavourRun2Def, eventWeight); - registry.fill(HIST("h3_taggedjet_pt_3prong_mass_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + if (fillGeneralSVQA) { + for (const auto& prong : mcdjet.template secondaryVertices_as()) { + auto Lxy = prong.decayLengthXY(); + auto Sxy = prong.decayLengthXY() / prong.errorDecayLengthXY(); + auto Lxyz = prong.decayLength(); + auto Sxyz = prong.decayLength() / prong.errorDecayLength(); + registry.fill(HIST("h3_jet_pt_3prong_Lxy_flavour_run2"), mcdjet.pt(), Lxy, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Sxy_flavour_run2"), mcdjet.pt(), Sxy, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Lxyz_flavour_run2"), mcdjet.pt(), Lxyz, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_Sxyz_flavour_run2"), mcdjet.pt(), Sxyz, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_sigmaLxy_flavour_run2"), mcdjet.pt(), prong.errorDecayLengthXY(), jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_sigmaLxyz_flavour_run2"), mcdjet.pt(), prong.errorDecayLength(), jetflavourRun2Def, eventWeight); + } + } + bool checkSv = false; + auto bjetCand = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyMax, prongIPxyMin, prongIPxyMax, false, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxy = bjetCand.decayLengthXY() / bjetCand.errorDecayLengthXY(); + auto massSV = bjetCand.m(); + registry.fill(HIST("h3_jet_pt_3prong_Sxy_N1_flavour_run2"), mcdjet.pt(), maxSxy, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_mass_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + if (mcdjet.flagtaggedjetSV()) { + registry.fill(HIST("h3_taggedjet_pt_3prong_Sxy_N1_flavour_run2"), mcdjet.pt(), maxSxy, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_3prong_mass_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + } + } + auto bjetCandXYZ = jettaggingutilities::jetFromProngMaxDecayLength(mcdjet, prongChi2PCAMin, prongChi2PCAMax, prongsigmaLxyzMax, prongIPxyMin, prongIPxyMax, true, &checkSv); + if (checkSv && jettaggingutilities::svAcceptance(bjetCand, svDispersionMax)) { + auto maxSxyz = bjetCandXYZ.decayLength() / bjetCandXYZ.errorDecayLength(); + auto massSV = bjetCand.m(); + registry.fill(HIST("h3_jet_pt_3prong_Sxyz_N1_flavour_run2"), mcdjet.pt(), maxSxyz, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_jet_pt_3prong_mass_xyz_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + if (mcdjet.flagtaggedjetSVxyz()) { + registry.fill(HIST("h3_taggedjet_pt_3prong_Sxyz_N1_flavour_run2"), mcdjet.pt(), maxSxyz, jetflavourRun2Def, eventWeight); + registry.fill(HIST("h3_taggedjet_pt_3prong_mass_xyz_N1_flavour_run2"), mcdjet.pt(), massSV, jetflavourRun2Def, eventWeight); + } + } } void processDummy(aod::Collision const&, aod::Tracks const&) @@ -999,16 +1178,15 @@ struct JetTaggerHFQA { if (!jetderiveddatautilities::selectTrack(jtrack, trackSelection)) { continue; } - float varImpXY, varImpXYSig, varImpZ, varImpZSig, varImpXYZ, varImpXYZSig; varImpXY = jtrack.dcaXY() * jettaggingutilities::cmTomum; varImpXYSig = jtrack.dcaXY() / jtrack.sigmadcaXY(); varImpZ = jtrack.dcaZ() * jettaggingutilities::cmTomum; varImpZSig = jtrack.dcaZ() / jtrack.sigmadcaZ(); float dcaXYZ = jtrack.dcaXYZ(); - float sigmadcaXYZ2 = jtrack.sigmadcaXYZ(); + float sigmadcaXYZ = jtrack.sigmadcaXYZ(); varImpXYZ = dcaXYZ * jettaggingutilities::cmTomum; - varImpXYZSig = dcaXYZ / std::sqrt(sigmadcaXYZ2); + varImpXYZSig = dcaXYZ / sigmadcaXYZ; registry.fill(HIST("h_impact_parameter_xy"), varImpXY); registry.fill(HIST("h_impact_parameter_xy_significance"), varImpXYSig); @@ -1020,7 +1198,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processTracksDca, "Fill inclusive tracks' imformation for data", false); - void processIPsData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTagTracksData const& jtracks) + void processIPsData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTagTracksData const& jtracks) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1029,7 +1207,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistogramIPsData(jet, jtracks); @@ -1037,7 +1215,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processIPsData, "Fill impact parameter imformation for data jets", false); - void processIPsMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const& jtracks, JetParticles&) + void processIPsMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const& jtracks, aod::JetParticles&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1046,7 +1224,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramIPsMCD(mcdjet, jtracks); @@ -1054,7 +1232,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processIPsMCD, "Fill impact parameter imformation for mcd jets", false); - void processIPsMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const& jtracks, JetParticles&) + void processIPsMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const& jtracks, aod::JetParticles&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1068,13 +1246,13 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processIPsMCDWeighted, "Fill impact parameter imformation for mcd jets", false); - void processIPsMCP(soa::Join const& mcpjets, JetParticles&, JetMcCollisions const&, soa::Filtered const& collisions) + void processIPsMCP(soa::Join const& mcpjets, aod::JetParticles&, aod::JetMcCollisions const&, soa::Filtered const& collisions) { for (auto mcpjet : mcpjets) { if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcpjet)) { + if (!isAcceptedJet(mcpjet)) { return; } if (checkMcCollisionIsMatched) { @@ -1089,13 +1267,13 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processIPsMCP, "Fill impact parameter imformation for mcp jets", false); - void processIPsMCPWeighted(soa::Filtered const& collisions, soa::Join const& mcpjets, JetParticles&) + void processIPsMCPWeighted(soa::Filtered const& collisions, soa::Join const& mcpjets, aod::JetParticles&) { for (auto mcpjet : mcpjets) { if (!jetfindingutilities::isInEtaAcceptance(mcpjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcpjet)) { + if (!isAcceptedJet(mcpjet)) { return; } if (checkMcCollisionIsMatched) { @@ -1110,7 +1288,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processIPsMCPWeighted, "Fill impact parameter imformation for mcp jets weighted", false); - void processIPsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTagTracksMCD const& jtracks, JetParticles& particles) + void processIPsMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTagTracksMCD const& jtracks, aod::JetParticles& particles) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1120,7 +1298,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramIPsMatched(mcdjet, mcpjets, jtracks, particlesPerColl); @@ -1128,7 +1306,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processIPsMCPMCDMatched, "Fill impact parameter imformation for mcp mcd matched jets", false); - void processIPsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTagTracksMCD const& jtracks, JetParticles& particles) + void processIPsMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTagTracksMCD const& jtracks, aod::JetParticles& particles) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1138,7 +1316,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramIPsMatched(mcdjet, mcpjets, jtracks, particlesPerColl, mcdjet.eventWeight()); @@ -1146,7 +1324,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processIPsMCPMCDMatchedWeighted, "Fill impact parameter imformation for mcp mcd matched jets", false); - void processJPData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTagTracksData const&) + void processJPData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTagTracksData const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1155,7 +1333,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistogramJPData(jet); @@ -1163,7 +1341,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processJPData, "Fill jet probability imformation for data jets", false); - void processJPMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const&) + void processJPMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1172,7 +1350,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramJPMCD(mcdjet); @@ -1180,7 +1358,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processJPMCD, "Fill jet probability imformation for mcd jets", false); - void processJPMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const&) + void processJPMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, JetTagTracksMCD const&) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1189,7 +1367,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramJPMCD(mcdjet, mcdjet.eventWeight()); @@ -1197,7 +1375,43 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processJPMCDWeighted, "Fill jet probability imformation for mcd jets", false); - void processSV2ProngData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::DataSecondaryVertex2Prongs const& prongs) + void processJPMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTagTracksMCD const&, aod::JetParticles& particles) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto mcdjet : mcdjets) { + auto const particlesPerColl = particles.sliceBy(particlesPerCollision, collision.mcCollisionId()); + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + fillHistogramJPMatched(mcdjet, mcpjets, particlesPerColl); + } + } + PROCESS_SWITCH(JetTaggerHFQA, processJPMCPMCDMatched, "Fill jet probability imformation for mcd jets", false); + + void processJPMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTagTracksMCD const&, aod::JetParticles& particles) + { + if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { + return; + } + for (auto mcdjet : mcdjets) { + auto const particlesPerColl = particles.sliceBy(particlesPerCollision, collision.mcCollisionId()); + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + if (!isAcceptedJet(mcdjet)) { + continue; + } + fillHistogramJPMatched(mcdjet, mcpjets, particlesPerColl, mcdjet.eventWeight()); + } + } + PROCESS_SWITCH(JetTaggerHFQA, processJPMCPMCDMatchedWeighted, "Fill jet probability imformation for mcd jets", false); + + void processSV2ProngData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::DataSecondaryVertex2Prongs const& prongs) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1206,7 +1420,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistogramSV2ProngData(jet, prongs); @@ -1214,7 +1428,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV2ProngData, "Fill 2prong imformation for data jets", false); - void processSV3ProngData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::DataSecondaryVertex3Prongs const& prongs) + void processSV3ProngData(soa::Filtered::iterator const& collision, soa::Join const& jets, aod::DataSecondaryVertex3Prongs const& prongs) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1223,7 +1437,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(jet)) { + if (!isAcceptedJet(jet)) { continue; } fillHistogramSV3ProngData(jet, prongs); @@ -1231,7 +1445,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngData, "Fill 2prong imformation for data jets", false); - void processSV2ProngMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex2Prongs const& prongs) + void processSV2ProngMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex2Prongs const& prongs) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1240,7 +1454,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV2ProngMCD(mcdjet, prongs); @@ -1248,7 +1462,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV2ProngMCD, "Fill 2prong imformation for mcd jets", false); - void processSV2ProngMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex2Prongs const& prongs) + void processSV2ProngMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex2Prongs const& prongs) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1257,7 +1471,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV2ProngMCD(mcdjet, prongs, mcdjet.eventWeight()); @@ -1265,7 +1479,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV2ProngMCDWeighted, "Fill 2prong imformation for mcd jets", false); - void processSV2ProngMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex2Prongs const& prongs, JetParticles& particles) + void processSV2ProngMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex2Prongs const& prongs, aod::JetParticles& particles) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1275,7 +1489,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV2ProngMCPMCDMatched(mcdjet, mcpjets, prongs, particlesPerColl); @@ -1283,7 +1497,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV2ProngMCPMCDMatched, "Fill 2prong imformation for mcd jets", false); - void processSV2ProngMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex2Prongs const& prongs, JetParticles& particles) + void processSV2ProngMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex2Prongs const& prongs, aod::JetParticles& particles) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1293,7 +1507,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV2ProngMCPMCDMatched(mcdjet, mcpjets, prongs, particlesPerColl, mcdjet.eventWeight()); @@ -1301,7 +1515,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV2ProngMCPMCDMatchedWeighted, "Fill 2prong imformation for mcd jets", false); - void processSV3ProngMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex3Prongs const& prongs) + void processSV3ProngMCD(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex3Prongs const& prongs) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1310,7 +1524,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV3ProngMCD(mcdjet, prongs); @@ -1318,7 +1532,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCD, "Fill 3prong imformation for mcd jets", false); - void processSV3ProngMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex3Prongs const& prongs) + void processSV3ProngMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, aod::MCDSecondaryVertex3Prongs const& prongs) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1327,7 +1541,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV3ProngMCD(mcdjet, prongs, mcdjet.eventWeight()); @@ -1335,7 +1549,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCDWeighted, "Fill 3prong imformation for mcd jets", false); - void processSV3ProngMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex3Prongs const& prongs, JetParticles& particles) + void processSV3ProngMCPMCDMatched(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex3Prongs const& prongs, aod::JetParticles& particles) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1345,7 +1559,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV3ProngMCPMCDMatched(mcdjet, mcpjets, prongs, particlesPerColl); @@ -1353,7 +1567,7 @@ struct JetTaggerHFQA { } PROCESS_SWITCH(JetTaggerHFQA, processSV3ProngMCPMCDMatched, "Fill 3prong imformation for mcd jets", false); - void processSV3ProngMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex3Prongs const& prongs, JetParticles& particles) + void processSV3ProngMCPMCDMatchedWeighted(soa::Filtered>::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, aod::MCDSecondaryVertex3Prongs const& prongs, aod::JetParticles& particles) { if (collision.trackOccupancyInTimeRange() < trackOccupancyInTimeRangeMin || trackOccupancyInTimeRangeMax < collision.trackOccupancyInTimeRange()) { return; @@ -1363,7 +1577,7 @@ struct JetTaggerHFQA { if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { continue; } - if (!isAcceptedJet(mcdjet)) { + if (!isAcceptedJet(mcdjet)) { continue; } fillHistogramSV3ProngMCPMCDMatched(mcdjet, mcpjets, prongs, particlesPerColl, mcdjet.eventWeight()); diff --git a/PWGJE/Tasks/jetvalidationqa.cxx b/PWGJE/Tasks/jetvalidationqa.cxx index 1ef731bad09..c608c9c256c 100644 --- a/PWGJE/Tasks/jetvalidationqa.cxx +++ b/PWGJE/Tasks/jetvalidationqa.cxx @@ -169,9 +169,9 @@ struct jetTrackCollisionQa { Filter etafilter = (aod::jtrack::eta <= etaup) && (aod::jtrack::eta >= etalow); Filter ptfilter = (aod::jtrack::pt <= ptUp) && (aod::jtrack::pt >= ptLow); using Tracks = soa::Join; - using TracksJE = soa::Filtered>; + using TracksJE = soa::Filtered>; - void processESD(JetCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const&) + void processESD(aod::JetCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const&) { mHistManager.fill(HIST("controlCollisionVtxZ"), collision.posZ()); if (evSel == true) { @@ -239,7 +239,7 @@ struct jetTrackCollisionQa { PROCESS_SWITCH(jetTrackCollisionQa, processESD, "validate jet-finder output on run2 ESD", true); // process for run3 AOD's - void processRun3AOD(JetCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const&) + void processRun3AOD(aod::JetCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const&) { if (evSel == true) { if (!jetderiveddatautilities::selectCollision(collision, jetderiveddatautilities::JCollisionSel::sel8) || fabs(collision.posZ()) > 10) { @@ -304,7 +304,7 @@ struct jetTrackCollisionQa { PROCESS_SWITCH(jetTrackCollisionQa, processRun3AOD, "validate jet-finder output on run3 AOD", false); // dummy process to run jetfinder validation code on ESD, but MC validation for run3 on hyperloop - void processDummy(JetCollisions const&) + void processDummy(aod::JetCollisions const&) { } PROCESS_SWITCH(jetTrackCollisionQa, processDummy, "Dummy process function turned on by default", false); @@ -473,12 +473,12 @@ struct mcJetTrackCollisionQa { Filter etafilter = (aod::jtrack::eta < etaup) && (aod::jtrack::eta > etalow); Filter ptfilter = (aod::jtrack::pt < ptUp) && (aod::jtrack::pt > ptLow); - using MCTracksJE = soa::Filtered; + using MCTracksJE = soa::Filtered; - void processMcRun2(JetCollisionsMCD::iterator const& collision, + void processMcRun2(aod::JetCollisionsMCD::iterator const& collision, soa::Join const& mcPartJets, soa::Join const& mcDetJets, - JetParticles const&, JetMcCollisions const&, + aod::JetParticles const&, aod::JetMcCollisions const&, MCTracksJE const& tracks) { if (fabs(collision.posZ()) > 10) { @@ -491,7 +491,7 @@ struct mcJetTrackCollisionQa { for (const auto& genJet : mcPartJets) { if (genJet.mcCollisionId() == collision.globalIndex()) { fillMcPartJets(genJet); - for (auto& mcParticle : genJet.tracks_as()) { + for (auto& mcParticle : genJet.tracks_as()) { fillMcPartJetConstituents(mcParticle); } } @@ -509,10 +509,10 @@ struct mcJetTrackCollisionQa { } // end processMcRun2 PROCESS_SWITCH(mcJetTrackCollisionQa, processMcRun2, "validate jet-finder output on converted run2 mc AOD's", false); - void processMcRun3(JetCollisionsMCD::iterator const& collision, + void processMcRun3(aod::JetCollisionsMCD::iterator const& collision, soa::Join const& mcPartJets, soa::Join const& mcDetJets, - JetParticles const&, JetMcCollisions const&, + aod::JetParticles const&, aod::JetMcCollisions const&, MCTracksJE const& tracks) { if (fabs(collision.posZ()) > 10) { @@ -525,7 +525,7 @@ struct mcJetTrackCollisionQa { for (const auto& genJet : mcPartJets) { if (genJet.mcCollisionId() == collision.globalIndex()) { fillMcPartJets(genJet); - for (auto& mcParticle : genJet.tracks_as()) { + for (auto& mcParticle : genJet.tracks_as()) { fillMcPartJetConstituents(mcParticle); } } @@ -544,7 +544,7 @@ struct mcJetTrackCollisionQa { 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 - void processDummy(JetMcCollisions const&) + void processDummy(aod::JetMcCollisions const&) { } PROCESS_SWITCH(mcJetTrackCollisionQa, processDummy, "Dummy process function turned off by default", true); diff --git a/PWGJE/Tasks/mcgeneratorstudies.cxx b/PWGJE/Tasks/mcgeneratorstudies.cxx index 1362ed572a5..98ec04f3341 100644 --- a/PWGJE/Tasks/mcgeneratorstudies.cxx +++ b/PWGJE/Tasks/mcgeneratorstudies.cxx @@ -32,13 +32,14 @@ using namespace o2::framework; using namespace o2::framework::expressions; using MyMCCollisions = soa::Join; +using MyBCs = o2::soa::Join; struct MCGeneratorStudies { HistogramRegistry mHistManager{"MCGeneratorStudyHistograms"}; Configurable mVertexCut{"vertexCut", 10.f, "apply z-vertex cut with value in cm"}; Configurable mRapidityCut{"rapidityCut", 0.9f, "Maximum absolute rapidity of counted generated particles"}; - Configurable mSelectedParticleCode{"particlePDGCode", 111, "PDG code of the particle to be investigated"}; + Configurable mSelectedParticleCode{"particlePDGCode", 111, "PDG code of the particle to be investigated (0 for all)"}; Configurable mRequireGammaGammaDecay{"requireGammaGammaDecay", false, "Only count generated particles that decayed into two photons"}; Configurable mRequireEMCCellContent{"requireEMCCellContent", false, "Ask forEMCal cell content instead of the kTVXinEMC trigger"}; @@ -48,14 +49,23 @@ struct MCGeneratorStudies { auto hCollisionCounter = mHistManager.add("hCollisionCounter", "Number of collisions after event cuts", HistType::kTH1F, {{7, 0.5, 7.5}}); hCollisionCounter->GetXaxis()->SetBinLabel(1, "all"); - hCollisionCounter->GetXaxis()->SetBinLabel(2, "TVX"); - hCollisionCounter->GetXaxis()->SetBinLabel(3, "T zSmall"); - hCollisionCounter->GetXaxis()->SetBinLabel(4, "Tz zGood"); - hCollisionCounter->GetXaxis()->SetBinLabel(5, "Tzz EMCal"); - hCollisionCounter->GetXaxis()->SetBinLabel(6, "TzzE Sel8"); - hCollisionCounter->GetXaxis()->SetBinLabel(7, "TzzES Unique"); + hCollisionCounter->GetXaxis()->SetBinLabel(2, "+TVX"); // TVX + hCollisionCounter->GetXaxis()->SetBinLabel(3, "+|z|<10cm"); // TVX with z < 10cm + hCollisionCounter->GetXaxis()->SetBinLabel(4, "+Sel8"); // TVX with z < 10cm and Sel8 + hCollisionCounter->GetXaxis()->SetBinLabel(5, "+Good z vtx"); // TVX with z < 10cm and Sel8 and good z xertex + 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: + mesonLatexString = "particles"; + break; case 111: mesonLatexString = "#pi^{0}"; break; @@ -63,15 +73,20 @@ struct MCGeneratorStudies { mesonLatexString = "#eta"; break; } - mHistManager.add("hpT_all", Form("Generated %s in all collisions", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpT_TVX", Form("Generated %s in TVX triggered collisions", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpT_T_zsmall", Form("Generated %s in TVX collisions with z < 10cm", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpT_T_z_zGood", Form("Generated %s in TVX collisions with good z < 10cm", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpTAccepted_T_z_z", Form("Accepted (EMCal) %s in TVX collisions with good z < 10cm", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpT_T_z_z_EMCal", Form("Generated %s in TVXinEMC collisions with good z < 10cm", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpT_T_z_z_E_Sel8", Form("Generated %s in TVXinEMC collisions with good z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpT_T_z_z_E_S_Unique", Form("Generated %s in unique TVXinEMC collisions with good z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); - mHistManager.add("hpTAccepted_T_z_z_E_S_U", Form("Accepted %s in unique TVXinEMC collisions with good z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield", Form("Generated %s in all collisions", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_Accepted", Form("Accepted %s in all collisions", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_T", Form("Generated %s in TVX triggered collisions", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_TZ", Form("Generated %s in TVX collisions with z < 10cm", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_TZS", Form("Generated %s in TVX collisions with z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_TZSG", Form("Generated %s in collisions with good z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + mHistManager.add("Yield_TZSGU", Form("Generated %s in unique collisions with good z < 10cm and Sel8", mesonLatexString.Data()), HistType::kTH1F, {pTAxis}); + 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"); @@ -91,40 +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() != mSelectedParticleCode || fabs(mcParticle.y()) > mRapidityCut) - continue; - if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator()) - continue; - if (mRequireGammaGammaDecay && !isGammaGammaDecay(mcParticle, mcParticles)) - continue; - - mHistManager.fill(HIST("hpT_all"), mcParticle.pt()); - if (collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { - mHistManager.fill(HIST("hpT_TVX"), mcParticle.pt()); - if (abs(collision.posZ()) < mVertexCut) { - mHistManager.fill(HIST("hpT_T_zsmall"), mcParticle.pt()); - if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - mHistManager.fill(HIST("hpT_T_z_zGood"), mcParticle.pt()); - if (isAccepted(mcParticle, mcParticles)) - mHistManager.fill(HIST("hpTAccepted_T_z_z"), mcParticle.pt()); - if (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC)) { - mHistManager.fill(HIST("hpT_T_z_z_EMCal"), mcParticle.pt()); - if (collision.sel8()) { - mHistManager.fill(HIST("hpT_T_z_z_E_Sel8"), 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("hpT_T_z_z_E_S_Unique"), mcParticle.pt()); - if (isAccepted(mcParticle, mcParticles)) - mHistManager.fill(HIST("hpTAccepted_T_z_z_E_S_U"), mcParticle.pt()); + 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()); + } } } } @@ -200,14 +264,14 @@ struct MCGeneratorStudies { fRegistry->fill(HIST("hCollisionCounter"), 2); if (abs(collision.posZ()) < mVertexCut) { fRegistry->fill(HIST("hCollisionCounter"), 3); - if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + if (collision.sel8()) { fRegistry->fill(HIST("hCollisionCounter"), 4); - if (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC)) { - fRegistry->fill(HIST("hCollisionCounter"), 5); - if (collision.sel8()) { - fRegistry->fill(HIST("hCollisionCounter"), 6); + if (collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + fRegistry->fill(HIST("hCollisionCounter"), 5); if (collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - fRegistry->fill(HIST("hCollisionCounter"), 7); + fRegistry->fill(HIST("hCollisionCounter"), 6); + if (mRequireEMCCellContent ? collision.isemcreadout() : collision.alias_bit(kTVXinEMC)) + fRegistry->fill(HIST("hCollisionCounter"), 7); } } } diff --git a/PWGJE/Tasks/nSubjettiness.cxx b/PWGJE/Tasks/nSubjettiness.cxx index b1a695bd9f7..1eabf7c6c50 100644 --- a/PWGJE/Tasks/nSubjettiness.cxx +++ b/PWGJE/Tasks/nSubjettiness.cxx @@ -227,7 +227,7 @@ struct NSubjettinessTask { table(jet.pt(), jet.eta(), jet.phi(), nSub_Kt_results[1], nSub_Kt_results[2], nSub_Kt_results[0], nSub_CA_results[1], nSub_CA_results[2], nSub_CA_results[0], nSub_CASD_results[1], nSub_CASD_results[2], nSub_CASD_results[0]); } - void processJetsData(soa::Filtered::iterator const&, soa::Filtered> const& jets, JetTracks const& tracks) + void processJetsData(soa::Filtered::iterator const&, soa::Filtered> const& jets, aod::JetTracks const& tracks) { for (auto& jet : jets) { processJet(jet, tracks); @@ -236,7 +236,7 @@ struct NSubjettinessTask { } PROCESS_SWITCH(NSubjettinessTask, processJetsData, "Process function for inclusive jets in data", true); - void processJetsDataEWS(soa::Filtered::iterator const&, soa::Filtered> const& jets, JetTracksSub const& tracks) + void processJetsDataEWS(soa::Filtered::iterator const&, soa::Filtered> const& jets, aod::JetTracksSub const& tracks) { for (auto& jet : jets) { processJet(jet, tracks); @@ -245,7 +245,7 @@ struct NSubjettinessTask { } PROCESS_SWITCH(NSubjettinessTask, processJetsDataEWS, "Process function for inclusive jets with eventwise subtraction in data", false); - void processJetsMCD(soa::Filtered::iterator const&, soa::Filtered> const& jets, JetTracks const& tracks) + void processJetsMCD(soa::Filtered::iterator const&, soa::Filtered> const& jets, aod::JetTracks const& tracks) { for (auto& jet : jets) { processJet(jet, tracks); @@ -254,7 +254,7 @@ struct NSubjettinessTask { } PROCESS_SWITCH(NSubjettinessTask, processJetsMCD, "Process function for inclusive jets in mcd", false); - void processJetsMCDWeighted(soa::Filtered::iterator const&, soa::Filtered> const& jets, JetTracks const& tracks) + void processJetsMCDWeighted(soa::Filtered::iterator const&, soa::Filtered> const& jets, aod::JetTracks const& tracks) { for (auto& jet : jets) { processJet(jet, tracks, jet.eventWeight()); @@ -263,7 +263,7 @@ struct NSubjettinessTask { } PROCESS_SWITCH(NSubjettinessTask, processJetsMCDWeighted, "Process function for inclusive jets in weighted mcd", false); - void processJetsMCP(JetMcCollision const&, soa::Filtered> const& jets, JetParticles const& particles) + void processJetsMCP(aod::JetMcCollision const&, soa::Filtered> const& jets, aod::JetParticles const& particles) { for (auto& jet : jets) { processJet(jet, particles); @@ -272,7 +272,7 @@ struct NSubjettinessTask { } PROCESS_SWITCH(NSubjettinessTask, processJetsMCP, "Process function for inclusive jets in mcp", false); - void processJetsMCPWeighted(JetMcCollision const&, soa::Filtered> const& jets, JetParticles const& particles) + void processJetsMCPWeighted(aod::JetMcCollision const&, soa::Filtered> const& jets, aod::JetParticles const& particles) { for (auto& jet : jets) { processJet(jet, particles, jet.eventWeight()); diff --git a/PWGJE/Tasks/nucleiInJets.cxx b/PWGJE/Tasks/nucleiInJets.cxx index 897774b8874..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" @@ -90,6 +94,10 @@ struct nucleiInJets { Configurable cfgtrackSelections{"cfgtrackSelections", "globalTracks", "set track selections"}; 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"}; Configurable cfgtrkMaxRap{"cfgtrkMaxRap", 0.5, "set track max y"}; @@ -146,7 +154,9 @@ struct nucleiInJets { using TrackCandidates = soa::Join; - + using TrackCandidatesLfPid = soa::Join; using TrackCandidatesMC = soa::Join(HIST("mcpJet/eventStat")); h->GetXaxis()->SetBinLabel(1, "All"); h->GetXaxis()->SetBinLabel(2, "Sel8-goodRecJet"); - h->GetXaxis()->SetBinLabel(3, "vz< 10"); + h->GetXaxis()->SetBinLabel(3, "vz < 10"); h->GetXaxis()->SetBinLabel(4, "ingt0"); jetHist.add("mcpJet/vertexZ", "vertexZ (All)", kTH1F, {{100, -15.0, 15.0}}); @@ -256,13 +267,14 @@ struct nucleiInJets { jetHist.add("tracks/antiHelium/dca/after/hDCAzVsPtantiHelium_jet", "DCAz vs Pt (#bar{He})", HistType::kTH2F, {{dcazAxis}, {450, 0.5f, 5.f}}); } - jetHist.add("tracks/h2TPCsignVsTPCmomentum", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}}); - jetHist.add("tracks/h2TPCsignVsTPCmomentum_Jet", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}}); - jetHist.add("tracks/h2TPCsignVsTPCmomentum_OutJet", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}}); + jetHist.add("tracks/h2TPCsignVsTPCmomentum", "TPC <-dE/dX> vs #it{p}/Z;#it{p}/Z (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}}); + jetHist.add("tracks/h2TPCsignVsTPCmomentum_Jet", "TPC <-dE/dX> vs #it{p}/Z;#it{p}/Z (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}}); + jetHist.add("tracks/h2TPCsignVsTPCmomentum_OutJet", "TPC <-dE/dX> vs #it{p}/Z;#it{p}/Z (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}}); + jetHist.add("tracks/perpCone/h2TPCsignVsTPCmomentum", "TPC <-dE/dX> vs #it{p}/Z;#it{p}/Z (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{500, -5.f, 5.f}, {dedxAxis}}); - jetHist.add("tracks/h2TOFbetaVsP_Jet", "TOF #beta vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TOF #beta", HistType::kTH2F, {{250, -5.f, 5.f}, {betaAxis}}); - jetHist.add("tracks/h2TOFbetaVsP_OutJet", "TOF #beta vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TOF #beta", HistType::kTH2F, {{250, -5.f, 5.f}, {betaAxis}}); - jetHist.add("tracks/h2TOFbetaVsP", "TOF #beta vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TOF #beta", HistType::kTH2F, {{250, -5.f, 5.f}, {betaAxis}}); + jetHist.add("tracks/h2TOFbetaVsP_Jet", "TOF #beta vs #it{p}/Z; #it{p}/Z (GeV/#it{c}); TOF #beta", HistType::kTH2F, {{250, -5.f, 5.f}, {betaAxis}}); + jetHist.add("tracks/h2TOFbetaVsP_OutJet", "TOF #beta vs #it{p}/Z; #it{p}/Z (GeV/#it{c}); TOF #beta", HistType::kTH2F, {{250, -5.f, 5.f}, {betaAxis}}); + jetHist.add("tracks/h2TOFbetaVsP", "TOF #beta vs #it{p}/Z; #it{p}/Z (GeV/#it{c}); TOF #beta", HistType::kTH2F, {{250, -5.f, 5.f}, {betaAxis}}); // TOF hist jetHist.add("tracks/proton/h2TOFmassProtonVsPt_jet", "h2TOFmassProtonVsPt_jet; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{80, 0.4, 4.}, {50, 0., 5.}}); @@ -300,6 +312,17 @@ struct nucleiInJets { jetHist.add("tracks/antiTriton/h2TofNsigmaantiTritonVsPt_jet", "h2TofNsigmaantiTritonVsPt_jet; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); jetHist.add("tracks/helium/h2TofNsigmaHeliumVsPt_jet", "h2TofNsigmaHeliumVsPt_jet; TofNsigma; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); jetHist.add("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt_jet", "h2TofNsigmaantiHeliumVsPt_jet; TofNsigma; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + ///////////// + // perp cone + ///////////// + jetHist.add("tracks/perpCone/proton/h2TofNsigmaProtonVsPt", "h2TofNsigmaProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + jetHist.add("tracks/perpCone/antiProton/h2TofNsigmaantiProtonVsPt", "h2TofNsigmaantiProtonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + jetHist.add("tracks/perpCone/deuteron/h2TofNsigmaDeuteronVsPt", "h2TofNsigmaDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + jetHist.add("tracks/perpCone/antiDeuteron/h2TofNsigmaantiDeuteronVsPt", "h2TofNsigmaantiDeuteronVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + jetHist.add("tracks/perpCone/triton/h2TofNsigmaTritonVsPt", "h2TofNsigmaTritonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + jetHist.add("tracks/perpCone/antiTriton/h2TofNsigmaantiTritonVsPt", "h2TofNsigmaantiTritonVsPt; TofNsigma; #it{p}_{T} (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + jetHist.add("tracks/perpCone/helium/h2TofNsigmaHeliumVsPt", "h2TofNsigmaHeliumVsPt; TofNsigma; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); + jetHist.add("tracks/perpCone/antiHelium/h2TofNsigmaantiHeliumVsPt", "h2TofNsigmaantiHeliumVsPt; TofNsigma; #it{p}_{T}/z (GeV)", HistType::kTH2F, {{100, -5, 5}, {50, 0., 5.}}); ////////////////////////////////////////////// // outside jet ////////////////////////////////////////////// @@ -312,6 +335,15 @@ struct nucleiInJets { jetHist.add("tracks/triton/h3PtVsTritonNSigmaTPC", "pT(Tr) vs NSigmaTPC(Tr); #it{p}_{T} (GeV/#it{c}; NSigmaTPC;", HistType::kTH2F, {{PtAxis}, {200, -10, 10}}); jetHist.add("tracks/antiTriton/h3PtVsantiTritonNSigmaTPC", "pT(#barTr}) vs NSigmaTPC (#bar{Tr}); #it{p}_{T} (GeV/#it{c}; NSigmaTPC;", HistType::kTH2F, {{PtAxis}, {200, -10, 10}}); + jetHist.add("tracks/perpCone/proton/h3PtVsProtonNSigmaTPCVsPtJet", "pT(p) vs NSigmaTPC (p) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + jetHist.add("tracks/perpCone/antiProton/h3PtVsantiProtonNSigmaTPCVsPtJet", "pT(#bar{p}) vs NSigmaTPC (#bar{p}) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + jetHist.add("tracks/perpCone/deuteron/h3PtVsDeuteronNSigmaTPCVsPtJet", "pT(d) vs NSigmaTPC (d) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + jetHist.add("tracks/perpCone/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPtJet", "pT(#bar{d}) vs NSigmaTPC (#bar{d}) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + jetHist.add("tracks/perpCone/helium/h3PtVsHeliumNSigmaTPCVsPtJet", "pT(He) vs NSigmaTPC (He) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + jetHist.add("tracks/perpCone/antiHelium/h3PtVsantiHeliumNSigmaTPCVsPtJet", "pT(#bar{He}) vs NSigmaTPC (#bar{He}) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + jetHist.add("tracks/perpCone/triton/h3PtVsTritonNSigmaTPCVsPtJet", "pT(Tr) vs NSigmaTPC (Tr) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + jetHist.add("tracks/perpCone/antiTriton/h3PtVsantiTritonNSigmaTPCVsPtJet", "pT(#bar{Tr}) vs NSigmaTPC (#bar{Tr}) vs jet pT; #it{p}_{T} (GeV/#it{c}; NSigmaTPC; p^{jet}_{T}", HistType::kTH3F, {{PtAxis}, {200, -10, 10}, {PtJetAxis}}); + if (cEnableProtonQA) { jetHist.add("tracks/proton/dca/after/hDCAxyVsPtProton", "DCAxy vs Pt (p)", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); jetHist.add("tracks/antiProton/dca/after/hDCAxyVsPtantiProton", "DCAxy vs Pt (#bar{p})", HistType::kTH2F, {{dcaxyAxis}, {PtAxis}}); @@ -440,6 +472,7 @@ struct nucleiInJets { jetHist.add("mcpJet/pt/PtParticleType", "Pt (p) vs jetflag vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {2, 0, 2}, {14, -7, 7}}); // detectorJet-constituents jetHist.add("mcdJet/pt/PtParticleType", "Pt (p) vs jetflag vs particletype", HistType::kTH3D, {{100, 0.f, 10.f}, {2, 0, 2}, {14, -7, 7}}); + jetHist.add("mcdJet/pt/perpCone/PtParticleType", "Pt (p) vs particletype", HistType::kTH2D, {{100, 0.f, 10.f}, {14, -7, 7}}); jetHist.add("mcpJet/hJetPt", "Pt (jet)", HistType::kTH1F, {{100, 0.f, 50.f}}); jetHist.add("mcpJet/hJetEta", "Eta (jet)", HistType::kTH1F, {{100, 1.5, 1.5}}); @@ -476,6 +509,15 @@ struct nucleiInJets { } } + std::array getPerpendicuarPhi(float jetPhi) + { + std::array PerpendicularConeAxisPhi = {-999.0f, -999.0f}; + // build 2 perp cones in phi around the leading jet (right and left of the jet) + PerpendicularConeAxisPhi[0] = RecoDecay::constrainAngle(jetPhi + (M_PI / 2.)); // This will contrain the angel between 0-2Pi + PerpendicularConeAxisPhi[1] = RecoDecay::constrainAngle(jetPhi - (M_PI / 2.)); // This will contrain the angel between 0-2Pi + return PerpendicularConeAxisPhi; + } + template bool isTrackSelected(const TrackType track) { @@ -503,24 +545,42 @@ struct nucleiInJets { int nEvents = 0; template - void fillTrackInfo(const TracksType& trk, const JetType& jets) + void fillTrackInfo(const TracksType& trk, const JetType& jets, std::vector& leadingJetPtEtaPhi) { - if (!isTrackSelected(trk)) return; if (trk.pt() > cMaxPt) return; jetHist.fill(HIST("tracks/h2TPCsignVsTPCmomentum"), trk.tpcInnerParam() / (1.f * trk.sign()), trk.tpcSignal()); bool jetFlag = false; + bool jetFlagPerpCone = false; float jetPt = -999.; - for (auto const& jet : jets) { - double delPhi = TVector2::Phi_mpi_pi(jet.phi() - trk.phi()); - double delEta = jet.eta() - trk.eta(); + + if (isWithLeadingJet) { + double delPhi = TVector2::Phi_mpi_pi(leadingJetPtEtaPhi[2] - trk.phi()); + double delEta = leadingJetPtEtaPhi[1] - trk.eta(); double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); if (R < cfgjetR) jetFlag = true; - jetPt = jet.pt(); - break; + jetPt = leadingJetPtEtaPhi[0]; + // Get perpCone + std::array perpConePhiJet = getPerpendicuarPhi(leadingJetPtEtaPhi[2]); + double delPhiPerpCone1 = TVector2::Phi_mpi_pi(perpConePhiJet[0] - trk.phi()); + double delPhiPerpCone2 = TVector2::Phi_mpi_pi(perpConePhiJet[1] - trk.phi()); + double RPerpCone1 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone1 * delPhiPerpCone1)); + double RPerpCone2 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone2 * delPhiPerpCone2)); + if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR) + jetFlagPerpCone = true; + } else { + for (auto const& jet : jets) { + double delPhi = TVector2::Phi_mpi_pi(jet.phi() - trk.phi()); + double delEta = jet.eta() - trk.eta(); + double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + if (R < cfgjetR) + jetFlag = true; + jetPt = jet.pt(); + break; + } } // tof // float gamma =-999; @@ -702,6 +762,9 @@ struct nucleiInJets { ////////////////////////////////////////// } else { jetHist.fill(HIST("tracks/h2TPCsignVsTPCmomentum_OutJet"), trk.tpcInnerParam() / (1.f * trk.sign()), trk.tpcSignal()); + if (jetFlagPerpCone && isWithLeadingJet) { + jetHist.fill(HIST("tracks/perpCone/h2TPCsignVsTPCmomentum"), trk.tpcInnerParam() / (1.f * trk.sign()), trk.tpcSignal()); + } if (addTOFplots && trk.hasTOF()) { jetHist.fill(HIST("tracks/h2TOFbetaVsP_OutJet"), trk.p() / (1.f * trk.sign()), trk.beta()); } @@ -710,6 +773,13 @@ struct nucleiInJets { jetHist.fill(HIST("tracks/deuteron/h3PtVsDeuteronNSigmaTPC"), trk.pt(), trk.tpcNSigmaDe()); // De jetHist.fill(HIST("tracks/helium/h3PtVsHeliumNSigmaTPC"), trk.pt(), trk.tpcNSigmaHe()); // He jetHist.fill(HIST("tracks/triton/h3PtVsTritonNSigmaTPC"), trk.pt(), trk.tpcNSigmaTr()); // Tr + // perpCone + if (jetFlagPerpCone && isWithLeadingJet) { + jetHist.fill(HIST("tracks/perpCone/proton/h3PtVsProtonNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaPr(), jetPt); // Pr + jetHist.fill(HIST("tracks/perpCone/deuteron/h3PtVsDeuteronNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaDe(), jetPt); // De + jetHist.fill(HIST("tracks/perpCone/helium/h3PtVsHeliumNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaHe(), jetPt); // He + jetHist.fill(HIST("tracks/perpCone/triton/h3PtVsTritonNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaTr(), jetPt); // Tr + } if (cEnableProtonQA && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/proton/dca/after/hDCAxyVsPtProton"), trk.dcaXY(), trk.pt()); @@ -749,21 +819,29 @@ struct nucleiInJets { jetHist.fill(HIST("tracks/proton/h2TOFmassProtonVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TOFmass2ProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); jetHist.fill(HIST("tracks/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/proton/h2TofNsigmaProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); } if (trk.tpcNSigmaDe() < useTPCpreSel) { jetHist.fill(HIST("tracks/deuteron/h2TOFmassDeuteronVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TOFmass2DeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/deuteron/h2TofNsigmaDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); } if (trk.tpcNSigmaTr() < useTPCpreSel) { jetHist.fill(HIST("tracks/triton/h2TOFmassTritonVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TOFmass2TritonVsPt"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); jetHist.fill(HIST("tracks/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/triton/h2TofNsigmaTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } if (trk.tpcNSigmaHe() < useTPCpreSel) { jetHist.fill(HIST("tracks/helium/h2TOFmassHeliumVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TOFmass2HeliumVsPt"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); jetHist.fill(HIST("tracks/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/helium/h2TofNsigmaHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); } } @@ -774,6 +852,15 @@ struct nucleiInJets { jetHist.fill(HIST("tracks/antiHelium/h3PtVsantiHeliumNSigmaTPC"), trk.pt(), trk.tpcNSigmaHe()); // He jetHist.fill(HIST("tracks/antiTriton/h3PtVsantiTritonNSigmaTPC"), trk.pt(), trk.tpcNSigmaTr()); // Tr + // perpCone + if (jetFlagPerpCone && isWithLeadingJet) { + // antiparticle info + jetHist.fill(HIST("tracks/perpCone/antiProton/h3PtVsantiProtonNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaPr(), jetPt); // Pr + jetHist.fill(HIST("tracks/perpCone/antiDeuteron/h3PtVsantiDeuteronNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaDe(), jetPt); // De + jetHist.fill(HIST("tracks/perpCone/antiHelium/h3PtVsantiHeliumNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaHe(), jetPt); // He + jetHist.fill(HIST("tracks/perpCone/antiTriton/h3PtVsantiTritonNSigmaTPCVsPtJet"), trk.pt(), trk.tpcNSigmaTr(), jetPt); // Tr + } + if (cEnableProtonQA && std::abs(trk.tpcNSigmaPr()) < cfgnTPCPIDPr) { jetHist.fill(HIST("tracks/antiProton/dca/after/hDCAxyVsPtantiProton"), trk.dcaXY(), trk.pt()); jetHist.fill(HIST("tracks/antiProton/dca/after/hDCAzVsPtantiProton"), trk.dcaZ(), trk.pt()); @@ -813,28 +900,36 @@ struct nucleiInJets { jetHist.fill(HIST("tracks/antiProton/h2TOFmassantiProtonVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TOFmass2antiProtonVsPt"), massTOF * massTOF - gMassProton * gMassProton, trk.pt()); jetHist.fill(HIST("tracks/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/antiProton/h2TofNsigmaantiProtonVsPt"), trk.tofNSigmaPr(), trk.pt()); } if (trk.tpcNSigmaDe() < useTPCpreSel) { jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmassantiDeuteronVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TOFmass2antiDeuteronVsPt"), massTOF * massTOF - gMassDeuteron * gMassDeuteron, trk.pt()); jetHist.fill(HIST("tracks/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/antiDeuteron/h2TofNsigmaantiDeuteronVsPt"), trk.tofNSigmaDe(), trk.pt()); } if (trk.tpcNSigmaTr() < useTPCpreSel) { jetHist.fill(HIST("tracks/antiTriton/h2TOFmassantiTritonVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TOFmass2antiTritonVsPt"), massTOF * massTOF - gMassTriton * gMassTriton, trk.pt()); jetHist.fill(HIST("tracks/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/antiTriton/h2TofNsigmaantiTritonVsPt"), trk.tofNSigmaTr(), trk.pt()); } if (trk.tpcNSigmaHe() < useTPCpreSel) { jetHist.fill(HIST("tracks/antiHelium/h2TOFmassantiHeliumVsPt"), massTOF, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TOFmass2antiHeliumVsPt"), massTOF * massTOF - gMassHelium * gMassHelium, trk.pt()); jetHist.fill(HIST("tracks/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); + if (jetFlagPerpCone && isWithLeadingJet) + jetHist.fill(HIST("tracks/perpCone/antiHelium/h2TofNsigmaantiHeliumVsPt"), trk.tofNSigmaHe(), trk.pt()); } } } } } //////////////////////////////////////// - // outside jet + // outside jet end //////////////////////////////////////// } @@ -847,24 +942,41 @@ struct nucleiInJets { return; int nJets = 0; - + std::vector leadingJetWithPtEtaPhi(3); + float leadingJetPt = -1.0f; for (const auto& chargedjet : chargedjets) { jetHist.fill(HIST("jet/h1JetPt"), chargedjet.pt()); jetHist.fill(HIST("jet/h1JetEta"), chargedjet.eta()); jetHist.fill(HIST("jet/h1JetPhi"), chargedjet.phi()); + + if (chargedjet.pt() > leadingJetPt) { + leadingJetWithPtEtaPhi[0] = chargedjet.pt(); + leadingJetWithPtEtaPhi[1] = chargedjet.eta(); + leadingJetWithPtEtaPhi[2] = chargedjet.phi(); + } nJets++; } jetHist.fill(HIST("jet/nJetsPerEvent"), nJets); jetHist.fill(HIST("vertexZ"), collision.posZ()); + if (nJets > 0) jetHist.fill(HIST("jet/vertexZ"), collision.posZ()); else jetHist.fill(HIST("jetOut/vertexZ"), collision.posZ()); + if (isWithJetEvents && nJets == 0) + return; + jetHist.fill(HIST("jet/h1JetEvents"), 0.5); + for (auto& track : tracks) { - auto trk = track.track_as(); - fillTrackInfo(trk, chargedjets); + if (useLfTpcPid) { + auto trk = track.track_as(); + fillTrackInfo(trk, chargedjets, leadingJetWithPtEtaPhi); + } else { + auto trk = track.track_as(); + fillTrackInfo(trk, chargedjets, leadingJetWithPtEtaPhi); + } } } @@ -926,10 +1038,10 @@ struct nucleiInJets { } } // track - } // process mc + } // process mc void processMCRec(o2::aod::JCollision const& collisionJet, soa::Join const& tracks, - soa::Filtered const& mcdjets, TrackCandidatesMC const&, JetParticles const&) + soa::Filtered const& mcdjets, TrackCandidatesMC const&, aod::JetParticles const&) { jetHist.fill(HIST("mcdJet/eventStat"), 0.5); // JEhistos.fill(HIST("nEvents_MCRec"), 0.5); @@ -955,42 +1067,70 @@ struct nucleiInJets { return; jetHist.fill(HIST("mcdJet/eventStat"), 3.5); int nJets = 0; + std::vector leadingJetWithPtEtaPhi(3); + float leadingJetPt = -1.0f; for (auto& mcdjet : mcdjets) { jetHist.fill(HIST("mcdJet/hJetPt"), mcdjet.pt()); jetHist.fill(HIST("mcdJet/hJetEta"), mcdjet.eta()); jetHist.fill(HIST("mcdJet/hJetPhi"), mcdjet.phi()); + if (mcdjet.pt() > leadingJetPt) { + leadingJetWithPtEtaPhi[0] = mcdjet.pt(); + leadingJetWithPtEtaPhi[1] = mcdjet.eta(); + leadingJetWithPtEtaPhi[2] = mcdjet.phi(); + } nJets++; } jetHist.fill(HIST("mcdJet/vertexZ"), collisionJet.posZ()); jetHist.fill(HIST("mcdJet/nJetsPerEvent"), nJets); + if (isWithJetEvents && nJets == 0) + return; + for (auto& track : tracks) { auto fullTrack = track.track_as(); if (!isTrackSelected(fullTrack)) continue; if (!track.has_mcParticle()) continue; - auto mcTrack = track.mcParticle_as(); + auto mcTrack = track.mcParticle_as(); if (fabs(mcTrack.eta()) > cfgtrkMaxEta) continue; if (!mcTrack.isPhysicalPrimary()) continue; bool jetFlag = false; + bool jetFlagPerpCone = false; // float jetPt = -999.; - for (auto& mcdjet : mcdjets) { - double delPhi = TVector2::Phi_mpi_pi(mcdjet.phi() - track.phi()); - double delEta = mcdjet.eta() - track.eta(); + if (isWithLeadingJet) { + double delPhi = TVector2::Phi_mpi_pi(leadingJetWithPtEtaPhi[2] - track.phi()); + double delEta = leadingJetWithPtEtaPhi[1] - track.eta(); double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); if (R < cfgjetR) jetFlag = true; - // jetPt = mcdjet.pt(); - break; - } // jet + std::array perpConePhiJet = getPerpendicuarPhi(leadingJetWithPtEtaPhi[2]); + double delPhiPerpCone1 = TVector2::Phi_mpi_pi(perpConePhiJet[0] - track.phi()); + double delPhiPerpCone2 = TVector2::Phi_mpi_pi(perpConePhiJet[1] - track.phi()); + double RPerpCone1 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone1 * delPhiPerpCone1)); + double RPerpCone2 = TMath::Sqrt((delEta * delEta) + (delPhiPerpCone2 * delPhiPerpCone2)); + if (RPerpCone1 < cfgjetR || RPerpCone2 < cfgjetR) + jetFlagPerpCone = true; + } else { + for (auto& mcdjet : mcdjets) { + double delPhi = TVector2::Phi_mpi_pi(mcdjet.phi() - track.phi()); + double delEta = mcdjet.eta() - track.eta(); + double R = TMath::Sqrt((delEta * delEta) + (delPhi * delPhi)); + if (R < cfgjetR) + jetFlag = true; + // jetPt = mcdjet.pt(); + break; + } // jet + } if (mapPDGToValue(mcTrack.pdgCode()) != 0) { jetHist.fill(HIST("mcdJet/pt/PtParticleType"), mcTrack.pt(), jetFlag, mapPDGToValue(mcTrack.pdgCode())); + if (jetFlagPerpCone) + jetHist.fill(HIST("mcdJet/pt/perpCone/PtParticleType"), mcTrack.pt(), mapPDGToValue(mcTrack.pdgCode())); } } // tracks @@ -1058,11 +1198,11 @@ struct nucleiInJets { continue; if (!track.has_mcParticle()) continue; - auto mcTrack = track.mcParticle_as(); + auto mcTrack = track.mcParticle_as(); // 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)); @@ -1077,7 +1217,7 @@ struct nucleiInJets { jetHist.fill(HIST("recmatched/pt/PtParticleType"), mcTrack.pt(), jetFlag, mapPDGToValue(mcTrack.pdgCode())); } } // tracks - } // process + } // process int nprocessSimJEEvents = 0; void processGenMatched(aod::JMcCollision const& collision, @@ -1134,7 +1274,7 @@ struct nucleiInJets { jetHist.fill(HIST("genmatched/hRecMatchedJetEta"), mcpjet.eta(), mcpjet.eta() - mcdjet.eta()); } // mcdJet - } // mcpJet + } // mcpJet for (const auto& mcParticle : mcParticles) { if (fabs(mcParticle.eta()) > cfgtrkMaxEta) @@ -1142,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/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index 35907b1460a..b3d1aaaffa9 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -83,13 +83,33 @@ struct statPromptPhoton { // INIT void init(InitContext const&) { - std::vector ptBinning = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 8.0, 12.0}; + std::vector ptBinning = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 8.0, 12.0, 16.0, 20.0, 25.0, 30.0, 40.0, 50.0, 75.0, 100.0, 150.0, 200.0, 300.0, 500.0}; AxisSpec pthadAxis = {ptBinning, "#it{p}_{T}^{had sum} [GeV/c]"}; histos.add("REC_nEvents", "REC_nEvents", kTH1F, {{4, 0.0, 4.0}}); + histos.add("REC_Cluster_QA", "REC_Cluster_QA", kTH1F, {{10, -0.5, 9.5}}); histos.add("REC_PtHadSum_Photon", "REC_PtHadSum_Photon", kTH1F, {pthadAxis}); - + histos.add("REC_TrackPhi_photontrigger", "REC_TrackPhi_photontrigger", kTH1F, {{64, 0, 2 * TMath::Pi()}}); + histos.add("REC_TrackEta_photontrigger", "REC_TrackEta_photontrigger", kTH1F, {{100, -1, 1}}); + histos.add("REC_True_v_Cluster_Phi", "REC_True_v_Cluster_Phi", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_True_v_Cluster_Eta", "REC_True_v_Cluster_Eta", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_Track_v_Cluster_Phi", "REC_Track_v_Cluster_Phi", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_Track_v_Cluster_Eta", "REC_Track_v_Cluster_Eta", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_Track_v_Cluster_Phi_AC", "REC_Track_v_Cluster_Phi_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_Track_v_Cluster_Eta_AC", "REC_Track_v_Cluster_Eta_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_SumPt_BC", "REC_SumPt_BC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_SumPt_AC", "REC_SumPt_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_M02_BC", "REC_M02_BC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + histos.add("REC_M02_AC", "REC_M02_AC", kTH1F, {{628, -2 * TMath::Pi(), 2 * TMath::Pi()}}); + + histos.add("REC_Trigger_Purity", "REC_Trigger_Purity", kTH1F, {{4, 0.0, 4.0}}); histos.add("REC_Trigger_Energy", "REC_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); + + histos.add("REC_Trigger_Energy_GOOD", "REC_Trigger_Energy_GOOD", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_Trigger_Energy_MISS", "REC_Trigger_Energy_MISS", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_Trigger_Energy_FAKE", "REC_Trigger_Energy_FAKE", kTH1F, {{82, -1.0, 40.0}}); + + histos.add("REC_All_Energy", "REC_All_Energy", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_True_Trigger_Energy", "REC_True_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); histos.add("REC_True_Prompt_Trigger_Energy", "REC_True_Prompt_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); @@ -99,8 +119,9 @@ struct statPromptPhoton { histos.add("REC_dR_Photon", "REC_dR_Photon", kTH1F, {{628, 0.0, 2 * TMath::Pi()}}); histos.add("REC_dR_Stern", "REC_dR_Stern", kTH1F, {{628, 0.0, 2 * TMath::Pi()}}); - histos.add("GEN_True_Photon_Energy", "GEN_True_Photon_Energy", kTH1F, {{82, -1.0, 40.0}}); - histos.add("GEN_True_Prompt_Photon_Energy", "GEN_True_Prompt_Photon_Energy", kTH1F, {{82, -1.0, 40.0}}); + histos.add("GEN_nEvents", "GEN_nEvents", kTH1F, {{4, 0.0, 4.0}}); + histos.add("GEN_True_Photon_Energy", "GEN_True_Photon_Energy", kTH1F, {{8200, -1.0, 40.0}}); + histos.add("GEN_True_Prompt_Photon_Energy", "GEN_True_Prompt_Photon_Energy", kTH1F, {{8200, -1.0, 40.0}}); histos.add("GEN_Trigger_V_PtHadSum_Stern", "GEN_Trigger_V_PtHadSum_Stern", kTH2F, {{100, 0, 100}, pthadAxis}); histos.add("GEN_Trigger_V_PtHadSum_Photon", "GEN_Trigger_V_PtHadSum_Photon", kTH2F, {{100, 0, 100}, pthadAxis}); histos.add("GEN_TrueTrigger_V_PtHadSum_Photon", "GEN_Trigger_V_PtHadSum_Photon", kTH2F, {{100, 0, 100}, pthadAxis}); @@ -128,6 +149,7 @@ struct statPromptPhoton { using filteredMCCollisions = soa::Filtered; Preslice perClusterMatchedTracks = o2::aod::emcalclustercell::emcalclusterId; + // Helper functions ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -154,14 +176,20 @@ struct statPromptPhoton { double eta_track = track.eta(); double pt_track = track.pt(); - if constexpr (requires { track.isPVContributor(); }) { - if (!IsParticle) { + if (!IsParticle) { + if constexpr (requires { track.trackId(); }) { + auto originaltrack = track.template track_as>(); + if (!trackSelection(originaltrack)) { + continue; + } // reject track + } else if constexpr (requires { track.sign(); }) { // checking for JTrack + // done checking for JTrack, now default to normal tracks if (!trackSelection(track)) { continue; - } - } + } // reject track + } // done checking for JTrack } else { - if (IsParticle) { + if constexpr (requires { track.isPhysicalPrimary(); }) { if (track.pt() < 0.15) { continue; } @@ -263,108 +291,18 @@ struct statPromptPhoton { ///////////////////////////////////////////////////////////////////////////// // PROCESS - - // int nEvents = 0; - int nEventsRecMC = 0; - int nEventsGenMC = 0; - // aod::StoredMcParticles_001 const& - void processMCRec(filteredCollisions::iterator const& collision, filteredMCClusters const& mcclusters, aod::McParticles const&, o2::aod::EMCALClusterCells const& /*emccluscells*/, o2::aod::EMCALMatchedTracks const& matchedtracks, TrackCandidates const& tracks) - { - - nEventsRecMC++; - if ((nEventsRecMC + 1) % 10000 == 0) { - std::cout << "Processed Rec MC Events: " << nEventsRecMC << std::endl; - } - histos.fill(HIST("REC_nEvents"), 0.5); - - if (fabs(collision.posZ()) > cfgVtxCut) - return; - if (!collision.sel8()) - return; - - // now we do clusters - for (auto& mccluster : mcclusters) { - bool photontrigger = false; - double photonPt = 0.0; - double truephotonPt = 0.0; - auto tracksofcluster = matchedtracks.sliceBy(perClusterMatchedTracks, mccluster.globalIndex()); - - // first, we do the data-level analysis - if (tracksofcluster.size() < 1) { - if (mccluster.energy() > cfgMinTrig && mccluster.energy() < cfgMaxTrig) { - if (fabs(mccluster.eta()) <= cfgtrkMaxEta) { - photontrigger = true; - photonPt = mccluster.energy(); - } - } - } - - if (photontrigger) { - double pthadsum = GetPtHadSum(tracks, mccluster, cfgMinR, cfgMaxR, false, false, true); - histos.fill(HIST("REC_Trigger_V_PtHadSum_Photon"), photonPt, pthadsum); - histos.fill(HIST("REC_PtHadSum_Photon"), pthadsum); - histos.fill(HIST("REC_Trigger_Energy"), mccluster.energy()); - - // now we check the realness of our prompt photons - auto ClusterParticles = mccluster.mcParticle_as(); - for (auto& clusterparticle : ClusterParticles) { - if (clusterparticle.pdgCode() == 22) { - histos.fill(HIST("REC_True_Trigger_Energy"), clusterparticle.e()); - if (std::abs(clusterparticle.getGenStatusCode()) > 19 && std::abs(clusterparticle.getGenStatusCode()) < 70) { - histos.fill(HIST("REC_True_Promt_Trigger_Energy"), clusterparticle.e()); - TLorentzVector lRealPhoton; - lRealPhoton.SetPxPyPzE(clusterparticle.px(), clusterparticle.py(), clusterparticle.pz(), clusterparticle.e()); - double truepthadsum = GetPtHadSum(tracks, lRealPhoton, cfgMinR, cfgMaxR, false, false, false); - truephotonPt = clusterparticle.e(); - histos.fill(HIST("REC_TrueTrigger_V_PtHadSum_Photon"), truephotonPt, truepthadsum); - } - } // photon check - } // photon trigger loop - } // clusterparticle loop - - } // cluster loop - - // clusters done, now we do the sternheimer tracks - - for (auto& track : tracks) { - bool sterntrigger = false; - double sternPt = 0.0; - if (track.pt() > cfgMinTrig && track.pt() < cfgMaxTrig) { - if (fabs(track.eta()) <= cfgtrkMaxEta) { - sterntrigger = true; - sternPt = track.pt(); - } - } - - if (sterntrigger) { - bool doStern = true; - double sterncount = 1.0; - while (doStern) { - double pthadsum = GetPtHadSum(tracks, track, cfgMinR, cfgMaxR, true, false, true); - histos.fill(HIST("REC_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, 2.0 / sternPt); - if (sterncount < sternPt) { - sterncount++; - } else { - doStern = false; - } - } // While sternin' - } // stern trigger loop - } // track loop - - histos.fill(HIST("REC_nEvents"), 1.5); - } // end of process - - PROCESS_SWITCH(statPromptPhoton, processMCRec, "process MC data", true); ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// + int nEventsGenMC = 0; - void processMCGen(filteredMCCollisions::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& mcParticles) + void processMCGen(filteredMCCollisions::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& mcParticles, filteredMCClusters const&) { nEventsGenMC++; if ((nEventsGenMC + 1) % 10000 == 0) { std::cout << "Processed Gen MC Events: " << nEventsGenMC << std::endl; } + histos.fill(HIST("GEN_nEvents"), 0.5); if (fabs(collision.posZ()) > cfgVtxCut) return; @@ -376,6 +314,10 @@ struct statPromptPhoton { if (fabs(recocoll.posZ()) > cfgVtxCut) return; + histos.fill(HIST("GEN_nEvents"), 1.5); + if (!recocoll.alias_bit(kTVXinEMC)) + return; + histos.fill(HIST("GEN_nEvents"), 2.5); } for (auto& mcPhoton : mcParticles) { @@ -453,6 +395,234 @@ struct statPromptPhoton { PROCESS_SWITCH(statPromptPhoton, processMCGen, "process MC Gen", true); + Filter PosZFilter_JE = nabs(aod::jcollision::posZ) < cfgVtxCut; + Filter clusterDefinitionSelection_JE = (o2::aod::jcluster::definition == cfgClusterDefinition) && (o2::aod::jcluster::time >= cfgMinTime) && (o2::aod::jcluster::time <= cfgMaxTime) && (o2::aod::jcluster::energy > cfgMinClusterEnergy) && (o2::aod::jcluster::nCells >= cfgMinNCells) && (o2::aod::jcluster::nlm <= cfgMaxNLM) && (o2::aod::jcluster::isExotic == cfgExoticContribution); + + using jTrackCandidates = soa::Join; + using jMCClusters = o2::soa::Join; + using jselectedCollisions = soa::Join; + using jfilteredCollisions = soa::Filtered; + 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&) + { + + nEventsRecMC_JE++; + if ((nEventsRecMC_JE + 1) % 10000 == 0) { + std::cout << "Processed JE Rec MC Events: " << nEventsRecMC_JE << std::endl; + } + + histos.fill(HIST("REC_nEvents"), 0.5); + + if (fabs(collision.posZ()) > cfgVtxCut) + return; + if (!collision.sel8()) + return; + + histos.fill(HIST("REC_nEvents"), 1.5); + + if (!collision.isEmcalReadout()) + return; + + histos.fill(HIST("REC_nEvents"), 2.5); + + // now we do clusters + bool clustertrigger = false; + for (auto& mccluster : mcclusters) { + histos.fill(HIST("REC_M02_BC"), mccluster.energy()); + if (mccluster.m02() < 0.1) + continue; + histos.fill(HIST("REC_Cluster_QA"), 0.5); + histos.fill(HIST("REC_M02_AC"), mccluster.energy()); + histos.fill(HIST("REC_All_Energy"), mccluster.energy()); + bool photontrigger = false; // is a neutral cluster + bool vetotrigger = false; // might be a neutral cluster + bool chargetrigger = false; // is definitely not a neutral cluster + double photonPt = 0.0; + double truephotonPt = 0.0; + auto tracksofcluster = mccluster.matchedTracks_as>(); + + // first, we check if veto is required + double sumptT = 0; + double sumptTAC = 0; + for (auto& ctrack : tracksofcluster) { + auto ogtrack = ctrack.track_as(); + if (!trackSelection(ogtrack)) { + continue; + } + if (!ogtrack.isGlobalTrack()) { + continue; + } + + double ptT = ctrack.pt(); + sumptT += ptT; + double phidiff = TVector2::Phi_mpi_pi(mccluster.phi() - ctrack.phi()); + double etadiff = mccluster.eta() - ctrack.eta(); + histos.fill(HIST("REC_Track_v_Cluster_Phi"), phidiff); + histos.fill(HIST("REC_Track_v_Cluster_Eta"), etadiff); + } + + if (sumptT > 0) { + double mccluster_over_sumptT = mccluster.energy() / sumptT; + histos.fill(HIST("REC_SumPt_BC"), mccluster_over_sumptT); + if (mccluster_over_sumptT < 1.7) { + histos.fill(HIST("REC_Cluster_QA"), 2.5); + vetotrigger = true; + } else { + photontrigger = true; + histos.fill(HIST("REC_Cluster_QA"), 1.5); + } + } else { + photontrigger = true; + } + + // veto is required + if (vetotrigger) { + for (auto& ctrack : tracksofcluster) { + auto ogtrack = ctrack.track_as(); + if (!trackSelection(ogtrack)) { + continue; + } + if (!ogtrack.isGlobalTrack()) { + continue; + } + + double etaT = ctrack.eta(); + double etaC = mccluster.eta(); + double phiT = ctrack.phi(); + double phiC = mccluster.phi(); + double ptT = ctrack.pt(); + + if (fabs(etaT - etaC) < (0.010 + pow(ptT + 4.07, -2.5))) { + chargetrigger = true; + } + if (fabs(TVector2::Phi_mpi_pi(phiT - phiC)) < (0.015 + pow(ptT + 3.65, -2.0))) { + chargetrigger = true; + } + if (chargetrigger) { + histos.fill(HIST("REC_Cluster_QA"), 3.5); + break; + } + } // tracks + } // veto + + // check if cluster is good + if (!chargetrigger) { + for (auto& ctrack : tracksofcluster) { + auto ogtrack = ctrack.track_as(); + if (!trackSelection(ogtrack)) { + continue; + } + if (!ogtrack.isGlobalTrack()) { + continue; + } + + double ptT = ctrack.pt(); + sumptTAC += ptT; + double phidiff = TVector2::Phi_mpi_pi(mccluster.phi() - ctrack.phi()); + double etadiff = mccluster.eta() - ctrack.eta(); + histos.fill(HIST("REC_Track_v_Cluster_Phi_AC"), phidiff); + histos.fill(HIST("REC_Track_v_Cluster_Eta_AC"), etadiff); + } // tracks + + if (sumptTAC > 0) { + double mccluster_over_sumptTAC = mccluster.energy() / sumptTAC; + histos.fill(HIST("REC_SumPt_AC"), mccluster_over_sumptTAC); + } + + photontrigger = true; + } // check if there is no charge trigger + + if (photontrigger) { // if no charge trigger, cluster is good! + histos.fill(HIST("REC_Cluster_QA"), 4.5); + clustertrigger = true; + double pthadsum = GetPtHadSum(tracks, mccluster, cfgMinR, cfgMaxR, false, false, true); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Photon"), photonPt, pthadsum); + histos.fill(HIST("REC_PtHadSum_Photon"), pthadsum); + histos.fill(HIST("REC_Trigger_Energy"), mccluster.energy()); + } + + // now we check the realness of our prompt photons + auto ClusterParticles = mccluster.mcParticle_as(); + bool goodgentrigger = true; + for (auto& clusterparticle : ClusterParticles) { + if (clusterparticle.pdgCode() == 211 || clusterparticle.pdgCode() == 321 || clusterparticle.pdgCode() == 2212) { + goodgentrigger = false; + } + + double phidiff = TVector2::Phi_mpi_pi(mccluster.phi() - clusterparticle.phi()); + double etadiff = mccluster.eta() - clusterparticle.eta(); + histos.fill(HIST("REC_True_v_Cluster_Phi"), phidiff); + histos.fill(HIST("REC_True_v_Cluster_Eta"), etadiff); + + if (!photontrigger) { + continue; + } + if (clusterparticle.pdgCode() == 22) { + histos.fill(HIST("REC_True_Trigger_Energy"), clusterparticle.e()); + if (std::abs(clusterparticle.getGenStatusCode()) > 19 && std::abs(clusterparticle.getGenStatusCode()) < 70) { + histos.fill(HIST("REC_True_Prompt_Trigger_Energy"), clusterparticle.e()); + TLorentzVector lRealPhoton; + lRealPhoton.SetPxPyPzE(clusterparticle.px(), clusterparticle.py(), clusterparticle.pz(), clusterparticle.e()); + double truepthadsum = GetPtHadSum(tracks, lRealPhoton, cfgMinR, cfgMaxR, false, false, false); + truephotonPt = clusterparticle.e(); + histos.fill(HIST("REC_TrueTrigger_V_PtHadSum_Photon"), truephotonPt, truepthadsum); + } + } // photon check + } // clusterparticle loop + if (goodgentrigger && photontrigger) { + histos.fill(HIST("REC_Trigger_Purity"), 0.5); + histos.fill(HIST("REC_Trigger_Energy_GOOD"), mccluster.energy()); + } + if (goodgentrigger && !photontrigger) { + histos.fill(HIST("REC_Trigger_Purity"), 1.5); + histos.fill(HIST("REC_Trigger_Energy_MISS"), mccluster.energy()); + } + if (!goodgentrigger && photontrigger) { + histos.fill(HIST("REC_Trigger_Purity"), 2.5); + histos.fill(HIST("REC_Trigger_Energy_FAKE"), mccluster.energy()); + } + } // cluster loop + + // clusters done, now we do the sternheimer tracks + for (auto& track : tracks) { + bool sterntrigger = false; + double sternPt = 0.0; + auto ogtrack = track.track_as(); + if (!trackSelection(ogtrack)) { + continue; + } + if (clustertrigger) { + histos.fill(HIST("REC_TrackPhi_photontrigger"), track.phi()); + histos.fill(HIST("REC_TrackEta_photontrigger"), track.eta()); + } + if (track.pt() > cfgMinTrig && track.pt() < cfgMaxTrig) { + if (fabs(track.eta()) <= cfgtrkMaxEta) { + sterntrigger = true; + sternPt = track.pt(); + } + } + + if (sterntrigger) { + bool doStern = true; + double sterncount = 1.0; + while (doStern) { + double pthadsum = GetPtHadSum(tracks, track, cfgMinR, cfgMaxR, true, false, true); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, 2.0 / sternPt); + if (sterncount < sternPt) { + sterncount++; + } else { + doStern = false; + } + } // While sternin' + } // stern trigger loop + } // track loop + + } // end of process + + PROCESS_SWITCH(statPromptPhoton, processMCRec_JE, "processJE MC data", false); + }; // end of main struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGJE/Tasks/trackEfficiency.cxx b/PWGJE/Tasks/trackEfficiency.cxx index a4f08419073..47d5ce4ea17 100644 --- a/PWGJE/Tasks/trackEfficiency.cxx +++ b/PWGJE/Tasks/trackEfficiency.cxx @@ -44,7 +44,7 @@ using namespace o2::framework::expressions; struct TrackEfficiencyJets { Service pdg; - using JetParticlesWithOriginal = soa::Join; + using JetParticlesWithOriginal = soa::Join; HistogramRegistry registry; @@ -207,7 +207,7 @@ struct TrackEfficiencyJets { if (doprocessParticles || doprocessParticlesWeighted) { AxisSpec centAxis = {121, -10., 111., "centrality (%)"}; registry.add("h_mccollisions", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); - registry.add("h2_centrality_mccollisions", "centrality vs mccollisions; centrality; collisions", {HistType::kTH1F, {centAxis, {4, 0.0, 4.0}}}); + registry.add("h2_centrality_mccollisions", "centrality vs mccollisions; centrality; collisions", {HistType::kTH2F, {centAxis, {4, 0.0, 4.0}}}); } if (doprocessTracksWeighted) { registry.add("h_collisions_weighted", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); @@ -217,16 +217,16 @@ struct TrackEfficiencyJets { } } - Preslice tracksPerJCollision = o2::aod::jtrack::collisionId; + Preslice tracksPerJCollision = o2::aod::jtrack::collisionId; // filters for processTracks QA functions only: Filter trackCuts = (aod::jtrack::pt >= trackQAPtMin && aod::jtrack::pt < trackQAPtMax && aod::jtrack::eta > trackQAEtaMin && aod::jtrack::eta < trackQAEtaMax); Filter particleCuts = (aod::jmcparticle::pt >= trackQAPtMin && aod::jmcparticle::pt < trackQAPtMax && aod::jmcparticle::eta > trackQAEtaMin && aod::jmcparticle::eta < trackQAEtaMax); Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); - void processEFficiencyPurity(JetMcCollision const& mcCollision, - soa::SmallGroups const& collisions, // smallgroups gives only the collisions associated to the current mccollision, thanks to the mccollisionlabel pre-integrated in jetcollisionsmcd - soa::Join const& jetTracks, + void processEFficiencyPurity(aod::JetMcCollision const& mcCollision, + soa::SmallGroups const& collisions, // smallgroups gives only the collisions associated to the current mccollision, thanks to the mccollisionlabel pre-integrated in jetcollisionsmcd + soa::Join const& jetTracks, JetParticlesWithOriginal const& jMcParticles) { // missing: @@ -384,8 +384,8 @@ struct TrackEfficiencyJets { } PROCESS_SWITCH(TrackEfficiencyJets, processEFficiencyPurity, "Histograms for efficiency and purity quantities", true); - void processTracks(soa::Filtered::iterator const& collision, - soa::Filtered> const& tracks) + void processTracks(soa::Filtered::iterator const& collision, + soa::Filtered> const& tracks) { registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h2_centrality_collisions"), collision.centrality(), 0.5); @@ -403,9 +403,9 @@ struct TrackEfficiencyJets { } PROCESS_SWITCH(TrackEfficiencyJets, processTracks, "QA for charged tracks", false); - void processTracksWeighted(soa::Join::iterator const& collision, - JetMcCollisions const&, - soa::Filtered> const& tracks) + void processTracksWeighted(soa::Join::iterator const& collision, + aod::JetMcCollisions const&, + soa::Filtered> const& tracks) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); @@ -424,9 +424,9 @@ struct TrackEfficiencyJets { } PROCESS_SWITCH(TrackEfficiencyJets, processTracksWeighted, "QA for charged tracks weighted", false); - void processParticles(JetMcCollision const& mcCollision, - soa::SmallGroups const& collisions, - soa::Filtered const& mcparticles) + void processParticles(aod::JetMcCollision const& mcCollision, + soa::SmallGroups const& collisions, + soa::Filtered const& mcparticles) { registry.fill(HIST("h_mccollisions"), 0.5); registry.fill(HIST("h2_centrality_mccollisions"), collisions.begin().centrality(), 0.5); @@ -473,9 +473,9 @@ struct TrackEfficiencyJets { } PROCESS_SWITCH(TrackEfficiencyJets, processParticles, "QA for charged particles", false); - void processParticlesWeighted(JetMcCollision const& mcCollision, - soa::SmallGroups const& collisions, - soa::Filtered const& mcparticles) + void processParticlesWeighted(aod::JetMcCollision const& mcCollision, + soa::SmallGroups const& collisions, + soa::Filtered const& mcparticles) { float eventWeight = mcCollision.weight(); registry.fill(HIST("h_mccollisions"), 0.5); diff --git a/PWGJE/Tasks/v0jetspectra.cxx b/PWGJE/Tasks/v0jetspectra.cxx index dad55b12e52..cbf39c5b057 100644 --- a/PWGJE/Tasks/v0jetspectra.cxx +++ b/PWGJE/Tasks/v0jetspectra.cxx @@ -9,8 +9,8 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// jet spectra for v0 fragmentation study -// +/// \brief Jet spectra for ch+V0 jets +/// /// \author Gijs van Weelden // @@ -89,7 +89,7 @@ struct V0JetSpectra { } } - void processData(soa::Filtered::iterator const& jcoll, aod::ChargedJets const& chjets, aod::V0ChargedJets const& v0jets) + void processData(soa::Filtered::iterator const& jcoll, aod::ChargedJets const& chjets, aod::V0ChargedJets const& v0jets) { if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { return; @@ -100,7 +100,7 @@ struct V0JetSpectra { } PROCESS_SWITCH(V0JetSpectra, processData, "Jet spectra for V0 jets or Ch jets if no V0s in data", false); - void processMCD(soa::Filtered::iterator const& jcoll, JetMcCollisions const&, MCDJets const& chjets, MCDV0Jets const& v0jets) + void processMCD(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MCDJets const& chjets, MCDV0Jets const& v0jets) { if (!jcoll.has_mcCollision()) { return; @@ -115,7 +115,7 @@ struct V0JetSpectra { } PROCESS_SWITCH(V0JetSpectra, processMCD, "Jet spectra for V0 jets or Ch jets if no V0s", false); - void processMCP(JetMcCollision const& jcoll, MCPJets const& chjets, MCPV0Jets const& v0jets) + void processMCP(aod::JetMcCollision const& jcoll, MCPJets const& chjets, MCPV0Jets const& v0jets) { double weight = jcoll.weight(); if (v0jets.size() == 0) { @@ -124,7 +124,7 @@ struct V0JetSpectra { } PROCESS_SWITCH(V0JetSpectra, processMCP, "Jet spectra for V0 jets or Ch jets if no V0s", false); - void processMcMatched(soa::Filtered::iterator const& jcoll, JetMcCollisions const&, MatchedMCDJets const& chjetsMCD, MatchedMCPJets const& chjetsMCP, MatchedMCDV0Jets const& v0jetsMCD, MatchedMCPV0Jets const& v0jetsMCP) + void processMcMatched(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDJets const& chjetsMCD, MatchedMCPJets const& chjetsMCP, MatchedMCDV0Jets const& v0jetsMCD, MatchedMCPV0Jets const& v0jetsMCP) { if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { return; diff --git a/PWGJE/Tasks/v0qa.cxx b/PWGJE/Tasks/v0qa.cxx new file mode 100644 index 00000000000..e4de0088ccf --- /dev/null +++ b/PWGJE/Tasks/v0qa.cxx @@ -0,0 +1,1280 @@ +// 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 QA task for V0s in the jets framework, based on the LF v0cascadesqa task +// +/// \author Gijs van Weelden +// + +#include "TH1F.h" +#include "TTree.h" + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/RunningWorkflowInfo.h" + +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" + +#include "CommonConstants/PhysicsConstants.h" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGLF/DataModel/V0SelectorTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// V0 jets +using MCDV0Jets = aod::V0ChargedMCDetectorLevelJets; +using MCDV0JetsWithConstituents = soa::Join; +using MatchedMCDV0Jets = soa::Join; +using MatchedMCDV0JetsWithConstituents = soa::Join; + +using MCPV0Jets = aod::V0ChargedMCParticleLevelJets; +using MCPV0JetsWithConstituents = soa::Join; +using MatchedMCPV0Jets = soa::Join; +using MatchedMCPV0JetsWithConstituents = soa::Join; + +struct V0QA { + HistogramRegistry registry{"registry"}; // CallSumw2 = false? + + Configurable evSel{"evSel", "sel8WithoutTimeFrameBorderCut", "choose event selection"}; + Configurable v0cospaMin{"v0cospaMin", 0.995, "Minimum V0 cosine of pointing angle"}; + Configurable v0radiusMin{"v0radiusMin", 0.5, "Minimum V0 radius (cm)"}; + Configurable dcav0dauMax{"dcav0dauMax", 1.0, "Maximum DCA between V0 daughters (cm)"}; + Configurable dcapiMin{"dcapiMin", 0.1, "Minimum DCA of pion daughter to PV (cm)"}; + Configurable dcaprMin{"dcaprMin", 0.1, "Minimum DCA of proton daughter to PV (cm)"}; + Configurable yK0SMax{"yK0SMax", 0.5, "Maximum rapidity of K0S"}; + Configurable yLambdaMax{"yLambdaMax", 0.5, "Maximum rapidity of Lambda(bar)"}; + Configurable lifetimeK0SMax{"lifetimeK0SMax", 20.0, "Maximum lifetime of K0S (cm)"}; + Configurable lifetimeLambdaMax{"lifetimeLambdaMax", 30.0, "Maximum lifetime of Lambda (cm)"}; + Configurable yPartMax{"yPartMax", 0.5, "Maximum rapidity of particles"}; + Configurable vertexZCut{"vertexZCut", 10.0, "Vertex Z cut"}; + + Filter jetCollisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + + ConfigurableAxis binPtJet{"ptJet", {100., 0.0f, 50.0f}, ""}; + ConfigurableAxis binPtV0{"ptV0", {100., 0.0f, 50.0f}, ""}; + ConfigurableAxis binEta{"binEta", {100, -1.0f, 1.0f}, ""}; + ConfigurableAxis binPhi{"binPhi", {static_cast(TMath::Pi()) * 10 / 2, 0.0f, 2. * static_cast(TMath::Pi())}, ""}; + + ConfigurableAxis binInvMassK0S{"binInvMassK0S", {200, 0.4f, 0.6f}, ""}; + ConfigurableAxis binInvMassLambda{"binInvMassLambda", {200, 1.07f, 1.17f}, ""}; + ConfigurableAxis binV0Radius{"R", {100., 0.0f, 50.0f}, ""}; + ConfigurableAxis binV0CosPA{"cosPA", {50., 0.95f, 1.0f}, ""}; + + ConfigurableAxis binsDcaXY{"binsDcaXY", {100, -0.5f, 0.5f}, ""}; + ConfigurableAxis binsDcaZ{"binsDcaZ", {100, -5.f, 5.f}, ""}; + ConfigurableAxis binPtDiff{"ptdiff", {200., -49.5f, 50.5f}, ""}; + ConfigurableAxis binITSNCl{"ITSNCl", {8, -0.5, 7.5}, ""}; + ConfigurableAxis binITSChi2NCl{"ITSChi2NCl", {100, 0, 40}, ""}; + + ConfigurableAxis binTPCNCl{"TPCNCl", {165, -0.5, 164.5}, ""}; + ConfigurableAxis binTPCChi2NCl{"TPCChi2NCl", {100, 0, 10}, ""}; + ConfigurableAxis binTPCNClSharedFraction{"sharedFraction", {100, 0., 1.}, ""}; + ConfigurableAxis binTPCCrossedRowsOverFindableCl{"crossedOverFindable", {120, 0.0, 1.2}, ""}; + + int eventSelection = -1; + + void init(InitContext&) + { + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(evSel)); + + const AxisSpec axisJetPt{binPtJet, "Jet Pt (GeV/c)"}; + const AxisSpec axisV0Pt{binPtV0, "V0 Pt (GeV/c)"}; + const AxisSpec axisEta{binEta, "Eta"}; + const AxisSpec axisPhi{binPhi, "Phi"}; + const AxisSpec axisV0Radius{binV0Radius, "V0 Radius (cm)"}; + const AxisSpec axisV0CosPA{binV0CosPA, "V0 CosPA"}; + const AxisSpec axisK0SM{binInvMassK0S, "M(#pi^{+} #pi^{-}) (GeV/c^{2})"}; + const AxisSpec axisLambdaM{binInvMassLambda, "M(p #pi^{-}) (GeV/c^{2})"}; + const AxisSpec axisAntiLambdaM{binInvMassLambda, "M(#bar{p} #pi^{+}) (GeV/c^{2})"}; + + const AxisSpec axisPtDiff{binPtDiff, "Pt difference (GeV/c)"}; + const AxisSpec axisDcaXY{binsDcaXY, "DCA_{xy} (cm)"}; + const AxisSpec axisDcaZ{binsDcaZ, "DCA_{z} (cm)"}; + const AxisSpec axisITSNCl{binITSNCl, "# clusters ITS"}; + const AxisSpec axisITSChi2NCl{binITSChi2NCl, "Chi2 / cluster ITS"}; + + const AxisSpec axisNClFindable{binTPCNCl, "# findable clusters TPC"}; + const AxisSpec axisNClFound{binTPCNCl, "# found clusters TPC"}; + const AxisSpec axisNClShared{binTPCNCl, "# shared clusters TPC"}; + const AxisSpec axisNClCrossedRows{binTPCNCl, "# crossed rows TPC"}; + const AxisSpec axisTPCChi2NCl{binTPCChi2NCl, "Chi2 / cluster TPC"}; + const AxisSpec axisSharedFraction{binTPCNClSharedFraction, "Fraction shared clusters TPC"}; + const AxisSpec axisCrossedRowsOverFindable{binTPCCrossedRowsOverFindableCl, "Crossed rows / findable clusters TPC"}; + + if (doprocessFlags) { + registry.add("inclusive/V0Flags", "V0Flags", HistType::kTH2D, {{4, -0.5, 3.5}, {4, -0.5, 3.5}}); + } + if (doprocessMcD) { + registry.add("inclusive/hEvents", "Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("inclusive/K0SPtEtaMass", "K0S Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); + registry.add("inclusive/InvMassK0STrue", "Invariant mass of K0S", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisK0SM}); + registry.add("inclusive/InvMassLambdaTrue", "Invariant mass of Lambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisLambdaM}); + registry.add("inclusive/LambdaPtEtaMass", "Lambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); + registry.add("inclusive/InvMassAntiLambdaTrue", "Invariant mass of AntiLambda", HistType::kTH3D, {axisV0Pt, axisV0Radius, axisAntiLambdaM}); + registry.add("inclusive/AntiLambdaPtEtaMass", "AntiLambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); + } + if (doprocessMcP) { + registry.add("inclusive/hMcEvents", "MC Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("inclusive/GeneratedK0S", "Generated K0S", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); + registry.add("inclusive/GeneratedLambda", "Generated Lambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); + registry.add("inclusive/GeneratedAntiLambda", "Generated AntiLambda", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Radius}); + } + if (doprocessMcDJets) { + registry.add("jets/hJetEvents", "Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("jets/JetPtEtaK0SPt", "Jet Pt, Eta, K0S Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/InvMassJetK0STrue", "Invariant mass of K0S in jets", HistType::kTH3D, {axisJetPt, axisV0Pt, axisK0SM}); + registry.add("jets/JetPtEtaLambdaPt", "Jet Pt, Eta, Lambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/InvMassJetLambdaTrue", "Invariant mass of Lambda in jets", HistType::kTH3D, {axisJetPt, axisV0Pt, axisLambdaM}); + registry.add("jets/JetPtEtaAntiLambdaPt", "Jet Pt, Eta, AntiLambda Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/InvMassJetAntiLambdaTrue", "Invariant mass of AntiLambda in jets", HistType::kTH3D, {axisJetPt, axisV0Pt, axisAntiLambdaM}); + } + if (doprocessMcDMatchedJets) { + registry.add("jets/hMatchedJetEvents", "Matched Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("jets/JetsPtEtaK0SPt", "Matched Jet Pt, Eta, K0S Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/InvMassJetsK0STrue", "Invariant mass of K0S in matched jets", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisK0SM}); + registry.add("jets/JetsPtEtaLambdaPt", "Matched Jet Pt, Eta, Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/InvMassJetsLambdaTrue", "Invariant mass of Lambda in matched jets", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisLambdaM}); + registry.add("jets/JetsPtEtaAntiLambdaPt", "Matched Jet Pt, Eta, AntiLambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/InvMassJetsAntiLambdaTrue", "Invariant mass of AntiLambda in matched jets", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisAntiLambdaM}); + } + if (doprocessMcPJets) { + registry.add("jets/hMcJetEvents", "MC Jet Events", {HistType::kTH1D, {{2, 0.0f, 2.0f}}}); + registry.add("jets/GeneratedJetK0S", "Generated Jet K0S", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetLambda", "Generated Jet Lambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("jets/GeneratedJetAntiLambda", "Generated Jet AntiLambda", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + } + if (doprocessCollisionAssociation) { + registry.add("collisions/V0PtEta", "V0 Pt, Eta", HistType::kTH2D, {axisV0Pt, axisEta}); + registry.add("collisions/V0PtEtaWrongColl", "V0 Pt, Eta, wrong collision", HistType::kTH2D, {axisV0Pt, axisEta}); + registry.add("collisions/K0SPtEtaMass", "K0S Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); + registry.add("collisions/K0SPtEtaMassWrongColl", "K0S Pt, Eta, Mass, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisK0SM}); + registry.add("collisions/LambdaPtEtaMass", "Lambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); + registry.add("collisions/LambdaPtEtaMassWrongColl", "Lambda Pt, Eta, Mass, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisLambdaM}); + registry.add("collisions/AntiLambdaPtEtaMass", "AntiLambda Pt, Eta, Mass", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); + registry.add("collisions/AntiLambdaPtEtaMassWrongColl", "AntiLambda Pt, Eta, Mass, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisAntiLambdaM}); + + registry.add("collisions/XiMinusPtYLambdaPt", "#Xi^{-} Pt, Y, #Lambda Pt", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("collisions/XiMinusPtYLambdaPtWrongColl", "#Xi^{-} Pt, Y, #Lambda Pt, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("collisions/XiPlusPtYAntiLambdaPt", "#Xi^{+} Pt, Y, #bar{#Lambda} Pt", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("collisions/XiPlusPtYAntiLambdaPtWrongColl", "#Xi^{+} Pt, Y, #bar{#Lambda} Pt, wrong collision", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + } + if (doprocessCollisionAssociationJets) { + registry.add("collisions/JetPtEtaV0Pt", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("collisions/JetPtEtaV0PtWrongColl", "Jet Pt, Eta, V0 Pt", HistType::kTH3D, {axisJetPt, axisEta, axisV0Pt}); + registry.add("collisions/JetPtEtaK0SPtMass", "Jet Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisK0SM}); + registry.add("collisions/JetPtEtaK0SPtMassWrongColl", "Jet Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisK0SM}); + registry.add("collisions/JetPtEtaLambdaPtMass", "Jet Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetPtEtaLambdaPtMassWrongColl", "Jet Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetPtEtaAntiLambdaPtMass", "Jet Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + registry.add("collisions/JetPtEtaAntiLambdaPtMassWrongColl", "Jet Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + + registry.add("collisions/JetPtEtaXiMinusPtLambdaPt", "Jet Pt, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("collisions/JetPtEtaXiMinusPtLambdaPtWrongColl", "Jet Pt, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("collisions/JetPtEtaXiPlusPtAntiLambdaPt", "Jet Pt, #Xi^{+} Pt, #bar{#Lambda} Pt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("collisions/JetPtEtaXiPlusPtAntiLambdaPtWrongColl", "Jet Pt, #Xi^{+} Pt, #bar{#Lambda} Pt", HistType::kTHnSparseD, {axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + } + if (doprocessCollisionAssociationMatchedJets) { + registry.add("collisions/JetsPtEtaV0Pt", "Jets Pt, Eta, V0 Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("collisions/JetsPtEtaV0PtWrongColl", "Jets Pt, Eta, V0 Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt}); + registry.add("collisions/JetsPtEtaK0SPtMass", "Jets Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisK0SM}); + registry.add("collisions/JetsPtEtaK0SPtMassWrongColl", "Jets Pt, Eta, K0S Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisK0SM}); + registry.add("collisions/JetsPtEtaLambdaPtMass", "Jets Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetsPtEtaLambdaPtMassWrongColl", "Jets Pt, Eta, Lambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisLambdaM}); + registry.add("collisions/JetsPtEtaAntiLambdaPtMass", "Jets Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + registry.add("collisions/JetsPtEtaAntiLambdaPtMassWrongColl", "Jets Pt, Eta, AntiLambda Pt Mass", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisAntiLambdaM}); + + registry.add("collisions/JetsPtEtaXiMinusPtLambdaPt", "Jets Pt, Eta, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("collisions/JetsPtEtaXiMinusPtLambdaPtWrongColl", "Jets Pt, Eta, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("collisions/JetsPtEtaXiPlusPtAntiLambdaPt", "Jets Pt, Eta, #Xi^{+} Pt, #bar{#Lambda} Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + registry.add("collisions/JetsPtEtaXiPlusPtAntiLambdaPtWrongColl", "Jets Pt, Eta, #Xi^{+} Pt, #bar{#Lambda} Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisEta, axisV0Pt, axisV0Pt}); + } + if (doprocessFeeddown) { + registry.add("feeddown/XiMinusPtYLambdaPt", "#Xi^{-} Pt, Y, #Lambda Pt", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + registry.add("feeddown/XiPlusPtYAntiLambdaPt", "#Xi^{-} Pt, Y, #Lambda Pt", HistType::kTH3D, {axisV0Pt, axisEta, axisV0Pt}); + } + if (doprocessFeeddownJets) { + registry.add("feeddown/JetPtXiMinusPtLambdaPt", "Jets Pt, #Xi^{-} Pt, #Lambda Pt", HistType::kTH3D, {axisJetPt, axisJetPt, axisV0Pt}); + registry.add("feeddown/JetPtXiPlusPtAntiLambdaPt", "Jets Pt, #Xi^{+} Pt, #Lambda Pt", HistType::kTH3D, {axisJetPt, axisJetPt, axisV0Pt}); + } + if (doprocessFeeddownMatchedJets) { + registry.add("feeddown/JetsPtXiMinusPtLambdaPt", "Jets Pt, #Xi^{-} Pt, #Lambda Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisV0Pt}); + registry.add("feeddown/JetsPtXiPlusPtAntiLambdaPt", "Jets Pt, #Xi^{+} Pt, #bar{#Lambda} Pt", HistType::kTHnSparseD, {axisJetPt, axisJetPt, axisV0Pt, axisV0Pt}); + } + if (doprocessV0TrackQA) { + registry.add("tracks/Pos", "pos", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisEta, axisPhi}); + registry.add("tracks/Neg", "neg", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisEta, axisPhi}); + registry.add("tracks/Pt", "pt", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/PtMass", "pt mass", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM, axisLambdaM, axisAntiLambdaM}); + registry.add("tracks/PtDiffMass", "ptdiff mass", HistType::kTHnSparseD, {axisV0Pt, axisPtDiff, axisK0SM, axisLambdaM, axisAntiLambdaM}); + + registry.add("tracks/DCAxy", "dcaxy", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaXY, axisDcaXY, axisPtDiff}); + registry.add("tracks/DCAxyMassK0S", "dcaxy mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaXY, axisDcaXY, axisK0SM}); + registry.add("tracks/DCAxyMassLambda0", "dcaxy mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaXY, axisDcaXY, axisLambdaM}); + registry.add("tracks/DCAxyMassAntiLambda0", "dcaxy mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaXY, axisDcaXY, axisAntiLambdaM}); + + registry.add("tracks/DCAz", "dcaz", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaZ, axisDcaZ, axisPtDiff}); + registry.add("tracks/DCAzMassK0S", "dcaz mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaZ, axisDcaZ, axisK0SM}); + registry.add("tracks/DCAzMassLambda0", "dcaz mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaZ, axisDcaZ, axisLambdaM}); + registry.add("tracks/DCAzMassAntiLambda0", "dcaz mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisDcaZ, axisDcaZ, axisAntiLambdaM}); + + registry.add("tracks/V0Radius", "v0 radius", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0Radius, axisPtDiff}); + registry.add("tracks/V0RadiusMassK0S", "v0 radius mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0Radius, axisK0SM}); + registry.add("tracks/V0RadiusMassLambda0", "v0 radius mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0Radius, axisLambdaM}); + registry.add("tracks/V0RadiusMassAntiLambda0", "v0 radius mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0Radius, axisAntiLambdaM}); + + registry.add("tracks/V0CosPa", "v0 cos pa", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0CosPA, axisPtDiff}); + registry.add("tracks/V0CosPaMassK0S", "v0 cos pa mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0CosPA, axisK0SM}); + registry.add("tracks/V0CosPaMassLambda0", "v0 cos pa mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0CosPA, axisLambdaM}); + registry.add("tracks/V0CosPaMassAntiLambda0", "v0 cos pa mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisV0CosPA, axisAntiLambdaM}); + + // TRD + registry.add("tracks/posTRDPt", "pos trd pt", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/posTRDPtMass", "pos trd pt mass", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM, axisLambdaM, axisAntiLambdaM}); + registry.add("tracks/posNoTRDPt", "pos no trd pt", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/posNoTRDPtMass", "pos no trd pt mass", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM, axisLambdaM, axisAntiLambdaM}); + + registry.add("tracks/negTRDPt", "neg trd pt", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/negTRDPtMass", "neg trd pt mass", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM, axisLambdaM, axisAntiLambdaM}); + registry.add("tracks/negNoTRDPt", "neg no trd pt", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/negNoTRDPtMass", "neg no trd pt mass", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM, axisLambdaM, axisAntiLambdaM}); + + // ITS: positive track + registry.add("tracks/ITS/posLayer1", "pos layer 1", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer1MassK0S", "pos layer 1 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer1MassLambda0", "pos layer 1 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer1MassAntiLambda0", "pos layer 1 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer2", "pos layer 2", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer2MassK0S", "pos layer 2 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer2MassLambda0", "pos layer 2 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer2MassAntiLambda0", "pos layer 2 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer3", "pos layer 3", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer3MassK0S", "pos layer 3 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer3MassLambda0", "pos layer 3 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer3MassAntiLambda0", "pos layer 3 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer4", "pos layer 4", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer4MassK0S", "pos layer 4 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer4MassLambda0", "pos layer 4 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer4MassAntiLambda0", "pos layer 4 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer5", "pos layer 5", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer5MassK0S", "pos layer 5 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer5MassLambda0", "pos layer 5 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer5MassAntiLambda0", "pos layer 5 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer6", "pos layer 6", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer6MassK0S", "pos layer 6 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer6MassLambda0", "pos layer 6 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer6MassAntiLambda0", "pos layer 6 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer7", "pos layer 7", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer7MassK0S", "pos layer 7 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer7MassLambda0", "pos layer 7 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer7MassAntiLambda0", "pos layer 7 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer56", "pos layer 56", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer56MassK0S", "pos layer 56 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer56MassLambda0", "pos layer 56 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer56MassAntiLambda0", "pos layer 56 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer67", "pos layer 67", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer67MassK0S", "pos layer 67 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer67MassLambda0", "pos layer 67 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer67MassAntiLambda0", "pos layer 67 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer57", "pos layer 57", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer57MassK0S", "pos layer 57 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer57MassLambda0", "pos layer 57 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer57MassAntiLambda0", "pos layer 57 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posLayer567", "pos layer 567", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/posLayer567MassK0S", "pos layer 567 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/posLayer567MassLambda0", "pos layer 567 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/posLayer567MassAntiLambda0", "pos layer 567 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/posNCl", "pos ncl", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisITSNCl}); + registry.add("tracks/ITS/posChi2NCl", "pos chi2ncl", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisITSChi2NCl}); + + // ITS: Negative track + registry.add("tracks/ITS/negLayer1", "neg layer 1", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer1MassK0S", "neg layer 1 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer1MassLambda0", "neg layer 1 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer1MassAntiLambda0", "neg layer 1 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer2", "neg layer 2", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer2MassK0S", "neg layer 2 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer2MassLambda0", "neg layer 2 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer2MassAntiLambda0", "neg layer 2 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer3", "neg layer 3", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer3MassK0S", "neg layer 3 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer3MassLambda0", "neg layer 3 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer3MassAntiLambda0", "neg layer 3 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer4", "neg layer 4", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer4MassK0S", "neg layer 4 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer4MassLambda0", "neg layer 4 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer4MassAntiLambda0", "neg layer 4 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer5", "neg layer 5", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer5MassK0S", "neg layer 5 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer5MassLambda0", "neg layer 5 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer5MassAntiLambda0", "neg layer 5 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer6", "neg layer 6", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer6MassK0S", "neg layer 6 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer6MassLambda0", "neg layer 6 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer6MassAntiLambda0", "neg layer 6 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer7", "neg layer 7", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer7MassK0S", "neg layer 7 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer7MassLambda0", "neg layer 7 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer7MassAntiLambda0", "neg layer 7 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer56", "neg layer 56", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer56MassK0S", "neg layer 56 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer56MassLambda0", "neg layer 56 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer56MassAntiLambda0", "neg layer 56 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer67", "neg layer 67", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer67MassK0S", "neg layer 67 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer67MassLambda0", "neg layer 67 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer67MassAntiLambda0", "neg layer 67 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer57", "neg layer 57", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer57MassK0S", "neg layer 57 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer57MassLambda0", "neg layer 57 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer57MassAntiLambda0", "neg layer 57 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negLayer567", "neg layer 567", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisPtDiff}); + registry.add("tracks/ITS/negLayer567MassK0S", "neg layer 567 mass K0S", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisK0SM}); + registry.add("tracks/ITS/negLayer567MassLambda0", "neg layer 567 mass Lambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisLambdaM}); + registry.add("tracks/ITS/negLayer567MassAntiLambda0", "neg layer 567 mass AntiLambda0", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisAntiLambdaM}); + + registry.add("tracks/ITS/negNCl", "neg ncl", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisITSNCl}); + registry.add("tracks/ITS/negChi2NCl", "neg chi2ncl", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisITSChi2NCl}); + + // TPC information + registry.add("tracks/TPC/posNClFindable", "pos ncl findable", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClFindable}); + registry.add("tracks/TPC/posNClsFound", "pos ncl found", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClFound}); + registry.add("tracks/TPC/posNClsShared", "pos ncl shared", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClShared}); + registry.add("tracks/TPC/posNClsCrossedRows", "pos ncl crossed rows", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClCrossedRows}); + registry.add("tracks/TPC/posNClsCrossedRowsOverFindableCls", "pos ncl crossed rows over findable cls", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisCrossedRowsOverFindable}); + registry.add("tracks/TPC/posFractionSharedCls", "pos fraction shared cls", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisSharedFraction}); + registry.add("tracks/TPC/posChi2NCl", "pos chi2ncl", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisTPCChi2NCl}); + + registry.add("tracks/TPC/negNClFindable", "neg ncl findable", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClFindable}); + registry.add("tracks/TPC/negNClsFound", "neg ncl found", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClFound}); + registry.add("tracks/TPC/negNClsShared", "neg ncl shared", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClShared}); + registry.add("tracks/TPC/negNClsCrossedRows", "neg ncl crossed rows", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisNClCrossedRows}); + registry.add("tracks/TPC/negNClsCrossedRowsOverFindableCls", "neg ncl crossed rows over findable cls", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisCrossedRowsOverFindable}); + registry.add("tracks/TPC/negFractionSharedCls", "neg fraction shared cls", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisSharedFraction}); + registry.add("tracks/TPC/negChi2NCl", "neg chi2ncl", HistType::kTHnSparseD, {axisV0Pt, axisV0Pt, axisV0Pt, axisTPCChi2NCl}); + } // doprocessV0TrackQA + } // init + + template + bool isCollisionReconstructed(T const& collision, U const& eventSelection) + { + if (!collision.has_mcCollision()) { + return false; + } + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return false; + } + return true; + } + template + bool V0sAreMatched(T const& v0, U const& particle, V const& /*tracks*/) + { + // This is necessary, because the V0Labels table points to aod::McParticles, not to aod::CandidatesV0MCP + auto negId = v0.template negTrack_as().mcParticleId(); + auto posId = v0.template posTrack_as().mcParticleId(); + auto daughters = particle.daughtersIds(); + return ((negId == daughters[0] && posId == daughters[1]) || (posId == daughters[0] && negId == daughters[1])); + } + template + bool isV0Reconstructed(T collision, U const& v0, int pdg) + { + // TODO: This should use the JE V0 selector once it it ready! + if (v0.v0cosPA() < v0cospaMin) + return false; + if (v0.v0radius() < v0radiusMin) + return false; + if (v0.dcaV0daughters() > dcav0dauMax) + return false; + + // K0S + if (TMath::Abs(pdg) == 310) { + if (TMath::Abs(v0.dcapostopv()) < dcapiMin) + return false; + if (TMath::Abs(v0.dcanegtopv()) < dcapiMin) + return false; + if (TMath::Abs(v0.yK0Short()) > yK0SMax) + return false; + float ctauK0S = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short; + if (ctauK0S > lifetimeK0SMax) + return false; + } + // Lambda + if (pdg == 3122) { + if (TMath::Abs(v0.dcapostopv()) < dcaprMin) + return false; + if (TMath::Abs(v0.dcanegtopv()) < dcapiMin) + return false; + if (TMath::Abs(v0.yLambda()) > yLambdaMax) + return false; + float ctauLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; + if (ctauLambda > lifetimeLambdaMax) + return false; + } + if (pdg == -3122) { + if (TMath::Abs(v0.dcapostopv()) < dcapiMin) + return false; + if (TMath::Abs(v0.dcanegtopv()) < dcaprMin) + return false; + if (TMath::Abs(v0.yLambda()) > yLambdaMax) + return false; + float ctauAntiLambda = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0Bar; + if (ctauAntiLambda > lifetimeLambdaMax) + return false; + } + return true; + } + + template + bool hasITSHit(T const& track, int layer) + { + int ibit = layer - 1; + return (track.itsClusterMap() & (1 << ibit)); + } + + template + void fillTrackQa(V const& v0) + { + auto posTrack = v0.template posTrack_as().template track_as(); + auto negTrack = v0.template negTrack_as().template track_as(); + + double mK = v0.mK0Short(); + double mL = v0.mLambda(); + double mAL = v0.mAntiLambda(); + + double vPt = v0.pt(); + double pPt = posTrack.pt(); + double nPt = negTrack.pt(); + double dPt = posTrack.pt() - negTrack.pt(); + + registry.fill(HIST("tracks/Pos"), vPt, pPt, posTrack.eta(), posTrack.phi()); + registry.fill(HIST("tracks/Neg"), vPt, nPt, negTrack.eta(), negTrack.phi()); + registry.fill(HIST("tracks/Pt"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/PtMass"), vPt, pPt, nPt, mK, mL, mAL); + registry.fill(HIST("tracks/PtDiffMass"), vPt, dPt, mK, mL, mAL); + + registry.fill(HIST("tracks/DCAxy"), vPt, pPt, nPt, posTrack.dcaXY(), negTrack.dcaXY(), dPt); + registry.fill(HIST("tracks/DCAxyMassK0S"), vPt, pPt, nPt, posTrack.dcaXY(), negTrack.dcaXY(), mK); + registry.fill(HIST("tracks/DCAxyMassLambda0"), vPt, pPt, nPt, posTrack.dcaXY(), negTrack.dcaXY(), mL); + registry.fill(HIST("tracks/DCAxyMassAntiLambda0"), vPt, pPt, nPt, posTrack.dcaXY(), negTrack.dcaXY(), mAL); + + registry.fill(HIST("tracks/DCAz"), vPt, pPt, nPt, posTrack.dcaZ(), negTrack.dcaZ(), dPt); + registry.fill(HIST("tracks/DCAzMassK0S"), vPt, pPt, nPt, posTrack.dcaZ(), negTrack.dcaZ(), mK); + registry.fill(HIST("tracks/DCAzMassLambda0"), vPt, pPt, nPt, posTrack.dcaZ(), negTrack.dcaZ(), mL); + registry.fill(HIST("tracks/DCAzMassAntiLambda0"), vPt, pPt, nPt, posTrack.dcaZ(), negTrack.dcaZ(), mAL); + + registry.fill(HIST("tracks/V0Radius"), vPt, pPt, nPt, v0.v0radius(), dPt); + registry.fill(HIST("tracks/V0RadiusMassK0S"), vPt, pPt, nPt, v0.v0radius(), mK); + registry.fill(HIST("tracks/V0RadiusMassLambda0"), vPt, pPt, nPt, v0.v0radius(), mL); + registry.fill(HIST("tracks/V0RadiusMassAntiLambda0"), vPt, pPt, nPt, v0.v0radius(), mAL); + + registry.fill(HIST("tracks/V0CosPa"), vPt, pPt, nPt, v0.v0cosPA(), dPt); + registry.fill(HIST("tracks/V0CosPaMassK0S"), vPt, pPt, nPt, v0.v0cosPA(), mK); + registry.fill(HIST("tracks/V0CosPaMassLambda0"), vPt, pPt, nPt, v0.v0cosPA(), mL); + registry.fill(HIST("tracks/V0CosPaMassAntiLambda0"), vPt, pPt, nPt, v0.v0cosPA(), mAL); + + // Has TRD or not + if (posTrack.hasTRD()) { + registry.fill(HIST("tracks/posTRDPt"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/posTRDPtMass"), vPt, pPt, nPt, mK, mL, mAL); + } else { + registry.fill(HIST("tracks/posNoTRDPt"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/posNoTRDPtMass"), vPt, pPt, nPt, mK, mL, mAL); + } + if (negTrack.hasTRD()) { + registry.fill(HIST("tracks/negTRDPt"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/negTRDPtMass"), vPt, pPt, nPt, mK, mL, mAL); + } else { + registry.fill(HIST("tracks/negNoTRDPt"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/negNoTRDPtMass"), vPt, pPt, nPt, mK, mL, mAL); + } + + // ITS information + if (hasITSHit(posTrack, 1)) { + registry.fill(HIST("tracks/ITS/posLayer1"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer1MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer1MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer1MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 2)) { + registry.fill(HIST("tracks/ITS/posLayer2"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer2MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer2MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer2MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 3)) { + registry.fill(HIST("tracks/ITS/posLayer3"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer3MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer3MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer3MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 4)) { + registry.fill(HIST("tracks/ITS/posLayer4"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer4MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer4MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer4MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 5)) { + registry.fill(HIST("tracks/ITS/posLayer5"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer5MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer5MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer5MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 6)) { + registry.fill(HIST("tracks/ITS/posLayer6"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer6MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer6MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer6MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 7)) { + registry.fill(HIST("tracks/ITS/posLayer7"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer7MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer7MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer7MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 5) && hasITSHit(posTrack, 6)) { + registry.fill(HIST("tracks/ITS/posLayer56"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer56MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer56MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer56MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 6) && hasITSHit(posTrack, 7)) { + registry.fill(HIST("tracks/ITS/posLayer67"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer67MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer67MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer67MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 5) && hasITSHit(posTrack, 7)) { + registry.fill(HIST("tracks/ITS/posLayer57"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer57MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer57MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer57MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(posTrack, 5) && hasITSHit(posTrack, 6) && hasITSHit(posTrack, 7)) { + registry.fill(HIST("tracks/ITS/posLayer567"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/posLayer567MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/posLayer567MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/posLayer567MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + registry.fill(HIST("tracks/ITS/posNCl"), vPt, pPt, nPt, posTrack.itsNCls()); + registry.fill(HIST("tracks/ITS/posChi2NCl"), vPt, pPt, nPt, posTrack.itsChi2NCl()); + + if (hasITSHit(negTrack, 1)) { + registry.fill(HIST("tracks/ITS/negLayer1"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer1MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer1MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer1MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 2)) { + registry.fill(HIST("tracks/ITS/negLayer2"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer2MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer2MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer2MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 3)) { + registry.fill(HIST("tracks/ITS/negLayer3"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer3MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer3MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer3MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 4)) { + registry.fill(HIST("tracks/ITS/negLayer4"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer4MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer4MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer4MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 5)) { + registry.fill(HIST("tracks/ITS/negLayer5"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer5MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer5MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer5MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 6)) { + registry.fill(HIST("tracks/ITS/negLayer6"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer6MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer6MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer6MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 7)) { + registry.fill(HIST("tracks/ITS/negLayer7"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer7MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer7MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer7MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 5) && hasITSHit(negTrack, 6)) { + registry.fill(HIST("tracks/ITS/negLayer56"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer56MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer56MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer56MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 6) && hasITSHit(negTrack, 7)) { + registry.fill(HIST("tracks/ITS/negLayer67"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer67MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer67MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer67MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 5) && hasITSHit(negTrack, 7)) { + registry.fill(HIST("tracks/ITS/negLayer57"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer57MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer57MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer57MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + if (hasITSHit(negTrack, 5) && hasITSHit(negTrack, 6) && hasITSHit(negTrack, 7)) { + registry.fill(HIST("tracks/ITS/negLayer567"), vPt, pPt, nPt, dPt); + registry.fill(HIST("tracks/ITS/negLayer567MassK0S"), vPt, pPt, nPt, mK); + registry.fill(HIST("tracks/ITS/negLayer567MassLambda0"), vPt, pPt, nPt, mL); + registry.fill(HIST("tracks/ITS/negLayer567MassAntiLambda0"), vPt, pPt, nPt, mAL); + } + registry.fill(HIST("tracks/ITS/negNCl"), vPt, pPt, nPt, negTrack.itsNCls()); + registry.fill(HIST("tracks/ITS/negChi2NCl"), vPt, pPt, nPt, negTrack.itsChi2NCl()); + + // TPC information + registry.fill(HIST("tracks/TPC/posNClFindable"), vPt, pPt, nPt, posTrack.tpcNClsFindable()); + registry.fill(HIST("tracks/TPC/posNClsFound"), vPt, pPt, nPt, posTrack.tpcNClsFound()); + registry.fill(HIST("tracks/TPC/posChi2NCl"), vPt, pPt, nPt, posTrack.tpcChi2NCl()); + registry.fill(HIST("tracks/TPC/posNClsShared"), vPt, pPt, nPt, posTrack.tpcNClsShared()); + registry.fill(HIST("tracks/TPC/posFractionSharedCls"), vPt, pPt, nPt, posTrack.tpcFractionSharedCls()); + registry.fill(HIST("tracks/TPC/posNClsCrossedRows"), vPt, pPt, nPt, posTrack.tpcNClsCrossedRows()); + registry.fill(HIST("tracks/TPC/posNClsCrossedRowsOverFindableCls"), vPt, pPt, nPt, posTrack.tpcCrossedRowsOverFindableCls()); + + registry.fill(HIST("tracks/TPC/negNClFindable"), vPt, pPt, nPt, negTrack.tpcNClsFindable()); + registry.fill(HIST("tracks/TPC/negNClsFound"), vPt, pPt, nPt, negTrack.tpcNClsFound()); + registry.fill(HIST("tracks/TPC/negChi2NCl"), vPt, pPt, nPt, negTrack.tpcChi2NCl()); + registry.fill(HIST("tracks/TPC/negNClsShared"), vPt, pPt, nPt, negTrack.tpcNClsShared()); + registry.fill(HIST("tracks/TPC/negFractionSharedCls"), vPt, pPt, nPt, negTrack.tpcFractionSharedCls()); + registry.fill(HIST("tracks/TPC/negNClsCrossedRows"), vPt, pPt, nPt, negTrack.tpcNClsCrossedRows()); + registry.fill(HIST("tracks/TPC/negNClsCrossedRowsOverFindableCls"), vPt, pPt, nPt, negTrack.tpcCrossedRowsOverFindableCls()); + } + + using CandidatesV0MCDWithFlags = soa::Join; + + void processDummy(aod::CandidatesV0MCD const&) {} + PROCESS_SWITCH(V0QA, processDummy, "Dummy process function turned on by default", true); + + void processFlags(soa::Join::iterator const& v0) + { + int isK0S = static_cast(v0.isK0SCandidate()); + int isLambda = static_cast((v0.isLambdaCandidate())); + int isAntiLambda = static_cast(v0.isAntiLambdaCandidate()); + int isRejected = static_cast(v0.isRejectedCandidate()); + + registry.fill(HIST("inclusive/V0Flags"), 0, 0, isK0S); + registry.fill(HIST("inclusive/V0Flags"), 1, 1, isLambda); + registry.fill(HIST("inclusive/V0Flags"), 2, 2, isAntiLambda); + registry.fill(HIST("inclusive/V0Flags"), 3, 3, isRejected); + + registry.fill(HIST("inclusive/V0Flags"), 0, 1, isK0S * isLambda); + registry.fill(HIST("inclusive/V0Flags"), 1, 0, isK0S * isLambda); + registry.fill(HIST("inclusive/V0Flags"), 0, 2, isK0S * isAntiLambda); + registry.fill(HIST("inclusive/V0Flags"), 2, 0, isK0S * isAntiLambda); + registry.fill(HIST("inclusive/V0Flags"), 0, 3, isK0S * isRejected); + registry.fill(HIST("inclusive/V0Flags"), 3, 0, isK0S * isRejected); + + registry.fill(HIST("inclusive/V0Flags"), 1, 2, isLambda * isAntiLambda); + registry.fill(HIST("inclusive/V0Flags"), 2, 1, isLambda * isAntiLambda); + registry.fill(HIST("inclusive/V0Flags"), 1, 3, isLambda * isRejected); + registry.fill(HIST("inclusive/V0Flags"), 3, 1, isLambda * isRejected); + + registry.fill(HIST("inclusive/V0Flags"), 2, 3, isAntiLambda * isRejected); + registry.fill(HIST("inclusive/V0Flags"), 3, 2, isAntiLambda * isRejected); + } + PROCESS_SWITCH(V0QA, processFlags, "V0 flags", false); + + void processMcD(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, CandidatesV0MCDWithFlags const& v0s, aod::McParticles const&) + { + registry.fill(HIST("inclusive/hEvents"), 0.5); + if (!isCollisionReconstructed(jcoll, eventSelection)) { + return; + } + registry.fill(HIST("inclusive/hEvents"), 1.5); + double weight = jcoll.mcCollision().weight(); + + for (const auto& v0 : v0s) { + if (!v0.has_mcParticle()) { + continue; + } + int pdg = v0.mcParticle().pdgCode(); + + // Check V0 decay kinematics + if (v0.isRejectedCandidate()) + continue; + + // K0S + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("inclusive/K0SPtEtaMass"), v0.pt(), v0.eta(), v0.mK0Short(), weight); + registry.fill(HIST("inclusive/InvMassK0STrue"), v0.pt(), v0.v0radius(), v0.mK0Short(), weight); + } + // Lambda + if (pdg == 3122) { + registry.fill(HIST("inclusive/LambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mLambda(), weight); + registry.fill(HIST("inclusive/InvMassLambdaTrue"), v0.pt(), v0.v0radius(), v0.mLambda(), weight); + } + if (pdg == -3122) { + registry.fill(HIST("inclusive/AntiLambdaPtEtaMass"), v0.pt(), v0.eta(), v0.mAntiLambda(), weight); + registry.fill(HIST("inclusive/InvMassAntiLambdaTrue"), v0.pt(), v0.v0radius(), v0.mAntiLambda(), weight); + } + } + } + PROCESS_SWITCH(V0QA, processMcD, "Reconstructed true V0s", false); + + void processMcP(aod::JetMcCollision const& mccoll, aod::CandidatesV0MCP const& pv0s, soa::SmallGroups const& collisions) + { + registry.fill(HIST("inclusive/hMcEvents"), 0.5); + bool isReconstructed = false; + + for (auto collision : collisions) { + if (!isCollisionReconstructed(collision, eventSelection)) { + continue; + } + if (collision.mcCollision().globalIndex() != mccoll.globalIndex()) { + continue; + } + isReconstructed = true; + break; + } + if (!isReconstructed) { + return; + } + + registry.fill(HIST("inclusive/hMcEvents"), 1.5); + double weight = mccoll.weight(); + + for (auto& pv0 : pv0s) { + if (!pv0.has_daughters()) + continue; + if (!pv0.isPhysicalPrimary()) + continue; + if (TMath::Abs(pv0.y() > yPartMax)) + continue; + + // Can calculate this from aod::CandidatesV0MCD (contains decay vertex) + double R_Decay = 1.0; + + if (pv0.pdgCode() == 310) { + registry.fill(HIST("inclusive/GeneratedK0S"), pv0.pt(), pv0.eta(), R_Decay, weight); + } + if (pv0.pdgCode() == 3122) { + registry.fill(HIST("inclusive/GeneratedLambda"), pv0.pt(), pv0.eta(), R_Decay, weight); + } + if (pv0.pdgCode() == -3122) { + registry.fill(HIST("inclusive/GeneratedAntiLambda"), pv0.pt(), pv0.eta(), R_Decay, weight); + } + } + } + PROCESS_SWITCH(V0QA, processMcP, "Particle level V0s", false); + + void processMcDJets(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, aod::McParticles const&) + { + registry.fill(HIST("jets/hJetEvents"), 0.5); + if (!isCollisionReconstructed(jcoll, eventSelection)) { + return; + } + registry.fill(HIST("jets/hJetEvents"), 1.5); + double weight = jcoll.mcCollision().weight(); + + for (const auto& mcdjet : mcdjets) { + // if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) + for (const auto& v0 : mcdjet.template candidates_as()) { + if (!v0.has_mcParticle()) { + continue; + } + int pdg = v0.mcParticle().pdgCode(); + + // Check V0 decay kinematics + if (v0.isRejectedCandidate()) + continue; + + // K0S + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("jets/JetPtEtaK0SPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/InvMassJetK0STrue"), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); + } + // Lambda + if (pdg == 3122) { + registry.fill(HIST("jets/JetPtEtaLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/InvMassJetLambdaTrue"), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); + } + if (pdg == -3122) { + registry.fill(HIST("jets/JetPtEtaAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/InvMassJetAntiLambdaTrue"), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); + } + } + } + } + PROCESS_SWITCH(V0QA, processMcDJets, "Reconstructed true V0s in jets", false); + + void processMcDMatchedJets(soa::Filtered::iterator const& jcoll, aod::JetMcCollisions const&, MatchedMCDV0JetsWithConstituents const& mcdjets, MatchedMCPV0JetsWithConstituents const&, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, aod::JetTracksMCD const& jTracks, aod::McParticles const&) + { + registry.fill(HIST("jets/hMatchedJetEvents"), 0.5); + if (!isCollisionReconstructed(jcoll, eventSelection)) { + return; + } + registry.fill(HIST("jets/hMatchedJetEvents"), 1.5); + double weight = jcoll.mcCollision().weight(); + + for (const auto& mcdjet : mcdjets) { + // if (!jetfindingutilities::isInEtaAcceptance(mcdjet, -99., -99., v0EtaMin, v0EtaMax)) + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + for (const auto& v0 : mcdjet.template candidates_as()) { + if (!v0.has_mcParticle()) + continue; + + for (const auto& pv0 : mcpjet.template candidates_as()) { + if (!V0sAreMatched(v0, pv0, jTracks)) + continue; + int pdg = pv0.pdgCode(); + + // Check V0 decay kinematics + if (v0.isRejectedCandidate()) + continue; + + // K0S + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("jets/JetsPtEtaK0SPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/InvMassJetsK0STrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mK0Short(), weight); + } + // Lambda + if (pdg == 3122) { + registry.fill(HIST("jets/JetsPtEtaLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/InvMassJetsLambdaTrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mLambda(), weight); + } + if (pdg == -3122) { + registry.fill(HIST("jets/JetsPtEtaAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), v0.pt(), weight); + registry.fill(HIST("jets/InvMassJetsAntiLambdaTrue"), mcpjet.pt(), mcdjet.pt(), v0.pt(), v0.mAntiLambda(), weight); + } + } + } + } + } + } + PROCESS_SWITCH(V0QA, processMcDMatchedJets, "Reconstructed true V0s in jets", false); + + void processMcPJets(aod::JetMcCollision const& mccoll, soa::SmallGroups const& collisions, MCPV0JetsWithConstituents const& jets, aod::CandidatesV0MCP const&) + { + registry.fill(HIST("jets/hMcJetEvents"), 0.5); + bool isReconstructed = false; + + for (auto collision : collisions) { + if (!isCollisionReconstructed(collision, eventSelection)) { + continue; + } + if (collision.mcCollision().globalIndex() != mccoll.globalIndex()) { + continue; + } + isReconstructed = true; + break; + } + if (!isReconstructed) { + return; + } + + registry.fill(HIST("jets/hMcJetEvents"), 1.5); + double weight = mccoll.weight(); + + for (auto& jet : jets) { + // if (!jetfindingutilities::isInEtaAcceptance(jet, -99., -99., v0EtaMin, v0EtaMax)) + for (const auto& pv0 : jet.template candidates_as()) { + if (!pv0.has_daughters()) + continue; + if (!pv0.isPhysicalPrimary()) + continue; + if (TMath::Abs(pv0.y() > yPartMax)) + continue; // TODO: Should actually check the jets + + if (pv0.pdgCode() == 310) { + registry.fill(HIST("jets/GeneratedJetK0S"), jet.pt(), jet.eta(), pv0.pt(), weight); + } + if (pv0.pdgCode() == 3122) { + registry.fill(HIST("jets/GeneratedJetLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + } + if (pv0.pdgCode() == -3122) { + registry.fill(HIST("jets/GeneratedJetAntiLambda"), jet.pt(), jet.eta(), pv0.pt(), weight); + } + } + } + } + PROCESS_SWITCH(V0QA, processMcPJets, "Particle level V0s in jets", false); + + void processCollisionAssociation(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + { + // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx + if (!jcoll.has_mcCollision()) { + return; + } + auto mcColl = jcoll.template mcCollision_as>(); + double weight = mcColl.weight(); + + for (const auto& v0 : v0s) { + if (!v0.has_mcParticle()) { + continue; + } + + auto pv0 = v0.mcParticle(); + bool correctCollision = (mcColl.mcCollisionId() == v0.mcParticle().mcCollisionId()); + int pdg = v0.mcParticle().pdgCode(); + + // Check V0 decay kinematics + if (v0.isRejectedCandidate()) + continue; + + registry.fill(HIST("collisions/V0PtEta"), pv0.pt(), pv0.eta(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/V0PtEtaWrongColl"), pv0.pt(), pv0.eta(), weight); + } + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("collisions/K0SPtEtaMass"), pv0.pt(), pv0.eta(), v0.mK0Short(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/K0SPtEtaMassWrongColl"), pv0.pt(), pv0.eta(), v0.mK0Short(), weight); + } + } + if (pdg == 3122) { + registry.fill(HIST("collisions/LambdaPtEtaMass"), pv0.pt(), pv0.eta(), v0.mLambda(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/LambdaPtEtaMassWrongColl"), pv0.pt(), pv0.eta(), v0.mLambda(), weight); + } + } + if (pdg == -3122) { + registry.fill(HIST("collisions/AntiLambdaPtEtaMass"), pv0.pt(), pv0.eta(), v0.mAntiLambda(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/AntiLambdaPtEtaMassWrongColl"), pv0.pt(), pv0.eta(), v0.mAntiLambda(), weight); + } + } + // Feed-down from Xi + if (!v0.has_mcMotherParticle()) { + continue; + } + auto mother = v0.mcMotherParticle(); + pdg = mother.pdgCode(); + correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); + + if (pdg == 3312) { // Xi- + registry.fill(HIST("collisions/XiMinusPtYLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/XiMinusPtYLambdaPtWrongColl"), mother.pt(), mother.y(), pv0.pt(), weight); + } + } + if (pdg == -3312) { // Xi+ + registry.fill(HIST("collisions/XiPlusPtYAntiLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/XiPlusPtYAntiLambdaPtWrongColl"), mother.pt(), mother.y(), pv0.pt(), weight); + } + } + } + } + PROCESS_SWITCH(V0QA, processCollisionAssociation, "V0 collision association", false); + + void processCollisionAssociationJets(soa::Filtered::iterator const& jcoll, MCDV0JetsWithConstituents const& mcdjets, soa::Join const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + { + if (!jcoll.has_mcCollision()) { + return; + } + auto mcColl = jcoll.template mcCollision_as>(); + double weight = mcColl.weight(); + + for (const auto& mcdjet : mcdjets) { + // Eta cut? + for (const auto& v0 : mcdjet.template candidates_as>()) { + if (!v0.has_mcParticle()) { + continue; + } + + auto pv0 = v0.mcParticle(); + bool correctCollision = (mcColl.mcCollisionId() == pv0.mcCollisionId()); + int pdg = pv0.pdgCode(); + + // Check V0 decay kinematics + if (!isV0Reconstructed(jcoll, v0, pdg)) + continue; + + registry.fill(HIST("collisions/JetPtEtaV0Pt"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetPtEtaV0PtWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + } + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("collisions/JetPtEtaK0SPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetPtEtaK0SPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + } + } + if (pdg == 3122) { + registry.fill(HIST("collisions/JetPtEtaLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetPtEtaLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + } + } + if (pdg == -3122) { + registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMass"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetPtEtaAntiLambdaPtMassWrongColl"), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + } + } + + if (!v0.has_mcMotherParticle()) { + continue; + } + auto mother = v0.mcMotherParticle(); + pdg = mother.pdgCode(); + correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); + if (pdg == 3312) { // Xi- + registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetPtEtaXiMinusPtLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + } + } + if (pdg == -3312) { // Xi+ + registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPt"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + } + } + } // for v0s + } // for mcdjets + } + PROCESS_SWITCH(V0QA, processCollisionAssociationJets, "V0 in jets collision association", false); + + void processCollisionAssociationMatchedJets(soa::Filtered::iterator const& jcoll, MatchedMCDV0JetsWithConstituents const& mcdjets, MatchedMCPV0JetsWithConstituents const&, soa::Join const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&, aod::JetTracksMCD const& jTracks) + { + if (!jcoll.has_mcCollision()) { + return; + } + auto mcColl = jcoll.template mcCollision_as>(); + double weight = mcColl.weight(); + + for (const auto& mcdjet : mcdjets) { + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + for (const auto& v0 : mcdjet.template candidates_as>()) { + if (!v0.has_mcParticle()) + continue; + + for (const auto& pv0 : mcpjet.template candidates_as()) { + if (!V0sAreMatched(v0, pv0, jTracks)) + continue; + int pdg = pv0.pdgCode(); + bool correctCollision = (mcColl.mcCollisionId() == pv0.mcCollisionId()); + + // Check V0 decay kinematics + if (!isV0Reconstructed(jcoll, v0, pdg)) + continue; + + registry.fill(HIST("collisions/JetsPtEtaV0Pt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetsPtEtaV0PtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), weight); + } + if (TMath::Abs(pdg) == 310) { + registry.fill(HIST("collisions/JetsPtEtaK0SPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetsPtEtaK0SPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mK0Short(), weight); + } + } + if (pdg == 3122) { + registry.fill(HIST("collisions/JetsPtEtaLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetsPtEtaLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mLambda(), weight); + } + } + if (pdg == -3122) { + registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMass"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetsPtEtaAntiLambdaPtMassWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), pv0.pt(), v0.mAntiLambda(), weight); + } + } + + if (!v0.has_mcMotherParticle()) { + continue; + } + auto mother = v0.mcMotherParticle(); + pdg = mother.pdgCode(); + correctCollision = (mcColl.mcCollisionId() == mother.mcCollisionId()); + if (pdg == 3312) { // Xi- + registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetsPtEtaXiMinusPtLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + } + } + if (pdg == -3312) { // Xi+ + registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + if (!correctCollision) { + registry.fill(HIST("collisions/JetsPtEtaXiPlusPtAntiLambdaPtWrongColl"), mcpjet.pt(), mcdjet.pt(), mcdjet.eta(), mother.pt(), pv0.pt(), weight); + } + } + } // for pv0 + } // for v0 + } // for mcpjet + } // for mcdjet + } + PROCESS_SWITCH(V0QA, processCollisionAssociationMatchedJets, "V0 in matched jets collision association", false); + + void processFeeddown(soa::Filtered::iterator const& jcoll, CandidatesV0MCDWithFlags const& v0s, aod::CandidatesV0MCP const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + { + // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx + if (!jcoll.has_mcCollision()) { + return; + } + auto mcColl = jcoll.template mcCollision_as>(); + double weight = mcColl.weight(); + + for (const auto& v0 : v0s) { + if (!v0.has_mcParticle()) { + continue; + } + int pdg = v0.mcParticle().pdgCode(); + + // Check V0 decay kinematics + if (v0.isRejectedCandidate()) + continue; + // Feed-down from Xi + if (!v0.has_mcMotherParticle()) + continue; + + auto pv0 = v0.mcParticle(); + auto mother = v0.mcMotherParticle(); + pdg = mother.pdgCode(); + + if (pdg == 3312) { // Xi- + registry.fill(HIST("feeddown/XiMinusPtYLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); + } + if (pdg == -3312) { // Xi+ + registry.fill(HIST("feeddown/XiPlusPtYAntiLambdaPt"), mother.pt(), mother.y(), pv0.pt(), weight); + } + } + } + PROCESS_SWITCH(V0QA, processFeeddown, "Inclusive feeddown", false); + + void processFeeddownJets(soa::Filtered::iterator const& jcoll, MCDV0JetsWithConstituents const& mcdjets, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + { + // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx + if (!jcoll.has_mcCollision()) { + return; + } + auto mcColl = jcoll.template mcCollision_as>(); + double weight = mcColl.weight(); + + for (const auto& mcdjet : mcdjets) { + for (const auto& v0 : mcdjet.template candidates_as()) { + if (!v0.has_mcParticle()) { + continue; + } + int pdg = v0.mcParticle().pdgCode(); + + // Check V0 decay kinematics + if (v0.isRejectedCandidate()) + continue; + // Feed-down from Xi + if (!v0.has_mcMotherParticle()) + continue; + + auto pv0 = v0.mcParticle(); + auto mother = v0.mcMotherParticle(); + pdg = mother.pdgCode(); + + if (pdg == 3312) { // Xi- + registry.fill(HIST("feeddown/JetPtXiMinusPtLambdaPt"), mcdjet.pt(), mother.pt(), pv0.pt(), weight); + } + if (pdg == -3312) { // Xi+ + registry.fill(HIST("feeddown/JetPtXiPlusPtAntiLambdaPt"), mcdjet.pt(), mother.pt(), pv0.pt(), weight); + } + } + } + } + PROCESS_SWITCH(V0QA, processFeeddownJets, "Jets feeddown", false); + + void processFeeddownMatchedJets(soa::Filtered::iterator const& jcoll, MatchedMCDV0JetsWithConstituents const& mcdjets, aod::JetTracksMCD const& jTracks, MatchedMCPV0JetsWithConstituents const&, CandidatesV0MCDWithFlags const&, aod::CandidatesV0MCP const&, soa::Join const&, aod::McCollisions const&, aod::McParticles const&) + { + // Based on PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx + if (!jcoll.has_mcCollision()) { + return; + } + auto mcColl = jcoll.template mcCollision_as>(); + double weight = mcColl.weight(); + + for (const auto& mcdjet : mcdjets) { + for (const auto& mcpjet : mcdjet.template matchedJetGeo_as()) { + for (const auto& v0 : mcdjet.template candidates_as()) { + if (!v0.has_mcParticle()) + continue; + if (!v0.has_mcMotherParticle()) + continue; + + for (const auto& pv0 : mcpjet.template candidates_as()) { + if (!V0sAreMatched(v0, pv0, jTracks)) + continue; + + int pdg = v0.mcParticle().pdgCode(); + + // Check V0 decay kinematics + if (v0.isRejectedCandidate()) + continue; + + auto mother = v0.mcMotherParticle(); + pdg = mother.pdgCode(); + if (pdg == 3312) { // Xi- + registry.fill(HIST("feeddown/JetsPtXiMinusPtLambdaPt"), mcpjet.pt(), mcdjet.pt(), mother.pt(), pv0.pt(), weight); + } + if (pdg == -3312) { // Xi+ + registry.fill(HIST("feeddown/JetsPtXiPlusPtAntiLambdaPt"), mcpjet.pt(), mcdjet.pt(), mother.pt(), pv0.pt(), weight); + } + } + } + } + } + } + PROCESS_SWITCH(V0QA, processFeeddownMatchedJets, "Jets feeddown", false); + + using DaughterJTracks = soa::Join; + using DaughterTracks = soa::Join; + void processV0TrackQA(aod::JetCollision const& /*jcoll*/, soa::Join const& v0s, DaughterJTracks const&, DaughterTracks const&) + { + // if (!jetderiveddatautilities::selectCollision(jcoll, eventSelection)) { + // return; + // } + for (const auto& v0 : v0s) { + if (v0.isRejectedCandidate()) { + continue; + } + fillTrackQa(v0); + } + } + PROCESS_SWITCH(V0QA, processV0TrackQA, "V0 track QA", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"jet-v0qa"})}; +} diff --git a/PWGLF/DataModel/LFEbyeTables.h b/PWGLF/DataModel/LFEbyeTables.h index b102ad97030..d7ff437ece4 100644 --- a/PWGLF/DataModel/LFEbyeTables.h +++ b/PWGLF/DataModel/LFEbyeTables.h @@ -22,7 +22,7 @@ namespace LFEbyeCollTable { DECLARE_SOA_COLUMN(Centrality, centrality, uint8_t); DECLARE_SOA_COLUMN(Zvtx, zvtx, float); -DECLARE_SOA_COLUMN(ZvtxMask, zvtxMask, uint8_t); +DECLARE_SOA_COLUMN(ZvtxMask, zvtxMask, int8_t); DECLARE_SOA_COLUMN(TriggerMask, triggerMask, uint8_t); DECLARE_SOA_COLUMN(Ntracklets, ntracklets, uint8_t); DECLARE_SOA_COLUMN(V0Multiplicity, v0Multiplicity, uint8_t); @@ -66,10 +66,10 @@ DECLARE_SOA_COLUMN(GenPt, genPt, float); DECLARE_SOA_COLUMN(GenEta, genEta, float); DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); DECLARE_SOA_COLUMN(IsReco, isReco, bool); -DECLARE_SOA_COLUMN(EtaMask, etaMask, uint8_t); +DECLARE_SOA_COLUMN(EtaMask, etaMask, int8_t); DECLARE_SOA_COLUMN(SelMask, selMask, int); DECLARE_SOA_COLUMN(OuterPID, outerPID, float); -DECLARE_SOA_COLUMN(GenEtaMask, genEtaMask, uint8_t); +DECLARE_SOA_COLUMN(GenEtaMask, genEtaMask, int8_t); } // namespace LFEbyeTable DECLARE_SOA_TABLE(NucleiEbyeTables, "AOD", "NUCLEBYETABLE", diff --git a/PWGLF/DataModel/LFHStrangeCorrelationTables.h b/PWGLF/DataModel/LFHStrangeCorrelationTables.h index b800182e28f..1b31239f406 100644 --- a/PWGLF/DataModel/LFHStrangeCorrelationTables.h +++ b/PWGLF/DataModel/LFHStrangeCorrelationTables.h @@ -39,8 +39,9 @@ namespace triggerTracks DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! DECLARE_SOA_COLUMN(MCPhysicalPrimary, mcPhysicalPrimary, bool); // true physical primary flag DECLARE_SOA_INDEX_COLUMN_FULL(Track, track, int, Tracks, "_Trigger"); //! +DECLARE_SOA_COLUMN(MCOriginalPt, mcOriginalPt, float); // true generated pt } // namespace triggerTracks -DECLARE_SOA_TABLE(TriggerTracks, "AOD", "TRIGGERTRACKS", o2::soa::Index<>, triggerTracks::CollisionId, triggerTracks::MCPhysicalPrimary, triggerTracks::TrackId); +DECLARE_SOA_TABLE(TriggerTracks, "AOD", "TRIGGERTRACKS", o2::soa::Index<>, triggerTracks::CollisionId, triggerTracks::MCPhysicalPrimary, triggerTracks::TrackId, triggerTracks::MCOriginalPt); /// _________________________________________ /// Table for storing assoc track indices namespace assocPions 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 50c5acb5cca..486e44575ee 100644 --- a/PWGLF/DataModel/LFLithium4Tables.h +++ b/PWGLF/DataModel/LFLithium4Tables.h @@ -44,6 +44,8 @@ DECLARE_SOA_COLUMN(InnerParamTPCPr, innerParamTPCPr, float); DECLARE_SOA_COLUMN(NClsTPCHe3, nClsTPCHe3, uint8_t); DECLARE_SOA_COLUMN(NSigmaTPCHe3, nSigmaTPCHe3, float); DECLARE_SOA_COLUMN(NSigmaTPCPr, nSigmaTOFPr, float); +DECLARE_SOA_COLUMN(Chi2TPCHe3, chi2TPCHe3, float); +DECLARE_SOA_COLUMN(Chi2TPCPr, chi2TPCPr, float); DECLARE_SOA_COLUMN(MassTOFHe3, massTOFHe3, float); DECLARE_SOA_COLUMN(MassTOFPr, massTOFPr, float); DECLARE_SOA_COLUMN(PIDtrkHe3, pidTrkHe3, uint32_t); @@ -59,10 +61,18 @@ DECLARE_SOA_COLUMN(IsBkgLS, isBkgLS, 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(PtMCPr, ptMCPr, float); +DECLARE_SOA_COLUMN(EtaMCPr, etaMCPr, float); +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", @@ -83,6 +93,8 @@ DECLARE_SOA_TABLE(Lithium4Table, "AOD", "LITHIUM4TABLE", Lithium4TablesNS::NClsTPCHe3, Lithium4TablesNS::NSigmaTPCHe3, Lithium4TablesNS::NSigmaTPCPr, + Lithium4TablesNS::Chi2TPCHe3, + Lithium4TablesNS::Chi2TPCPr, Lithium4TablesNS::MassTOFHe3, Lithium4TablesNS::MassTOFPr, Lithium4TablesNS::PIDtrkHe3, @@ -94,37 +106,18 @@ 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::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, Lithium4TablesNS::PtMCPr, + Lithium4TablesNS::EtaMCPr, + 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/LFLnnTables.h b/PWGLF/DataModel/LFLnnTables.h index 2ee0fa22839..f9ab7fe3989 100644 --- a/PWGLF/DataModel/LFLnnTables.h +++ b/PWGLF/DataModel/LFLnnTables.h @@ -58,6 +58,8 @@ DECLARE_SOA_COLUMN(TPCsignalPi, tpcSignalPi, uint16_t); // TPC 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(TPCmom3H, tpcMom3H, float); // TPC momentum of the 3H daughter DECLARE_SOA_COLUMN(TPCmomPi, tpcMomPi, float); // TPC momentum of the Pi daughter +DECLARE_SOA_COLUMN(MassTrTOF, mass2TrTOF, float); // TOF 3H mass +DECLARE_SOA_COLUMN(TPCchi3H, tpcChi3H, float); // tpcChi3H DECLARE_SOA_COLUMN(ITSclusterSizes3H, itsClusterSizes3H, uint32_t); // ITS cluster size of the 3H daughter DECLARE_SOA_COLUMN(ITSclusterSizesPi, itsClusterSizesPi, uint32_t); // ITS cluster size of the Pi daughter DECLARE_SOA_COLUMN(Dca3H, dca3H, float); // DCA between 3H daughter and V0 @@ -87,6 +89,7 @@ DECLARE_SOA_TABLE(DataLnnCands, "AOD", "LNNCANDS", lnnrec::DcaV0Daug, lnnrec::Dca3H, lnnrec::DcaPi, lnnrec::NSigma3H, lnnrec::NTPCclus3H, lnnrec::NTPCclusPi, lnnrec::TPCmom3H, lnnrec::TPCmomPi, lnnrec::TPCsignal3H, lnnrec::TPCsignalPi, + lnnrec::MassTrTOF, lnnrec::TPCchi3H, lnnrec::ITSclusterSizes3H, lnnrec::ITSclusterSizesPi, lnnrec::Flags); @@ -102,6 +105,7 @@ DECLARE_SOA_TABLE(MCLnnCands, "AOD", "MCLNNCANDS", lnnrec::DcaV0Daug, lnnrec::Dca3H, lnnrec::DcaPi, lnnrec::NSigma3H, lnnrec::NTPCclus3H, lnnrec::NTPCclusPi, lnnrec::TPCmom3H, lnnrec::TPCmomPi, lnnrec::TPCsignal3H, lnnrec::TPCsignalPi, + lnnrec::MassTrTOF, lnnrec::TPCchi3H, lnnrec::ITSclusterSizes3H, lnnrec::ITSclusterSizesPi, lnnrec::Flags, lnnrec::GenPt, @@ -119,4 +123,4 @@ using DataLnnCand = DataLnnCands::iterator; using MCLnnCand = MCLnnCands::iterator; } // namespace o2::aod -#endif // PWGLF_DATAMODEL_LFLNNTABLES_H_ \ No newline at end of file +#endif // PWGLF_DATAMODEL_LFLNNTABLES_H_ diff --git a/PWGLF/DataModel/LFNonPromptCascadeTables.h b/PWGLF/DataModel/LFNonPromptCascadeTables.h index 72654d0f530..4bdca4b9c97 100644 --- a/PWGLF/DataModel/LFNonPromptCascadeTables.h +++ b/PWGLF/DataModel/LFNonPromptCascadeTables.h @@ -28,7 +28,9 @@ DECLARE_SOA_COLUMN(MatchingChi2, matchingChi2, float); DECLARE_SOA_COLUMN(ITSClusSize, itsClusSize, float); DECLARE_SOA_COLUMN(IsGoodMatch, isGoodMatch, bool); DECLARE_SOA_COLUMN(IsGoodCascade, isGoodCascade, bool); -DECLARE_SOA_COLUMN(PdgCodePrimary, pdgCodePrimary, int); +DECLARE_SOA_COLUMN(PdgCodeMom, pdgCodeMom, int); +DECLARE_SOA_COLUMN(IsFromBeauty, isFromBeauty, bool); +DECLARE_SOA_COLUMN(IsFromCharm, isFromCharm, bool); DECLARE_SOA_COLUMN(PvX, pvX, float); DECLARE_SOA_COLUMN(PvY, pvY, float); @@ -162,7 +164,9 @@ DECLARE_SOA_TABLE(NPCascTableMC, "AOD", "NPCASCTABLEMC", NPCascadeTable::ITSClusSize, NPCascadeTable::IsGoodMatch, NPCascadeTable::IsGoodCascade, - NPCascadeTable::PdgCodePrimary, + NPCascadeTable::PdgCodeMom, + NPCascadeTable::IsFromBeauty, + NPCascadeTable::IsFromCharm, NPCascadeTable::PvX, NPCascadeTable::PvY, NPCascadeTable::PvZ, @@ -222,6 +226,18 @@ DECLARE_SOA_TABLE(NPCascTableMC, "AOD", "NPCASCTABLEMC", NPCascadeTable::DCAzMC, NPCascadeTable::MCcollisionMatch) +DECLARE_SOA_TABLE(NPCascTableGen, "AOD", "NPCASCTABLEGen", + NPCascadeTable::gPt, + NPCascadeTable::gEta, + NPCascadeTable::gPhi, + NPCascadeTable::PDGcode, + NPCascadeTable::PdgCodeMom, + NPCascadeTable::DCAxMC, + NPCascadeTable::DCAyMC, + NPCascadeTable::DCAzMC, + NPCascadeTable::IsFromBeauty, + NPCascadeTable::IsFromCharm) + } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFNONPROMPTCASCADETABLES_H_ 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 18658529dda..609137d3b16 100644 --- a/PWGLF/DataModel/LFResonanceTables.h +++ b/PWGLF/DataModel/LFResonanceTables.h @@ -82,7 +82,8 @@ DECLARE_SOA_TABLE(ResoCollisions, "AOD", "RESOCOLLISION", resocollision::EvtPlResAC, resocollision::EvtPlResBC, resocollision::BMagField, - timestamp::Timestamp); + timestamp::Timestamp, + evsel::NumTracksInTimeRange); using ResoCollision = ResoCollisions::iterator; DECLARE_SOA_TABLE(ResoMCCollisions, "AOD", "RESOMCCOL", @@ -122,19 +123,37 @@ 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(DaughterTPCNSigmaPi1, daughterTPCNSigmaPi1, float); //! TPC PID of the first daughter as Pion +DECLARE_SOA_COLUMN(DaughterTPCNSigmaKa1, daughterTPCNSigmaKa1, float); //! TPC PID of the first daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPr1, daughterTPCNSigmaPr1, float); //! TPC PID of the first daughter as Proton +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPi2, daughterTPCNSigmaPi2, float); //! TPC PID of the second daughter as Pion +DECLARE_SOA_COLUMN(DaughterTPCNSigmaKa2, daughterTPCNSigmaKa2, float); //! TPC PID of the second daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPr2, daughterTPCNSigmaPr2, float); //! TPC PID of the second daughter as Proton +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPiBach, daughterTPCNSigmaPiBach, float); //! TPC PID of the bachelor daughter as Pion +DECLARE_SOA_COLUMN(DaughterTPCNSigmaKaBach, daughterTPCNSigmaKaBach, float); //! TPC PID of the bachelor daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTPCNSigmaPrBach, daughterTPCNSigmaPrBach, float); //! TPC PID of the bachelor daughter as Proton +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPi1, daughterTOFNSigmaPi1, float); //! TOF PID of the first daughter as Pion +DECLARE_SOA_COLUMN(DaughterTOFNSigmaKa1, daughterTOFNSigmaKa1, float); //! TOF PID of the first daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPr1, daughterTOFNSigmaPr1, float); //! TOF PID of the first daughter as Proton +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPi2, daughterTOFNSigmaPi2, float); //! TOF PID of the second daughter as Pion +DECLARE_SOA_COLUMN(DaughterTOFNSigmaKa2, daughterTOFNSigmaKa2, float); //! TOF PID of the second daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPr2, daughterTOFNSigmaPr2, float); //! TOF PID of the second daughter as Proton +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPiBach, daughterTOFNSigmaPiBach, float); //! TOF PID of the bachelor daughter as Pion +DECLARE_SOA_COLUMN(DaughterTOFNSigmaKaBach, daughterTOFNSigmaKaBach, float); //! TOF PID of the bachelor daughter as Kaon +DECLARE_SOA_COLUMN(DaughterTOFNSigmaPrBach, daughterTOFNSigmaPrBach, 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); @@ -199,6 +218,18 @@ DECLARE_SOA_TABLE(ResoV0s, "AOD", "RESOV0S", resodaughter::Eta, resodaughter::Phi, resodaughter::Indices, + resodaughter::DaughterTPCNSigmaPi1, + resodaughter::DaughterTPCNSigmaKa1, + resodaughter::DaughterTPCNSigmaPr1, + resodaughter::DaughterTPCNSigmaPi2, + resodaughter::DaughterTPCNSigmaKa2, + resodaughter::DaughterTPCNSigmaPr2, + resodaughter::DaughterTOFNSigmaPi1, + resodaughter::DaughterTOFNSigmaKa1, + resodaughter::DaughterTOFNSigmaPr1, + resodaughter::DaughterTOFNSigmaPi2, + resodaughter::DaughterTOFNSigmaKa2, + resodaughter::DaughterTOFNSigmaPr2, resodaughter::V0CosPA, resodaughter::DaughDCA, v0data::DCAPosToPV, @@ -223,6 +254,24 @@ DECLARE_SOA_TABLE(ResoCascades, "AOD", "RESOCASCADES", resodaughter::Eta, resodaughter::Phi, resodaughter::CascadeIndices, + resodaughter::DaughterTPCNSigmaPi1, + resodaughter::DaughterTPCNSigmaKa1, + resodaughter::DaughterTPCNSigmaPr1, + resodaughter::DaughterTPCNSigmaPi2, + resodaughter::DaughterTPCNSigmaKa2, + resodaughter::DaughterTPCNSigmaPr2, + resodaughter::DaughterTPCNSigmaPiBach, + resodaughter::DaughterTPCNSigmaKaBach, + resodaughter::DaughterTPCNSigmaPrBach, + resodaughter::DaughterTOFNSigmaPi1, + resodaughter::DaughterTOFNSigmaKa1, + resodaughter::DaughterTOFNSigmaPr1, + resodaughter::DaughterTOFNSigmaPi2, + resodaughter::DaughterTOFNSigmaKa2, + resodaughter::DaughterTOFNSigmaPr2, + resodaughter::DaughterTOFNSigmaPiBach, + resodaughter::DaughterTOFNSigmaKaBach, + resodaughter::DaughterTOFNSigmaPrBach, resodaughter::V0CosPA, resodaughter::CascCosPA, resodaughter::DaughDCA, diff --git a/PWGLF/DataModel/LFSigmaTables.h b/PWGLF/DataModel/LFSigmaTables.h index b5a909733c7..136f000316f 100644 --- a/PWGLF/DataModel/LFSigmaTables.h +++ b/PWGLF/DataModel/LFSigmaTables.h @@ -31,36 +31,32 @@ DECLARE_SOA_TABLE(Sigma0Collisions, "AOD", "SIGMA0COLLISION", //! basic collisio using Sigma0Collision = Sigma0Collisions::iterator; -namespace v0SigmaCandidate +namespace sigma0Core { //______________________________________________________ // REGULAR COLUMNS FOR INDEXING // FOR DERIVED DECLARE_SOA_INDEX_COLUMN(Sigma0Collision, sigma0Collision); //! -} // namespace v0SigmaCandidate +} // namespace sigma0Core // for real data -namespace v0SigmaCandidate +namespace sigma0Core { DECLARE_SOA_COLUMN(SigmapT, sigmapT, float); DECLARE_SOA_COLUMN(SigmaMass, sigmaMass, float); DECLARE_SOA_COLUMN(SigmaRapidity, sigmaRapidity, float); -// DECLARE_SOA_COLUMN(SigmaDCAz, sigmaDCAz, float); -// DECLARE_SOA_COLUMN(SigmaDCAxy, sigmaDCAxy, float); -// DECLARE_SOA_COLUMN(SigmaDCADau, sigmaDCADau, float); +} // namespace sigma0Core -} // namespace v0SigmaCandidate +DECLARE_SOA_TABLE(Sigma0Cores, "AOD", "SIGMA0CORES", + sigma0Core::SigmapT, + sigma0Core::SigmaMass, + sigma0Core::SigmaRapidity); -DECLARE_SOA_TABLE(V0SigmaCandidates, "AOD", "V0SIGMAS", - v0SigmaCandidate::SigmapT, - v0SigmaCandidate::SigmaMass, - v0SigmaCandidate::SigmaRapidity); - -DECLARE_SOA_TABLE(V0Sigma0CollRefs, "AOD", "V0SIGMA0COLLREF", //! optional table to refer back to a collision - o2::soa::Index<>, v0SigmaCandidate::Sigma0CollisionId); +DECLARE_SOA_TABLE(Sigma0CollRefs, "AOD", "SIGMA0COLLREF", //! optional table to refer back to a collision + o2::soa::Index<>, sigma0Core::Sigma0CollisionId); // For Photon extra info -namespace v0SigmaPhotonExtras +namespace sigmaPhotonExtra { DECLARE_SOA_COLUMN(PhotonPt, photonPt, float); DECLARE_SOA_COLUMN(PhotonMass, photonMass, float); @@ -92,44 +88,45 @@ DECLARE_SOA_COLUMN(PhotonNegITSClSize, photonNegITSClSize, uint32_t); DECLARE_SOA_COLUMN(PhotonV0Type, photonV0Type, uint8_t); DECLARE_SOA_COLUMN(GammaBDTScore, gammaBDTScore, float); -} // namespace v0SigmaPhotonExtras - -DECLARE_SOA_TABLE(V0SigmaPhotonExtras, "AOD", "V0SIGMAPHOTON", - v0SigmaPhotonExtras::PhotonMass, - v0SigmaPhotonExtras::PhotonPt, - v0SigmaPhotonExtras::PhotonQt, - v0SigmaPhotonExtras::PhotonAlpha, - v0SigmaPhotonExtras::PhotonRadius, - v0SigmaPhotonExtras::PhotonCosPA, - v0SigmaPhotonExtras::PhotonDCADau, - v0SigmaPhotonExtras::PhotonDCANegPV, - v0SigmaPhotonExtras::PhotonDCAPosPV, - v0SigmaPhotonExtras::PhotonZconv, - v0SigmaPhotonExtras::PhotonEta, - v0SigmaPhotonExtras::PhotonY, - v0SigmaPhotonExtras::PhotonPosTPCNSigma, - v0SigmaPhotonExtras::PhotonNegTPCNSigma, - v0SigmaPhotonExtras::PhotonPosTPCCrossedRows, - v0SigmaPhotonExtras::PhotonNegTPCCrossedRows, - v0SigmaPhotonExtras::PhotonPosPt, - v0SigmaPhotonExtras::PhotonNegPt, - v0SigmaPhotonExtras::PhotonPosEta, - v0SigmaPhotonExtras::PhotonNegEta, - v0SigmaPhotonExtras::PhotonPosY, - v0SigmaPhotonExtras::PhotonNegY, - v0SigmaPhotonExtras::PhotonPsiPair, - v0SigmaPhotonExtras::PhotonPosITSCls, - v0SigmaPhotonExtras::PhotonNegITSCls, - v0SigmaPhotonExtras::PhotonPosITSClSize, - v0SigmaPhotonExtras::PhotonNegITSClSize, - v0SigmaPhotonExtras::PhotonV0Type, - v0SigmaPhotonExtras::GammaBDTScore); +} // namespace sigmaPhotonExtra + +DECLARE_SOA_TABLE(SigmaPhotonExtras, "AOD", "SIGMA0PHOTON", + sigmaPhotonExtra::PhotonPt, + sigmaPhotonExtra::PhotonMass, + sigmaPhotonExtra::PhotonQt, + sigmaPhotonExtra::PhotonAlpha, + sigmaPhotonExtra::PhotonRadius, + sigmaPhotonExtra::PhotonCosPA, + sigmaPhotonExtra::PhotonDCADau, + sigmaPhotonExtra::PhotonDCANegPV, + sigmaPhotonExtra::PhotonDCAPosPV, + sigmaPhotonExtra::PhotonZconv, + sigmaPhotonExtra::PhotonEta, + sigmaPhotonExtra::PhotonY, + sigmaPhotonExtra::PhotonPosTPCNSigma, + sigmaPhotonExtra::PhotonNegTPCNSigma, + sigmaPhotonExtra::PhotonPosTPCCrossedRows, + sigmaPhotonExtra::PhotonNegTPCCrossedRows, + sigmaPhotonExtra::PhotonPosPt, + sigmaPhotonExtra::PhotonNegPt, + sigmaPhotonExtra::PhotonPosEta, + sigmaPhotonExtra::PhotonNegEta, + sigmaPhotonExtra::PhotonPosY, + sigmaPhotonExtra::PhotonNegY, + sigmaPhotonExtra::PhotonPsiPair, + sigmaPhotonExtra::PhotonPosITSCls, + sigmaPhotonExtra::PhotonNegITSCls, + sigmaPhotonExtra::PhotonPosITSClSize, + sigmaPhotonExtra::PhotonNegITSClSize, + sigmaPhotonExtra::PhotonV0Type, + sigmaPhotonExtra::GammaBDTScore); // For Lambda extra info -namespace v0SigmaLambdaExtras +namespace sigmaLambdaExtra { DECLARE_SOA_COLUMN(LambdaPt, lambdaPt, float); DECLARE_SOA_COLUMN(LambdaMass, lambdaMass, float); +DECLARE_SOA_COLUMN(AntiLambdaMass, antilambdaMass, float); DECLARE_SOA_COLUMN(LambdaQt, lambdaQt, float); DECLARE_SOA_COLUMN(LambdaAlpha, lambdaAlpha, float); DECLARE_SOA_COLUMN(LambdaRadius, lambdaRadius, float); @@ -161,51 +158,54 @@ DECLARE_SOA_COLUMN(LambdaV0Type, lambdaV0Type, uint8_t); DECLARE_SOA_COLUMN(LambdaBDTScore, lambdaBDTScore, float); DECLARE_SOA_COLUMN(AntiLambdaBDTScore, antilambdaBDTScore, float); -} // namespace v0SigmaLambdaExtras - -DECLARE_SOA_TABLE(V0SigmaLambdaExtras, "AOD", "V0SIGMALAMBDA", - v0SigmaLambdaExtras::LambdaPt, - v0SigmaLambdaExtras::LambdaMass, - v0SigmaLambdaExtras::LambdaQt, - v0SigmaLambdaExtras::LambdaAlpha, - v0SigmaLambdaExtras::LambdaRadius, - v0SigmaLambdaExtras::LambdaCosPA, - v0SigmaLambdaExtras::LambdaDCADau, - v0SigmaLambdaExtras::LambdaDCANegPV, - v0SigmaLambdaExtras::LambdaDCAPosPV, - v0SigmaLambdaExtras::LambdaEta, - v0SigmaLambdaExtras::LambdaY, - v0SigmaLambdaExtras::LambdaPosPrTPCNSigma, - v0SigmaLambdaExtras::LambdaPosPiTPCNSigma, - v0SigmaLambdaExtras::LambdaNegPrTPCNSigma, - v0SigmaLambdaExtras::LambdaNegPiTPCNSigma, - v0SigmaLambdaExtras::LambdaPosTPCCrossedRows, - v0SigmaLambdaExtras::LambdaNegTPCCrossedRows, - v0SigmaLambdaExtras::LambdaPosPt, - v0SigmaLambdaExtras::LambdaNegPt, - v0SigmaLambdaExtras::LambdaPosEta, - v0SigmaLambdaExtras::LambdaNegEta, - v0SigmaLambdaExtras::LambdaPosPrY, - v0SigmaLambdaExtras::LambdaPosPiY, - v0SigmaLambdaExtras::LambdaNegPrY, - v0SigmaLambdaExtras::LambdaNegPiY, - v0SigmaLambdaExtras::LambdaPosITSCls, - v0SigmaLambdaExtras::LambdaNegITSCls, - v0SigmaLambdaExtras::LambdaPosITSClSize, - v0SigmaLambdaExtras::LambdaNegITSClSize, - v0SigmaLambdaExtras::LambdaV0Type, - v0SigmaLambdaExtras::LambdaBDTScore, - v0SigmaLambdaExtras::AntiLambdaBDTScore); +} // namespace sigmaLambdaExtra + +DECLARE_SOA_TABLE(SigmaLambdaExtras, "AOD", "SIGMA0LAMBDA", + sigmaLambdaExtra::LambdaPt, + sigmaLambdaExtra::LambdaMass, + sigmaLambdaExtra::AntiLambdaMass, + sigmaLambdaExtra::LambdaQt, + sigmaLambdaExtra::LambdaAlpha, + sigmaLambdaExtra::LambdaRadius, + sigmaLambdaExtra::LambdaCosPA, + sigmaLambdaExtra::LambdaDCADau, + sigmaLambdaExtra::LambdaDCANegPV, + sigmaLambdaExtra::LambdaDCAPosPV, + sigmaLambdaExtra::LambdaEta, + sigmaLambdaExtra::LambdaY, + sigmaLambdaExtra::LambdaPosPrTPCNSigma, + sigmaLambdaExtra::LambdaPosPiTPCNSigma, + sigmaLambdaExtra::LambdaNegPrTPCNSigma, + sigmaLambdaExtra::LambdaNegPiTPCNSigma, + sigmaLambdaExtra::LambdaPosTPCCrossedRows, + sigmaLambdaExtra::LambdaNegTPCCrossedRows, + sigmaLambdaExtra::LambdaPosPt, + sigmaLambdaExtra::LambdaNegPt, + sigmaLambdaExtra::LambdaPosEta, + sigmaLambdaExtra::LambdaNegEta, + sigmaLambdaExtra::LambdaPosPrY, + sigmaLambdaExtra::LambdaPosPiY, + sigmaLambdaExtra::LambdaNegPrY, + sigmaLambdaExtra::LambdaNegPiY, + sigmaLambdaExtra::LambdaPosITSCls, + sigmaLambdaExtra::LambdaNegITSCls, + sigmaLambdaExtra::LambdaPosITSClSize, + sigmaLambdaExtra::LambdaNegITSClSize, + sigmaLambdaExtra::LambdaV0Type, + sigmaLambdaExtra::LambdaBDTScore, + sigmaLambdaExtra::AntiLambdaBDTScore); // for MC data -namespace v0SigmaMCCandidate +namespace sigmaMCCore { DECLARE_SOA_COLUMN(IsSigma, isSigma, bool); +DECLARE_SOA_COLUMN(IsAntiSigma, isAntiSigma, bool); -} // namespace v0SigmaMCCandidate +} // namespace sigmaMCCore -DECLARE_SOA_TABLE(V0SigmaMCCandidates, "AOD", "V0MCSIGMAS", - v0SigmaMCCandidate::IsSigma); +DECLARE_SOA_TABLE(SigmaMCCores, "AOD", "SIGMA0MCCORES", + sigmaMCCore::IsSigma, + sigmaMCCore::IsAntiSigma); } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFSIGMATABLES_H_ diff --git a/PWGLF/DataModel/LFSlimNucleiTables.h b/PWGLF/DataModel/LFSlimNucleiTables.h index afc076d1a54..19c42ed12f9 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); @@ -79,6 +80,7 @@ DECLARE_SOA_TABLE(NucleiTable, "AOD", "NUCLEITABLE", NucleiTableNS::TPCsignal, NucleiTableNS::ITSchi2, NucleiTableNS::TPCchi2, + NucleiTableNS::TOFchi2, NucleiTableNS::Flags, NucleiTableNS::TPCfindableCls, NucleiTableNS::TPCcrossedRows, @@ -113,6 +115,7 @@ DECLARE_SOA_TABLE(NucleiTableMC, "AOD", "NUCLEITABLEMC", NucleiTableNS::TPCsignal, NucleiTableNS::ITSchi2, NucleiTableNS::TPCchi2, + NucleiTableNS::TOFchi2, NucleiTableNS::Flags, NucleiTableNS::TPCfindableCls, NucleiTableNS::TPCcrossedRows, diff --git a/PWGLF/DataModel/LFStrangenessMLTables.h b/PWGLF/DataModel/LFStrangenessMLTables.h index fdb97e1ca1b..abae8814856 100644 --- a/PWGLF/DataModel/LFStrangenessMLTables.h +++ b/PWGLF/DataModel/LFStrangenessMLTables.h @@ -235,6 +235,18 @@ DECLARE_SOA_TABLE(CascMLCandidates, "AOD", "CAMLCANDIDATES", cascmlcandidates::IsXiPlus, cascmlcandidates::IsOmegaMinus, cascmlcandidates::IsOmegaPlus); + +namespace CascMLSelection +{ +DECLARE_SOA_COLUMN(XiBDTScore, xiBDTScore, float); +DECLARE_SOA_COLUMN(OmegaBDTScore, omegaBDTScore, float); +} // namespace CascMLSelection + +DECLARE_SOA_TABLE(CascXiMLScores, "AOD", "CASCXIMLSCORES", + CascMLSelection::XiBDTScore); +DECLARE_SOA_TABLE(CascOmMLScores, "AOD", "CASCOMMLSCORES", + CascMLSelection::OmegaBDTScore); + } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFSTRANGENESSMLTABLES_H_ diff --git a/PWGLF/DataModel/LFStrangenessTables.h b/PWGLF/DataModel/LFStrangenessTables.h index 2e77610a4c6..a9ad398c043 100644 --- a/PWGLF/DataModel/LFStrangenessTables.h +++ b/PWGLF/DataModel/LFStrangenessTables.h @@ -27,6 +27,15 @@ namespace o2::aod { +// for DF name follow-up and debug +namespace straorigin +{ +DECLARE_SOA_COLUMN(DataframeID, dataframeID, uint64_t); //! Data frame ID (what is usually found in directory name in the AO2D.root, i.e. +} // namespace straorigin + +DECLARE_SOA_TABLE(StraOrigins, "AOD", "STRAORIGIN", //! Table which contains the IDs of all dataframes merged into this dataframe + o2::soa::Index<>, straorigin::DataframeID); + namespace stracollision { DECLARE_SOA_DYNAMIC_COLUMN(IsUPC, isUPC, //! check whether this is a UPC or hadronic collision @@ -130,6 +139,75 @@ DECLARE_SOA_TABLE_VERSIONED(StraEvSels_001, "AOD", "STRAEVSELS", 1, //! // stracollision::EnergyCommonZNC, stracollision::IsUPC); +DECLARE_SOA_TABLE_VERSIONED(StraEvSels_002, "AOD", "STRAEVSELS", 2, //! 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 + 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 + + // 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_003, "AOD", "STRAEVSELS", 3, //! 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 + + // Dynamic columns for manipulating information + // stracollision::TotalFV0AmplitudeA, + // stracollision::TotalFT0AmplitudeA, + // stracollision::TotalFT0AmplitudeC, + // stracollision::TotalFDDAmplitudeA, + // stracollision::TotalFDDAmplitudeC, + // stracollision::EnergyCommonZNA, + // stracollision::EnergyCommonZNC, + stracollision::IsUPC); + DECLARE_SOA_TABLE(StraFT0AQVs, "AOD", "STRAFT0AQVS", //! t0a Qvec qvec::QvecFT0ARe, qvec::QvecFT0AIm, qvec::SumAmplFT0A); DECLARE_SOA_TABLE(StraFT0CQVs, "AOD", "STRAFT0CQVS", //! t0c Qvec @@ -147,7 +225,7 @@ DECLARE_SOA_TABLE(StraStamps, "AOD", "STRASTAMPS", //! information for ID-ing ma bc::RunNumber, timestamp::Timestamp); using StraRawCents = StraRawCents_004; -using StraEvSels = StraEvSels_001; +using StraEvSels = StraEvSels_003; using StraCollision = StraCollisions::iterator; using StraCent = StraCents::iterator; @@ -551,110 +629,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, @@ -730,60 +760,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>); @@ -792,11 +822,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; @@ -965,13 +992,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 @@ -1341,11 +1377,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", //! @@ -1421,6 +1466,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..eb923a31746 --- /dev/null +++ b/PWGLF/DataModel/LFhe3HadronTables.h @@ -0,0 +1,124 @@ +// 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(IsBkgLS, isBkgLS, 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(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::IsBkgLS, + 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::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 82d622e2c8c..bc92d39a4b7 100644 --- a/PWGLF/DataModel/SPCalibrationTables.h +++ b/PWGLF/DataModel/SPCalibrationTables.h @@ -31,15 +31,19 @@ namespace spcalibrationtable DECLARE_SOA_COLUMN(TriggerEvent, triggerevent, bool); DECLARE_SOA_COLUMN(TriggerEventRunNo, triggereventrunno, 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(ZNAEN1, znaen1, float); -DECLARE_SOA_COLUMN(ZNAEN2, znaen2, float); -DECLARE_SOA_COLUMN(ZNAEN3, znaen3, float); -DECLARE_SOA_COLUMN(ZNAEN4, znaen4, float); -DECLARE_SOA_COLUMN(ZNCEN1, zncen1, float); -DECLARE_SOA_COLUMN(ZNCEN2, zncen2, float); -DECLARE_SOA_COLUMN(ZNCEN3, zncen3, float); -DECLARE_SOA_COLUMN(ZNCEN4, zncen4, float); +DECLARE_SOA_COLUMN(ZNAC, znaC, float); +DECLARE_SOA_COLUMN(ZNCC, zncC, float); +DECLARE_SOA_COLUMN(ZNAE0, znaE0, float); +DECLARE_SOA_COLUMN(ZNAE1, znaE1, float); +DECLARE_SOA_COLUMN(ZNAE2, znaE2, float); +DECLARE_SOA_COLUMN(ZNAE3, znaE3, float); +DECLARE_SOA_COLUMN(ZNCE0, zncE0, float); +DECLARE_SOA_COLUMN(ZNCE1, zncE1, float); +DECLARE_SOA_COLUMN(ZNCE2, zncE2, float); +DECLARE_SOA_COLUMN(ZNCE3, zncE3, float); DECLARE_SOA_COLUMN(QXZDCA, qxZDCA, float); DECLARE_SOA_COLUMN(QXZDCC, qxZDCC, float); DECLARE_SOA_COLUMN(QYZDCA, qyZDCA, float); @@ -51,15 +55,19 @@ DECLARE_SOA_TABLE(SPCalibrationTables, "AOD", "SPCALCOLS", spcalibrationtable::TriggerEvent, spcalibrationtable::TriggerEventRunNo, spcalibrationtable::Cent, + spcalibrationtable::Vx, + spcalibrationtable::Vy, spcalibrationtable::Vz, - spcalibrationtable::ZNAEN1, - spcalibrationtable::ZNAEN2, - spcalibrationtable::ZNAEN3, - spcalibrationtable::ZNAEN4, - spcalibrationtable::ZNCEN1, - spcalibrationtable::ZNCEN2, - spcalibrationtable::ZNCEN3, - spcalibrationtable::ZNCEN4, + spcalibrationtable::ZNAC, + spcalibrationtable::ZNCC, + spcalibrationtable::ZNAE0, + spcalibrationtable::ZNAE1, + spcalibrationtable::ZNAE2, + spcalibrationtable::ZNAE3, + spcalibrationtable::ZNCE0, + spcalibrationtable::ZNCE1, + spcalibrationtable::ZNCE2, + spcalibrationtable::ZNCE3, spcalibrationtable::QXZDCA, spcalibrationtable::QXZDCC, spcalibrationtable::QYZDCA, diff --git a/PWGLF/DataModel/V0SelectorTables.h b/PWGLF/DataModel/V0SelectorTables.h new file mode 100644 index 00000000000..1283c754819 --- /dev/null +++ b/PWGLF/DataModel/V0SelectorTables.h @@ -0,0 +1,49 @@ +// 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 PWGLF_DATAMODEL_V0SELECTORTABLES_H_ +#define PWGLF_DATAMODEL_V0SELECTORTABLES_H_ + +#include +#include +namespace o2::aod +{ + +namespace v0flags +{ + +enum V0Flags : uint8_t { + FK0S = 0x1, // K0S candidate + FLAMBDA = 0x2, // Lambda candidate + FANTILAMBDA = 0x4, // AntiLambda candidate + FREJECTED = 0x8 // Does not satisfy any of the above, or is randomly rejected +}; + +DECLARE_SOA_COLUMN(SignalFlag, signalFlag, uint8_t); +DECLARE_SOA_DYNAMIC_COLUMN(IsK0SCandidate, isK0SCandidate, //! Flag to check if V0 is a K0S candidate + [](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FK0S; }); +DECLARE_SOA_DYNAMIC_COLUMN(IsLambdaCandidate, isLambdaCandidate, //! Flag to check if V0 is a Lambda candidate + [](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FLAMBDA; }); +DECLARE_SOA_DYNAMIC_COLUMN(IsAntiLambdaCandidate, isAntiLambdaCandidate, //! Flag to check if V0 is a AntiLambda candidate + [](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FANTILAMBDA; }); +DECLARE_SOA_DYNAMIC_COLUMN(IsRejectedCandidate, isRejectedCandidate, //! Flag to check if V0 is rejected + [](uint8_t flag) -> bool { return flag & o2::aod::v0flags::FREJECTED; }); +} // namespace v0flags + +DECLARE_SOA_TABLE_STAGED(V0SignalFlags, "V0SIGNALFLAGS", + v0flags::SignalFlag, + v0flags::IsK0SCandidate, + v0flags::IsLambdaCandidate, + v0flags::IsAntiLambdaCandidate, + v0flags::IsRejectedCandidate); + +} // namespace o2::aod + +#endif // PWGLF_DATAMODEL_V0SELECTORTABLES_H_ diff --git a/PWGLF/DataModel/Vtx3BodyTables.h b/PWGLF/DataModel/Vtx3BodyTables.h index f1b88dfb455..49255b54da1 100644 --- a/PWGLF/DataModel/Vtx3BodyTables.h +++ b/PWGLF/DataModel/Vtx3BodyTables.h @@ -209,34 +209,29 @@ namespace hyp3body { // collision DECLARE_SOA_COLUMN(Centrality, centrality, float); //! centrality -DECLARE_SOA_COLUMN(XPV, xpv, float); //! primary vertex X -DECLARE_SOA_COLUMN(YPV, ypv, float); //! primary vertex Y -DECLARE_SOA_COLUMN(ZPV, zpv, float); //! primary vertex Z // reconstruced candidate DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); //! bool: true for matter DECLARE_SOA_COLUMN(M, m, float); //! invariant mass DECLARE_SOA_COLUMN(P, p, float); //! p DECLARE_SOA_COLUMN(Pt, pt, float); //! pT DECLARE_SOA_COLUMN(Ct, ct, float); //! ct -DECLARE_SOA_COLUMN(X, x, float); //! decay position X -DECLARE_SOA_COLUMN(Y, y, float); //! decay position Y -DECLARE_SOA_COLUMN(Z, z, float); //! decay position Z DECLARE_SOA_COLUMN(CosPA, cospa, float); DECLARE_SOA_COLUMN(DCADaughters, dcaDaughters, float); //! DCA among daughters DECLARE_SOA_COLUMN(DCACandToPV, dcaCandtopv, float); //! DCA of the reconstructed track to pv +DECLARE_SOA_COLUMN(VtxRadius, vtxRadius, float); //! Radius of SV // kinematic infomation of daughter tracks -DECLARE_SOA_COLUMN(PProton, pProton, float); //! p of the proton daughter -DECLARE_SOA_COLUMN(PtProton, ptProton, float); //! pT of the proton daughter -DECLARE_SOA_COLUMN(EtaProton, etaProton, float); //! eta of the proton daughter -DECLARE_SOA_COLUMN(PhiProton, phiProton, float); //! phi of the proton daughter -DECLARE_SOA_COLUMN(PPion, pPion, float); //! p of the pion daughter -DECLARE_SOA_COLUMN(PtPion, ptPion, float); //! pT of the pion daughter -DECLARE_SOA_COLUMN(EtaPion, etaPion, float); //! eta of the pion daughter -DECLARE_SOA_COLUMN(PhiPion, phiPion, float); //! phi of the pion daughter -DECLARE_SOA_COLUMN(PBachelor, pBachelor, float); //! p of the bachelor daughter -DECLARE_SOA_COLUMN(PtBachelor, ptBachelor, float); //! pT of the bachelor daughter -DECLARE_SOA_COLUMN(EtaBachelor, etaBachelor, float); //! eta of the bachelor daughter -DECLARE_SOA_COLUMN(PhiBachelor, phiBachelor, float); //! phi of the bachelor daughter +DECLARE_SOA_COLUMN(PtProton, ptProton, float); //! pT of the proton daughter +DECLARE_SOA_COLUMN(EtaProton, etaProton, float); //! eta of the proton daughter +DECLARE_SOA_COLUMN(PhiProton, phiProton, float); //! phi of the proton daughter +DECLARE_SOA_COLUMN(RadiusProton, radiusProton, float); //! radius of innermost hit of the proton daughter +DECLARE_SOA_COLUMN(PtPion, ptPion, float); //! pT of the pion daughter +DECLARE_SOA_COLUMN(EtaPion, etaPion, float); //! eta of the pion daughter +DECLARE_SOA_COLUMN(PhiPion, phiPion, float); //! phi of the pion daughter +DECLARE_SOA_COLUMN(RadiusPion, radiusPion, float); //! radius of innermost hit of the pion daughter +DECLARE_SOA_COLUMN(PtBachelor, ptBachelor, float); //! pT of the bachelor daughter +DECLARE_SOA_COLUMN(EtaBachelor, etaBachelor, float); //! eta of the bachelor daughter +DECLARE_SOA_COLUMN(PhiBachelor, phiBachelor, float); //! phi of the bachelor daughter +DECLARE_SOA_COLUMN(RadiusBachelor, radiusBachelor, float); //! radius of innermost hit of the bachelor daughter // track quality DECLARE_SOA_COLUMN(TPCNclusProton, tpcNclusProton, uint8_t); //! number of TPC clusters of the proton daughter DECLARE_SOA_COLUMN(TPCNclusPion, tpcNclusPion, uint8_t); //! number of TPC clusters of the pion daughter @@ -273,21 +268,20 @@ DECLARE_SOA_COLUMN(SurvivedEventSelection, survivedEventSelection, bool); // boo DECLARE_SOA_TABLE(Hyp3BodyCands, "AOD", "HYP3BODYCANDS", o2::soa::Index<>, hyp3body::Centrality, - hyp3body::XPV, hyp3body::YPV, hyp3body::ZPV, // secondary vertex and reconstruced candidate hyp3body::IsMatter, hyp3body::M, hyp3body::P, hyp3body::Pt, hyp3body::Ct, - hyp3body::X, hyp3body::Y, hyp3body::Z, hyp3body::CosPA, hyp3body::DCADaughters, hyp3body::DCACandToPV, + hyp3body::VtxRadius, // daughter tracks - hyp3body::PProton, hyp3body::PtProton, hyp3body::EtaProton, hyp3body::PhiProton, - hyp3body::PPion, hyp3body::PtPion, hyp3body::EtaPion, hyp3body::PhiPion, - hyp3body::PBachelor, hyp3body::PtBachelor, hyp3body::EtaBachelor, hyp3body::PhiBachelor, + hyp3body::PtProton, hyp3body::EtaProton, hyp3body::PhiProton, hyp3body::RadiusProton, + hyp3body::PtPion, hyp3body::EtaPion, hyp3body::PhiPion, hyp3body::RadiusPion, + hyp3body::PtBachelor, hyp3body::EtaBachelor, hyp3body::PhiBachelor, hyp3body::RadiusBachelor, hyp3body::TPCNclusProton, hyp3body::TPCNclusPion, hyp3body::TPCNclusBachelor, hyp3body::ITSNclusSizeProton, hyp3body::ITSNclusSizePion, hyp3body::ITSNclusSizeBachelor, hyp3body::TPCNSigmaProton, hyp3body::TPCNSigmaPion, hyp3body::TPCNSigmaBachelor, @@ -299,21 +293,20 @@ DECLARE_SOA_TABLE(Hyp3BodyCands, "AOD", "HYP3BODYCANDS", DECLARE_SOA_TABLE(MCHyp3BodyCands, "AOD", "MCHYP3BODYCANDS", o2::soa::Index<>, hyp3body::Centrality, - hyp3body::XPV, hyp3body::YPV, hyp3body::ZPV, // secondary vertex and reconstruced candidate hyp3body::IsMatter, hyp3body::M, hyp3body::P, hyp3body::Pt, hyp3body::Ct, - hyp3body::X, hyp3body::Y, hyp3body::Z, hyp3body::CosPA, hyp3body::DCADaughters, hyp3body::DCACandToPV, + hyp3body::VtxRadius, // daughter tracks - hyp3body::PProton, hyp3body::PtProton, hyp3body::EtaProton, hyp3body::PhiProton, - hyp3body::PPion, hyp3body::PtPion, hyp3body::EtaPion, hyp3body::PhiPion, - hyp3body::PBachelor, hyp3body::PtBachelor, hyp3body::EtaBachelor, hyp3body::PhiBachelor, + hyp3body::PtProton, hyp3body::EtaProton, hyp3body::PhiProton, hyp3body::RadiusProton, + hyp3body::PtPion, hyp3body::EtaPion, hyp3body::PhiPion, hyp3body::RadiusPion, + hyp3body::PtBachelor, hyp3body::EtaBachelor, hyp3body::PhiBachelor, hyp3body::RadiusBachelor, hyp3body::TPCNclusProton, hyp3body::TPCNclusPion, hyp3body::TPCNclusBachelor, hyp3body::ITSNclusSizeProton, hyp3body::ITSNclusSizePion, hyp3body::ITSNclusSizeBachelor, hyp3body::TPCNSigmaProton, hyp3body::TPCNSigmaPion, hyp3body::TPCNSigmaBachelor, @@ -338,18 +331,25 @@ DECLARE_SOA_TABLE(MCHyp3BodyCands, "AOD", "MCHYP3BODYCANDS", namespace kfvtx3body { // General 3 body Vtx properties: mass, momentum, charge -DECLARE_SOA_COLUMN(Mass, mass, float); //! candidate mass (PID hypothesis depending on bachelor charge) -DECLARE_SOA_COLUMN(Px, px, float); //! candidate px at decay position -DECLARE_SOA_COLUMN(Py, py, float); //! candidate py at decay position -DECLARE_SOA_COLUMN(Pz, pz, float); //! candidate pz at decay position -DECLARE_SOA_COLUMN(Pt, pt, float); //! candidate pt at decay position -DECLARE_SOA_COLUMN(Sign, sign, float); //! candidate sign +DECLARE_SOA_COLUMN(Mass, mass, float); //! candidate mass (PID hypothesis depending on bachelor charge) +DECLARE_SOA_COLUMN(XErr, xerr, float); //! candidate position x error at decay position +DECLARE_SOA_COLUMN(YErr, yerr, float); //! candidate position y error at decay position +DECLARE_SOA_COLUMN(ZErr, zerr, float); //! candidate position z error at decay position +DECLARE_SOA_COLUMN(Px, px, float); //! candidate px at decay position +DECLARE_SOA_COLUMN(Py, py, float); //! candidate py at decay position +DECLARE_SOA_COLUMN(Pz, pz, float); //! candidate pz at decay position +DECLARE_SOA_COLUMN(Pt, pt, float); //! candidate pt at decay position +DECLARE_SOA_COLUMN(PxErr, pxerr, float); //! candidate px error at decay position +DECLARE_SOA_COLUMN(PyErr, pyerr, float); //! candidate py error at decay position +DECLARE_SOA_COLUMN(PzErr, pzerr, float); //! candidate pz error at decay position +DECLARE_SOA_COLUMN(PtErr, pterr, float); //! candidate pt error at decay position +DECLARE_SOA_COLUMN(Sign, sign, float); //! candidate sign // topological properties -DECLARE_SOA_COLUMN(VtxCosPAKF, vtxcosPAkf, float); //! 3 body vtx CosPA from KFParticle (using kfpPV) -DECLARE_SOA_COLUMN(VtxCosXYPAKF, vtxcosxyPAkf, float); //! 3 body vtx CosPA from KFParticle (using kfpPV) -DECLARE_SOA_COLUMN(VtxCosPAKFtopo, vtxcosPAkftopo, float); //! 3 body vtx CosPA from KFParticle after topological constraint (using kfpPV) -DECLARE_SOA_COLUMN(VtxCosXYPAKFtopo, vtxcosxyPAkftopo, float); //! 3 body vtx CosPA from KFParticle after topological constraint (using kfpPV) +DECLARE_SOA_COLUMN(VtxCosPAKF, vtxcospakf, float); //! 3 body vtx CosPA from KFParticle (using kfpPV) +DECLARE_SOA_COLUMN(VtxCosXYPAKF, vtxcosxypakf, float); //! 3 body vtx CosPA from KFParticle (using kfpPV) +DECLARE_SOA_COLUMN(VtxCosPAKFtopo, vtxcospakftopo, float); //! 3 body vtx CosPA from KFParticle after topological constraint (using kfpPV) +DECLARE_SOA_COLUMN(VtxCosXYPAKFtopo, vtxcosxypakftopo, float); //! 3 body vtx CosPA from KFParticle after topological constraint (using kfpPV) DECLARE_SOA_COLUMN(DCAVtxToPVKF, dcavtxtopvkf, float); //! 3 body vtx DCA to PV from KFParticle (using kfpPV) DECLARE_SOA_COLUMN(DCAXYVtxToPVKF, dcaxyvtxtopvkf, float); //! 3 body vtx DCAxy to PV from KFParticle (using kfpPV) DECLARE_SOA_COLUMN(DecayLKF, decaylkf, float); //! 3 body vtx decay length from KFParticle (using kfpPV after topological constraint) @@ -357,60 +357,106 @@ DECLARE_SOA_COLUMN(DecayLXYKF, decaylxykf, float); //! 3 body vtx de DECLARE_SOA_COLUMN(DecayLDeltaL, decayldeltal, float); //! 3 body vtx l/dl from KFParticle (using kfpPV after topological constraint) DECLARE_SOA_COLUMN(Chi2geoNDF, chi2geondf, float); //! 3 body vtx chi2geo from geometrical KFParticle fit DECLARE_SOA_COLUMN(Chi2topoNDF, chi2topondf, float); //! 3 body vtx chi2topo from KFParticle topological constraint to the PV (using kfpPV) +DECLARE_SOA_COLUMN(CTauKFtopo, ctaukftopo, float); //! 3 body vtx ctau from KFParticle after topological constraint // daughters -DECLARE_SOA_COLUMN(DCATrack0ToPVKF, dcatrack0topvkf, float); //! DCA of proton prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCATrack1ToPVKF, dcatrack1topvkf, float); //! DCA of pion prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCATrack2ToPVKF, dcatrack2topvkf, float); //! DCA of deuteron prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack0ToPVKF, dcaxytrack0topvkf, float); //! DCAxy of proton prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack1ToPVKF, dcaxytrack1topvkf, float); //! DCAxy of pion prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack2ToPVKF, dcaxytrack2topvkf, float); //! DCAxy of deuteron prong to PV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack0ToSVKF, dcaxytrack0tosvkf, float); //! DCAxy of proton prong to SV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack1ToSVKF, dcaxytrack1tosvkf, float); //! DCAxy of pion prong to SV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack2ToSVKF, dcaxytrack2tosvkf, float); //! DCAxy of deuteron prong to SV from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack0ToTrack1, dcaxytrack0totrack1kf, float); //! DCAxy of proton prong to pion from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack0ToTrack2, dcaxytrack0totrack2kf, float); //! DCAxy of proton prong to deuteron from KFParticle -DECLARE_SOA_COLUMN(DCAxyTrack1ToTrack2, dcaxytrack1totrack2kf, float); //! DCAxy of pion prong to deuteron from KFParticle -DECLARE_SOA_COLUMN(DCAVtxDaughtersKF, dcavtxdaughterskf, float); //! sum of DCAs between daughters in 3D from KFParticle -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(DCATrack0ToPVKF, dcatrack0topvkf, float); //! DCA of proton prong to PV from KFParticle +DECLARE_SOA_COLUMN(DCATrack1ToPVKF, dcatrack1topvkf, float); //! DCA of pion prong to PV from KFParticle +DECLARE_SOA_COLUMN(DCATrack2ToPVKF, dcatrack2topvkf, float); //! DCA of deuteron prong to PV from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack0ToPVKF, dcaxytrack0topvkf, float); //! DCAxy of proton prong to PV from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack1ToPVKF, dcaxytrack1topvkf, float); //! DCAxy of pion prong to PV from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack2ToPVKF, dcaxytrack2topvkf, float); //! DCAxy of deuteron prong to PV from KFParticle +DECLARE_SOA_COLUMN(DCATrackPosToPV, dcatrackpostopv, float); //! DCA of positive track to PV (propagated before vtx fit) +DECLARE_SOA_COLUMN(DCATrackNegToPV, dcatracknegtopv, float); //! DCA of negative track to PV (propagated before vtx fit) +DECLARE_SOA_COLUMN(DCATrackBachToPV, dcatrackbachtopv, float); //! DCA of bachelor track to PV (propagated before vtx fit) +DECLARE_SOA_COLUMN(DCAxyTrackPosToPV, dcaxytrackpostopv, float); //! DCAxy of positive track to PV (propagated before vtx fit) +DECLARE_SOA_COLUMN(DCAxyTrackNegToPV, dcaxytracknegtopv, float); //! DCAxy of negative track to PV (propagated before vtx fit) +DECLARE_SOA_COLUMN(DCAxyTrackBachToPV, dcaxytrackbachtopv, float); //! DCAxy of bachelor track to PV (propagated before vtx fit) +DECLARE_SOA_COLUMN(DCAxyTrack0ToSVKF, dcaxytrack0tosvkf, float); //! DCAxy of proton prong to SV from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack1ToSVKF, dcaxytrack1tosvkf, float); //! DCAxy of pion prong to SV from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack2ToSVKF, dcaxytrack2tosvkf, float); //! DCAxy of deuteron prong to SV from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack0ToTrack1KF, dcaxytrack0totrack1kf, float); //! DCAxy of proton prong to pion from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack0ToTrack2KF, dcaxytrack0totrack2kf, float); //! DCAxy of proton prong to deuteron from KFParticle +DECLARE_SOA_COLUMN(DCAxyTrack1ToTrack2KF, dcaxytrack1totrack2kf, float); //! DCAxy of pion prong to deuteron from KFParticle +DECLARE_SOA_COLUMN(DCAVtxDaughtersKF, dcavtxdaughterskf, float); //! sum of DCAs between daughters in 3D from KFParticle +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(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 +DECLARE_SOA_COLUMN(GenPt, genpt, float); //! generated transverse momentum +DECLARE_SOA_COLUMN(GenDecVtxX, gendecvtxx, double); //! generated decay vertex position x +DECLARE_SOA_COLUMN(GenDecVtxY, gendecvtxy, double); //! generated decay vertex position y +DECLARE_SOA_COLUMN(GenDecVtxZ, gendecvtxz, double); //! generated decay vertex position z +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(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 +DECLARE_SOA_COLUMN(SurvEvSel, survevsel, int); //! flag if reco collision survived event selection +DECLARE_SOA_COLUMN(IsReco, isreco, int); //! flag if candidate was reconstructed // 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 -DECLARE_SOA_TABLE(StoredKFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA", //! - // indices +DECLARE_SOA_TABLE(KFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA", o2::soa::Index<>, vtx3body::CollisionId, vtx3body::Track0Id, vtx3body::Track1Id, vtx3body::Track2Id, vtx3body::Decay3BodyId, // 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::PxErr, kfvtx3body::PyErr, kfvtx3body::PzErr, kfvtx3body::PtErr, 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::DCAxyTrack0ToTrack1, kfvtx3body::DCAxyTrack0ToTrack2, kfvtx3body::DCAxyTrack1ToTrack2, + kfvtx3body::DCAxyTrack0ToTrack1KF, kfvtx3body::DCAxyTrack0ToTrack2KF, kfvtx3body::DCAxyTrack1ToTrack2KF, kfvtx3body::DCAVtxDaughtersKF, - vtx3body::DCATrack0ToPV, vtx3body::DCATrack1ToPV, vtx3body::DCATrack2ToPV, + kfvtx3body::DCAxyTrackPosToPV, kfvtx3body::DCAxyTrackNegToPV, kfvtx3body::DCAxyTrackBachToPV, + kfvtx3body::DCATrackPosToPV, kfvtx3body::DCATrackNegToPV, kfvtx3body::DCATrackBachToPV, kfvtx3body::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron - vtx3body::TOFNSigmaBachDe, + kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, + kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, + kfvtx3body::TOFNSigmaDeuteron, + kfvtx3body::ITSClusSizeDeuteron, + kfvtx3body::PIDTrackingDeuteron, // dynamic columns vtx3body::VtxRadius, @@ -432,12 +478,165 @@ DECLARE_SOA_TABLE(StoredKFVtx3BodyDatas, "AOD", "KFVTX3BODYDATA", //! vtx3body::Track2Eta, // deuteron eta vtx3body::Track2Phi); // deuteron phi -using StoredKFVtx3BodyData = StoredKFVtx3BodyDatas::iterator; +using KFVtx3BodyData = KFVtx3BodyDatas::iterator; namespace kfvtx3body { -DECLARE_SOA_INDEX_COLUMN(StoredKFVtx3BodyData, storedkfvtx3BodyData); //! Index to KFVtx3BodyData entry +DECLARE_SOA_INDEX_COLUMN(KFVtx3BodyData, kfvtx3BodyData); //! Index to KFVtx3BodyData entry } +DECLARE_SOA_TABLE(KFDecay3BodyDataLink, "AOD", "KF3BODYLINK", //! Joinable table with Decay3bodys which links to KFVtx3BodyData which is not produced for all entries + kfvtx3body::KFVtx3BodyDataId); + +using KFDecay3BodysLinked = soa::Join; +using KFDecay3BodyLinked = KFDecay3BodysLinked::iterator; + +// Lite data candidate table for analysis +DECLARE_SOA_TABLE(KFVtx3BodyDatasLite, "AOD", "KF3BODYLITE", + o2::soa::Index<>, + // hypertriton candidate + kfvtx3body::Mass, + vtx3body::X, vtx3body::Y, vtx3body::Z, + kfvtx3body::Px, kfvtx3body::Py, kfvtx3body::Pz, kfvtx3body::Pt, + kfvtx3body::Sign, + kfvtx3body::DCAVtxToPVKF, kfvtx3body::DCAXYVtxToPVKF, + kfvtx3body::VtxCosPAKF, kfvtx3body::VtxCosXYPAKF, + 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 + 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::Track0Sign, kfvtx3body::Track1Sign, kfvtx3body::Track2Sign, // track sing: proton, pion, deuteron + kfvtx3body::TPCNSigmaProton, kfvtx3body::TPCNSigmaPion, kfvtx3body::TPCNSigmaDeuteron, + kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, + kfvtx3body::TOFNSigmaDeuteron, + kfvtx3body::ITSClusSizeDeuteron, + kfvtx3body::PIDTrackingDeuteron, + + // 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 + +using KFVtx3BodyDataLite = KFVtx3BodyDatasLite::iterator; + +// MC candidate table for analysis +DECLARE_SOA_TABLE(McKFVtx3BodyDatas, "AOD", "MCKF3BODYDATAS", + o2::soa::Index<>, + // 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::PxErr, kfvtx3body::PyErr, kfvtx3body::PzErr, kfvtx3body::PtErr, + 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 + 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, + kfvtx3body::TPCdEdxProton, kfvtx3body::TPCdEdxPion, kfvtx3body::TPCdEdxDeuteron, + kfvtx3body::TOFNSigmaDeuteron, + kfvtx3body::ITSClusSizeDeuteron, + kfvtx3body::PIDTrackingDeuteron, + + // MC information + kfvtx3body::GenP, + kfvtx3body::GenPt, + kfvtx3body::GenDecVtxX, kfvtx3body::GenDecVtxY, kfvtx3body::GenDecVtxZ, + kfvtx3body::GenCtau, + kfvtx3body::GenPhi, + kfvtx3body::GenEta, + kfvtx3body::GenRapidity, + 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 + +// Definition of labels for KFVtx3BodyDatas +namespace mckfvtx3bodylabel +{ +DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for KF Vtx3BodyDatas +} // namespace mckfvtx3bodylabel + +DECLARE_SOA_TABLE(McKFVtx3BodyLabels, "AOD", "MCKFVTXLABEL", //! Table joinable with KFVtx3BodyData containing the MC labels + mckfvtx3bodylabel::McParticleId); +using McKFVtx3BodyLabel = McKFVtx3BodyLabels::iterator; + +// Definition of labels for KFDecay3Bodys // Full table, joinable with KFDecay3Bodys (CAUTION: NOT WITH Vtx3BodyDATA) +namespace mcfullkfvtx3bodylabel +{ +DECLARE_SOA_INDEX_COLUMN(McParticle, mcParticle); //! MC particle for Decay3Bodys +} // namespace mcfullkfvtx3bodylabel + +DECLARE_SOA_TABLE(McFullKFVtx3BodyLabels, "AOD", "MCFULLKFLABEL", //! Table joinable with Decay3Bodys (CAUTION: NOT WITH Vtx3BodyDATA) + mcfullkfvtx3bodylabel::McParticleId); +using McFullKFVtx3BodyLabel = McFullKFVtx3BodyLabels::iterator; } // namespace o2::aod #endif // PWGLF_DATAMODEL_VTX3BODYTABLES_H_ diff --git a/PWGLF/DataModel/cascqaanalysis.h b/PWGLF/DataModel/cascqaanalysis.h index 5bc77d96d10..30053e145a6 100644 --- a/PWGLF/DataModel/cascqaanalysis.h +++ b/PWGLF/DataModel/cascqaanalysis.h @@ -160,7 +160,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); + 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); namespace myMCcascades { diff --git a/PWGLF/DataModel/pidTOFGeneric.h b/PWGLF/DataModel/pidTOFGeneric.h index 047ec6aa477..2c1c9960a21 100644 --- a/PWGLF/DataModel/pidTOFGeneric.h +++ b/PWGLF/DataModel/pidTOFGeneric.h @@ -59,6 +59,7 @@ class TofPidNewCollision ~TofPidNewCollision() = default; o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + o2::track::PID::ID pidType; template using ResponseImplementation = o2::pid::tof::ExpTimes; @@ -77,6 +78,11 @@ class TofPidNewCollision mRespParamsV2.setParameters(para); } + void SetPidType(o2::track::PID::ID pidId) + { + 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()]; @@ -150,6 +156,11 @@ class TofPidNewCollision return tofNsigma; } + + float GetTOFNSigma(TTrack const& track, TCollision const& originalcol, TCollision const& correctedcol, bool EnableBCAO2D = true) + { + return GetTOFNSigma(pidType, track, originalcol, correctedcol, EnableBCAO2D); + } }; } // namespace pidtofgeneric diff --git a/PWGLF/DataModel/spectraTOF.h b/PWGLF/DataModel/spectraTOF.h index 00b9e60ee26..d6cf346b862 100644 --- a/PWGLF/DataModel/spectraTOF.h +++ b/PWGLF/DataModel/spectraTOF.h @@ -398,11 +398,11 @@ DECLARE_SOA_DYNAMIC_COLUMN(TRDSignal, trdSignal, //! Dummy [](float /*v*/) -> float { return 0.f; }); DECLARE_SOA_DYNAMIC_COLUMN(P, p, [](float signedpt, float eta) -> float { return std::abs(signedpt) * cosh(eta); }); DECLARE_SOA_DYNAMIC_COLUMN(TrackType, trackType, [](float /*v*/) -> uint8_t { return o2::aod::track::TrackTypeEnum::Track; }); -DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); // if a track passed the isGlobalTrack requirement -DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); // if a track passed the isGlobalTrackWoDCA requirement -DECLARE_SOA_DYNAMIC_COLUMN(Flags, flags, [](float /*v*/) -> uint32_t { return 0; }); // Dummy +DECLARE_SOA_COLUMN(IsGlobalTrack, isGlobalTrack, bool); // if a track passed the isGlobalTrack requirement +DECLARE_SOA_COLUMN(IsGlobalTrackWoDCA, isGlobalTrackWoDCA, bool); // if a track passed the isGlobalTrackWoDCA requirement +DECLARE_SOA_DYNAMIC_COLUMN(Flags, flags, [](float /*v*/) -> uint32_t { return 0; }); // Dummy DECLARE_SOA_DYNAMIC_COLUMN(TRDPattern, trdPattern, [](float /*v*/) -> uint8_t { return 0; }); // Dummy -DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed under the mass assumption given as input +DECLARE_SOA_DYNAMIC_COLUMN(Rapidity, rapidity, //! Track rapidity, computed under the mass assumption given as input [](float signedPt, float eta, float mass) -> float { const auto pt = std::abs(signedPt); const auto p = std::abs(signedPt) * cosh(eta); diff --git a/PWGLF/DataModel/v0qaanalysis.h b/PWGLF/DataModel/v0qaanalysis.h index 05c90791bde..9e4efd7c3c6 100644 --- a/PWGLF/DataModel/v0qaanalysis.h +++ b/PWGLF/DataModel/v0qaanalysis.h @@ -58,6 +58,8 @@ DECLARE_SOA_COLUMN(IsPhysicalPrimary, isphysprimary, bool); DECLARE_SOA_COLUMN(MultFT0M, multft0m, float); DECLARE_SOA_COLUMN(MultFV0A, multfv0a, float); DECLARE_SOA_COLUMN(EvFlag, evflag, int); +DECLARE_SOA_COLUMN(Alpha, alpha, float); +DECLARE_SOA_COLUMN(QtArm, qtarm, float); } // namespace myv0candidates @@ -73,7 +75,7 @@ DECLARE_SOA_TABLE(MyV0Candidates, "AOD", "MYV0CANDIDATES", o2::soa::Index<>, myv0candidates::PosHasTOF, myv0candidates::NegHasTOF, myv0candidates::PDGCode, myv0candidates::IsPhysicalPrimary, myv0candidates::MultFT0M, myv0candidates::MultFV0A, - myv0candidates::EvFlag); + myv0candidates::EvFlag, myv0candidates::Alpha, myv0candidates::QtArm); } // namespace o2::aod diff --git a/PWGLF/TableProducer/Common/spvector.cxx b/PWGLF/TableProducer/Common/spvector.cxx index bf9074e38e1..7afa0a23c20 100644 --- a/PWGLF/TableProducer/Common/spvector.cxx +++ b/PWGLF/TableProducer/Common/spvector.cxx @@ -55,6 +55,7 @@ #include "Framework/ASoAHelpers.h" #include "ReconstructionDataFormats/Track.h" #include "PWGLF/DataModel/SPCalibrationTables.h" +// #include "SPCalibrationTableswrite.h" // o2 includes. #include "CCDB/CcdbApi.h" @@ -84,7 +85,8 @@ struct spvector { HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; - Configurable cfgCutCentrality{"cfgCutCentrality", 80.0f, "Centrality cut"}; + Configurable cfgCutCentralityMax{"cfgCutCentralityMax", 80.0f, "Centrality cut Max"}; + Configurable cfgCutCentralityMin{"cfgCutCentralityMin", 0.0f, "Centrality cut Min"}; Configurable cfgCutPT{"cfgCutPT", 0.15, "PT cut on daughter track"}; Configurable cfgCutPTMax{"cfgCutPTMax", 3.0, "Max PT cut on daughter track"}; Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; @@ -93,23 +95,61 @@ struct spvector { Configurable cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"}; Configurable QxyNbins{"QxyNbins", 100, "Number of bins in QxQy histograms"}; + Configurable PhiNbins{"PhiNbins", 100, "Number of bins in phi histogram"}; Configurable lbinQxy{"lbinQxy", -5.0, "lower bin value in QxQy histograms"}; Configurable hbinQxy{"hbinQxy", 5.0, "higher bin value in QxQy histograms"}; - Configurable ZDCgainNbins{"ZDCgainNbins", 500, "Number of bins in Gaineq histograms"}; - Configurable lbinZDCgain{"lbinZDCgain", 0.0, "lower bin value in Gaineq histograms"}; - Configurable hbinZDCgain{"hbinZDCgain", 1000.0, "higher bin value in Gaineq histograms"}; - + // Configurable ZDCgainNbins{"ZDCgainNbins", 500, "Number of bins in Gaineq histograms"}; + // Configurable lbinZDCgain{"lbinZDCgain", 0.0, "lower bin value in Gaineq histograms"}; + // Configurable hbinZDCgain{"hbinZDCgain", 1000.0, "higher bin value in Gaineq histograms"}; + Configurable VxNbins{"VxNbins", 25, "Number of bins in Vx histograms"}; + Configurable lbinVx{"lbinVx", -0.05, "lower bin value in Vx histograms"}; + Configurable hbinVx{"hbinVx", 0.0, "higher bin value in Vx histograms"}; + Configurable VyNbins{"VyNbins", 25, "Number of bins in Vy histograms"}; + Configurable lbinVy{"lbinVy", -0.02, "lower bin value in Vy histograms"}; + Configurable hbinVy{"hbinVy", 0.02, "higher bin value in Vy histograms"}; + Configurable VzNbins{"VzNbins", 20, "Number of bins in Vz histograms"}; + Configurable lbinVz{"lbinVz", -10.0, "lower bin value in Vz histograms"}; + Configurable hbinVz{"hbinVz", 10.0, "higher bin value in Vz histograms"}; + 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 VxfineNbins{"VxfineNbins", 25, "Number of bins in Vx fine histograms"}; + Configurable lfinebinVx{"lfinebinVx", -0.05, "lower bin value in Vx fine histograms"}; + Configurable hfinebinVx{"hfinebinVx", 0.0, "higher bin value in Vx fine histograms"}; + Configurable VyfineNbins{"VyfineNbins", 25, "Number of bins in Vy fine histograms"}; + Configurable lfinebinVy{"lfinebinVy", -0.02, "lower bin value in Vy fine histograms"}; + Configurable hfinebinVy{"hfinebinVy", 0.02, "higher bin value in Vy fine histograms"}; + Configurable VzfineNbins{"VzfineNbins", 20, "Number of bins in Vz fine histograms"}; + Configurable lfinebinVz{"lfinebinVz", -10.0, "lower bin value in Vz fine histograms"}; + Configurable hfinebinVz{"hfinebinVz", 10.0, "higher bin value in Vz fine histograms"}; + Configurable CentfineNbins{"CentfineNbins", 16, "Number of bins in cent fine histograms"}; + 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 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"}; + Configurable rejbadeventcent{"rejbadeventcent", true, "Flag to check bad events for cent"}; + Configurable rejbadeventvx{"rejbadeventvx", true, "Flag to check bad events for vx"}; + Configurable rejbadeventvy{"rejbadeventvy", true, "Flag to check bad events for vy"}; + Configurable rejbadeventvz{"rejbadeventvz", true, "Flag to check bad events for vz"}; + Configurable usesparse{"usesparse", false, "flag to use sparse histogram"}; + Configurable usenormqn{"usenormqn", true, "flag to use normalized qs"}; + Configurable refsys{"refsys", true, "flag to use own reference system"}; + Configurable followpub{"followpub", true, "flag to use alphaZDC"}; Configurable useGainCallib{"useGainCallib", false, "use gain calibration"}; - Configurable useRecentere{"useRecentere", false, "use Recentering"}; - Configurable useShift{"useShift", false, "use Shift"}; - Configurable ConfGainPath{"ConfGainPath", "Users/p/prottay/My/Object/test100", "Path to gain calibration"}; - Configurable ConfRecentere{"ConfRecentere", "Users/p/prottay/My/Object/NewPbPbpass4_23082024/recenter", "Path for recentere"}; - Configurable ConfShift{"ConfShift", "Users/p/prottay/My/Object/Finaltest2/recenereall", "Path for Shift"}; - - ConfigurableAxis configAxisCentrality{"configAxisCentrality", {80, 0.0, 80}, "centrality bining"}; - // ConfigurableAxis configAxisZDCgain{"configAxisZDCgain", {ZDCgainNbins, lbinZDCgain, hbinZDCgain}, "gainamplitude bining"}; - // ConfigurableAxis configAxisQx{"configAxisQx", {QxyNbins, lbinQxy, hbinQxy}, "qx bining"}; - // ConfigurableAxis configAxisQy{"configAxisQy", {QxyNbins, lbinQxy, hbinQxy}, "qy bining"}; + Configurable useRecentereSp{"useRecentereSp", false, "use Recentering with Sparse or THn"}; + Configurable useRecenterefineSp{"useRecenterefineSp", false, "use fine Recentering with Sparse or THn"}; + Configurable useRecenteresqSp{"useRecenteresqSp", false, "use Recenteringsq with Sparse or THn"}; + Configurable recwitherror{"recwitherror", false, "use Recentering with error"}; + Configurable recfinewitherror{"recfinewitherror", false, "use Recentering fine with error"}; + Configurable ConfGainPath{"ConfGainPath", "Users/p/prottay/My/Object/NewPbPbpass4_10092024/gaincallib", "Path to gain calibration"}; + Configurable ConfRecentereSp{"ConfRecentereSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for recentere"}; + Configurable ConfRecenterecentSp{"ConfRecenterecentSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for cent recentere"}; + Configurable ConfRecenterevxSp{"ConfRecenterevxSp", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "Sparse or THn Path for vx recentere"}; + 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"}; // Event selection cuts - Alex TF1* fMultPVCutLow = nullptr; @@ -121,7 +161,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)) @@ -143,33 +183,76 @@ struct spvector { void init(o2::framework::InitContext&) { - std::vector occupancyBinning = {0.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 4000.0, 5000.0, 50000.0}; - - const AxisSpec centAxis{configAxisCentrality, "V0M (%)"}; - - // AxisSpec amplitudeZDC = {configAxisZDCgain, "ZDC amplitude"}; - AxisSpec amplitudeZDC = {ZDCgainNbins, lbinZDCgain, hbinZDCgain, "ZDC amplitude"}; + // const AxisSpec centAxis{configAxisCentrality, "V0M (%)"}; + // AxisSpec amplitudeZDC = {configAxisZDCgain, "ZDC amplitude"}; + // AxisSpec amplitudeZDC = {ZDCgainNbins, lbinZDCgain, hbinZDCgain, "ZDC amplitude"}; AxisSpec channelZDCAxis = {8, 0.0, 8.0, "ZDC tower"}; AxisSpec qxZDCAxis = {QxyNbins, lbinQxy, hbinQxy, "Qx"}; - AxisSpec qyZDCAxis = {QxyNbins, lbinQxy, hbinQxy, "Qy"}; - AxisSpec phiAxis = {50, -6.28, 6.28, "phi"}; - AxisSpec vzAxis = {20, -10, 10, "vz"}; - - histos.add("hCentrality", "hCentrality", kTH1F, {{8, 0, 80.0}}); - histos.add("Vz", "Vz", kTH1F, {vzAxis}); - - histos.add("hpQxZDCAC", "hpQxZDCAC", kTProfile, {centAxis}); - histos.add("hpQyZDCAC", "hpQyZDCAC", kTProfile, {centAxis}); - histos.add("hpQxZDCAQyZDCC", "hpQxZDCAQyZDCC", kTProfile, {centAxis}); - histos.add("hpQxZDCCQyZDCA", "hpQxZDCCQyZDCA", kTProfile, {centAxis}); - histos.add("QxZDCC", "QxZDCC", kTH2F, {centAxis, qxZDCAxis}); - histos.add("QyZDCC", "QyZDCC", kTH2F, {centAxis, qyZDCAxis}); - histos.add("QxZDCA", "QxZDCA", kTH2F, {centAxis, qxZDCAxis}); - histos.add("QyZDCA", "QyZDCA", kTH2F, {centAxis, qyZDCAxis}); - histos.add("PsiZDCC", "PsiZDCC", kTH2F, {centAxis, phiAxis}); - histos.add("PsiZDCA", "PsiZDCA", kTH2F, {centAxis, phiAxis}); - histos.add("ZDCAmp", "ZDCAmp", kTProfile2D, {channelZDCAxis, vzAxis}); - histos.add("hZDCAmp", "hZDCAmp", kTH3F, {channelZDCAxis, vzAxis, amplitudeZDC}); + AxisSpec phiAxis = {PhiNbins, -6.28, 6.28, "phi"}; + AxisSpec vzAxis = {VzNbins, lbinVz, hbinVz, "vz"}; + AxisSpec vxAxis = {VxNbins, lbinVx, hbinVx, "vx"}; + AxisSpec vyAxis = {VyNbins, lbinVy, hbinVy, "vy"}; + AxisSpec centAxis = {CentNbins, lbinCent, hbinCent, "V0M (%)"}; + AxisSpec vzfineAxis = {VzfineNbins, lfinebinVz, hfinebinVz, "vzfine"}; + AxisSpec vxfineAxis = {VxfineNbins, lfinebinVx, hfinebinVx, "vxfine"}; + AxisSpec vyfineAxis = {VyfineNbins, lfinebinVy, hfinebinVy, "vyfine"}; + AxisSpec centfineAxis = {CentfineNbins, lfinebinCent, hfinebinCent, "V0M (%) fine"}; + + histos.add("hCentrality", "hCentrality", kTH1F, {{centfineAxis}}); + histos.add("hpQxZDCAC", "hpQxZDCAC", kTProfile, {centfineAxis}); + histos.add("hpQyZDCAC", "hpQyZDCAC", kTProfile, {centfineAxis}); + histos.add("hpQxZDCAQyZDCC", "hpQxZDCAQyZDCC", kTProfile, {centfineAxis}); + histos.add("hpQxZDCCQyZDCA", "hpQxZDCCQyZDCA", kTProfile, {centfineAxis}); + + if (!ispolarization) { + if (usesparse == 1) { + histos.add("hsQxZDCA", "hsQxZDCA", kTHnSparseF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + histos.add("hsQyZDCA", "hsQyZDCA", kTHnSparseF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + histos.add("hsQxZDCC", "hsQxZDCC", kTHnSparseF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + histos.add("hsQyZDCC", "hsQyZDCC", kTHnSparseF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + } else { + histos.add("hnQxZDCA", "hnQxZDCA", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + histos.add("hnQyZDCA", "hnQyZDCA", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + histos.add("hnQxZDCC", "hnQxZDCC", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + histos.add("hnQyZDCC", "hnQyZDCC", kTHnF, {{centAxis}, {vxAxis}, {vyAxis}, {vzAxis}, {qxZDCAxis}}); + + if (finecorrection) { + histos.add("hcentQxZDCA", "hcentQxZDCA", kTH2F, {{centfineAxis}, {qxZDCAxis}}); + histos.add("hcentQyZDCA", "hcentQyZDCA", kTH2F, {{centfineAxis}, {qxZDCAxis}}); + histos.add("hcentQxZDCC", "hcentQxZDCC", kTH2F, {{centfineAxis}, {qxZDCAxis}}); + histos.add("hcentQyZDCC", "hcentQyZDCC", kTH2F, {{centfineAxis}, {qxZDCAxis}}); + + histos.add("hvxQxZDCA", "hvxQxZDCA", kTH2F, {{vxfineAxis}, {qxZDCAxis}}); + histos.add("hvxQyZDCA", "hvxQyZDCA", kTH2F, {{vxfineAxis}, {qxZDCAxis}}); + histos.add("hvxQxZDCC", "hvxQxZDCC", kTH2F, {{vxfineAxis}, {qxZDCAxis}}); + histos.add("hvxQyZDCC", "hvxQyZDCC", kTH2F, {{vxfineAxis}, {qxZDCAxis}}); + + histos.add("hvyQxZDCA", "hvyQxZDCA", kTH2F, {{vyfineAxis}, {qxZDCAxis}}); + histos.add("hvyQyZDCA", "hvyQyZDCA", kTH2F, {{vyfineAxis}, {qxZDCAxis}}); + histos.add("hvyQxZDCC", "hvyQxZDCC", kTH2F, {{vyfineAxis}, {qxZDCAxis}}); + histos.add("hvyQyZDCC", "hvyQyZDCC", kTH2F, {{vyfineAxis}, {qxZDCAxis}}); + + histos.add("hvzQxZDCA", "hvzQxZDCA", kTH2F, {{vzfineAxis}, {qxZDCAxis}}); + histos.add("hvzQyZDCA", "hvzQyZDCA", kTH2F, {{vzfineAxis}, {qxZDCAxis}}); + histos.add("hvzQxZDCC", "hvzQxZDCC", kTH2F, {{vzfineAxis}, {qxZDCAxis}}); + histos.add("hvzQyZDCC", "hvzQyZDCC", kTH2F, {{vzfineAxis}, {qxZDCAxis}}); + } + } + } + + histos.add("PsiZDCC", "PsiZDCC", kTH2F, {centfineAxis, phiAxis}); + histos.add("PsiZDCA", "PsiZDCA", kTH2F, {centfineAxis, phiAxis}); + // histos.add("ZDCAmp", "ZDCAmp", kTProfile3D, {channelZDCAxis, vzfineAxis, centfineAxis}); + 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}); + + if (QA) { + histos.add("Vz", "Vz", kTH1F, {vzfineAxis}); + histos.add("hpCosPsiAPsiC", "hpCosPsiAPsiC", kTProfile, {centfineAxis}); + histos.add("hpSinPsiAPsiC", "hpSinPsiAPsiC", kTProfile, {centfineAxis}); + } + // histos.add("hZDCAmp", "hZDCAmp", kTHnF, {channelZDCAxis, vzAxis, centfineAxis, {1000, 0, 1000}}); // Event selection cut additional - Alex 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); @@ -192,9 +275,17 @@ struct spvector { int currentRunNumber = -999; int lastRunNumber = -999; + // TH3D* gainprofile; TH2D* gainprofile; - TH2D* hrecentere; - + THnF* hrecentereSp; + TH2F* hrecenterecentSp; + TH2F* hrecenterevxSp; + TH2F* hrecenterevySp; + TH2F* hrecenterevzSp; + THnF* hrecenteresqSp; + + // 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); @@ -203,27 +294,23 @@ struct spvector { Preslice zdcPerCollision = aod::collision::bcId; - // void process(MyCollisions::iterator const& collision, aod::FT0s const& /*ft0s*/, BCsRun3 const& bcs, aod::Zdcs const&, MyTracks const&) - void process(MyCollisions::iterator const& collision, aod::FT0s const& /*ft0s*/, BCsRun3 const& bcs, aod::Zdcs const&) + void process(MyCollisions::iterator const& collision, aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0s*/, BCsRun3 const& bcs, aod::Zdcs const&) { auto centrality = collision.centFT0C(); + bool triggerevent = false; if (bcs.size() != 0) { gRandom->SetSeed(bcs.iteratorAt(0).globalBC()); } - auto bc = collision.foundBC_as(); - if (!bc.has_zdc()) { - return; - } - currentRunNumber = collision.foundBC_as().runNumber(); auto vz = collision.posZ(); - bool triggerevent = false; + 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; @@ -231,92 +318,344 @@ struct spvector { auto sumA = 0.0; auto sumC = 0.0; + auto bc = collision.foundBC_as(); + + if (!bc.has_zdc()) { + triggerevent = false; + spcalibrationtable(triggerevent, currentRunNumber, centrality, vx, vy, vz, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, qxZDCA, qxZDCC, qyZDCA, qyZDCC, psiZDCC, psiZDCA); + return; + } + auto zdc = bc.zdc(); auto zncEnergy = zdc.energySectorZNC(); auto znaEnergy = zdc.energySectorZNA(); + auto zncEnergycommon = zdc.energyCommonZNC(); + auto znaEnergycommon = zdc.energyCommonZNA(); + + if (znaEnergycommon <= 0.0 || zncEnergycommon <= 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 (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; + } - if (collision.sel8() && centrality < cfgCutCentrality && TMath::Abs(vz) < cfgCutVertex && collision.has_foundFT0() && eventSelected(collision, centrality) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { + if (collision.sel8() && centrality > cfgCutCentralityMin && centrality < cfgCutCentralityMax && TMath::Abs(vz) < cfgCutVertex && collision.has_foundFT0() && eventSelected(collision, centrality) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) { triggerevent = true; if (useGainCallib && (currentRunNumber != lastRunNumber)) { + // gainprofile = ccdb->getForTimeStamp(ConfGainPath.value, bc.timestamp()); gainprofile = ccdb->getForTimeStamp(ConfGainPath.value, bc.timestamp()); } - histos.fill(HIST("hCentrality"), centrality); - histos.fill(HIST("Vz"), vz); - - initCCDB(bc); + // initCCDB(bc); auto gainequal = 1.0; - constexpr float x[4] = {-1.75, 1.75, -1.75, 1.75}; - constexpr float y[4] = {-1.75, -1.75, 1.75, 1.75}; + auto alphaZDC = 0.395; + 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); + histos.fill(HIST("ZDCAmpCommon"), 0.5, vz, znaEnergycommon); + histos.fill(HIST("ZDCAmpCommon"), 1.5, vz, zncEnergycommon); + + // LOG(info) << "**********energy values************" << znaEnergycommon<<" "<GetBinContent(gainprofile->FindBin(chanelid)); + if (useGainCallib && gainprofile) { + // gainequal = gainprofile->GetBinContent(gainprofile->FindBin(vz, centrality, chanelid + 0.5)); + gainequal = gainprofile->GetBinContent(gainprofile->FindBin(vz, chanelid + 0.5)); } if (iChA < 4) { if (znaEnergy[iChA] <= 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; } else { - float ampl = gainequal * znaEnergy[iChA]; - qxZDCA = qxZDCA + ampl * x[iChA]; + double ampl = gainequal * znaEnergy[iChA]; + if (followpub) { + ampl = TMath::Power(ampl, alphaZDC); + } + qxZDCA = qxZDCA - ampl * x[iChA]; qyZDCA = qyZDCA + ampl * y[iChA]; sumA = sumA + ampl; histos.fill(HIST("ZDCAmp"), chanelid + 0.5, vz, ampl); - histos.fill(HIST("hZDCAmp"), chanelid + 0.5, vz, ampl); + // histos.fill(HIST("hZDCAmp"), chanelid + 0.5, vz, centrality, ampl); } } else { - if (zncEnergy[iChA - 4] <= 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; } 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]; qyZDCC = qyZDCC + ampl * y[iChA - 4]; sumC = sumC + ampl; histos.fill(HIST("ZDCAmp"), chanelid + 0.5, vz, ampl); - histos.fill(HIST("hZDCAmp"), chanelid + 0.5, vz, ampl); + // histos.fill(HIST("hZDCAmp"), chanelid + 0.5, vz, centrality, ampl); } } } - if (sumA > 0) { - qxZDCA = qxZDCA / sumA; - qyZDCA = qyZDCA / sumA; - } - if (sumC > 0) { - qxZDCC = qxZDCC / sumC; - qyZDCC = qyZDCC / sumC; + if (usenormqn) { + if (sumA > 0) { + qxZDCA = qxZDCA / sumA; + qyZDCA = qyZDCA / sumA; + } + if (sumC > 0) { + 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; qxZDCC = 0.0; qyZDCA = 0.0; qyZDCC = 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 (useRecentere && (currentRunNumber != lastRunNumber)) { - hrecentere = ccdb->getForTimeStamp(ConfRecentere.value, bc.timestamp()); + histos.fill(HIST("hCentrality"), centrality); + histos.fill(HIST("Vz"), vz); + + if (useRecentereSp && (currentRunNumber != lastRunNumber)) { + hrecentereSp = ccdb->getForTimeStamp(ConfRecentereSp.value, bc.timestamp()); + } + if (useRecenterefineSp && (currentRunNumber != lastRunNumber)) { + hrecenterecentSp = ccdb->getForTimeStamp(ConfRecenterecentSp.value, bc.timestamp()); + hrecenterevxSp = ccdb->getForTimeStamp(ConfRecenterevxSp.value, bc.timestamp()); + hrecenterevySp = ccdb->getForTimeStamp(ConfRecenterevySp.value, bc.timestamp()); + hrecenterevzSp = ccdb->getForTimeStamp(ConfRecenterevzSp.value, bc.timestamp()); } + if (useRecenteresqSp && (currentRunNumber != lastRunNumber)) { + hrecenteresqSp = ccdb->getForTimeStamp(ConfRecenteresqSp.value, bc.timestamp()); + } + + if (useRecentereSp && hrecentereSp) { + + int binCoords[5]; + + // Get axes of the THnSparse + TAxis* centralityAxis = hrecentereSp->GetAxis(0); // Axis 0: centrality + TAxis* vxAxis = hrecentereSp->GetAxis(1); // Axis 1: vx + TAxis* vyAxis = hrecentereSp->GetAxis(2); // Axis 2: vy + TAxis* vzAxis = hrecentereSp->GetAxis(3); // Axis 3: vz + TAxis* channelAxis = hrecentereSp->GetAxis(4); // Axis 4: channel + + // Find bin indices for centrality, vx, vy, vz, and channel (for meanxA, 0.5) + binCoords[0] = centralityAxis->FindBin(centrality); // Centrality + binCoords[1] = vxAxis->FindBin(vx); // vx + binCoords[2] = vyAxis->FindBin(vy); // vy + binCoords[3] = vzAxis->FindBin(vz); // vz + binCoords[4] = channelAxis->FindBin(0.5); // Channel for meanxA + + // Get the global bin for meanxA + int globalBinMeanxA = hrecentereSp->GetBin(binCoords); + 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); + double meanyA = hrecentereSp->GetBinContent(globalBinMeanyA); + double meanyAerror = hrecentereSp->GetBinError(globalBinMeanyA); + + binCoords[4] = channelAxis->FindBin(2.5); // Channel for meanxC + int globalBinMeanxC = hrecentereSp->GetBin(binCoords); + double meanxC = hrecentereSp->GetBinContent(globalBinMeanxC); + double meanxCerror = hrecentereSp->GetBinError(globalBinMeanxC); + + binCoords[4] = channelAxis->FindBin(3.5); // Channel for meanyC + int globalBinMeanyC = hrecentereSp->GetBin(binCoords); + 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)) { + 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 (useRecentere) { + qxZDCA = qxZDCA - meanxA; + qyZDCA = qyZDCA - meanyA; + qxZDCC = qxZDCC - meanxC; + qyZDCC = qyZDCC - meanyC; - qxZDCA = (qxZDCA - hrecentere->GetBinContent(hrecentere->FindBin(centrality, 0.5))) / hrecentere->GetBinError(hrecentere->FindBin(centrality, 0.5)); - qyZDCA = (qyZDCA - hrecentere->GetBinContent(hrecentere->FindBin(centrality, 1.5))) / hrecentere->GetBinError(hrecentere->FindBin(centrality, 1.5)); - qxZDCC = (qxZDCC - hrecentere->GetBinContent(hrecentere->FindBin(centrality, 2.5))) / hrecentere->GetBinError(hrecentere->FindBin(centrality, 2.5)); - qyZDCC = (qyZDCC - hrecentere->GetBinContent(hrecentere->FindBin(centrality, 3.5))) / hrecentere->GetBinError(hrecentere->FindBin(centrality, 3.5)); + if (recwitherror) { + if (meanxAerror != 0.0) { + qxZDCA = qxZDCA / meanxAerror; + } + if (meanyAerror != 0.0) { + qyZDCA = qyZDCA / meanyAerror; + } + if (meanxCerror != 0.0) { + qxZDCC = qxZDCC / meanxCerror; + } + if (meanyCerror != 0.0) { + qyZDCC = qyZDCC / meanyCerror; + } + } } + if (useRecenterefineSp && hrecenterecentSp) { + + 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)); + + 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)) { + 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; + } + } + + qxZDCA = qxZDCA - hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 0.5)); + qyZDCA = qyZDCA - hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 1.5)); + qxZDCC = qxZDCC - hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 2.5)); + qyZDCC = qyZDCC - hrecenterecentSp->GetBinContent(hrecenterecentSp->FindBin(centrality, 3.5)); + + if (recfinewitherror) { + qxZDCA = qxZDCA / meanxAcenterror; + qyZDCA = qyZDCA / meanyAcenterror; + qxZDCC = qxZDCC / meanxCcenterror; + qyZDCC = qyZDCC / meanyCcenterror; + } + } + + if (useRecenterefineSp && hrecenterevxSp) { + + 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)); + + 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)) { + 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; + } + } + + qxZDCA = qxZDCA - hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 0.5)); + qyZDCA = qyZDCA - hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 1.5)); + qxZDCC = qxZDCC - hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 2.5)); + qyZDCC = qyZDCC - hrecenterevxSp->GetBinContent(hrecenterevxSp->FindBin(vx, 3.5)); + + if (recfinewitherror) { + qxZDCA = qxZDCA / meanxAvxerror; + qyZDCA = qyZDCA / meanyAvxerror; + qxZDCC = qxZDCC / meanxCvxerror; + qyZDCC = qyZDCC / meanyCvxerror; + } + } + + if (useRecenterefineSp && hrecenterevySp) { + + 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)); + + 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)) { + 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; + } + } + + qxZDCA = qxZDCA - hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 0.5)); + qyZDCA = qyZDCA - hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 1.5)); + qxZDCC = qxZDCC - hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 2.5)); + qyZDCC = qyZDCC - hrecenterevySp->GetBinContent(hrecenterevySp->FindBin(vy, 3.5)); + + if (recfinewitherror) { + qxZDCA = qxZDCA / meanxAvyerror; + qyZDCA = qyZDCA / meanyAvyerror; + qxZDCC = qxZDCC / meanxCvyerror; + qyZDCC = qyZDCC / meanyCvyerror; + } + } + + if (useRecenterefineSp && hrecenterevzSp) { + + 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)); + + 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)) { + 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; + } + } + + qxZDCA = qxZDCA - hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 0.5)); + qyZDCA = qyZDCA - hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 1.5)); + qxZDCC = qxZDCC - hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 2.5)); + qyZDCC = qyZDCC - hrecenterevzSp->GetBinContent(hrecenterevzSp->FindBin(vz, 3.5)); + + if (recfinewitherror) { + qxZDCA = qxZDCA / meanxAvzerror; + qyZDCA = qyZDCA / meanyAvzerror; + qxZDCC = qxZDCC / meanxCvzerror; + qyZDCC = qyZDCC / meanyCvzerror; + } + } + + // LOG(info) << "**********qxa values in spvector************" << qxZDCA<<" "< m_ccdb; @@ -504,20 +439,18 @@ struct LfTreeCreatorClusterStudies { return false; } - template + template float computeTOFmassDe(const T& candidate) { - 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); - } - - template - float computeTOFmassDeMc(const T& candidate) - { - 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); + 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); + } } // ========================================================================================================= @@ -542,24 +475,23 @@ struct LfTreeCreatorClusterStudies { return false; } - template + template float computeTOFmassHe3(const T& candidate) { - 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); - } - - template - float computeTOFmassHe3Mc(const T& candidate) - { - 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); + 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; } // ========================================================================================================= @@ -654,22 +586,22 @@ struct LfTreeCreatorClusterStudies { m_hAnalysis.get(HIST("v0_type"))->GetXaxis()->SetBinLabel(i + 1, V0Type_labels[i].c_str()); } - template - bool fillV0Cand(const std::array& PV, const aod::V0s::iterator& v0, CandidateV0& candV0, const Track&) + template + void fillV0Cand(const std::array& PV, const aod::V0s::iterator& v0, const Track&) { m_hAnalysis.fill(HIST("v0_selections"), V0Selections::kV0NoCut); auto posTrack = v0.posTrack_as(); auto negTrack = v0.negTrack_as(); if (!qualityTrackSelection(posTrack) || !qualityTrackSelection(negTrack)) { - return false; + return; } m_hAnalysis.fill(HIST("v0_selections"), V0Selections::kV0DaughterQuality); auto daughterTrackCovarianceA = getTrackParCov(posTrack); auto daughterTrackCovarianceB = getTrackParCov(negTrack); if (!initializeFitter(daughterTrackCovarianceA, daughterTrackCovarianceB)) { - return false; + return; } std::array momPos, momNeg, momMother; @@ -689,7 +621,7 @@ struct LfTreeCreatorClusterStudies { float dcaV0toPV = dcaToPV(PV, v0TrackParCov.trackParCov, dcaInfo); float cosPA = RecoDecay::cpa(PV, decayVtx, momMother); if (!qualitySelectionV0(dcaV0toPV, dcaV0daughters, radiusV0, cosPA)) { - return false; + return; } // mass hypothesis @@ -713,57 +645,57 @@ struct LfTreeCreatorClusterStudies { SETBIT(v0Bitmask, AntiLambda); } if (v0Bitmask == 0 || (v0Bitmask & (v0Bitmask - 1)) != 0) { - return false; + return; } m_hAnalysis.fill(HIST("v0_selections"), V0Selections::kV0PID); uint8_t partID_pos{0}, partID_neg{0}; if (TESTBIT(v0Bitmask, Lambda)) { if (qtAP < lambdasetting_qtAPcut) - return false; + return; if (std::abs(posTrack.tpcNSigmaPr()) > v0setting_nsigmatpcPr || std::abs(negTrack.tpcNSigmaPi()) > v0setting_nsigmatpcPi) - return false; + return; if (std::hypot(momMother[0], momMother[1], momMother[2]) < lambdasetting_pmin) - return false; + return; partID_pos = PartID::pr; partID_neg = PartID::pi; m_hAnalysis.fill(HIST("v0_type"), V0Type::Lambda); } else if (TESTBIT(v0Bitmask, AntiLambda)) { if (qtAP < lambdasetting_qtAPcut) - return false; + return; if (std::abs(posTrack.tpcNSigmaPi()) > v0setting_nsigmatpcPr || std::abs(negTrack.tpcNSigmaPr()) > v0setting_nsigmatpcPi) - return false; + return; if (std::hypot(momMother[0], momMother[1], momMother[2]) < lambdasetting_pmin) - return false; + return; partID_pos = PartID::pi; partID_neg = PartID::pr; m_hAnalysis.fill(HIST("v0_type"), V0Type::AntiLambda); } else if (TESTBIT(v0Bitmask, K0s)) { m_hAnalysis.fill(HIST("v0_type"), V0Type::K0s); - return false; // K0s not implemented + return; // K0s not implemented } else if (TESTBIT(v0Bitmask, Photon)) { // require photon conversion to happen in one of the Inner Tracker layers (± 0.5 cm resolution) m_hAnalysis.fill(HIST("photon_conversion_position"), decayVtx[0], decayVtx[1]); m_hAnalysis.fill(HIST("photon_radiusV0"), radiusV0); if (!(radiusV0 > 1.76 && radiusV0 < 4.71)) - return false; + return; if (std::abs(posTrack.tpcNSigmaEl()) > v0setting_nsigmatpcEl || std::abs(negTrack.tpcNSigmaEl()) > v0setting_nsigmatpcEl) - return false; + return; m_hAnalysis.fill(HIST("photon_conversion_position_layer"), decayVtx[0], decayVtx[1]); partID_pos = PartID::el; partID_neg = PartID::el; m_hAnalysis.fill(HIST("v0_type"), V0Type::Photon); } else { - return false; + return; } float dcaToPVpos = dcaToPV(PV, daughterTrackCovarianceA, dcaInfo); if (std::abs(dcaToPVpos) < v0setting_dcaDaughtersToPV /*&& std::abs(dcaInfo[0]) < v0setting_dcaDaughtersToPV*/) { - return false; + return; } float dcaToPVneg = dcaToPV(PV, daughterTrackCovarianceB, dcaInfo); if (std::abs(dcaToPVneg) < v0setting_dcaDaughtersToPV /*&& std::abs(dcaInfo[0]) < v0setting_dcaDaughtersToPV*/) { - return false; + return; } float massV0{0.f}; @@ -799,148 +731,113 @@ struct LfTreeCreatorClusterStudies { m_hAnalysis.fill(HIST("armenteros_plot"), alphaAP, qtAP); m_v0TrackParCovs.push_back(v0TrackParCov); - candV0.p_pos = std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(); - candV0.eta_pos = RecoDecay::eta(momPos); - candV0.phi_pos = RecoDecay::phi(momPos); - candV0.itsClsize_pos = posTrack.itsClusterSizes(); - candV0.partID_pos = partID_pos; - candV0.pTPC_pos = posTrack.tpcInnerParam() * posTrack.sign(); - candV0.pidInTrk_pos = posTrack.pidForTracking(); - - candV0.p_neg = std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(); - candV0.eta_neg = RecoDecay::eta(momNeg); - candV0.phi_neg = RecoDecay::phi(momNeg); - candV0.itsClsize_neg = negTrack.itsClusterSizes(); - candV0.partID_neg = partID_neg; - candV0.pTPC_neg = negTrack.tpcInnerParam() * negTrack.sign(); - candV0.pidInTrk_pos = posTrack.pidForTracking(); - - candV0.cosPA = cosPA; - candV0.massV0 = massV0; - - return true; - } - - bool fillV0CandMc(const aod::V0s::iterator& v0, CandidateV0& candV0) - { - auto posTrack = v0.posTrack_as(); - auto negTrack = v0.negTrack_as(); - - if (!posTrack.has_mcParticle() || !negTrack.has_mcParticle()) { - return false; - } - - auto posMcParticle = posTrack.mcParticle(); - auto negMcParticle = negTrack.mcParticle(); - - candV0.partIDMc_pos = posMcParticle.pdgCode(); - candV0.partIDMc_neg = negMcParticle.pdgCode(); - - return true; - } - - void fillV0Table(const CandidateV0& candV0) - { - if (setting_smallTable) { - m_ClusterStudiesTable( - candV0.p_pos, // p_pos - candV0.eta_pos, // eta_pos - candV0.phi_pos, // phi_pos - candV0.itsClsize_pos, // itsClsize_pos - candV0.partID_pos); // partID_pos - m_ClusterStudiesTable( - candV0.p_neg, // p_neg - candV0.eta_neg, // eta_neg - candV0.phi_neg, // phi_neg - candV0.itsClsize_neg, // itsClsize_neg - candV0.partID_neg); // partID_neg - } else { - m_ClusterStudiesTableExtra( - candV0.p_pos, // p_pos - candV0.eta_pos, // eta_pos - candV0.phi_pos, // phi_pos - candV0.itsClsize_pos, // itsClsize_pos - candV0.partID_pos, // partID_pos - candV0.pTPC_pos, // pTPC_pos - candV0.pidInTrk_pos, // pidInTrk_pos - -999.f, // TpcNSigma_pos - -999.f, // TofNSigma_pos - -999.f, // TofMass_pos - candV0.cosPA, // cosPA - candV0.massV0); // massV0 - m_ClusterStudiesTableExtra( - candV0.p_neg, // p_neg - candV0.eta_neg, // eta_neg - candV0.phi_neg, // phi_neg - candV0.itsClsize_neg, // itsClsize_neg - candV0.partID_neg, // partID_neg - candV0.pTPC_neg, // pTPC_neg - candV0.pidInTrk_neg, // pidInTrk_neg - -999.f, // TpcNSigma_neg - -999.f, // TofNSigma_neg - -999.f, // TofMass_neg - candV0.cosPA, // cosPA - candV0.massV0); // massV0 + if (!setting_fillV0) { + return; } - m_hAnalysis.fill(HIST("isPositive"), true); - m_hAnalysis.fill(HIST("isPositive"), false); - } + if constexpr (isMC) { // MC + if (!posTrack.has_mcParticle() || !negTrack.has_mcParticle()) { + return; + } - void fillV0TableMc(const CandidateV0& candV0) - { - if (setting_smallTable) { - m_ClusterStudiesTableMc( - candV0.p_pos, // p_pos - candV0.eta_pos, // eta_pos - candV0.phi_pos, // phi_pos - candV0.itsClsize_pos, // itsClsize_pos - candV0.partID_pos, // partID_pos - candV0.partIDMc_pos); // pdgCode_pos - m_ClusterStudiesTableMc( - candV0.p_neg, // p_neg - candV0.eta_neg, // eta_neg - candV0.phi_neg, // phi_neg - candV0.itsClsize_neg, // itsClsize_neg - candV0.partID_neg, // partID_neg - candV0.partIDMc_neg); // pdgCode_neg - } else { - m_ClusterStudiesTableMcExtra( - candV0.p_pos, // p_pos - candV0.eta_pos, // eta_pos - candV0.phi_pos, // phi_pos - candV0.itsClsize_pos, // itsClsize_pos - candV0.partID_pos, // partID_pos - candV0.partIDMc_pos, // pdgCode_neg - candV0.pTPC_pos, // pTPC_pos - candV0.pidInTrk_pos, // pidInTrk_pos - -999.f, // TpcNSigma_pos - -999.f, // TofNSigma_pos - -999.f, // TofMass_pos - candV0.cosPA, // cosPA - candV0.massV0); // massV0 - m_ClusterStudiesTableMcExtra( - candV0.p_neg, // p_neg - candV0.eta_neg, // eta_neg - candV0.phi_neg, // phi_neg - candV0.itsClsize_neg, // itsClsize_neg - candV0.partID_neg, // partID_neg - candV0.partIDMc_neg, // pdgCode_neg - candV0.pTPC_neg, // pTPC_neg - candV0.pidInTrk_neg, // pidInTrk_neg - -999.f, // TpcNSigma_neg - -999.f, // TofNSigma_neg - -999.f, // TofMass_neg - candV0.cosPA, // cosPA - candV0.massV0); // massV0 + auto posMcParticle = posTrack.mcParticle(); + auto negMcParticle = negTrack.mcParticle(); + + if (setting_smallTable) { + m_ClusterStudiesTableMc( + std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos + RecoDecay::eta(momPos), // eta_pos + RecoDecay::phi(momPos), // phi_pos + posTrack.itsClusterSizes(), // itsClsize_pos + partID_pos, // partID_pos + posMcParticle.pdgCode()); // pdgCode_pos + m_ClusterStudiesTableMc( + std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg + RecoDecay::eta(momNeg), // eta_neg + RecoDecay::phi(momNeg), // phi_neg + negTrack.itsClusterSizes(), // itsClsize_neg + partID_neg, // partID_neg + negMcParticle.pdgCode()); // pdgCode_neg + } else { + m_ClusterStudiesTableMcExtra( + std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos + RecoDecay::eta(momPos), // eta_pos + RecoDecay::phi(momPos), // phi_pos + posTrack.itsClusterSizes(), // itsClsize_pos + partID_pos, // partID_pos + posMcParticle.pdgCode(), // pdgCode_pos + posTrack.tpcInnerParam() * posTrack.sign(), // pTPC_pos + posTrack.pidForTracking(), // pidInTrk_pos + -999.f, // TpcNSigma_pos + -999.f, // TofNSigma_pos + -999.f, // TofMass_pos + cosPA, // cosPA + massV0); // massV0 + m_ClusterStudiesTableMcExtra( + std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg + RecoDecay::eta(momNeg), // eta_neg + RecoDecay::phi(momNeg), // phi_neg + negTrack.itsClusterSizes(), // itsClsize_neg + partID_neg, // partID_neg + negMcParticle.pdgCode(), // pdgCode_pos + negTrack.tpcInnerParam() * negTrack.sign(), // pTPC_neg + negTrack.pidForTracking(), // pidInTrk_neg + -999.f, // TpcNSigma_neg + -999.f, // TofNSigma_neg + -999.f, // TofMass_neg + cosPA, // cosPA + massV0); // massV0 + } + } else { // data + if (setting_smallTable) { + m_ClusterStudiesTable( + std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos + RecoDecay::eta(momPos), // eta_pos + RecoDecay::phi(momPos), // phi_pos + posTrack.itsClusterSizes(), // itsClsize_pos + partID_pos); // partID_pos + m_ClusterStudiesTable( + std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg + RecoDecay::eta(momNeg), // eta_neg + RecoDecay::phi(momNeg), // phi_neg + negTrack.itsClusterSizes(), // itsClsize_neg + partID_neg); // partID_neg + } else { + m_ClusterStudiesTableExtra( + std::hypot(momPos[0], momPos[1], momPos[2]) * posTrack.sign(), // p_pos + RecoDecay::eta(momPos), // eta_pos + RecoDecay::phi(momPos), // phi_pos + posTrack.itsClusterSizes(), // itsClsize_pos + partID_pos, // partID_pos + posTrack.tpcInnerParam() * posTrack.sign(), // pTPC_pos + posTrack.pidForTracking(), // pidInTrk_pos + -999.f, // TpcNSigma_pos + -999.f, // TofNSigma_pos + -999.f, // TofMass_pos + cosPA, // cosPA + massV0); // massV0 + m_ClusterStudiesTableExtra( + std::hypot(momNeg[0], momNeg[1], momNeg[2]) * negTrack.sign(), // p_neg + RecoDecay::eta(momNeg), // eta_neg + RecoDecay::phi(momNeg), // phi_neg + negTrack.itsClusterSizes(), // itsClsize_neg + partID_neg, // partID_neg + negTrack.tpcInnerParam() * negTrack.sign(), // pTPC_neg + negTrack.pidForTracking(), // pidInTrk_neg + -999.f, // TpcNSigma_neg + -999.f, // TofNSigma_neg + -999.f, // TofMass_neg + cosPA, // cosPA + massV0); // massV0 + } } m_hAnalysis.fill(HIST("isPositive"), true); m_hAnalysis.fill(HIST("isPositive"), false); } - template - bool fillKCand(const std::array& PV, const aod::Cascades::iterator& cascade, CandidateK& candK, const Track&) + template + void fillKCand(const std::array& PV, const aod::Cascades::iterator& cascade, const Track&) { m_hAnalysis.fill(HIST("casc_selections"), CascSelections::kCascNoCut); @@ -949,13 +846,13 @@ struct LfTreeCreatorClusterStudies { auto itv0 = std::find_if(m_v0TrackParCovs.begin(), m_v0TrackParCovs.end(), [&](const V0TrackParCov& v0) { return v0.globalIndex == v0Track.globalIndex(); }); if (itv0 == m_v0TrackParCovs.end()) { - return false; + return; } auto v0TrackCovariance = itv0->trackParCov; auto bachelorTrackCovariance = getTrackParCov(bachelorTrack); if (!initializeFitter(v0TrackCovariance, bachelorTrackCovariance)) { - return false; + return; } std::array momV0, momBachelor, momMother; @@ -970,7 +867,7 @@ struct LfTreeCreatorClusterStudies { float cosPA = RecoDecay::cpa(PV, decayVtx, momMother); if (!qualitySelectionCascade(dcaV0daughters, cosPA)) { - return false; + return; } // gpu::gpustd::array dcaInfo; // float dcaToPVbachelor = dcaToPV(PV, bachelorTrackCovariance, dcaInfo); @@ -979,16 +876,16 @@ struct LfTreeCreatorClusterStudies { float massOmega = computeMassMother(o2::constants::physics::MassLambda0, o2::constants::physics::MassKaonCharged, momV0, momBachelor, momMother); m_hAnalysis.fill(HIST("Xi_vs_Omega"), massOmega, massXi); if (std::abs(massOmega - o2::constants::physics::MassOmegaMinus) > cascsetting_massWindowOmega) { - return false; + return; } m_hAnalysis.fill(HIST("massOmegaWithBkg"), massOmega); m_hAnalysis.fill(HIST("casc_selections"), CascSelections::kAcceptedOmega); if (std::abs(massXi - o2::constants::physics::MassXiMinus) < cascsetting_massWindowXi) { - return false; + return; } // enhance purity by rejecting Xi background m_hAnalysis.fill(HIST("casc_selections"), CascSelections::kRejectedXi); if (std::abs(bachelorTrack.tpcNSigmaKa()) > cascsetting_nsigmatpc) { - return false; + return; } m_hAnalysis.fill(HIST("casc_selections"), CascSelections::kNSigmaTPC); m_hAnalysis.fill(HIST("massOmega"), std::hypot(momMother[0], momMother[1]) * bachelorTrack.sign(), massOmega); @@ -997,91 +894,66 @@ struct LfTreeCreatorClusterStudies { uint8_t partID_bachelor = PartID::ka; - candK.p_K = std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(); - candK.eta_K = RecoDecay::eta(momBachelor); - candK.phi_K = RecoDecay::phi(momBachelor); - candK.itsClsize_K = bachelorTrack.itsClusterSizes(); - candK.partID_K = partID_bachelor; - candK.pTPC_K = bachelorTrack.tpcInnerParam() * bachelorTrack.sign(); - candK.pidInTrk_K = bachelorTrack.pidForTracking(); - candK.cosPA = cosPA; - candK.massOmega = massOmega; - return true; - } - - bool fillKCandMc(const aod::Cascades::iterator& cascade, CandidateK& candK) - { - auto bachelorTrack = cascade.template bachelor_as(); - - if (!bachelorTrack.has_mcParticle()) { - return false; - } - - auto bachelorMcParticle = bachelorTrack.mcParticle(); - candK.partIDMc_K = bachelorMcParticle.pdgCode(); - - return true; - } - - void fillKTable(const CandidateK& candK) - { - if (setting_smallTable) { - m_ClusterStudiesTable( - candK.p_K, // p_K - candK.eta_K, // eta_K - candK.phi_K, // phi_K - candK.itsClsize_K, // itsClSize_K - candK.partID_K); // pdgCode_K - } else { - m_ClusterStudiesTableExtra( - candK.p_K, // p_K - candK.eta_K, // eta_K - candK.phi_K, // phi_K - candK.itsClsize_K, // itsClSize_K - candK.partID_K, // pdgCode_K - candK.pTPC_K, // pTPC_K - candK.pidInTrk_K, // PIDinTrk_K - -999.f, // TpcNSigma_K - -999.f, // TofNSigma_K - -999.f, // TofMass_K - candK.cosPA, // cosPA - candK.massOmega); // massMother - } - - m_hAnalysis.fill(HIST("isPositive"), candK.p_K > 0); - } - - void fillKTableMc(const CandidateK& candK) - { - if (setting_smallTable) { - m_ClusterStudiesTableMc( - candK.p_K, // p_K - candK.eta_K, // eta_K - candK.phi_K, // phi_K - candK.itsClsize_K, // itsClSize_K - candK.partID_K, // pdgCode_K - candK.partIDMc_K); // pdgCode_K + if constexpr (isMC) { + if (!bachelorTrack.has_mcParticle()) { + return; + } + auto mcParticle = bachelorTrack.mcParticle(); + + if (setting_smallTable) { + m_ClusterStudiesTableMc( + std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K + RecoDecay::eta(momBachelor), // eta_K + RecoDecay::phi(momBachelor), // phi_K + bachelorTrack.itsClusterSizes(), // itsClSize_K + partID_bachelor, // partID_K + mcParticle.pdgCode()); // pdgCode_K + } else { + m_ClusterStudiesTableMcExtra( + std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K + RecoDecay::eta(momBachelor), // eta_K + RecoDecay::phi(momBachelor), // phi_K + bachelorTrack.itsClusterSizes(), // itsClSize_K + partID_bachelor, // partID_K + mcParticle.pdgCode(), // pdgCode_K + bachelorTrack.tpcInnerParam() * bachelorTrack.sign(), // pTPC_K + bachelorTrack.pidForTracking(), // PIDinTrk_K + -999.f, // TpcNSigma_K + -999.f, // TofNSigma_K + -999.f, // TofMass_K + cosPA, // cosPA + massOmega); // massMother + } } else { - m_ClusterStudiesTableMcExtra( - candK.p_K, // p_K - candK.eta_K, // eta_K - candK.phi_K, // phi_K - candK.itsClsize_K, // itsClSize_K - candK.partID_K, // pdgCode_K - candK.partIDMc_K, // pdgCode_K - candK.pTPC_K, // pTPC_K - candK.pidInTrk_K, // PIDinTrk_K - -999.f, // TpcNSigma_K - -999.f, // TofNSigma_K - -999.f, // TofMass_K - candK.cosPA, // cosPA - candK.massOmega); // massMother + if (setting_smallTable) { + m_ClusterStudiesTable( + std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K + RecoDecay::eta(momBachelor), // eta_K + RecoDecay::phi(momBachelor), // phi_K + bachelorTrack.itsClusterSizes(), // itsClSize_K + partID_bachelor); // partID_K + } else { + m_ClusterStudiesTableExtra( + std::hypot(momBachelor[0], momBachelor[1], momBachelor[2]) * bachelorTrack.sign(), // p_K + RecoDecay::eta(momBachelor), // eta_K + RecoDecay::phi(momBachelor), // phi_K + bachelorTrack.itsClusterSizes(), // itsClSize_K + partID_bachelor, // partID_K + bachelorTrack.tpcInnerParam() * bachelorTrack.sign(), // pTPC_K + bachelorTrack.pidForTracking(), // PIDinTrk_K + -999.f, // TpcNSigma_K + -999.f, // TofNSigma_K + -999.f, // TofMass_K + cosPA, // cosPA + massOmega); + } } - m_hAnalysis.fill(HIST("isPositive"), candK.p_K > 0); + m_hAnalysis.fill(HIST("isPositive"), bachelorTrack.p() > 0); } - void fillDeTable(const TracksFullIU::iterator& track) + template + void fillDeTable(const Track& track) { if (track.sign() > 0) { return; @@ -1101,91 +973,72 @@ 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("nSigmaTOFDe"), track.p() * track.sign(), track.tofNSigmaDe()); - m_hAnalysis.fill(HIST("TOFmassDe"), track.p() * track.sign(), computeTOFmassDe(track)); + 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()); uint8_t partID = PartID::de; - if (setting_smallTable) { - m_ClusterStudiesTable( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID); // pdgCode_De + if constexpr (isMC) { + if (!track.has_mcParticle() || track.sign() > 0) { + return; + } + + auto mcParticle = track.mcParticle(); + + if (setting_smallTable) { + m_ClusterStudiesTableMc( + track.p() * track.sign(), // p_De, + track.eta(), // eta_De, + track.phi(), // phi_De, + track.itsClusterSizes(), // itsClSize_De, + partID, // pdgCode_De, + mcParticle.pdgCode()); // pdgCodeMc_De + } else { + m_ClusterStudiesTableMcExtra( + track.p() * track.sign(), // p_De, + track.eta(), // eta_De, + track.phi(), // phi_De, + track.itsClusterSizes(), // itsClSize_De, + partID, // pdgCode_De, + mcParticle.pdgCode(), // pdgCodeMc_De + track.tpcInnerParam() * track.sign(), // pTPC_De, + track.pidForTracking(), // PIDinTrk_De, + computeNSigmaDe(track), // TpcNSigma_De, + track.tofNSigmaDe(), // TofNSigma_De, + computeTOFmassDe(track), // TofMass_De, + -999.f, // cosPA, + -999.f); // massMother + } } else { - m_ClusterStudiesTableExtra( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID, // pdgCode_De, - track.tpcInnerParam() * track.sign(), // pTPC_De, - track.pidForTracking(), // PIDinTrk_De, - computeNSigmaDe(track), // TpcNSigma_De, - track.tofNSigmaDe(), // TofNSigma_De, - -999.f, // TofMass_De, - -999.f, // cosPA, - -999.f); // massMother + if (setting_smallTable) { + m_ClusterStudiesTable( + track.p() * track.sign(), // p_De, + track.eta(), // eta_De, + track.phi(), // phi_De, + track.itsClusterSizes(), // itsClSize_De, + partID); // pdgCode_De + } else { + m_ClusterStudiesTableExtra( + track.p() * track.sign(), // p_De, + track.eta(), // eta_De, + track.phi(), // phi_De, + track.itsClusterSizes(), // itsClSize_De, + partID, // pdgCode_De, + track.tpcInnerParam() * track.sign(), // pTPC_De, + track.pidForTracking(), // PIDinTrk_De, + computeNSigmaDe(track), // TpcNSigma_De, + track.tofNSigmaDe(), // TofNSigma_De, + computeTOFmassDe(track), // TofMass_De, + -999.f, // cosPA, + -999.f); // massMother + } } m_hAnalysis.fill(HIST("isPositive"), track.sign() > 0); } - void fillDeTableMc(const TracksFullIUMc::iterator& track) - { - if (!track.has_mcParticle() || track.sign() > 0) { - return; - } - auto mcParticle = track.mcParticle(); - - m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDeNoCut); - if (track.itsNCls() < desetting_nClsIts) { - return; - } - m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDeNClsIts); - if (!selectionPIDtpcDe(track)) { - return; - } - m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDePIDtpc); - if (!track.hasTOF() || std::abs(track.tofNSigmaDe()) > desetting_nsigmatof) { - return; - } - m_hAnalysis.fill(HIST("de_selections"), DeSelections::kDePIDtof); - m_hAnalysis.fill(HIST("nSigmaTPCDe"), track.p() * track.sign(), computeNSigmaDe(track)); - m_hAnalysis.fill(HIST("nSigmaTOFDe"), track.p() * track.sign(), track.tofNSigmaDe()); - m_hAnalysis.fill(HIST("TOFmassDe"), track.p() * track.sign(), computeTOFmassDeMc(track)); - m_hAnalysis.fill(HIST("pmatchingDe"), track.sign() * track.tpcInnerParam(), (track.tpcInnerParam() - track.p()) / track.tpcInnerParam()); - - uint8_t partID = PartID::de; - - if (setting_smallTable) { - m_ClusterStudiesTableMc( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID, // pdgCode_De, - mcParticle.pdgCode()); // pdgCodeMc_De - } else { - m_ClusterStudiesTableMcExtra( - track.p() * track.sign(), // p_De, - track.eta(), // eta_De, - track.phi(), // phi_De, - track.itsClusterSizes(), // itsClSize_De, - partID, // pdgCode_De, - mcParticle.pdgCode(), // pdgCodeMc_De - track.tpcInnerParam() * track.sign(), // pTPC_De, - track.pidForTracking(), // PIDinTrk_De, - computeNSigmaDe(track), // TpcNSigma_De, - track.tofNSigmaDe(), // TofNSigma_De, - -999.f, // TofMass_De, - -999.f, // cosPA, - -999.f); // massMother - } - } - - void fillHe3Table(const TracksFullIU::iterator& track) + template + void fillHe3Table(const Track& track) { m_hAnalysis.fill(HIST("he3_selections"), He3Selections::kHe3NoCut); @@ -1197,7 +1050,7 @@ struct LfTreeCreatorClusterStudies { return; } m_hAnalysis.fill(HIST("he3_selections"), He3Selections::kHe3PIDtpc); - float tofMass = track.hasTOF() ? computeTOFmassHe3(track) : -999.f; + float tofMass = track.hasTOF() ? computeTOFmassHe3(track) : -999.f; if (track.hasTOF() && (tofMass < he3setting_tofmasslow || tofMass > he3setting_tofmasshigh)) { return; } @@ -1210,99 +1063,81 @@ struct LfTreeCreatorClusterStudies { m_hAnalysis.fill(HIST("TOFmassHe"), track.p() * track.sign(), tofMass); m_hAnalysis.fill(HIST("pmatchingHe"), track.sign() * correctedTPCinnerParam, (correctedTPCinnerParam - track.p()) / correctedTPCinnerParam); - if (setting_smallTable) { - m_ClusterStudiesTable( - track.p() * track.sign(), // p_He3, - track.eta(), // eta_He3, - track.phi(), // phi_He3, - track.itsClusterSizes(), // itsClSize_He3, - partID); // pdgCode_He3 + if constexpr (isMC) { + if (!track.has_mcParticle()) { + return; + } + auto mcParticle = track.mcParticle(); + + if (setting_smallTable) { + m_ClusterStudiesTableMc( + track.p() * track.sign(), // p_He3, + track.eta(), // eta_He3, + track.phi(), // phi_He3, + track.itsClusterSizes(), // itsClSize_He3, + partID, // pdgCode_He3, + mcParticle.pdgCode()); // pdgCodeMc_He3 + } else { + m_ClusterStudiesTableMcExtra( + track.p() * track.sign(), // p_He3 + track.eta(), // eta_He3 + track.phi(), // phi_He3 + track.itsClusterSizes(), // itsClSize_He3 + partID, // pdgCode_He3 + mcParticle.pdgCode(), // pdgCodeMc_He3 + correctedTPCinnerParam * track.sign(), // pTPC_He3 + track.pidForTracking(), // PIDinTrk_He3 + computeNSigmaHe3(track), // TpcNSigma_He3 + -999.f, // TofNSigma_He3 + tofMass, // TofMass_He3 + -999.f, // cosPA_He3 + -999.f); // massMother_He3 + } + } else { - m_ClusterStudiesTableExtra( - track.p() * track.sign(), // p_He3, - track.eta(), // eta_He3, - track.phi(), // phi_He3, - track.itsClusterSizes(), // itsClSize_He3, - partID, // pdgCode_He3, - correctedTPCinnerParam * track.sign(), // pTPC_He3, - track.pidForTracking(), // PIDinTrk_He3, - computeNSigmaHe3(track), // TpcNSigma_He3, - -999.f, // TofNSigma_He3, - tofMass, // TofMass_He3, - -999.f, // cosPA, - -999.f); // massMother + if (setting_smallTable) { + m_ClusterStudiesTable( + track.p() * track.sign(), // p_He3, + track.eta(), // eta_He3, + track.phi(), // phi_He3, + track.itsClusterSizes(), // itsClSize_He3, + partID); // pdgCode_He3 + } else { + m_ClusterStudiesTableExtra( + track.p() * track.sign(), // p_He3, + track.eta(), // eta_He3, + track.phi(), // phi_He3, + track.itsClusterSizes(), // itsClSize_He3, + partID, // pdgCode_He3, + correctedTPCinnerParam * track.sign(), // pTPC_He3, + track.pidForTracking(), // PIDinTrk_He3, + computeNSigmaHe3(track), // TpcNSigma_He3, + -999.f, // TofNSigma_He3, + tofMass, // TofMass_He3, + -999.f, // cosPA, + -999.f); // massMother + } } m_hAnalysis.fill(HIST("isPositive"), track.sign() > 0); } - void fillHe3TableMc(const TracksFullIUMc::iterator& track) - { - if (!track.has_mcParticle()) { - return; - } - auto mcParticle = track.mcParticle(); - m_hAnalysis.fill(HIST("he3_selections"), He3Selections::kHe3NoCut); - - if (track.itsNCls() < he3setting_nClsIts) { - return; - } - m_hAnalysis.fill(HIST("he3_selections"), He3Selections::kHe3NClsIts); - if (!selectionPIDtpcHe3(track)) { - return; - } - m_hAnalysis.fill(HIST("he3_selections"), He3Selections::kHe3PIDtpc); - float tofMass = track.hasTOF() ? computeTOFmassHe3Mc(track) : -999.f; - if (track.hasTOF() && (tofMass < he3setting_tofmasslow || tofMass > he3setting_tofmasshigh)) { - return; - } - uint8_t partID = PartID::he; - bool heliumPID = track.pidForTracking() == o2::track::PID::Helium3 || track.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParam = (heliumPID && he3setting_compensatePIDinTracking) ? track.tpcInnerParam() / 2.f : track.tpcInnerParam(); - - m_hAnalysis.fill(HIST("he3_selections"), He3Selections::kHe3PIDtof); - m_hAnalysis.fill(HIST("nSigmaTPCHe"), track.p() * track.sign(), computeNSigmaHe3(track)); - m_hAnalysis.fill(HIST("TOFmassHe"), track.p() * track.sign(), tofMass); - m_hAnalysis.fill(HIST("pmatchingHe"), track.sign() * correctedTPCinnerParam, (correctedTPCinnerParam - track.p()) / correctedTPCinnerParam); - - if (setting_smallTable) { - m_ClusterStudiesTableMc( - track.p() * track.sign(), // p_He3, - track.eta(), // eta_He3, - track.phi(), // phi_He3, - track.itsClusterSizes(), // itsClSize_He3, - partID, // pdgCode_He3, - mcParticle.pdgCode()); // pdgCodeMc_He3 - } else { - m_ClusterStudiesTableMcExtra( - track.p() * track.sign(), // p_He3 - track.eta(), // eta_He3 - track.phi(), // phi_He3 - track.itsClusterSizes(), // itsClSize_He3 - partID, // pdgCode_He3 - mcParticle.pdgCode(), // pdgCodeMc_He3 - correctedTPCinnerParam * track.sign(), // pTPC_He3 - track.pidForTracking(), // PIDinTrk_He3 - computeNSigmaHe3(track), // TpcNSigma_He3 - -999.f, // TofNSigma_He3 - tofMass, // TofMass_He3 - -999.f, // cosPA_He3 - -999.f); // massMother_He3 - } - } - void fillPKPiTable(const TracksFullIU::iterator& track) { uint8_t partID = 0; - if (std::abs(track.tpcNSigmaPi()) < v0setting_nsigmatpcPi) { + float tpcNSigma = 0.f; + if (std::abs(track.tpcNSigmaPi()) < v0setting_nsigmatpcPi && std::abs(track.tpcNSigmaKa()) > 3) { partID = PartID::pi; - m_hAnalysis.fill(HIST("nSigmaTPCPi"), track.p() * track.sign(), track.tpcNSigmaPi()); - } else if (std::abs(track.tpcNSigmaKa()) < cascsetting_nsigmatpc) { + tpcNSigma = track.tpcNSigmaPi(); + m_hAnalysis.fill(HIST("nSigmaTPCPi"), track.p() * track.sign(), tpcNSigma); + } else if (std::abs(track.tpcNSigmaKa()) < cascsetting_nsigmatpc && (std::abs(track.tpcNSigmaPi()) > 3 /*&& std::abs(track.tpcNSigmaPr()) > 3*/)) { partID = PartID::ka; - m_hAnalysis.fill(HIST("nSigmaTPCKa"), track.p() * track.sign(), track.tpcNSigmaKa()); - } else if (std::abs(track.tpcNSigmaPr()) < v0setting_nsigmatpcPr) { + tpcNSigma = track.tpcNSigmaKa(); + m_hAnalysis.fill(HIST("nSigmaTPCKa"), track.p() * track.sign(), tpcNSigma); + } else if (std::abs(track.tpcNSigmaPr()) < v0setting_nsigmatpcPr && std::abs(track.tpcNSigmaKa()) > 3) { partID = PartID::pr; - m_hAnalysis.fill(HIST("nSigmaTPCPr"), track.p() * track.sign(), track.tpcNSigmaPr()); + tpcNSigma = track.tpcNSigmaPr(); + m_hAnalysis.fill(HIST("nSigmaTPCPr"), track.p() * track.sign(), tpcNSigma); } else { return; } @@ -1314,6 +1149,20 @@ struct LfTreeCreatorClusterStudies { track.phi(), track.itsClusterSizes(), partID); + } else { + m_ClusterStudiesTableExtra( + track.p() * track.sign(), // p, + track.eta(), // eta, + track.phi(), // phi, + track.itsClusterSizes(), // itsClSize, + partID, // pdgCode, + track.tpcInnerParam() * track.sign(), // pTPC, + track.pidForTracking(), // PIDinTrk, + tpcNSigma, // TpcNSigma, + -999.f, // TofNSigma, + -999.f, // TofMass, + -999.f, // cosPA, + -999.f); // massMother } } @@ -1325,10 +1174,6 @@ struct LfTreeCreatorClusterStudies { auto bc = collision.bc_as(); initCCDB(bc); - m_collisionCounter++; - if (m_collisionCounter % static_cast(1e3) == 0) - LOG(info) << "Processing collision " << m_collisionCounter << " with zVtx = " << collision.posZ(); - if (!collisionSelection(collision)) { continue; } @@ -1343,18 +1188,15 @@ struct LfTreeCreatorClusterStudies { cascTable_thisCollision.bindExternalIndices(&tracks); cascTable_thisCollision.bindExternalIndices(&v0s); - m_v0TrackParCovs.clear(); - for (auto& v0 : v0Table_thisCollision) { - CandidateV0 candV0; - if (fillV0Cand(PV, v0, candV0, tracks) && setting_fillV0) - fillV0Table(candV0); + if (setting_fillV0 || setting_fillK) { + m_v0TrackParCovs.clear(); + for (auto& v0 : v0Table_thisCollision) { + fillV0Cand(PV, v0, tracks); + } } - - if (setting_fillK && setting_fillV0) { // the v0 loops are needed for the Ks + if (setting_fillK) { // the v0 loops are needed for the Ks for (auto& cascade : cascTable_thisCollision) { - CandidateK candK; - if (fillKCand(PV, cascade, candK, tracks)) - fillKTable(candK); + fillKCand(PV, cascade, tracks); } } } @@ -1364,10 +1206,6 @@ struct LfTreeCreatorClusterStudies { void processDataNuclei(CollisionsCustom const& collisions, TracksFullIU const& tracks) { for (const auto& collision : collisions) { - m_collisionCounter++; - if (m_collisionCounter % static_cast(1e3) == 0) - LOG(info) << "Processing collision " << m_collisionCounter << " with zVtx = " << collision.posZ(); - if (!collisionSelection(collision)) { continue; } @@ -1384,9 +1222,9 @@ struct LfTreeCreatorClusterStudies { } if (setting_fillDe) - fillDeTable(track); + fillDeTable(track); if (setting_fillHe3) - fillHe3Table(track); + fillHe3Table(track); } } } @@ -1426,10 +1264,6 @@ struct LfTreeCreatorClusterStudies { auto bc = collision.bc_as(); initCCDB(bc); - m_collisionCounter++; - if (m_collisionCounter % static_cast(1e3) == 0) - LOG(info) << "Processing collision " << m_collisionCounter << " with zVtx = " << collision.posZ(); - if (!collisionSelection(collision)) { continue; } @@ -1445,23 +1279,15 @@ struct LfTreeCreatorClusterStudies { cascTable_thisCollision.bindExternalIndices(&v0s); m_v0TrackParCovs.clear(); - for (auto& v0 : v0Table_thisCollision) { - CandidateV0 candV0; - if (fillV0Cand(PV, v0, candV0, tracks) && setting_fillV0) { - if (fillV0CandMc(v0, candV0)) { - fillV0TableMc(candV0); - } + if (setting_fillV0 || setting_fillK) { + for (auto& v0 : v0Table_thisCollision) { + fillV0Cand(PV, v0, tracks); } } if (setting_fillK) { // the v0 loops are needed for the Ks for (auto& cascade : cascTable_thisCollision) { - CandidateK candK; - if (fillKCand(PV, cascade, candK, tracks)) { - if (fillKCandMc(cascade, candK)) { - fillKTableMc(candK); - } - } + fillKCand(PV, cascade, tracks); } } } @@ -1471,10 +1297,6 @@ struct LfTreeCreatorClusterStudies { void processMcNuclei(CollisionsCustom const& collisions, TracksFullIUMc const& tracks, aod::BCs const&, aod::McParticles const&) { for (const auto& collision : collisions) { - m_collisionCounter++; - if (m_collisionCounter % static_cast(1e3) == 0) - LOG(info) << "Processing collision " << m_collisionCounter << " with zVtx = " << collision.posZ(); - if (!collisionSelection(collision)) { continue; } @@ -1491,10 +1313,10 @@ struct LfTreeCreatorClusterStudies { } if (setting_fillDe) { - fillDeTableMc(track); + fillDeTable(track); } if (setting_fillHe3) { - fillHe3TableMc(track); + fillHe3Table(track); } } } diff --git a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx index aef355695a9..5216a99844c 100644 --- a/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx +++ b/PWGLF/TableProducer/Nuspex/decay3bodybuilder.cxx @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -59,24 +61,36 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using ColwithEvTimes = o2::soa::Join; using MyCollisions = soa::Join; -using FullTracksExtIU = soa::Join; +using FullTracksExtIU = soa::Join; using FullTracksExtPIDIU = soa::Join; + +using ColwithEvTimes = o2::soa::Join; +using TrackExtIUwithEvTimes = soa::Join; +using TrackExtPIDIUwithEvTimes = soa::Join; + using MCLabeledTracksIU = soa::Join; struct decay3bodyBuilder { Produces vtx3bodydata; - Produces kfvtx3bodydata; + Produces kfvtx3bodydata; + Produces kfvtx3bodydatalite; Service ccdb; o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE; // Configurables Configurable d_UseAbsDCA{"d_UseAbsDCA", true, "Use Abs DCAs"}; + enum hyp3body { kH3L = 0, + kH4L, + kHe4L, + kHe5L, + kNHyp3body }; + enum vtxstep { kVtxAll = 0, kVtxTPCNcls, + kVtxPIDCut, kVtxhasSV, kVtxDcaDau, kVtxCosPA, @@ -86,69 +100,43 @@ struct decay3bodyBuilder { kKfVtxCollIds, kKfVtxCharge, kKfVtxEta, - kKfVtxTPCPID, kKfVtxTPCNcls, kKfVtxTPCRows, + kKfVtxTPCPID, kKfVtxDCAxyPV, kKfVtxDCAzPV, - kKfVtxTrackPt, - kKfVtxNoV0, + kKfVtxV0MassConst, kKfVtxhasSV, kKfVtxDcaDau, kKfVtxDcaDauVtx, + kKfVtxDauPt, + kKfVtxRap, kKfVtxPt, kKfVtxMass, kKfVtxCosPA, kKfVtxCosPAXY, kKfVtxChi2geo, + kKfVtxTopoConstr, kKfVtxChi2topo, kKfNVtxSteps }; - HistogramRegistry registry{ - "registry", - {{"hEventCounter", "hEventCounter", {HistType::kTH1F, {{1, 0.0f, 1.0f}}}}, - {"hVtx3BodyCounter", "hVtx3BodyCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, - {"hVtx3BodyCounterKFParticle", "hVtx3BodyCounterKFParticle", {HistType::kTH1F, {{20, 0.0f, 20.0f}}}}, - {"hBachelorTOFNSigmaDe", "", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"QA/Tracks/hTrackPosTPCNcls", "hTrackPosTPCNcls", {HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}}}, - {"QA/Tracks/hTrackNegTPCNcls", "hTrackNegTPCNcls", {HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}}}, - {"QA/Tracks/hTrackBachTPCNcls", "hTrackBachTPCNcls", {HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}}}, - {"QA/Tracks/hTrackPosHasTPC", "hTrackPosHasTPC", {HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}}}, - {"QA/Tracks/hTrackNegHasTPC", "hTrackNegHasTPC", {HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}}}, - {"QA/Tracks/hTrackBachHasTPC", "hTrackBachHasTPC", {HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}}}, - {"QA/Tracks/hTrackProtonTPCPID", "hTrackProtonTPCPID", {HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}}}, - {"QA/Tracks/hTrackPionTPCPID", "hTrackPionTPCPID", {HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}}}, - {"QA/Tracks/hTrackBachTPCPID", "hTrackBachTPCPID", {HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}}}, - {"QA/Tracks/hTrackProtonPt", "hTrackProtonPt", {HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"QA/Tracks/hTrackPionPt", "hTrackPionPt", {HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"QA/Tracks/hTrackBachPt", "hTrackBachPt", {HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}}}, - {"QA/Event/hVtxXKF", "hVtxXKF", {HistType::kTH1F, {{500, -0.5f, 0.5f, "PV X (cm)"}}}}, - {"QA/Event/hVtxYKF", "hVtxYKF", {HistType::kTH1F, {{500, -0.5f, 0.5f, "PV Y (cm)"}}}}, - {"QA/Event/hVtxZKF", "hVtxZKF", {HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}}}, - {"QA/Event/hVtxCovXXKF", "hVtxCovXXKF", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(XX) (cm^{2})"}}}}, - {"QA/Event/hVtxCovYYKF", "hVtxCovYYKF", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(YY) (cm^{2})"}}}}, - {"QA/Event/hVtxCovZZKF", "hVtxCovZZKF", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(ZZ) (cm^{2})"}}}}, - {"QA/Event/hVtxCovXYKF", "hVtxCovXYKF", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(XY) (cm^{2})"}}}}, - {"QA/Event/hVtxCovXZKF", "hVtxCovXZKF", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(XZ) (cm^{2})"}}}}, - {"QA/Event/hVtxCovYZKF", "hVtxCovYZKF", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(YZ) (cm^{2})"}}}}, - {"QA/Event/hVtxX", "hVtxX", {HistType::kTH1F, {{500, -0.5f, 0.5f, "PV X (cm)"}}}}, - {"QA/Event/hVtxY", "hVtxY", {HistType::kTH1F, {{500, -0.5f, 0.5f, "PV Y (cm)"}}}}, - {"QA/Event/hVtxZ", "hVtxZ", {HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}}}, - {"QA/Event/hVtxCovXX", "hVtxCovXX", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(XX) (cm^{2})"}}}}, - {"QA/Event/hVtxCovYY", "hVtxCovYY", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(YY) (cm^{2})"}}}}, - {"QA/Event/hVtxCovZZ", "hVtxCovZZ", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(ZZ) (cm^{2})"}}}}, - {"QA/Event/hVtxCovXY", "hVtxCovXY", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(XY) (cm^{2})"}}}}, - {"QA/Event/hVtxCovXZ", "hVtxCovXZ", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(XZ) (cm^{2})"}}}}, - {"QA/Event/hVtxCovYZ", "hVtxCovYZ", {HistType::kTH1F, {{200, -0.005f, 0.005f, "PV cov(YZ) (cm^{2})"}}}}}, - }; + HistogramRegistry registry{"registry", {}}; // hypothesis - Configurable bachelorcharge{"bachelorcharge", 1, "charge of the bachelor track"}; + 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 + // Selection criteria Configurable d_bz_input{"d_bz", -999, "bz field, -999 is automatic"}; Configurable mintpcNCls{"mintpcNCls", 70, "min tpc Nclusters"}; Configurable minCosPA3body{"minCosPA3body", 0.9, "minCosPA3body"}; Configurable dcavtxdau{"dcavtxdau", 1.0, "DCA Vtx Daughters"}; + Configurable enablePidCut{"enablePidCut", 0, "enable function checkPIDH3L"}; + Configurable TofPidNsigmaMin{"TofPidNsigmaMin", -5, "TofPidNsigmaMin"}; + Configurable TofPidNsigmaMax{"TofPidNsigmaMax", 5, "TofPidNsigmaMax"}; + Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; + Configurable minBachPUseTOF{"minBachPUseTOF", 1, "minBachP Enable TOF PID"}; Configurable useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"}; // CCDB options @@ -167,41 +155,50 @@ struct decay3bodyBuilder { Configurable fatalOnPassNotAvailable{"fatalOnPassNotAvailable", true, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; // for KFParticle reconstruction struct : ConfigurableGroup { - Configurable kfDoDCAFitterPreMinimum{"kfDoDCAFitterPreMinimum", false, "KF: do DCAFitter pre-optimization before KF fit to include material corrections for decay3body vertex"}; - Configurable doTrackQA{"doTrackQA", false, "Flag to fill QA histograms for daughter tracks."}; - Configurable doVertexQA{"doVertexQA", false, "Flag to fill QA histograms for KFParticle PV."}; - Configurable maxEta{"maxEta", 0.9, "Maximum eta for daughter tracks"}; - Configurable mintpcNClsTrack{"mintpcNClsTrack", 70, "Minimum number of TPC clusters for proton and deuteron track"}; - Configurable mintpcNClsPion{"mintpcNClsPion", 70, "Minimum number of TPC clusters for pion track"}; - Configurable mintpcCrossedRows{"mintpcCrossedRows", 70, "Minimum number of TPC crossed rows for proton and deuteron track"}; - Configurable mintpcCrossedRowsPion{"mintpcCrossedRowsPion", 70, "Minimum number of TPC crossed rows for pion track"}; - Configurable mindcaXYPionPV{"mindcaXYPionPV", 0.1, "Minimum DCA XY of the pion daughter track to the PV"}; - Configurable mindcaXYProtonPV{"mindcaXYProtonPV", 0.1, "Minimum DCA XY of the proton daughter track to the PV"}; - Configurable mindcaZPionPV{"mindcaZPionPV", 0.1, "Minimum DCA Z of the pion daughter track to the PV"}; - Configurable mindcaZProtonPV{"mindcaZProtonPV", 0.1, "Minimum DCA Z of the proton daughter track to the PV"}; - Configurable maxtpcnSigma{"maxtpcnSigma", 5., "Maximum nSigma TPC for daughter tracks"}; - Configurable maxPionPt{"maxPionPt", 1.2, "Maximum pion pT"}; - Configurable minProtonPt{"minProtonPt", 1.2, "Maximum pion pT"}; - Configurable minDeuteronPt{"minDeuteronPt", 1.2, "Maximum pion pT"}; - Configurable lambdaMassWindow{"lambdaMassWindow", 0.01, "Window cut around lambda mass for proton-pion vertex with KFParticle"}; - Configurable maxDcaProDeu{"maxDcaProDeu", 1000., "Maximum geometrical distance between proton and deuteron at the SV in 3D with KFParticle"}; - Configurable maxDcaProPi{"maxDcaProPi", 1000., "Maximum geometrical distance between proton and pion at the SV in 3D with KFParticle"}; - Configurable maxDcaPiDe{"maxDcaPiDe", 1000., "Maximum geometrical distance between pion and deuteron at the SV in 3D with KFParticle"}; - Configurable maxDcaXYSVDau{"maxDcaXYSVDau", 1.0, "Maximum geometrical distance of daughter tracks from the SV in XY with KFParticle"}; - Configurable maxDcaXYSVPion{"maxDcaXYSVPion", 1.0, "Maximum geometrical distance of daughter tracks from the SV in XY with KFParticle"}; - Configurable minPtHt{"minPtHt", 0., "Minimum momentum for Hypertriton candidates with KFParticle"}; - Configurable maxPtHt{"maxPtHt", 36., "Maximum momentum for Hypertriton candidates with KFParticle"}; - Configurable minMassHt{"minMassHt", 2.96, "Minimum candidate mass with KFParticle"}; - Configurable maxMassHt{"maxMassHt", 3.05, "Maximum candidate mass with KFParticle"}; - Configurable maxChi2geo{"maxChi2geo", 1000., "Maximum chi2 geometrical with KFParticle"}; - Configurable minCosPA{"minCosPA", 0.5, "Minimum cosine pointing angle with KFParticle"}; - Configurable minCosPAxy{"minCosPAxy", 0.5, "Minimum cosine pointing angle in xy with KFParticle"}; - Configurable applyTopoSels{"applyTopoSels", false, "Apply selections constraining the mother to the PV with KFParticle"}; - Configurable maxChi2topo{"maxChi2topo", 1000., "Maximum chi2 topological with KFParticle"}; + Configurable fillCandidateLiteTable{"kfparticleConfigurations.fillCandidateLiteTable", false, "Switch to fill lite table with candidate properties"}; + Configurable doSel8selection{"kfparticleConfigurations.doSel8selection", true, "flag for sel8 event selection"}; + Configurable doPosZselection{"kfparticleConfigurations.doPosZselection", true, "flag for posZ event selection"}; + Configurable doDCAFitterPreMinimum{"kfparticleConfigurations.doDCAFitterPreMinimum", false, "do DCAFitter pre-optimization before KF fit to include material corrections for decay3body vertex"}; + Configurable doTrackQA{"kfparticleConfigurations.doTrackQA", false, "Flag to fill QA histograms for daughter tracks."}; + Configurable doVertexQA{"kfparticleConfigurations.doVertexQA", false, "Flag to fill QA histograms for KFParticle PV."}; + Configurable useLambdaMassConstraint{"kfparticleConfigurations.useLambdaMassConstraint", false, "Apply Lambda mass constraint on proton-pion vertex"}; + Configurable maxEta{"kfparticleConfigurations.maxEta", 0.9, "Maximum eta for daughter tracks"}; + Configurable useTPCforPion{"kfparticleConfigurations.useTPCforPion", true, "Flag to ask for TPC info for pion track (PID, nClusters), false: pion track can be ITS only"}; + Configurable mintpcNClsProton{"kfparticleConfigurations.mintpcNClsProton", 70, "Minimum number of TPC clusters for proton track"}; + Configurable mintpcNClsPion{"kfparticleConfigurations.mintpcNClsPion", 70, "Minimum number of TPC clusters for pion track"}; + Configurable mintpcNClsBach{"kfparticleConfigurations.mintpcNClsBach", 70, "Minimum number of TPC clusters for bachelor track"}; + Configurable mintpcCrossedRows{"kfparticleConfigurations.mintpcCrossedRows", 70, "Minimum number of TPC crossed rows for proton and deuteron track"}; + Configurable mintpcCrossedRowsPion{"kfparticleConfigurations.mintpcCrossedRowsPion", 70, "Minimum number of TPC crossed rows for pion track"}; + Configurable minPtProton{"kfparticleConfigurations.minPtProton", 0.1, "Minimum pT of proton track"}; + Configurable maxPtProton{"kfparticleConfigurations.maxPtProton", 10, "Maximum pT of proton track"}; + Configurable minPtPion{"kfparticleConfigurations.minPtPion", 0.1, "Minimum pT of pion track"}; + Configurable maxPtPion{"kfparticleConfigurations.maxPtPion", 10, "Maximum pT of pion track"}; + Configurable minPtDeuteron{"kfparticleConfigurations.minPtDeuteron", 0.1, "Minimum pT of deuteron track"}; + Configurable maxPtDeuteron{"kfparticleConfigurations.maxPtDeuteron", 10, "Maximum pT of deuteron track"}; + Configurable mindcaXYPionPV{"kfparticleConfigurations.mindcaXYPionPV", 0.1, "Minimum DCA XY of the pion daughter track to the PV"}; + Configurable mindcaXYProtonPV{"kfparticleConfigurations.mindcaXYProtonPV", 0.1, "Minimum DCA XY of the proton daughter track to the PV"}; + Configurable mindcaZPionPV{"kfparticleConfigurations.mindcaZPionPV", 0.1, "Minimum DCA Z of the pion daughter track to the PV"}; + Configurable mindcaZProtonPV{"kfparticleConfigurations.mindcaZProtonPV", 0.1, "Minimum DCA Z of the proton daughter track to the PV"}; + Configurable maxtpcnSigma{"kfparticleConfigurations.maxtpcnSigma", 5., "Maximum nSigma TPC for daughter tracks"}; + Configurable maxDcaProDeu{"kfparticleConfigurations.maxDcaProDeu", 1000., "Maximum geometrical distance between proton and deuteron at the SV in 3D with KFParticle"}; + Configurable maxDcaProPi{"kfparticleConfigurations.maxDcaProPi", 1000., "Maximum geometrical distance between proton and pion at the SV in 3D with KFParticle"}; + 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 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 applyTopoSel{"kfparticleConfigurations.applyTopoSel", false, "Apply selection constraining the mother to the PV with KFParticle"}; + Configurable maxChi2topo{"kfparticleConfigurations.maxChi2topo", 1000., "Maximum chi2 topological with KFParticle"}; } kfparticleConfigurations; // Filters and slices - Filter collisionFilter = (aod::evsel::sel8 == true && nabs(aod::collision::posZ) < 10.f); + // Filter collisionFilter = (aod::evsel::sel8 == true && nabs(aod::collision::posZ) < 10.f); Preslice perCollision = o2::aod::decay3body::collisionId; int mRunNumber; @@ -210,7 +207,6 @@ struct decay3bodyBuilder { float maxStep; // max step size (cm) for propagation o2::base::MatLayerCylSet* lut = nullptr; o2::vertexing::DCAFitterN<3> fitter3body; - o2::aod::pidtofgeneric::TofPidNewCollision bachelorTOFPID; o2::pid::tof::TOFResoParamsV2 mRespParamsV2; void init(InitContext&) @@ -219,6 +215,30 @@ struct decay3bodyBuilder { d_bz = 0; maxSnp = 0.85f; // could be changed later maxStep = 2.00f; // could be changed later + + // set hypothesis corresponds to hyp3body, tpcpid to be implemented + switch (motherhyp) { + case hyp3body::kH3L: + bachelorcharge = 1; + bachelorTOFPID.SetPidType(o2::track::PID::Deuteron); + break; + case hyp3body::kH4L: + bachelorcharge = 1; + bachelorTOFPID.SetPidType(o2::track::PID::Triton); + break; + case hyp3body::kHe4L: + bachelorcharge = 2; + bachelorTOFPID.SetPidType(o2::track::PID::Helium3); + break; + case hyp3body::kHe5L: + bachelorcharge = 2; + bachelorTOFPID.SetPidType(o2::track::PID::Alpha); + break; + default: + LOG(fatal) << "Wrong hypothesis for decay3body"; + return; + } + fitter3body.setPropagateToPCA(true); fitter3body.setMaxR(200.); //->maxRIni3body fitter3body.setMinParamChange(1e-3); @@ -244,34 +264,6 @@ struct decay3bodyBuilder { lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get(lutPath)); } - registry.get(HIST("hVtx3BodyCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hVtx3BodyCounter"))->GetXaxis()->SetBinLabel(2, "TPCNcls"); - registry.get(HIST("hVtx3BodyCounter"))->GetXaxis()->SetBinLabel(3, "HasSV"); - registry.get(HIST("hVtx3BodyCounter"))->GetXaxis()->SetBinLabel(4, "DcaDau"); - registry.get(HIST("hVtx3BodyCounter"))->GetXaxis()->SetBinLabel(5, "CosPA"); - - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(2, "CollIds"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(3, "Charge"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(4, "Eta"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(5, "TPCpid"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(6, "TPCNcls"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(7, "TPCRows"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(8, "DCAxyPV"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(9, "DCAzPV"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(10, "TrackPt"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(11, "NoV0"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(12, "HasSV"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(13, "DcaDau"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(14, "DCADauVtx"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(15, "Pt"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(16, "Mass"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(17, "CosPA"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(18, "CosPAxy"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(19, "Chi2geo"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->GetXaxis()->SetBinLabel(20, "Chi2topo"); - registry.get(HIST("hVtx3BodyCounterKFParticle"))->LabelsOption("v"); - // Material correction in the DCA fitter if (useMatCorrType == 1) matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo; @@ -279,6 +271,84 @@ struct decay3bodyBuilder { matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT; fitter3body.setMatCorrType(matCorr); + + // Add histograms separately for different process functions + if (doprocessRun3 == 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"); + hVtx3BodyCounter->GetXaxis()->SetBinLabel(2, "TPCNcls"); + hVtx3BodyCounter->GetXaxis()->SetBinLabel(3, "PIDCut"); + hVtx3BodyCounter->GetXaxis()->SetBinLabel(4, "HasSV"); + hVtx3BodyCounter->GetXaxis()->SetBinLabel(5, "DcaDau"); + hVtx3BodyCounter->GetXaxis()->SetBinLabel(6, "CosPA"); + 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) { + 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}}); + 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->LabelsOption("v"); + + registry.add("QA/Tracks/hTrackPosTPCNcls", "hTrackPosTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); + registry.add("QA/Tracks/hTrackNegTPCNcls", "hTrackNegTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); + registry.add("QA/Tracks/hTrackBachTPCNcls", "hTrackBachTPCNcls", HistType::kTH1F, {{152, 0, 152, "# TPC clusters"}}); + registry.add("QA/Tracks/hTrackPosHasTPC", "hTrackPosHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); + registry.add("QA/Tracks/hTrackNegHasTPC", "hTrackNegHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); + registry.add("QA/Tracks/hTrackBachHasTPC", "hTrackBachHasTPC", HistType::kTH1F, {{2, -0.5, 1.5, "has TPC"}}); + registry.add("QA/Tracks/hTrackBachITSClusSizes", "hTrackBachITSClusSizes", HistType::kTH1F, {{10, 0., 10., "ITS cluster sizes"}}); + registry.add("QA/Tracks/hTrackProtonTPCPID", "hTrackProtonTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); + registry.add("QA/Tracks/hTrackPionTPCPID", "hTrackPionTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); + registry.add("QA/Tracks/hTrackBachTPCPID", "hTrackBachTPCPID", HistType::kTH2F, {{100, -10.0f, 10.0f, "p/z (GeV/c)"}, {100, -10.0f, 10.0f, "TPC n#sigma"}}); + registry.add("QA/Tracks/hTrackProtonPt", "hTrackProtonPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); + registry.add("QA/Tracks/hTrackPionPt", "hTrackPionPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); + registry.add("QA/Tracks/hTrackBachPt", "hTrackBachPt", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}}); + registry.add("QA/Event/hVtxXKF", "hVtxXKF", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV X (cm)"}}); + registry.add("QA/Event/hVtxYKF", "hVtxYKF", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV Y (cm)"}}); + registry.add("QA/Event/hVtxZKF", "hVtxZKF", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); + registry.add("QA/Event/hVtxCovXXKF", "hVtxCovXXKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XX) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovYYKF", "hVtxCovYYKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YY) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovZZKF", "hVtxCovZZKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(ZZ) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovXYKF", "hVtxCovXYKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XY) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovXZKF", "hVtxCovXZKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XZ) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovYZKF", "hVtxCovYZKF", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YZ) (cm^{2})"}}); + registry.add("QA/Event/hVtxX", "hVtxX", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV X (cm)"}}); + registry.add("QA/Event/hVtxY", "hVtxY", HistType::kTH1F, {{500, -0.1f, 0.1f, "PV Y (cm)"}}); + registry.add("QA/Event/hVtxZ", "hVtxZ", HistType::kTH1F, {{500, -15.0f, 15.0f, "PV Z (cm)"}}); + registry.add("QA/Event/hVtxCovXX", "hVtxCovXX", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XX) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovYY", "hVtxCovYY", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(YY) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovZZ", "hVtxCovZZ", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(ZZ) (cm^{2})"}}); + registry.add("QA/Event/hVtxCovXY", "hVtxCovXY", HistType::kTH1F, {{200, -0.0001f, 0.0001f, "PV cov(XY) (cm^{2})"}}); + 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})"}}); + } } void initCCDB(aod::BCsWithTimestamps::iterator const& bc) @@ -398,17 +468,29 @@ struct decay3bodyBuilder { } //------------------------------------------------------------------ - // Recalculate TOF PID for bachelors (deuteron), copied from PIDTOF.h - template - static float GetExpectedSigma(const o2::pid::tof::TOFResoParamsV2& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes, double mMassZ) + // Select decay3body candidate based on daughter track PID + template + bool checkPID(TTrack const& trackProton, TTrack const& trackPion, TTrack const& trackBachelor, const double& tofNSigmaBach) { - const float& mom = track.p(); - if (mom <= 0) { - return -999.f; + if ((tofNSigmaBach < TofPidNsigmaMin || tofNSigmaBach > TofPidNsigmaMax) && trackBachelor.p() > minBachPUseTOF) { + return false; } - const float dpp = parameters[9] + parameters[10] * mom + parameters[11] * mMassZ / mom; // mean relative pt resolution; - const float sigma = dpp * tofSignal / (1. + mom * mom / (mMassZ * mMassZ)); - return std::sqrt(sigma * sigma + parameters[12] * parameters[12] / mom / mom + parameters[4] * parameters[4] + collisionTimeRes * collisionTimeRes); + if (std::abs(trackProton.tpcNSigmaPr()) > TpcPidNsigmaCut) { + return false; + } + if (std::abs(trackPion.tpcNSigmaPi()) > TpcPidNsigmaCut) { + return false; + } + return true; + } + // PID check for H3L + template + bool checkPIDH3L(TTrack const& trackProton, TTrack const& trackPion, TTrack const& trackBachelor, const double& tofNSigmaBach) + { + if ((std::abs(trackBachelor.tpcNSigmaDe()) > TpcPidNsigmaCut) || !checkPID(trackProton, trackPion, trackBachelor, tofNSigmaBach)) { + return false; + } + return true; } //------------------------------------------------------------------ @@ -416,13 +498,13 @@ struct decay3bodyBuilder { template bool selectTPCPID(TTrack const& trackProton, TTrack const& trackPion, TTrack const& trackDeuteron) { - if (abs(trackProton.tpcNSigmaPr()) > kfparticleConfigurations.maxtpcnSigma) { + if (std::abs(trackProton.tpcNSigmaPr()) > kfparticleConfigurations.maxtpcnSigma) { return false; } - if (abs(trackPion.tpcNSigmaPi()) > kfparticleConfigurations.maxtpcnSigma) { + if (std::abs(trackDeuteron.tpcNSigmaDe()) > kfparticleConfigurations.maxtpcnSigma) { return false; } - if (abs(trackDeuteron.tpcNSigmaDe()) > kfparticleConfigurations.maxtpcnSigma) { + if (kfparticleConfigurations.useTPCforPion && std::abs(trackPion.tpcNSigmaPi()) > kfparticleConfigurations.maxtpcnSigma) { return false; } return true; @@ -443,11 +525,30 @@ struct decay3bodyBuilder { auto t1 = vtx3body.template track1_as(); auto t2 = vtx3body.template track2_as(); - if (t0.tpcNClsFound() < mintpcNCls && t1.tpcNClsFound() < mintpcNCls && t2.tpcNClsFound() < mintpcNCls) { + 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()) { + 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; + } + } + + registry.fill(HIST("hVtx3BodyCounter"), kVtxPIDCut); + // Calculate DCA with respect to the collision associated to the V0, not individual tracks gpu::gpustd::array dcaInfo; @@ -504,15 +605,7 @@ struct decay3bodyBuilder { } registry.fill(HIST("hVtx3BodyCounter"), kVtxCosPA); - // Recalculate the TOF PID - double tofNsigmaDe = -999; - - if (t2.has_collision() && t2.hasTOF()) { - auto originalcol = t2.template collision_as(); - tofNsigmaDe = bachelorTOFPID.GetTOFNSigma(o2::track::PID::Deuteron, t2, originalcol, collision); - } - - registry.fill(HIST("hBachelorTOFNSigmaDe"), t2.sign() * t2.p(), tofNsigmaDe); + registry.fill(HIST("hBachelorTOFNSigmaDe"), t2.sign() * t2.p(), tofNSigmaBach); vtx3bodydata( t0.globalIndex(), t1.globalIndex(), t2.globalIndex(), collision.globalIndex(), vtx3body.globalIndex(), @@ -521,16 +614,44 @@ struct decay3bodyBuilder { fitter3body.getChi2AtPCACandidate(), Track0dcaXY, Track1dcaXY, Track2dcaXY, Track0dca, Track1dca, Track2dca, - tofNsigmaDe); + tofNSigmaBach); } } //------------------------------------------------------------------ // 3body candidate builder with KFParticle - template - void buildVtx3BodyDataTableKFParticle(TCollision const& collision, aod::Decay3Bodys const& decay3bodys, int bachelorcharge) + template + void buildVtx3BodyDataTableKFParticle(TCollision const& collision, aod::Decay3Bodys const& decay3bodys, int bachelorcharge = 1) { LOG(debug) << "buildVtx3BodyDataTableKFParticle called."; + + // 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()); + } + for (auto& vtx3body : decay3bodys) { LOG(debug) << "Entered decay3bodys loop."; @@ -544,13 +665,9 @@ struct decay3bodyBuilder { 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 + // ---------- fill track QA histograms ---------- if (kfparticleConfigurations.doTrackQA) { registry.fill(HIST("QA/Tracks/hTrackPosTPCNcls"), trackPos.tpcNClsFound()); registry.fill(HIST("QA/Tracks/hTrackNegTPCNcls"), trackNeg.tpcNClsFound()); @@ -558,6 +675,7 @@ struct decay3bodyBuilder { 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()); @@ -573,27 +691,6 @@ struct decay3bodyBuilder { 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()); - } - // -------- 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()) { @@ -609,26 +706,18 @@ struct decay3bodyBuilder { registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCharge); // track eta - if (trackPos.eta() > kfparticleConfigurations.maxEta || trackNeg.eta() > kfparticleConfigurations.maxEta || trackBach.eta() > kfparticleConfigurations.maxEta) { + if (abs(trackPos.eta()) > kfparticleConfigurations.maxEta || abs(trackNeg.eta()) > kfparticleConfigurations.maxEta || abs(trackBach.eta()) > kfparticleConfigurations.maxEta) { continue; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxEta); - // TPC PID - if (isMatter && !selectTPCPID(trackPos, trackNeg, trackBach)) { // hypertriton (proton, pi-, deuteron) - continue; - } else if (!isMatter && !selectTPCPID(trackNeg, trackPos, trackBach)) { // anti-hypertriton (anti-proton, pi+, deuteron) - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCPID); - // number of TPC clusters - if (trackBach.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsTrack) { + if (trackBach.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsBach) { continue; } - if (isMatter && (trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion || trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsTrack)) { + if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { continue; - } else if (!isMatter && (trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion || trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsTrack)) { + } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsPion) || trackNeg.tpcNClsFound() <= kfparticleConfigurations.mintpcNClsProton)) { continue; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCNcls); @@ -637,14 +726,58 @@ struct decay3bodyBuilder { if (trackBach.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows) { continue; } - if (isMatter && (trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion || trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { + if (isMatter && ((kfparticleConfigurations.useTPCforPion && trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { continue; - } else if (!isMatter && (trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion || trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { + } else if (!isMatter && ((kfparticleConfigurations.useTPCforPion && trackPos.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRowsPion) || trackNeg.tpcNClsCrossedRows() <= kfparticleConfigurations.mintpcCrossedRows)) { continue; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTPCRows); + + // TPC PID + float tpcNsigmaProton; + float tpcNsigmaPion; + float dEdxProton; + float dEdxPion; + float tpcNsigmaDeuteron = trackBach.tpcNSigmaDe(); + 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)) { + 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)) { + 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()) { + auto originalcol = trackBach.template collision_as(); + tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(trackBach, originalcol, collision); + } + + // 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); + // track DCAxy and DCAz to PV associated with decay3body o2::dataformats::VertexBase mPV; o2::dataformats::DCA mDcaInfoCovPos; @@ -654,40 +787,48 @@ struct decay3bodyBuilder { auto trackParCovPVNeg = trackParCovNeg; auto trackParCovPVBach = trackParCovBach; mPV.setPos({collision.posX(), collision.posY(), collision.posZ()}); - mPV.setCov(collision.covXX(), collision.covXX(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); + 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; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDCAxyPV); - if (isMatter && (fabs(mDcaInfoCovNeg.getZ()) <= kfparticleConfigurations.mindcaZPionPV || fabs(mDcaInfoCovPos.getZ()) <= kfparticleConfigurations.mindcaZProtonPV)) { + if (isMatter && (fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZPionPV || fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { continue; - } else if (!isMatter && (fabs(mDcaInfoCovPos.getZ()) <= kfparticleConfigurations.mindcaZPionPV || fabs(mDcaInfoCovNeg.getZ()) <= kfparticleConfigurations.mindcaZProtonPV)) { + } else if (!isMatter && (fabs(TrackPosDcaZ) <= kfparticleConfigurations.mindcaZPionPV || fabs(TrackNegDcaZ) <= kfparticleConfigurations.mindcaZProtonPV)) { continue; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxDCAzPV); - - // pT selection - if (trackBach.pt() <= kfparticleConfigurations.minDeuteronPt) { - continue; + // 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); + + // 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(); } - if (isMatter && (trackNeg.pt() > kfparticleConfigurations.maxPionPt || trackPos.pt() <= kfparticleConfigurations.minProtonPt)) { - continue; - } else if (!isMatter && (trackPos.pt() > kfparticleConfigurations.maxPionPt || trackNeg.pt() <= kfparticleConfigurations.minProtonPt)) { - continue; - } - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxTrackPt); // -------- STEP 2: fit vertex with proton and pion -------- // Fit vertex with DCA fitter to find minimization point --> uses material corrections implicitly - if (kfparticleConfigurations.kfDoDCAFitterPreMinimum) { + if (kfparticleConfigurations.doDCAFitterPreMinimum) { try { fitter3body.process(trackParCovPos, trackParCovNeg, trackParCovBach); } catch (std::runtime_error& e) { @@ -713,13 +854,13 @@ struct decay3bodyBuilder { } LOG(debug) << "KFParticle objects created from daughter tracks."; - // Construct V0 + // Construct V0 as intermediate step KFParticle KFV0; - int nDaughters = 2; - const KFParticle* Daughters[2] = {&kfpProton, &kfpPion}; + int nDaughtersV0 = 2; + const KFParticle* DaughtersV0[2] = {&kfpProton, &kfpPion}; KFV0.SetConstructMethod(2); try { - KFV0.Construct(Daughters, nDaughters); + KFV0.Construct(DaughtersV0, nDaughtersV0); } catch (std::runtime_error& e) { LOG(debug) << "Failed to create V0 vertex from daughter tracks." << e.what(); continue; @@ -730,40 +871,44 @@ struct decay3bodyBuilder { // check V0 mass and set mass constraint float massV0, sigmaMassV0; KFV0.GetMass(massV0, sigmaMassV0); - if (abs(massV0 - constants::physics::MassLambda) <= kfparticleConfigurations.lambdaMassWindow) { - continue; - } KFParticle KFV0Mass = KFV0; KFV0Mass.SetNonlinearMassConstraint(o2::constants::physics::MassLambda); float chi2massV0 = KFV0Mass.GetChi2() / KFV0Mass.GetNDF(); - LOG(debug) << "V0 mass constraint applied."; - registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxNoV0); + if (kfparticleConfigurations.useLambdaMassConstraint) { + LOG(debug) << "V0 mass constraint applied."; + KFV0 = KFV0Mass; + } + registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxV0MassConst); - // -------- STEP 3: fit vertex with V0 and deuteron -------- + // -------- 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."; - // Add deuteron to V0 vertex + // Construct 3body vertex + int nDaughters3body = 3; + const KFParticle* Daughters3body[3] = {&kfpProton, &kfpPion, &kfpDeuteron}; KFParticle KFHt; - KFHt = KFV0; KFHt.SetConstructMethod(2); try { - KFHt.AddDaughter(kfpDeuteron); + KFHt.Construct(Daughters3body, nDaughters3body); } catch (std::runtime_error& e) { - LOG(debug) << "Failed to create Hyper triton from V0 and deuteron." << e.what(); + LOG(debug) << "Failed to create Hyper triton 3-body vertex." << e.what(); continue; } + // 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: 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 + // daughter DCAs with KF if ((kfpProton.GetDistanceFromParticle(kfpPion) >= kfparticleConfigurations.maxDcaProPi) || (kfpProton.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaProDeu) || (kfpPion.GetDistanceFromParticle(kfpDeuteron) >= kfparticleConfigurations.maxDcaPiDe)) { continue; } @@ -772,13 +917,27 @@ struct decay3bodyBuilder { LOG(debug) << "DCA selection after vertex fit applied."; // daughter DCAs to vertex - if (kfpProton.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau || kfpPion.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVPion || kfpDeuteron.GetDistanceFromVertexXY(KFHt) >= kfparticleConfigurations.maxDcaXYSVDau) { + 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."; + // 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."; + // -------- 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); + // Pt selection if (KFHt.GetPt() <= kfparticleConfigurations.minPtHt || KFHt.GetPt() >= kfparticleConfigurations.maxPtHt) { continue; @@ -794,13 +953,13 @@ struct decay3bodyBuilder { registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxMass); // cos(PA) to PV - if (abs(cpaFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPA) { + if (std::abs(cpaFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPA) { continue; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCosPA); // cos(PA) xy to PV - if (abs(cpaXYFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPAxy) { + if (std::abs(cpaXYFromKF(KFHt, kfpv)) <= kfparticleConfigurations.minCosPAxy) { continue; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxCosPAXY); @@ -813,34 +972,28 @@ struct decay3bodyBuilder { registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxChi2geo); LOG(debug) << "Basic selections after vertex fit done."; + // ctau before topo constraint + if (KFHt.GetLifeTime() > kfparticleConfigurations.maxctauHt) { + return; + } + // -------- STEP 6: topological constraint -------- /// Set vertex constraint and topological selection KFParticle KFHtPV = KFHt; - KFHtPV.SetProductionVertex(kfpv); - KFHtPV.TransportToDecayVertex(); + 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(); - if (kfparticleConfigurations.applyTopoSels && chi2topoNDF >= kfparticleConfigurations.maxChi2topo) { + KFHtPV.TransportToDecayVertex(); + if (kfparticleConfigurations.applyTopoSel && chi2topoNDF >= kfparticleConfigurations.maxChi2topo) { continue; } registry.fill(HIST("hVtx3BodyCounterKFParticle"), kKfVtxChi2topo); - LOG(debug) << "Topological constraint applied."; - - //------------------------------------------------------------------ - // Recalculate the bachelor TOF PID - double tofNsigmaDe = -999; - static constexpr float kCSPEED = TMath::C() * 1.0e2f * 1.0e-12f; // c in cm/ps - if (trackBach.hasTOF()) { - double bachExpTime = trackBach.length() * sqrt((o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron) + (trackBach.tofExpMom() * trackBach.tofExpMom())) / (kCSPEED * trackBach.tofExpMom()); // L*E/(p*c) = L/v - double tofsignal = trackBach.trackTime() * 1000 + bachExpTime; - // double bachtime = trackBach.trackTime() * 1000 + bachExpTime - collision.collisionTime(); // in ps - - double expSigma = GetExpectedSigma(mRespParamsV2, trackBach, tofsignal, collision.collisionTimeRes(), o2::constants::physics::MassDeuteron); - double corrTofMom = trackBach.tofExpMom() / (1.f + trackBach.sign() * mRespParamsV2.getShift(trackBach.eta())); - double corrSignal = trackBach.length() * sqrt((o2::constants::physics::MassDeuteron * o2::constants::physics::MassDeuteron) + (corrTofMom * corrTofMom)) / (kCSPEED * corrTofMom) + mRespParamsV2.getTimeShift(trackBach.eta(), trackBach.sign()); - tofNsigmaDe = (tofsignal - collision.collisionTime() - corrSignal) / expSigma; - } - registry.fill(HIST("hBachelorTOFNSigmaDe"), trackBach.sign() * trackBach.p(), tofNsigmaDe); - LOG(debug) << "Bachelor TOF info calculated."; //------------------------------------------------------------------ // table filling @@ -849,7 +1002,9 @@ struct decay3bodyBuilder { // 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 @@ -859,12 +1014,16 @@ struct decay3bodyBuilder { 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), @@ -879,20 +1038,86 @@ struct decay3bodyBuilder { kfpProton.GetDistanceFromParticle(kfpDeuteron), kfpPion.GetDistanceFromParticle(kfpDeuteron), DCAvtxDaughters3D, - // daughter DCAs to PV propagated with material + // 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 - trackPos.sign(), - trackNeg.sign(), + kfpProton.GetQ(), + kfpPion.GetQ(), trackBach.sign(), - // bachelor TOF PID - tofNsigmaDe); + // daughter PID + tpcNsigmaProton, + tpcNsigmaPion, + tpcNsigmaDeuteron, + dEdxProton, + dEdxPion, + dEdxDeuteron, + tofNSigmaDeuteron, + averageClusterSizeDeuteron, + trackBach.pidForTracking()); + + if (kfparticleConfigurations.fillCandidateLiteTable) { + kfvtx3bodydatalite( + // hypertriton + massHt, + KFHt.GetX(), KFHt.GetY(), KFHt.GetZ(), + 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), + 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 signs + kfpProton.GetQ(), + kfpPion.GetQ(), + trackBach.sign(), + // daughter PID + tpcNsigmaProton, + tpcNsigmaPion, + tpcNsigmaDeuteron, + 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, FullTracksExtIU const& tracksIU, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) + void processRun3(ColwithEvTimes const& collisions, TrackExtPIDIUwithEvTimes const& tracksIU, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) { for (const auto& collision : collisions) { auto bc = collision.bc_as(); @@ -900,29 +1125,38 @@ struct decay3bodyBuilder { 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); + // buildVtx3BodyDataTable(collisions, collision, tracksIU, d3bodysInCollision, bachelorcharge); + buildVtx3BodyDataTable(collision, tracksIU, d3bodysInCollision, bachelorcharge); } } PROCESS_SWITCH(decay3bodyBuilder, processRun3, "Produce DCA fitter decay3body tables", true); - void processRun3withKFParticle(soa::Filtered::iterator const& collision, FullTracksExtPIDIU const& /*tracksIU*/, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) + void processRun3withKFParticle(ColwithEvTimes const& collisions, TrackExtPIDIUwithEvTimes const&, aod::Decay3Bodys const& decay3bodys, aod::BCsWithTimestamps const&) { - // for (const auto& collision : collisions) { - LOG(debug) << "Start of processRun3withKFParticle."; - auto bc = collision.bc_as(); - initCCDB(bc); - registry.fill(HIST("hEventCounter"), 0.5); - LOG(debug) << "CCDB initialised."; - - // slice Decay3Body table by collision - // const uint64_t collIdx = collision.globalIndex(); - // LOG(debug) << "Collision index: " << collIdx; - // auto Decay3BodyTable_thisCollision = decay3bodys.sliceBy(perCollision, collIdx); - // LOG(debug) << "Decay3Body tables sliced per collision. Calling buildVtx3BodyDataTableKFParticle function..."; - buildVtx3BodyDataTableKFParticle(collision, decay3bodys, bachelorcharge); - LOG(debug) << "End of processKFParticle."; - // } + for (const auto& collision : collisions) { + // event selection + registry.fill(HIST("hEventCounterKFParticle"), 0.5); + if (kfparticleConfigurations.doSel8selection && !collision.sel8()) { + continue; + } + registry.fill(HIST("hEventCounterKFParticle"), 1.5); + if (kfparticleConfigurations.doPosZselection && abs(collision.posZ()) > 10.f) { + continue; + } + registry.fill(HIST("hEventCounterKFParticle"), 2.5); + + auto bc = collision.bc_as(); + initCCDB(bc); + LOG(debug) << "CCDB initialised."; + + // slice Decay3Body table by collision + const uint64_t collIdx = collision.globalIndex(); + // 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); + LOG(debug) << "End of processKFParticle."; + } } PROCESS_SWITCH(decay3bodyBuilder, processRun3withKFParticle, "Produce KFParticle decay3body tables", false); }; @@ -947,30 +1181,51 @@ struct decay3bodyDataLinkBuilder { } }; +struct kfdecay3bodyDataLinkBuilder { + Produces kfvtxdataLink; + + void init(InitContext const&) {} + + // build Decay3Body -> KFDecay3BodyData link table + void process(aod::Decay3Bodys const& decay3bodytable, aod::KFVtx3BodyDatas const& vtxdatatable) + { + std::vector lIndices; + lIndices.reserve(decay3bodytable.size()); + for (int ii = 0; ii < decay3bodytable.size(); ii++) + lIndices[ii] = -1; + for (auto& vtxdata : vtxdatatable) { + lIndices[vtxdata.decay3bodyId()] = vtxdata.globalIndex(); + } + for (int ii = 0; ii < decay3bodytable.size(); ii++) { + kfvtxdataLink(lIndices[ii]); + } + } +}; + struct decay3bodyLabelBuilder { Produces vtxlabels; Produces vtxfulllabels; + Produces kfvtxlabels; + Produces kfvtxfulllabels; - // for bookkeeping purposes: how many V0s come from same mother etc - HistogramRegistry registry{ - "registry", - { - {"hLabelCounter", "hLabelCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hHypertritonMCPt", "hHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hAntiHypertritonMCPt", "hAntiHypertritonMCPt", {HistType::kTH1F, {{100, 0.0f, 10.0f}}}}, - {"hHypertritonMCMass", "hHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hAntiHypertritonMCMass", "hAntiHypertritonMCMass", {HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hHypertritonMCLifetime", "hHypertritonMCLifetime", {HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}}}, - {"hAntiHypertritonMCLifetime", "hAntiHypertritonMCLifetime", {HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}}}, - }, - }; + HistogramRegistry registry{"registry", {}}; void init(InitContext const&) { - registry.get(HIST("hLabelCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hLabelCounter"))->GetXaxis()->SetBinLabel(2, "Have Same MotherTrack"); - registry.get(HIST("hLabelCounter"))->GetXaxis()->SetBinLabel(3, "True H3L"); + if (doprocessDoNotBuildLabels == false) { + auto hLabelCounter = registry.add("hLabelCounter", "hLabelCounter", HistType::kTH1D, {{3, 0.0f, 3.0f}}); + hLabelCounter->GetXaxis()->SetBinLabel(1, "Total"); + hLabelCounter->GetXaxis()->SetBinLabel(2, "Have Same MotherTrack"); + hLabelCounter->GetXaxis()->SetBinLabel(3, "True H3L"); + + registry.add("hHypertritonMCPt", "hHypertritonMCPt", HistType::kTH1F, {{100, 0.0f, 10.0f}}); + registry.add("hAntiHypertritonMCPt", "hAntiHypertritonMCPt", HistType::kTH1F, {{100, 0.0f, 10.0f}}); + registry.add("hHypertritonMCMass", "hHypertritonMCMass", HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}); + registry.add("hAntiHypertritonMCMass", "hAntiHypertritonMCMass", HistType::kTH1F, {{40, 2.95f, 3.05f, "Inv. Mass (GeV/c^{2})"}}); + registry.add("hHypertritonMCLifetime", "hHypertritonMCLifetime", HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}); + registry.add("hAntiHypertritonMCLifetime", "hAntiHypertritonMCLifetime", HistType::kTH1F, {{50, 0.0f, 50.0f, "ct(cm)"}}); + } } Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; @@ -1067,10 +1322,65 @@ struct decay3bodyLabelBuilder { } } PROCESS_SWITCH(decay3bodyLabelBuilder, processBuildLabels, "Produce MC label tables", false); + + void processBuildKFLabels(aod::KFDecay3BodysLinked const& decay3bodys, aod::KFVtx3BodyDatas const& vtx3bodydatas, MCLabeledTracksIU const&, aod::McParticles const&) + { + std::vector lIndices; + lIndices.reserve(vtx3bodydatas.size()); + for (int ii = 0; ii < vtx3bodydatas.size(); ii++) { + lIndices[ii] = -1; + } + + for (auto& decay3body : decay3bodys) { + + int lLabel = -1; + + auto lTrack0 = decay3body.track0_as(); + auto lTrack1 = decay3body.track1_as(); + auto lTrack2 = decay3body.track2_as(); + + // counter total + registry.fill(HIST("hLabelCounter"), 0.5); + + // Association check + if (lTrack0.has_mcParticle() && lTrack1.has_mcParticle() && lTrack2.has_mcParticle()) { + auto lMCTrack0 = lTrack0.mcParticle_as(); + auto lMCTrack1 = lTrack1.mcParticle_as(); + auto lMCTrack2 = lTrack2.mcParticle_as(); + // check if mother is the same + 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()) { + if (lMother0.globalIndex() == lMother1.globalIndex() && lMother0.globalIndex() == lMother2.globalIndex()) { + lLabel = lMother1.globalIndex(); + // fill counter same mother + registry.fill(HIST("hLabelCounter"), 1.5); + } // end same mother conditional + } + } + } // end loop over daughters + } // end conditional of mothers existing + } // end association check + + // Construct label table, only vtx which corresponds to true mother and true daughters with a specified order is labeled + // for matter: track0->p, track1->pi, track2->bachelor + // for antimatter: track0->pi, track1->p, track2->bachelor + kfvtxfulllabels(lLabel); + if (decay3body.kfvtx3BodyDataId() != -1) { + lIndices[decay3body.kfvtx3BodyDataId()] = lLabel; + } + } + for (int ii = 0; ii < vtx3bodydatas.size(); ii++) { + kfvtxlabels(lIndices[ii]); + } + } + PROCESS_SWITCH(decay3bodyLabelBuilder, processBuildKFLabels, "Produce MC KF label tables", false); }; struct decay3bodyInitializer { Spawns vtx3bodydatas; + // Spawns kfvtx3bodydatas; void init(InitContext const&) {} }; @@ -1079,6 +1389,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), adaptAnalysisTask(cfgc), }; diff --git a/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx b/PWGLF/TableProducer/Nuspex/ebyeMaker.cxx index 88cd22d1692..e00ff5476a8 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" @@ -55,7 +57,8 @@ using BCsWithRun2Info = soa::Join; namespace { constexpr int kNpart = 2; -constexpr double trackSels[10]{/* 60, */ 80, 100, 2, 3, /* 4, */ 0.05, 0.1, /* 0.15, */ 0.5, 1, /* 1.5, */ 2, 3 /* , 4 */}; +constexpr float trackSels[10]{/* 60, */ 80, 100, 2, 3, /* 4, */ 0.05, 0.1, /* 0.15, */ 0.5, 1, /* 1.5, */ 2, 3 /* , 4 */}; +constexpr float dcaSels[3]{10., 10., 10.}; constexpr double betheBlochDefault[kNpart][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}, {-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; constexpr double estimatorsCorrelationCoef[2]{-0.669108, 1.04489}; constexpr double estimatorsSigmaPars[4]{0.933321, 0.0416976, -0.000936344, 8.92179e-06}; @@ -65,6 +68,7 @@ constexpr double partPdg[kNpart]{2212, o2::constants::physics::kDeuteron}; static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; static const std::vector particleNamesPar{"p", "d"}; static const std::vector trackSelsNames{"tpcClsMid", "tpcClsTight", "chi2TpcTight", "chi2TpcMid", "dcaxyTight", "dcaxyMid", "dcazTight", "dcazMid", "tpcNsigmaTight", "tpcNsigmaMid"}; +static const std::vector dcaSelsNames{"dcaxy", "dcaz", "dca"}; static const std::vector particleName{"p"}; std::array, kNpart> tofMass; void momTotXYZ(std::array& momA, std::array const& momB, std::array const& momC) @@ -177,6 +181,8 @@ struct tagRun2V0MCalibration { TH1* mhVtxAmpCorrV0A = nullptr; TH1* mhVtxAmpCorrV0C = nullptr; TH1* mhMultSelCalib = nullptr; + float mMCScalePars[6] = {0.0}; + TFormula* mMCScale = nullptr; } Run2V0MInfo; struct ebyeMaker { @@ -218,8 +224,10 @@ struct ebyeMaker { Configurable zVtxMax{"zVtxMax", 10.0f, "maximum z position of the primary vertex"}; Configurable etaMax{"etaMax", 0.8f, "maximum eta"}; Configurable etaMaxV0dau{"etaMaxV0dau", 0.8f, "maximum eta V0 daughters"}; + Configurable outerPIDMin{"outerPIDMin", -4.f, "minimum outer PID"}; Configurable fillOnlySignal{"fillOnlySignal", false, "fill histograms only for true signal candidates (MC)"}; + Configurable genName{"genname", "", "Genearator name: HIJING, PYTHIA8, ... Default: \"\""}; Configurable kINT7Intervals{"kINT7Intervals", false, "toggle kINT7 trigger selection in the 10-30% and 50-90% centrality intervals (2018 Pb-Pb)"}; Configurable kUseTPCPileUpCut{"kUseTPCPileUpCut", false, "toggle strong correlation cuts (Run 2)"}; @@ -239,7 +247,8 @@ struct ebyeMaker { 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 trackDcaCut{"trackDcaCut", 0.1f, "DCA antid to PV"}; + Configurable trackChi2Cut{"trackChi2Cut", 4.f, "Maximum chi2/ncls in TPC"}; + Configurable> cfgDcaSels{"cfgDcaSels", {dcaSels, 1, 3, particleName, dcaSelsNames}, "DCA selections"}; Configurable v0trackNcrossedRows{"v0trackNcrossedRows", 100, "Minimum number of crossed TPC rows for V0 daughter"}; Configurable v0trackNclusItsCut{"v0trackNclusITScut", 0, "Minimum number of ITS clusters for V0 daughter"}; @@ -269,10 +278,12 @@ struct ebyeMaker { Configurable v0setting_nsigmatpc{"v0setting_nsigmatpc", 4.f, "nsigmatpc"}; Configurable lambdaMassCut{"lambdaMassCut", 0.02f, "maximum deviation from PDG mass (for QA histograms)"}; + Configurable constDCASel{"constDCASel", true, "use DCA selections independent of pt"}; + Configurable antidItsClsSizeCut{"antidItsClsSizeCut", 1.e-10f, "cluster size cut for antideuterons"}; Configurable antidPtItsClsSizeCut{"antidPtItsClsSizeCut", 10.f, "pt for cluster size cut for antideuterons"}; - Configurable> cfgTrackSels{"cfgTrackSels", {trackSels, 1, 10, particleName, trackSelsNames}, "Track selections"}; + Configurable> cfgTrackSels{"cfgTrackSels", {trackSels, 1, 10, particleName, trackSelsNames}, "Track selections"}; std::array ptMin; std::array ptTof; @@ -328,7 +339,7 @@ struct ebyeMaker { track.tpcNClsFound() < trackNclusTpcCut || track.tpcNClsCrossedRows() < trackNcrossedRows || track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || - track.tpcChi2NCl() > 4.f || + track.tpcChi2NCl() > trackChi2Cut || track.itsChi2NCl() > 36.f) { return false; } @@ -352,6 +363,11 @@ struct ebyeMaker { return sum / track.itsNCls(); } + float dcaSigma(float const& pt) + { + return 0.0105 + 0.0350 / std::pow(std::abs(pt), 1.1); + } + template void initCCDB(Bc const& bc) { @@ -374,9 +390,28 @@ struct ebyeMaker { TH1* h = reinterpret_cast(callst->FindObject(ccdbhname)); return h; }; + auto getformulaccdb = [callst](const char* ccdbhname) { + TFormula* f = reinterpret_cast(callst->FindObject(ccdbhname)); + return f; + }; Run2V0MInfo.mhVtxAmpCorrV0A = getccdb("hVtx_fAmplitude_V0A_Normalized"); Run2V0MInfo.mhVtxAmpCorrV0C = getccdb("hVtx_fAmplitude_V0C_Normalized"); Run2V0MInfo.mhMultSelCalib = getccdb("hMultSelCalib_V0M"); + Run2V0MInfo.mMCScale = getformulaccdb(TString::Format("%s-V0M", genName->c_str()).Data()); + if ((Run2V0MInfo.mhVtxAmpCorrV0A != nullptr) && (Run2V0MInfo.mhVtxAmpCorrV0C != nullptr) && (Run2V0MInfo.mhMultSelCalib != nullptr)) { + if (genName->length() != 0) { + if (Run2V0MInfo.mMCScale != nullptr) { + for (int ixpar = 0; ixpar < 6; ++ixpar) { + Run2V0MInfo.mMCScalePars[ixpar] = Run2V0MInfo.mMCScale->GetParameter(ixpar); + } + } else { + LOGF(fatal, "MC Scale information from V0M for run %d not available", bc.runNumber()); + } + } + Run2V0MInfo.mCalibrationStored = true; + } else { + LOGF(fatal, "Calibration information from V0M for run %d corrupted", bc.runNumber()); + } } else { auto grpmagPath{"GLO/Config/GRPMagField"}; grpmag = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); @@ -423,9 +458,19 @@ struct ebyeMaker { multFV0C += amplitude; } - float v0m = multFV0A * Run2V0MInfo.mhVtxAmpCorrV0A->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0A->FindFixBin(zvtx)) + - multFV0C * Run2V0MInfo.mhVtxAmpCorrV0C->GetBinContent(Run2V0MInfo.mhVtxAmpCorrV0C->FindFixBin(zvtx)); + 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; } @@ -441,9 +486,9 @@ struct ebyeMaker { mask |= kChi2TPCTight; else if (track.tpcchi2 < cfgTrackSels->get("chi2TpcMid")) mask |= kChi2TPCMid; - if (std::abs(track.dcaxypv) < cfgTrackSels->get("dcaxyTight")) + if (std::abs(track.dcaxypv) < cfgTrackSels->get("dcaxyTight") * (constDCASel ? 1. : dcaSigma(track.pt))) mask |= kDCAxyTight; - else if (std::abs(track.dcaxypv) < cfgTrackSels->get("dcaxyMid")) + else if (std::abs(track.dcaxypv) < cfgTrackSels->get("dcaxyMid") * (constDCASel ? 1. : dcaSigma(track.pt))) mask |= kDCAxyMid; if (std::abs(track.dcazpv) < cfgTrackSels->get("dcazTight")) mask |= kDCAzTight; @@ -487,10 +532,10 @@ struct ebyeMaker { if (doprocessRun3) { histos.add("QA/PvMultVsCent", ";Centrality T0C (%);#it{N}_{PV contributors};", HistType::kTH2F, {centAxis, multAxis}); histos.add("QA/MultVsCent", ";Centrality T0C (%);Multiplicity T0C;", HistType::kTH2F, {centAxis, multFt0Axis}); - } else if (doprocessRun2 || doprocessMiniRun2) { + } else if (doprocessRun2 || doprocessMiniRun2 || doprocessMcRun2 || doprocessMiniMcRun2) { 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.6; Tracklets |#eta| < 0.6", HistType::kTH2D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}}); + histos.add("QA/nTrklCorrelation", ";Tracklets |#eta| < 0.6; Tracklets |#eta| > 0.7", HistType::kTH2D, {{201, -0.5, 200.5}, {201, -0.5, 200.5}}); histos.add("QA/TrklEta", ";Tracklets #eta; Entries", HistType::kTH1D, {{100, -3., 3.}}); } @@ -533,11 +578,14 @@ struct ebyeMaker { candidateV0s.clear(); gpu::gpustd::array dcaInfo; - int nTracklets[2]{0, 0}; + uint8_t nTracklets[2]{0, 0}; for (const auto& track : tracks) { if (track.trackType() == 255 && std::abs(track.eta()) < 1.2) { // tracklet - nTracklets[std::abs(track.eta()) < 0.6]++; + if (std::abs(track.eta()) < 0.6) + nTracklets[0]++; + else if (std::abs(track.eta()) > 0.7) + nTracklets[1]++; } if (!selectTrack(track)) { @@ -549,7 +597,13 @@ struct ebyeMaker { auto dca = std::hypot(dcaInfo[0], dcaInfo[1]); auto trackPt = trackParCov.getPt(); auto trackEta = trackParCov.getEta(); - if (dca > trackDcaCut) { + if (dca > cfgDcaSels->get("dca")) { // dca + continue; + } + if (std::abs(dcaInfo[1]) > cfgDcaSels->get("dcaz")) { // dcaz + continue; + } + if (std::abs(dcaInfo[0]) > cfgDcaSels->get("dcaxy") * (constDCASel ? 1. : dcaSigma(track.pt()))) { // dcaxy continue; } histos.fill(HIST("QA/tpcSignal"), track.tpcInnerParam(), track.tpcSignal()); @@ -611,8 +665,10 @@ struct ebyeMaker { } } } - histos.fill(HIST("QA/nTrklCorrelation"), nTracklets[0], nTracklets[1]); - nTrackletsColl = nTracklets[1]; + if (doprocessRun2 || doprocessMcRun2 || doprocessMiniRun2 || doprocessMiniMcRun2) { + histos.fill(HIST("QA/nTrklCorrelation"), nTracklets[0], nTracklets[1]); + nTrackletsColl = nTracklets[1]; + } if (lambdaPtMax > lambdaPtMin) { std::vector trkId; @@ -778,7 +834,7 @@ struct ebyeMaker { auto mcTrack = mcLab.template mcParticle_as(); if (std::abs(mcTrack.pdgCode()) != partPdg[iP]) continue; - if (((mcTrack.flags() & 0x8) && doprocessMcRun2) || (mcTrack.flags() & 0x2) || (mcTrack.flags() & 0x1)) + if (((mcTrack.flags() & 0x8) && (doprocessMcRun2 || doprocessMiniMcRun2)) || (mcTrack.flags() & 0x2) || (mcTrack.flags() & 0x1)) continue; if (!mcTrack.isPhysicalPrimary()) continue; @@ -811,7 +867,7 @@ struct ebyeMaker { } if (!posMother.isPhysicalPrimary() && !posMother.has_mothers()) continue; - if (((posMother.flags() & 0x8) && doprocessMcRun2) || (posMother.flags() & 0x2) || (posMother.flags() & 0x1)) + if (((posMother.flags() & 0x8) && (doprocessMcRun2 || doprocessMiniMcRun2)) || (posMother.flags() & 0x2) || (posMother.flags() & 0x1)) continue; auto genPt = std::hypot(posMother.px(), posMother.py()); @@ -834,7 +890,7 @@ struct ebyeMaker { if (std::abs(genEta) > etaMax) { continue; } - if (((mcPart.flags() & 0x8) && doprocessMcRun2) || (mcPart.flags() & 0x2) || (mcPart.flags() & 0x1)) + if (((mcPart.flags() & 0x8) && (doprocessMcRun2 || doprocessMiniMcRun2)) || (mcPart.flags() & 0x2) || (mcPart.flags() & 0x1)) continue; auto pdgCode = mcPart.pdgCode(); if (std::abs(pdgCode) == 3122) { @@ -859,7 +915,7 @@ struct ebyeMaker { if (it != candidateV0s.end()) { continue; } else { - LOGF(info, "not found!"); + LOGF(debug, "not found!"); candidateV0s.emplace_back(candV0); } } else if (std::abs(pdgCode) == partPdg[0] || std::abs(pdgCode) == partPdg[1]) { @@ -931,22 +987,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, 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(); @@ -961,8 +1019,9 @@ struct ebyeMaker { if (kUseTPCPileUpCut && !(bc.eventCuts() & BIT(aod::Run2EventCuts::kTPCPileUp))) continue; - auto centrality = collision.centRun2V0M(); - if (!(collision.sel7() && collision.alias_bit(kINT7)) && (!kINT7Intervals || (kINT7Intervals && ((centrality >= 10 && centrality < 30) || centrality > 50)))) + float v0m = getV0M(bc.globalIndex(), collision.posZ(), fv0as, fv0cs); + float cV0M = Run2V0MInfo.mhMultSelCalib->GetBinContent(Run2V0MInfo.mhMultSelCalib->FindFixBin(v0m)); + if (!(collision.sel7() && collision.alias_bit(kINT7)) && (!kINT7Intervals || (kINT7Intervals && ((cV0M >= 10 && cV0M < 30) || cV0M > 50)))) continue; auto centralityCl0 = collision.centRun2CL0(); @@ -970,7 +1029,7 @@ struct ebyeMaker { const auto& x = centralityCl0; const double center = estimatorsCorrelationCoef[0] + estimatorsCorrelationCoef[1] * x; const double sigma = estimatorsSigmaPars[0] + estimatorsSigmaPars[1] * x + estimatorsSigmaPars[2] * std::pow(x, 2) + estimatorsSigmaPars[3] * std::pow(x, 3); - if (centrality < center - deltaEstimatorNsigma[0] * sigma || centrality > center + deltaEstimatorNsigma[1] * sigma) { + if (cV0M < center - deltaEstimatorNsigma[0] * sigma || cV0M > center + deltaEstimatorNsigma[1] * sigma) { continue; } } @@ -982,12 +1041,12 @@ struct ebyeMaker { V0Table_thisCollision.bindExternalIndices(&tracks); auto multTracklets = collision.multTracklets(); - fillRecoEvent(collision, tracks, V0Table_thisCollision, centrality); + fillRecoEvent(collision, tracks, V0Table_thisCollision, cV0M); - histos.fill(HIST("QA/V0MvsCL0"), centralityCl0, centrality); - histos.fill(HIST("QA/trackletsVsV0M"), centrality, multTracklets); + histos.fill(HIST("QA/V0MvsCL0"), centralityCl0, cV0M); + histos.fill(HIST("QA/trackletsVsV0M"), cV0M, multTracklets); - collisionEbyeTable(centrality, collision.posZ()); + collisionEbyeTable(cV0M, collision.posZ()); for (auto& candidateV0 : candidateV0s) { lambdaEbyeTable( @@ -1006,16 +1065,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); + } } } } @@ -1049,19 +1110,19 @@ struct ebyeMaker { fillRecoEvent(collision, tracks, V0Table_thisCollision, cV0M); uint8_t trigger = collision.alias_bit(kINT7) ? 0x1 : 0x0; - miniCollTable(std::abs(collision.posZ()), trigger, nTrackletsColl, cV0M); + miniCollTable(static_cast(collision.posZ() * 10), trigger, nTrackletsColl, cV0M); for (auto& candidateTrack : candidateTracks[0]) { // protons auto tk = tracks.rawIteratorAt(candidateTrack.globalIndex); float outerPID = getOuterPID(tk); candidateTrack.outerPID = tk.pt() < antipPtTof ? candidateTrack.outerPID : outerPID; int selMask = getTrackSelMask(candidateTrack); - if (candidateTrack.outerPID < -4) + if (candidateTrack.outerPID < outerPIDMin) continue; miniTrkTable( miniCollTable.lastIndex(), candidateTrack.pt, - std::abs(candidateTrack.eta) * 10., + static_cast(candidateTrack.eta * 100), selMask, candidateTrack.outerPID); } @@ -1118,26 +1179,28 @@ 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); + } } } } PROCESS_SWITCH(ebyeMaker, processMcRun3, "process MC (Run 3)", false); - void processMcRun2(soa::Join const& collisions, aod::McCollisions const& /*mcCollisions*/, TracksFull const& tracks, aod::V0s const& V0s, aod::McParticles const& mcParticles, aod::McTrackLabels const& mcLab, BCsWithRun2Info const&) + void processMcRun2(soa::Join const& collisions, aod::McCollisions const& /*mcCollisions*/, TracksFull const& tracks, aod::V0s const& V0s, aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs, aod::McParticles const& mcParticles, aod::McTrackLabels const& mcLab, BCsWithRun2Info const&) { for (auto& collision : collisions) { auto bc = collision.bc_as(); @@ -1149,7 +1212,8 @@ struct ebyeMaker { if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))) continue; - auto centrality = collision.centRun2V0M(); + 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()); @@ -1157,10 +1221,10 @@ struct ebyeMaker { auto V0Table_thisCollision = V0s.sliceBy(perCollisionV0, collIdx); V0Table_thisCollision.bindExternalIndices(&tracks); - fillMcEvent(collision, tracks, V0Table_thisCollision, centrality, mcParticles, mcLab); + fillMcEvent(collision, tracks, V0Table_thisCollision, cV0M, mcParticles, mcLab); fillMcGen(mcParticles, mcLab, collision.mcCollisionId()); - collisionEbyeTable(centrality, collision.posZ()); + collisionEbyeTable(cV0M, collision.posZ()); for (auto& candidateV0 : candidateV0s) { mcLambdaEbyeTable( @@ -1183,20 +1247,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); + } } } } @@ -1227,23 +1293,26 @@ struct ebyeMaker { fillMcEvent(collision, tracks, V0Table_thisCollision, cV0M, mcParticles, mcLab); fillMcGen(mcParticles, mcLab, collision.mcCollisionId()); - miniCollTable(std::abs(collision.posZ()), 0x0, nTrackletsColl, cV0M); + miniCollTable(static_cast(collision.posZ() * 10), 0x0, nTrackletsColl, cV0M); for (auto& candidateTrack : candidateTracks[0]) { // protons - auto tk = tracks.rawIteratorAt(candidateTrack.globalIndex); - float outerPID = getOuterPID(tk); - candidateTrack.outerPID = tk.pt() < antipPtTof ? candidateTrack.outerPID : outerPID; - int selMask = getTrackSelMask(candidateTrack); - if (candidateTrack.outerPID < -4) - continue; + int selMask = -1; + if (candidateTrack.isreco) { + auto tk = tracks.rawIteratorAt(candidateTrack.globalIndex); + float outerPID = getOuterPID(tk); + candidateTrack.outerPID = tk.pt() < antipPtTof ? candidateTrack.outerPID : outerPID; + selMask = getTrackSelMask(candidateTrack); + // if (candidateTrack.outerPID < -4) + // continue; + } mcMiniTrkTable( miniCollTable.lastIndex(), candidateTrack.pt, - std::abs(candidateTrack.eta) * 10., + static_cast(candidateTrack.eta * 100), selMask, candidateTrack.outerPID, - candidateTrack.genpt, - candidateTrack.geneta, + candidateTrack.pdgcode > 0 ? candidateTrack.genpt : -candidateTrack.genpt, + static_cast(candidateTrack.geneta * 100), candidateTrack.isreco); } } diff --git a/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx new file mode 100644 index 00000000000..da20c2ac8eb --- /dev/null +++ b/PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx @@ -0,0 +1,1066 @@ +// 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. +// Analysis task for he3-hadron femto analysis + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include // std::prev + +#include "Framework/ASoAHelpers.h" +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" + +#include "Common/Core/PID/PIDTOF.h" +#include "Common/Core/PID/TPCPIDResponse.h" +#include "Common/Core/RecoDecay.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 "Common/TableProducer/PID/pidTOFBase.h" + +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" + +#include "CCDB/BasicCCDBManager.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "ReconstructionDataFormats/Track.h" + +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFhe3HadronTables.h" +#include "PWGLF/Utils/svPoolCreator.h" + +using namespace o2; +using namespace o2::framework; +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 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, + kTrackCuts, + kPID, + kAll +}; + +} // namespace + +struct he3HadCandidate { + + float recoPtHe3() const { return sign * 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 recoPtHad() const { return sign * 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 momHad = {99.f, 99.f, 99.f}; + + float sign = 1.f; + float invMass = -10.f; + float DCAxyHe3 = -10.f; + float DCAzHe3 = -10.f; + float DCAxyHad = -10.f; + float DCAzHad = -10.f; + + uint16_t tpcSignalHe3 = 0u; + uint16_t tpcSignalHad = 0u; + float momHe3TPC = -99.f; + float momHadTPC = -99.f; + uint8_t nTPCClustersHe3 = 0u; + uint8_t sharedClustersHe3 = 0u; + uint8_t sharedClustersHad = 0u; + float chi2TPCHe3 = -10.f; + float chi2TPCHad = -10.f; + float nSigmaHe3 = -10.f; + float nSigmaHad = -10.f; + uint32_t PIDtrkHe3 = 0xFFFFF; // PID in tracking + uint32_t PIDtrkHad = 0xFFFFF; + float massTOFHe3 = -10; + float massTOFHad = -10; + uint32_t itsClSizeHe3 = 0u; + uint32_t itsClSizeHad = 0u; + + bool isBkgUS = false; // unlike sign + bool isBkgEM = false; // event mixing + + int trackIDHe3 = -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 momHadMC = -99.f; + float etaHadMC = -99.f; + float phiHadMC = -99.f; + + // collision information + int32_t collisionID = 0; +}; + +struct he3hadronfemto { + + 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"}; + Configurable setting_cutDCAxy{"setting_cutDCAxy", 2.0f, "DCAxy range for tracks"}; + 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_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_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_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"}; + + // svPool + Configurable setting_skipAmbiTracks{"setting_skipAmbiTracks", false, "Skip ambiguous tracks"}; + Configurable setting_customVertexerTimeMargin{"setting_customVertexerTimeMargin", 800, "Time margin for custom vertexer (ns)"}; + + // CCDB options + Configurable setting_d_bz_input{"setting_d_bz", -999, "bz field, -999 is automatic"}; + Configurable setting_ccdburl{"setting_ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable setting_grpPath{"setting_grpPath", "GLO/GRP/GRP", "Path of the grp file"}; + Configurable setting_grpmagPath{"setting_grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable setting_lutPath{"setting_lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; + Configurable setting_geoPath{"setting_geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; + Configurable setting_pidPath{"setting_pidPath", "", "Path to the PID response object"}; + + Configurable> setting_BetheBlochParams{"setting_BetheBlochParams", {betheBlochDefault[0], 1, 6, {"He3"}, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for He3"}; + 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"}; + + Preslice m_perCol = aod::track::collisionId; + Preslice m_perColMC = aod::track::collisionId; + + // binning for EM background + ConfigurableAxis axisVertex{"axisVertex", {30, -10, 10}, "Binning for multiplicity"}; + ConfigurableAxis axisCentrality{"axisCentrality", {VARIABLE_WIDTH, 0., 15., 30., 45., 60., 75., 95., 250.}, "Binning for centrality"}; + using BinningType = ColumnBinningPolicy; + BinningType binningPolicy{{axisVertex, axisCentrality}, true}; + SliceCache cache; + SameKindPair m_pair{binningPolicy, setting_noMixedEvents, -1, &cache}; + + std::array m_BBparamsHe; + + std::vector m_recoCollisionIDs; + std::vector m_goodCollisions; + std::vector m_trackPairs; + o2::vertexing::DCAFitterN<2> m_fitter; + svPoolCreator m_svPoolCreator{hePDG, prPDG}; + + int m_runNumber; + float m_d_bz; + Service m_ccdb; + Zorro m_zorro; + OutputObj m_zorroSummary{"zorroSummary"}; + + // check for mixed event to same event distribution compatibility + std::vector m_trackIdx2; + + HistogramRegistry m_qaRegistry{ + "QA", + { + {"hVtxZ", "Vertex distribution in Z;Z (cm)", {HistType::kTH1F, {{400, -20.0, 20.0}}}}, + {"hNcontributor", "Number of primary vertex contributor", {HistType::kTH1F, {{2000, 0.0f, 2000.0f}}}}, + {"hTrackSel", "Accepted tracks", {HistType::kTH1F, {{Selections::kAll, -0.5, static_cast(Selections::kAll) - 0.5}}}}, + {"hEvents", "; Events;", {HistType::kTH1F, {{3, -0.5, 2.5}}}}, + {"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}}}}, + {"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, {{200, -6.0f, 6.0f}}}}, + {"hHadronPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", {HistType::kTH1F, {{200, -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}}}}, + {"h2NsigmaHe3TPC_preselection", "NsigmaHe3 TPC distribution; #it{p}/z (GeV/#it{c}); n#sigma_{TPC}(^{3}He)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {200, -10.0f, 10.0f}}}}, + {"h2NsigmaHadronTPC", "NsigmaHadron TPC distribution; #it{p}/z (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}, {200, -10.0f, 10.0f}}}}, + {"h2NsigmaHadronTOF", "NsigmaHadron TOF distribution; #it{p} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}}}, + {"h2NsigmaHadronTOF_preselection", "NsigmaHadron TOF distribution; #it{p} (GeV/#it{c}); n#sigma_{TOF}(p)", {HistType::kTH2F, {{100, -5.0f, 5.0f}, {200, -10.0f, 10.0f}}}}, + }, + OutputObjHandlingPolicy::AnalysisObject, + false, + true}; + + void init(o2::framework::InitContext&) + { + m_zorroSummary.setObject(m_zorro.getZorroSummary()); + m_runNumber = 0; + + m_ccdb->setURL(setting_ccdburl); + m_ccdb->setCaching(true); + m_ccdb->setLocalObjectValidityChecking(); + m_ccdb->setFatalWhenNull(false); + + m_fitter.setPropagateToPCA(true); + m_fitter.setMaxR(200.); + m_fitter.setMinParamChange(1e-3); + m_fitter.setMinRelChi2Change(0.9); + m_fitter.setMaxDZIni(1e9); + m_fitter.setMaxChi2(1e9); + m_fitter.setUseAbsDCA(true); + int mat{static_cast(setting_materialCorrection)}; + m_fitter.setMatCorrType(static_cast(mat)); + + m_svPoolCreator.setTimeMargin(setting_customVertexerTimeMargin); + if (setting_skipAmbiTracks) { + m_svPoolCreator.setSkipAmbiTracks(); + } + + for (int i = 0; i < 5; i++) { + m_BBparamsHe[i] = setting_BetheBlochParams->get("He3", Form("p%i", i)); + } + m_BBparamsHe[5] = setting_BetheBlochParams->get("He3", "resolution"); + + std::vector selection_labels = {"All", "Track selection", "PID"}; + for (int i = 0; i < Selections::kAll; i++) { + m_qaRegistry.get(HIST("hTrackSel"))->GetXaxis()->SetBinLabel(i + 1, selection_labels[i].c_str()); + } + + std::vector events_labels = {"All", "Selected", "Zorro He events"}; + for (int i = 0; i < Selections::kAll; i++) { + m_qaRegistry.get(HIST("hEvents"))->GetXaxis()->SetBinLabel(i + 1, events_labels[i].c_str()); + } + + m_qaRegistry.get(HIST("hEmptyPool"))->GetXaxis()->SetBinLabel(1, "False"); + m_qaRegistry.get(HIST("hEmptyPool"))->GetXaxis()->SetBinLabel(2, "True"); + } + + void initCCDB(const aod::BCsWithTimestamps::iterator& bc) + { + if (m_runNumber == bc.runNumber()) { + return; + } + if (setting_skimmedProcessing) { + m_zorro.initCCDB(m_ccdb.service, bc.runNumber(), bc.timestamp(), "fHe"); + m_zorro.populateHistRegistry(m_qaRegistry, bc.runNumber()); + } + m_runNumber = bc.runNumber(); + + auto run3grp_timestamp = bc.timestamp(); + o2::parameters::GRPObject* grpo = m_ccdb->getForTimeStamp(setting_grpPath, run3grp_timestamp); + o2::parameters::GRPMagField* grpmag = 0x0; + if (grpo) { + o2::base::Propagator::initFieldFromGRP(grpo); + if (setting_d_bz_input < -990) { + // Fetch magnetic field from ccdb for current collision + m_d_bz = grpo->getNominalL3Field(); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << m_d_bz << " kZG"; + } else { + m_d_bz = setting_d_bz_input; + } + } else { + grpmag = m_ccdb->getForTimeStamp(setting_grpmagPath, run3grp_timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << setting_grpmagPath << " of object GRPMagField and " << setting_grpPath << " of object GRPObject for timestamp " << run3grp_timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpmag); + if (setting_d_bz_input < -990) { + // Fetch magnetic field from ccdb for current collision + m_d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << m_d_bz << " kZG"; + } else { + m_d_bz = setting_d_bz_input; + } + } + } + + // ================================================================================================================== + + template + bool selectCollision(const Tcollision& collision, const aod::BCsWithTimestamps&) + { + m_qaRegistry.fill(HIST("hEvents"), 0); + + if constexpr (isMC) { + if (/*!collision.sel8() ||*/ std::abs(collision.posZ()) > setting_cutVertex) { + return false; + } + } else { + auto bc = collision.template bc_as(); + initCCDB(bc); + + if (!collision.sel8() || std::abs(collision.posZ()) > setting_cutVertex) { + return false; + } + if (setting_skimmedProcessing) { + bool zorroSelected = m_zorro.isSelected(collision.template bc_as().globalBC()); + if (zorroSelected) { + m_qaRegistry.fill(HIST("hEvents"), 2); + } + } + } + + m_qaRegistry.fill(HIST("hEvents"), 1); + m_qaRegistry.fill(HIST("hNcontributor"), collision.numContrib()); + m_qaRegistry.fill(HIST("hVtxZ"), collision.posZ()); + return true; + } + + template + bool selectTrack(const Ttrack& candidate) + { + if (std::abs(candidate.eta()) > setting_cutEta) { + return false; + } + if (candidate.itsNCls() < 5 || + candidate.tpcNClsFound() < 90 || + candidate.tpcNClsCrossedRows() < 70 || + candidate.tpcNClsCrossedRows() < 0.8 * candidate.tpcNClsFindable() || + candidate.tpcChi2NCl() > 4.f || + candidate.tpcChi2NCl() < setting_cutChi2tpcLow || + candidate.itsChi2NCl() > 36.f) { + return false; + } + + return true; + } + + template + float computeTPCNSigmaHadron(const Ttrack& candidate) + { + float tpcNSigmaHad = 0; + if (setting_HadPDGCode == 211) { + tpcNSigmaHad = candidate.tpcNSigmaPi(); + LOG(info) << "pion"; + } else if (setting_HadPDGCode == 2212) { + tpcNSigmaHad = candidate.tpcNSigmaPr(); + } else { + LOG(info) << "invalid PDG code for TPC"; + } + return tpcNSigmaHad; + } + + template + float computeTOFNSigmaHadron(const Ttrack& candidate) + { + float tofNSigmaHad = 0; + if (setting_HadPDGCode == 211) { + tofNSigmaHad = candidate.tofNSigmaPi(); + LOG(info) << "piontof"; + } 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; + } + m_qaRegistry.fill(HIST("h2NsigmaHadronTOF_preselection"), candidate.p(), tpcNSigmaHad); + if (std::abs(tpcNSigmaHad) > setting_cutNsigmaTOF) { + return false; + } + m_qaRegistry.fill(HIST("h2NsigmaHadronTPC"), candidate.tpcInnerParam(), tpcNSigmaHad); + m_qaRegistry.fill(HIST("h2NsigmaHadronTOF"), candidate.p(), tpcNSigmaHad); + return true; + } else if (std::abs(tpcNSigmaHad) < setting_cutNsigmaTPC) { + m_qaRegistry.fill(HIST("h2NsigmaHadronTPC"), candidate.tpcInnerParam(), tpcNSigmaHad); + return true; + } + return false; + } + + template + float computeNSigmaHe3(const Ttrack& candidate) + { + bool heliumPID = candidate.pidForTracking() == o2::track::PID::Helium3 || candidate.pidForTracking() == o2::track::PID::Alpha; + float correctedTPCinnerParam = (heliumPID && setting_compensatePIDinTracking) ? candidate.tpcInnerParam() / 2.f : candidate.tpcInnerParam(); + float expTPCSignal = o2::tpc::BetheBlochAleph(static_cast(correctedTPCinnerParam * 2.f / constants::physics::MassHelium3), m_BBparamsHe[0], m_BBparamsHe[1], m_BBparamsHe[2], m_BBparamsHe[3], m_BBparamsHe[4]); + + double resoTPC{expTPCSignal * m_BBparamsHe[5]}; + return static_cast((candidate.tpcSignal() - expTPCSignal) / resoTPC); + } + + template + bool selectionPIDHe3(const Ttrack& candidate) + { + bool heliumPID = candidate.pidForTracking() == o2::track::PID::Helium3 || candidate.pidForTracking() == o2::track::PID::Alpha; + float correctedTPCinnerParam = (heliumPID && setting_compensatePIDinTracking) ? candidate.tpcInnerParam() / 2.f : candidate.tpcInnerParam(); + + if (correctedTPCinnerParam < setting_cutRigidityMinHe3) { + 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() * correctedTPCinnerParam, nSigmaHe3); + if (std::abs(nSigmaHe3) > setting_cutNsigmaTPC) { + 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); + return true; + } + + // ================================================================================================================== + + template + bool fillCandidateInfo(const Ttrack& trackHe3, const Ttrack& trackHad, const CollBracket& collBracket, const Tcollisions& collisions, he3HadCandidate& he3Hadcand, const Ttracks& /*trackTable*/, bool isMixedEvent) + { + if (!isMixedEvent) { + auto trackCovHe3 = getTrackParCov(trackHe3); + auto trackCovHad = getTrackParCov(trackHad); + int nCand = 0; + try { + nCand = m_fitter.process(trackCovHe3, trackCovHad); + } catch (...) { + LOG(error) << "Exception caught in DCA fitter process call!"; + return false; + } + if (nCand == 0) { + return false; + } + + // associate collision id as the one that minimises the distance between the vertex and the PCAs of the daughters + double distanceMin = -1; + unsigned int collIdxMin = 0; + + for (int collIdx = collBracket.getMin(); collIdx <= collBracket.getMax(); collIdx++) { + auto collision = collisions.rawIteratorAt(collIdx); + std::array collVtx = {collision.posX(), collision.posY(), collision.posZ()}; + const auto& PCA = m_fitter.getPCACandidate(); + float distance = 0; + for (int i = 0; i < 3; i++) { + distance += (PCA[i] - collVtx[i]) * (PCA[i] - collVtx[i]); + } + if (distanceMin < 0 || distance < distanceMin) { + distanceMin = distance; + collIdxMin = collIdx; + } + } + + if (!m_goodCollisions[collIdxMin]) { + return false; + } + he3Hadcand.collisionID = collIdxMin; + } else { + he3Hadcand.collisionID = collBracket.getMin(); + } + + he3Hadcand.momHe3 = std::array{trackHe3.px(), trackHe3.py(), trackHe3.pz()}; + for (int i = 0; i < 3; i++) + 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 pthe3Had = std::hypot(he3Hadcand.momHe3[0] + he3Hadcand.momHad[0], he3Hadcand.momHe3[1] + he3Hadcand.momHad[1]); + if (pthe3Had < setting_cutPtMinhe3Had) { + return false; + } + + he3Hadcand.sign = trackHe3.sign(); + + he3Hadcand.DCAxyHe3 = trackHe3.dcaXY(); + he3Hadcand.DCAzHe3 = trackHe3.dcaZ(); + he3Hadcand.DCAxyHad = trackHad.dcaXY(); + he3Hadcand.DCAzHad = trackHad.dcaZ(); + + 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(); + he3Hadcand.momHe3TPC = correctedTPCinnerParamHe3; + he3Hadcand.tpcSignalHad = trackHad.tpcSignal(); + he3Hadcand.momHadTPC = trackHad.tpcInnerParam(); + + he3Hadcand.nTPCClustersHe3 = trackHe3.tpcNClsFound(); + he3Hadcand.nSigmaHe3 = computeNSigmaHe3(trackHe3); + he3Hadcand.nSigmaHad = computeTPCNSigmaHadron(trackHad); + // he3Hadcand.nSigmaHad = trackHad.tpcNSigmaPi();/*tpcNSigmaHad*/ + he3Hadcand.chi2TPCHe3 = trackHe3.tpcChi2NCl(); + he3Hadcand.chi2TPCHad = trackHad.tpcChi2NCl(); + + he3Hadcand.PIDtrkHe3 = trackHe3.pidForTracking(); + he3Hadcand.PIDtrkHad = trackHad.pidForTracking(); + + he3Hadcand.itsClSizeHe3 = trackHe3.itsClusterSizes(); + he3Hadcand.itsClSizeHad = trackHad.itsClusterSizes(); + + he3Hadcand.sharedClustersHe3 = trackHe3.tpcNClsShared(); + he3Hadcand.sharedClustersHad = trackHad.tpcNClsShared(); + + he3Hadcand.isBkgUS = trackHe3.sign() * trackHad.sign() < 0; + he3Hadcand.isBkgEM = isMixedEvent; + + he3Hadcand.invMass = invMass; + + he3Hadcand.trackIDHe3 = trackHe3.globalIndex(); + he3Hadcand.trackIDHad = trackHad.globalIndex(); + + o2::pid::tof::Beta responseBeta; + if (trackHe3.hasTOF()) { + float beta = responseBeta.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(); + he3Hadcand.massTOFHe3 = correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); + } + if (trackHad.hasTOF()) { + float beta = responseBeta.GetBeta(trackHad); + beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked + he3Hadcand.massTOFHad = trackHad.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); + } + + return true; + } + + template + void fillCandidateInfoMC(const Mc& mctrackHe3, const Mc& mctrackHad, const Mc& mctrackMother, he3HadCandidate& he3Hadcand) + { + 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); + + if (!selectTrack(track0)) { + continue; + } + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); + + if (!selectionPIDHe3(track0)) { + continue; + } + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kPID); + + for (auto track1 : tracks) { + + if (track0 == track1) { + continue; + } + + if (!setting_enableBkgUS) { + if (track0.sign() * track1.sign() < 0) { + continue; + } + } else if (setting_enableBkgUS) { + if (track0.sign() * track1.sign() > 0) { + continue; + } + } else { + LOG(info) << "setting_enableBkgUS has to be 0 or 1"; + } + + if (!selectTrack(track1) || !selectionPIDHadron(track1)) { + continue; + } + + SVCand trackPair; + trackPair.tr0Idx = track0.globalIndex(); + trackPair.tr1Idx = track1.globalIndex(); + const int collIdx = track0.collisionId(); + CollBracket collBracket{collIdx, collIdx}; + trackPair.collBracket = collBracket; + m_trackPairs.push_back(trackPair); + } + } + } + + template + void pairTracksEventMixing(T& he3Cands, T& hadronCands) + { + for (auto& he3Cand : he3Cands) { + if (!selectTrack(he3Cand) || !selectionPIDHe3(he3Cand)) { + continue; + } + for (auto& hadronCand : hadronCands) { + if (!selectTrack(hadronCand) || !selectionPIDHadron(hadronCand)) { + continue; + } + + SVCand trackPair; + trackPair.tr0Idx = he3Cand.globalIndex(); + trackPair.tr1Idx = hadronCand.globalIndex(); + const int collIdx = he3Cand.collisionId(); + CollBracket collBracket{collIdx, collIdx}; + trackPair.collBracket = collBracket; + m_trackPairs.push_back(trackPair); + } + } + } + + template + void fillTable(const he3HadCandidate& he3Hadcand, const Tcoll& collision, bool isMC = false) + { + 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( + he3Hadcand.momHe3MC, + he3Hadcand.etaHe3MC, + he3Hadcand.phiHe3MC, + he3Hadcand.momHadMC, + he3Hadcand.etaHadMC, + he3Hadcand.phiHadMC, + he3Hadcand.l4PtMC, + he3Hadcand.l4MassMC); + } + if (setting_fillMultiplicity) { + m_outputMultiplicityTable( + collision.numContrib(), + collision.centFT0C(), + collision.multFT0C()); + } + } + + void fillHistograms(const he3HadCandidate& he3Hadcand) + { + 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); + } + } + } + + // ================================================================================================================== + + void processSameEvent(const CollisionsFull& collisions, const TrackCandidates& tracks, const aod::BCsWithTimestamps& bcs) + { + m_goodCollisions.clear(); + m_goodCollisions.resize(collisions.size(), false); + + for (auto& collision : collisions) { + + m_trackPairs.clear(); + + if (!selectCollision(collision, bcs)) { + continue; + } + + m_goodCollisions[collision.globalIndex()] = true; + const uint64_t collIdx = collision.globalIndex(); + auto TrackTable_thisCollision = tracks.sliceBy(m_perCol, collIdx); + TrackTable_thisCollision.bindExternalIndices(&tracks); + + pairTracksSameEvent(TrackTable_thisCollision); + + if (m_trackPairs.size() == 0) { + continue; + } + + fillPairs(collisions, tracks, /*isMixedEvent*/ false); + } + } + PROCESS_SWITCH(he3hadronfemto, processSameEvent, "Process Same event", false); + + void processMixedEvent(const CollisionsFull& collisions, const TrackCandidates& tracks) + { + LOG(debug) << "Processing mixed event"; + m_trackPairs.clear(); + + for (auto& [c1, tracks1, c2, tracks2] : m_pair) { + if (!c1.sel8() || !c2.sel8()) { + continue; + } + + m_qaRegistry.fill(HIST("hNcontributor"), c1.numContrib()); + m_qaRegistry.fill(HIST("hVtxZ"), c1.posZ()); + + pairTracksEventMixing(tracks1, tracks2); + pairTracksEventMixing(tracks2, tracks1); + } + + fillPairs(collisions, tracks, /*isMixedEvent*/ true); + } + PROCESS_SWITCH(he3hadronfemto, processMixedEvent, "Process Mixed event", false); + + void processMC(const CollisionsFullMC& collisions, const aod::BCsWithTimestamps& bcs, const TrackCandidatesMC& tracks, const aod::McParticles& mcParticles) + { + std::vector filledMothers; + + m_goodCollisions.clear(); + m_goodCollisions.resize(collisions.size(), false); + + for (auto& collision : collisions) { + + m_trackPairs.clear(); + + if (!selectCollision(collision, bcs)) { + continue; + } + + const uint64_t collIdx = collision.globalIndex(); + m_goodCollisions[collIdx] = true; + auto TrackTable_thisCollision = tracks.sliceBy(m_perColMC, collIdx); + TrackTable_thisCollision.bindExternalIndices(&tracks); + + pairTracksSameEvent(TrackTable_thisCollision); + + for (auto& trackPair : m_trackPairs) { + + auto heTrack = tracks.rawIteratorAt(trackPair.tr0Idx); + auto prTrack = tracks.rawIteratorAt(trackPair.tr1Idx); + auto collBracket = trackPair.collBracket; + + if (!heTrack.has_mcParticle() || !prTrack.has_mcParticle()) { + continue; + } + + auto mctrackHe3 = heTrack.mcParticle(); + auto mctrackHad = prTrack.mcParticle(); + + if (std::abs(mctrackHe3.pdgCode()) != hePDG || std::abs(mctrackHad.pdgCode()) != prPDG) { + continue; + } + + for (auto& mothertrack : mctrackHe3.mothers_as()) { + for (auto& mothertrackHad : mctrackHad.mothers_as()) { + + if (mothertrack != mothertrackHad || std::abs(mothertrack.pdgCode()) != li4PDG || std::abs(mothertrack.y()) > 1) { + continue; + } + + he3HadCandidate he3Hadcand; + if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, he3Hadcand, tracks, /*mix*/ false)) { + continue; + } + fillCandidateInfoMC(mctrackHe3, mctrackHad, mothertrack, he3Hadcand); + fillHistograms(he3Hadcand); + auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); + fillTable(he3Hadcand, collision, /*isMC*/ true); + filledMothers.push_back(mothertrack.globalIndex()); + } + } + } + } + + fillMcParticles(collisions, mcParticles, filledMothers); + } + PROCESS_SWITCH(he3hadronfemto, processMC, "Process MC", false); + + void processSameEventPools(const CollisionsFull& collisions, const TrackCandidates& tracks, const aod::AmbiguousTracks& ambiguousTracks, const aod::BCsWithTimestamps& bcs) + { + m_goodCollisions.clear(); + m_goodCollisions.resize(collisions.size(), false); + + for (auto& collision : collisions) { + if (selectCollision(collision, bcs)) { + m_goodCollisions[collision.globalIndex()] = true; + } + } + + m_svPoolCreator.clearPools(); + m_svPoolCreator.fillBC2Coll(collisions, bcs); + + for (auto& track : tracks) { + + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kNoCuts); + if (!selectTrack(track)) + continue; + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); + + bool selHad = selectionPIDHadron(track); + bool selHe = selectionPIDHe3(track); + if ((!selHad && !selHe) || (selHad && selHe)) { + continue; + } + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kPID); + + int pdgHypo = selHe ? hePDG : prPDG; + + m_svPoolCreator.appendTrackCand(track, collisions, pdgHypo, ambiguousTracks, bcs); + } + + 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); + + fillPairs(collisions, tracks, /*isMixedEvent*/ 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) + { + std::vector filledMothers; + + m_goodCollisions.clear(); + m_goodCollisions.resize(collisions.size(), false); + + for (auto& collision : collisions) { + if (selectCollision(collision, bcs)) { + m_goodCollisions[collision.globalIndex()] = true; + } + } + + m_svPoolCreator.clearPools(); + m_svPoolCreator.fillBC2Coll(collisions, bcs); + + for (auto& track : tracks) { + + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kNoCuts); + if (!selectTrack(track)) + continue; + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kTrackCuts); + + bool selHad = selectionPIDHadron(track); + bool selHe = selectionPIDHe3(track); + if ((!selHad && !selHe) || (selHad && selHe)) + continue; + m_qaRegistry.fill(HIST("hTrackSel"), Selections::kPID); + + int pdgHypo = selHe ? hePDG : prPDG; + + m_svPoolCreator.appendTrackCand(track, collisions, pdgHypo, ambiguousTracks, bcs); + } + + auto& svPool = m_svPoolCreator.getSVCandPool(collisions, true); + if (svPool.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 heTrackLabel = mcTrackLabels.rawIteratorAt(svCand.tr0Idx); + auto prTrackLabel = mcTrackLabels.rawIteratorAt(svCand.tr1Idx); + auto collBracket = svCand.collBracket; + + if (!heTrackLabel.has_mcParticle() || !prTrackLabel.has_mcParticle()) { + continue; + } + + auto mctrackHe3 = heTrackLabel.mcParticle_as(); + auto mctrackHad = prTrackLabel.mcParticle_as(); + + 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& mothertrackHad : mctrackHad.mothers_as()) { + + if (mothertrackHe.globalIndex() != mothertrackHad.globalIndex() || std::abs(mothertrackHe.pdgCode()) != li4PDG || std::abs(mothertrackHe.y()) > 1) { + continue; + } + + he3HadCandidate he3Hadcand; + if (!fillCandidateInfo(heTrack, prTrack, collBracket, collisions, he3Hadcand, tracks, /*mix*/ false)) { + continue; + } + fillCandidateInfoMC(mctrackHe3, mctrackHad, mothertrackHe, he3Hadcand); + fillHistograms(he3Hadcand); + auto collision = collisions.rawIteratorAt(he3Hadcand.collisionID); + fillTable(he3Hadcand, collision, /*isMC*/ true); + filledMothers.push_back(mothertrackHe.globalIndex()); + } + } + } + + fillMcParticles(collisions, mcParticles, filledMothers); + } + PROCESS_SWITCH(he3hadronfemto, processMcPools, "Process MC pools", false); +}; + +WorkflowSpec defineDataProcessing(const ConfigContext& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"he3hadronfemto"})}; +} diff --git a/PWGLF/TableProducer/Nuspex/hyperKinkRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperKinkRecoTask.cxx index 658ab180d67..8e46e3326c1 100644 --- a/PWGLF/TableProducer/Nuspex/hyperKinkRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/hyperKinkRecoTask.cxx @@ -332,7 +332,7 @@ struct hyperKinkRecoTask { bool isGoodTPCCand = false; if (candidate.itsNClsInnerBarrel() == 0 && candidate.itsNCls() < 4 && candidate.tpcNClsCrossedRows() >= 70 && candidate.tpcChi2NCl() < 4.f && - candidate.tpcNClsCrossedRows() > 0.8 * candidate.tpcNClsFindable() && candidate.tpcNClsFound() > 80 && abs(nSigmaTrit) < nSigmaTPCCutTrit) { + candidate.tpcNClsCrossedRows() > 0.8 * candidate.tpcNClsFindable() && candidate.tpcNClsFound() > 80 && std::abs(nSigmaTrit) < nSigmaTPCCutTrit) { isGoodTPCCand = true; } @@ -340,7 +340,7 @@ struct hyperKinkRecoTask { return false; } - if (candidate.hasTOF() && abs(nSigmaTOFTrit) > nSigmaTOFCutTrit) { + if (candidate.hasTOF() && std::abs(nSigmaTOFTrit) > nSigmaTOFCutTrit) { return false; } @@ -394,7 +394,7 @@ struct hyperKinkRecoTask { gpu::gpustd::array dcaInfoHyp; o2::base::Propagator::Instance()->propagateToDCABxByBz({primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, trackParCovHyperPV, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoHyp); - if (abs(dcaInfoHyp[0]) > maxDCAHypToPV) { + if (std::abs(dcaInfoHyp[0]) > maxDCAHypToPV) { continue; } @@ -412,7 +412,7 @@ struct hyperKinkRecoTask { // propagate to PV gpu::gpustd::array dcaInfoTrit; o2::base::Propagator::Instance()->propagateToDCABxByBz({primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}, trackParCovTrit, 2.f, static_cast(cfgMaterialCorrection.value), &dcaInfoTrit); - if (abs(dcaInfoTrit[0]) < minDCATritToPV) { + if (std::abs(dcaInfoTrit[0]) < minDCATritToPV) { continue; } @@ -492,13 +492,13 @@ struct hyperKinkRecoTask { auto mcTrackHyper = mcLabHyper.mcParticle_as(); auto mcTrackTrit = mcLabTrit.mcParticle_as(); - if (abs(mcTrackHyper.pdgCode()) != hyperPdg || abs(mcTrackTrit.pdgCode()) != tritDauPdg) { + if (std::abs(mcTrackHyper.pdgCode()) != hyperPdg || std::abs(mcTrackTrit.pdgCode()) != tritDauPdg) { continue; } auto tritIdx = mcTrackTrit.globalIndex(); kinkCand.isSignal = false; for (auto& dauMCTracks : mcTrackHyper.daughters_as()) { - if (abs(dauMCTracks.pdgCode()) == tritDauPdg) { + if (std::abs(dauMCTracks.pdgCode()) == tritDauPdg) { if (dauMCTracks.globalIndex() == tritIdx) { kinkCand.isSignal = true; break; diff --git a/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx b/PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx index 8951e0eba29..6acf6578717 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; @@ -137,6 +140,7 @@ struct hyperRecoTask { Configurable v0cospacut{"hypcospa", 0.95, "V0 CosPA"}; Configurable masswidth{"hypmasswidth", 0.06, "Mass width (GeV/c^2)"}; Configurable dcaToPvPion{"dcapvPi", 0., "DCA to PV pion"}; + Configurable dcaToPvHe{"dcapvHe", 0., "DCA to PV helium"}; Configurable dcav0dau{"hypdcaDau", 1.0, "DCA V0 Daughters"}; Configurable ptMin{"ptMin", 0.5, "Minimum pT of the hypercandidate"}; Configurable TPCRigidityMinHe{"TPCRigidityMinHe", 0.2, "Minimum rigidity of the helium candidate"}; @@ -151,6 +155,8 @@ struct hyperRecoTask { o2::vertexing::DCAFitterN<2> fitter; svPoolCreator svCreator{heDauPdg, 211}; + o2::pid::tof::Beta responseBeta; + // daughter masses float he3Mass = o2::constants::physics::MassHelium3; float he4Mass = o2::constants::physics::MassAlpha; @@ -159,7 +165,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"}; @@ -387,6 +393,8 @@ struct hyperRecoTask { hypCand.clusterSizeITSPi = piTrack.itsClusterSizes(); bool heliumPID = heTrack.pidForTracking() == o2::track::PID::Helium3 || heTrack.pidForTracking() == o2::track::PID::Alpha; hypCand.momHe3TPC = (heliumPID && cfgCompensatePIDinTracking) ? heTrack.tpcInnerParam() / 2 : heTrack.tpcInnerParam(); + if (hypCand.momHe3TPC < TPCRigidityMinHe) + return; hypCand.momPiTPC = piTrack.tpcInnerParam(); hDeDxTot->Fill(hypCand.momHe3TPC * heTrack.sign(), heTrack.tpcSignal()); hDeDxTot->Fill(hypCand.momPiTPC * piTrack.sign(), piTrack.tpcSignal()); @@ -487,7 +495,7 @@ struct hyperRecoTask { o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, piTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo); hypCand.piDCAXY = dcaInfo[0]; - if (abs(hypCand.piDCAXY) < dcaToPvPion) { + if (std::abs(hypCand.piDCAXY) < dcaToPvPion || std::abs(hypCand.he3DCAXY) < dcaToPvHe) { return; } @@ -497,6 +505,12 @@ struct hyperRecoTask { hypCand.piTrackID = piTrack.globalIndex(); hypCand.collisionID = collision.globalIndex(); + if (heTrack.hasTOF()) { + float beta = responseBeta.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); @@ -594,7 +608,7 @@ struct hyperRecoTask { for (auto& piMother : mcTrackPi.mothers_as()) { if (heMother.globalIndex() != piMother.globalIndex()) continue; - if (abs(mcTrackHe.pdgCode()) != heDauPdg || abs(mcTrackPi.pdgCode()) != 211) + if (std::abs(mcTrackHe.pdgCode()) != heDauPdg || std::abs(mcTrackPi.pdgCode()) != 211) continue; if (std::abs(heMother.pdgCode()) != hyperPdg) continue; @@ -640,6 +654,7 @@ struct hyperRecoTask { for (auto& hypCand : hyperCandidates) { auto collision = collisions.rawIteratorAt(hypCand.collisionID); + float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0; outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.posX(), collision.posY(), collision.posZ(), hypCand.isMatter, @@ -649,7 +664,8 @@ 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.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedClSize[hypCand.v0ID]); + hypCand.massTOFHe3, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize); } } PROCESS_SWITCH(hyperRecoTask, processData, "Data analysis", true); @@ -666,6 +682,7 @@ struct hyperRecoTask { for (auto& hypCand : hyperCandidates) { auto collision = collisions.rawIteratorAt(hypCand.collisionID); + float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0; outputDataTableWithFlow(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.psiFT0A(), collision.multFT0A(), collision.psiFT0C(), collision.multFT0C(), @@ -678,7 +695,8 @@ 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.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedClSize[hypCand.v0ID]); + hypCand.massTOFHe3, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize); } } PROCESS_SWITCH(hyperRecoTask, processDataWithFlow, "Data analysis with flow", false); @@ -702,6 +720,7 @@ struct hyperRecoTask { if (!hypCand.isSignal && mcSignalOnly) continue; int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0); + float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0; outputMCTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.posX(), collision.posY(), collision.posZ(), hypCand.isMatter, @@ -711,7 +730,8 @@ 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.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedClSize[hypCand.v0ID], + 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], hypCand.isReco, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); @@ -783,8 +803,8 @@ struct hyperRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, false, -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], hypCand.isReco, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection); diff --git a/PWGLF/TableProducer/Nuspex/lithium4analysis.cxx b/PWGLF/TableProducer/Nuspex/lithium4analysis.cxx deleted file mode 100644 index 20e717836a1..00000000000 --- a/PWGLF/TableProducer/Nuspex/lithium4analysis.cxx +++ /dev/null @@ -1,681 +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. -// Analysis task for anti-lithium4 analysis - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "Common/Core/PID/PIDTOF.h" -#include "Common/TableProducer/PID/pidTOFBase.h" - -#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 "Common/Core/RecoDecay.h" -#include "Common/Core/TrackSelection.h" -#include "Framework/ASoAHelpers.h" -#include "DataFormatsTPC/BetheBlochAleph.h" -#include "CCDB/BasicCCDBManager.h" - -#include "PWGLF/DataModel/LFLithium4Tables.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; -using std::array; - -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 int lithium4PDG = 1000030040; -constexpr int protonPDG = 2212; -constexpr int he3PDG = 1000020030; - -enum Selections { - kNoCuts = 0, - kGlobalTrack, - kTrackCuts, - kPID, - kAll -}; - -} // namespace - -struct lithium4Candidate { - - float sign = 0.f; - - float recoPtHe3() const { return sign * 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()); } - - std::array momHe3 = {99.f, 99.f, 99.f}; - std::array momPr = {99.f, 99.f, 99.f}; - - uint32_t PIDtrkHe3 = 0xFFFFF; // PID in tracking - uint32_t PIDtrkPr = 0xFFFFF; - - float nSigmaHe3 = -10; - float nSigmaPr = -10; - float massTOFHe3 = -10; - float massTOFPr = -10; - - float DCAxyHe3 = -10; - float DCAzHe3 = -10; - float DCAxyPr = -10; - float DCAzPr = -10; - uint16_t tpcSignalHe3 = 0u; - float momHe3TPC = -99.f; - uint16_t tpcSignalPr = 0u; - float momPrTPC = -99.f; - float invMass = -10.f; - - uint32_t itsClSizeHe3 = 0u; - uint32_t itsClSizePr = 0u; - uint8_t nTPCClustersHe3 = 0u; - - float momHe3MC = -99.f; - float momPrMC = -99.f; - - uint8_t sharedClustersHe3 = 0u; - uint8_t sharedClustersPr = 0u; - - bool isBkgUS = false; - bool isBkgEM = false; - - float l4PtMC = -99.f; - float l4MassMC = -10.f; -}; - -struct lithium4analysis { - - Produces outputDataTable; - Produces outputMCTable; - - std::vector l4Candidates; - - SliceCache cache; - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable cfgCompensatePIDinTracking{"cfgCompensatePIDinTracking", false, "If true, divide tpcInnerParam by the electric charge"}; - // events - Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; - // track - Configurable cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"}; - Configurable cfgCutMaxPrPT{"cfgCutMaxPrPT", 1.8, "Max PT cut on proton"}; - 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 nsigmaCutTOF{"nsigmaCutTOF", 3.0, "Value of the TOF Nsigma cut"}; - Configurable cfgNoMixedEvents{"cfgNoMixedEvents", 5, "Number of mixed events per event"}; - Configurable cfgEnableBkgUS{"cfgEnableBkgUS", false, "Enable US background"}; - - // bethe bloch parameters - std::array mBBparamsHe; - Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, {"He3"}, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for He3"}; - // MC - Configurable isMC{"isMC", false, "Run MC"}; - void init(o2::framework::InitContext&) - { - - histos.add("hCentrality", "Centrality distribution", kTH1F, {{2001, -0.5, 2000.5}}); - histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); - histos.add("hNcontributor", "Number of primary vertex contributor", kTH1F, {{2000, 0.0f, 2000.0f}}); - histos.add("hDCAxyHe3", ";DCA_{xy} (cm)", kTH1F, {{200, -1.0f, 1.0f}}); - histos.add("hDCAzHe3", ";DCA_{z} (cm)", kTH1F, {{200, -1.0f, 1.0f}}); - histos.add("hLitInvMass", "; M(^{3}He + p) (GeV/#it{c}^{2})", kTH1F, {{50, 3.74f, 3.85f}}); - histos.add("hHe3Pt", "#it{p}_{T} distribution; #it{p}_{T} (GeV/#it{c})", kTH1F, {{200, 0.0f, 6.0f}}); - histos.add("hProtonPt", "Pt distribution; #it{p}_{T} (GeV/#it{c})", kTH1F, {{200, 0.0f, 3.0f}}); - histos.add("h2dEdxHe3candidates", "dEdx distribution; Signed #it{p} (GeV/#it{c}); dE/dx (a.u.)", kTH2F, {{200, -5.0f, 5.0f}, {100, 0.0f, 2000.0f}}); - histos.add("h2NsigmaHe3TPC", "NsigmaHe3 TPC distribution; Signed #it{p}/#it{z} (GeV/#it{c}); n#sigma_{TPC}({}^{3}He)", kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}); - histos.add("h2NsigmaProtonTPC", "NsigmaProton TPC distribution; Signed #it{p}/#it{z} (GeV/#it{c}); n#sigma_{TPC}(p)", kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}); - histos.add("h2NsigmaProtonTOF", "NsigmaProton TOF distribution; #it{p}_{T} (GeV/#it{c}); n#sigma_{TOF}(p)", kTH2F, {{20, -5.0f, 5.0f}, {200, -5.0f, 5.0f}}); - histos.add("hTrackSel", "Accepted tracks", kTH1F, {{Selections::kAll, -0.5, static_cast(Selections::kAll) - 0.5}}); - - for (int i = 0; i < 5; i++) { - mBBparamsHe[i] = cfgBetheBlochParams->get("He3", Form("p%i", i)); - } - mBBparamsHe[5] = cfgBetheBlochParams->get("He3", "resolution"); - - std::vector labels = {"All", "Global track", "Track selection", "PID {}^{3}He"}; - for (int i = 0; i < Selections::kAll; i++) { - histos.get(HIST("hTrackSel"))->GetXaxis()->SetBinLabel(i + 1, labels[i].c_str()); - } - } - - template - bool selectionTrack(const T& candidate) - { - - if (candidate.itsNCls() < 5 || - candidate.tpcNClsFound() < 90 || // candidate.tpcNClsFound() < 70 || - candidate.tpcNClsCrossedRows() < 70 || - candidate.tpcNClsCrossedRows() < 0.8 * candidate.tpcNClsFindable() || - candidate.tpcChi2NCl() > 4.f || - candidate.itsChi2NCl() > 36.f) { - return false; - } - - return true; - } - - template - bool selectionPIDProton(const T& candidate) - { - if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaPr()) < nsigmaCutTOF && std::abs(candidate.tpcNSigmaPr()) < nsigmaCutTPC) { - histos.fill(HIST("h2NsigmaProtonTPC"), candidate.tpcInnerParam(), candidate.tpcNSigmaPr()); - histos.fill(HIST("h2NsigmaProtonTOF"), candidate.p(), candidate.tofNSigmaPr()); - return true; - } - } else if (std::abs(candidate.tpcNSigmaPr()) < nsigmaCutTPC) { - histos.fill(HIST("h2NsigmaProtonTPC"), candidate.tpcInnerParam(), candidate.tpcNSigmaPr()); - return true; - } - return false; - } - - template - float computeNSigmaHe3(const T& candidate) - { - bool heliumPID = candidate.pidForTracking() == o2::track::PID::Helium3 || candidate.pidForTracking() == o2::track::PID::Alpha; - - float correctedTPCinnerParam = (heliumPID && cfgCompensatePIDinTracking) ? candidate.tpcInnerParam() / 2.f : candidate.tpcInnerParam(); - float expTPCSignal = o2::tpc::BetheBlochAleph(static_cast(correctedTPCinnerParam * 2.f / constants::physics::MassHelium3), mBBparamsHe[0], mBBparamsHe[1], mBBparamsHe[2], mBBparamsHe[3], mBBparamsHe[4]); - - double resoTPC{expTPCSignal * mBBparamsHe[5]}; - return static_cast((candidate.tpcSignal() - expTPCSignal) / resoTPC); - } - - template - bool selectionPIDHe3(const T& candidate) - { - auto nSigmaHe3 = computeNSigmaHe3(candidate); - if (std::abs(nSigmaHe3) < nsigmaCutTPC) { - return true; - } - return false; - } - - template - bool FillCandidateInfo(const T1& candidateHe3, const T2& candidatePr, bool mix, bool /*isMC*/ = false) - { - lithium4Candidate l4Cand; - - l4Cand.momHe3 = array{2 * candidateHe3.px(), 2 * candidateHe3.py(), 2 * candidateHe3.pz()}; - l4Cand.momPr = array{candidatePr.px(), candidatePr.py(), candidatePr.pz()}; - - float invMass = RecoDecay::m(array{l4Cand.momHe3, l4Cand.momPr}, array{he3Mass, protonMass}); - - if (invMass < 3.74 || invMass > 3.85 || candidatePr.pt() > cfgCutMaxPrPT) { - return false; - } - - l4Cand.PIDtrkHe3 = candidateHe3.pidForTracking(); - l4Cand.PIDtrkPr = candidatePr.pidForTracking(); - - l4Cand.sign = candidateHe3.sign(); - - l4Cand.isBkgUS = candidateHe3.sign() * candidatePr.sign() < 0; - l4Cand.isBkgEM = mix; - - l4Cand.DCAxyHe3 = candidateHe3.dcaXY(); - l4Cand.DCAzHe3 = candidateHe3.dcaZ(); - l4Cand.DCAxyPr = candidatePr.dcaXY(); - l4Cand.DCAzPr = candidatePr.dcaZ(); - - bool heliumPID = candidateHe3.pidForTracking() == o2::track::PID::Helium3 || candidateHe3.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParamHe3 = (heliumPID && cfgCompensatePIDinTracking) ? candidateHe3.tpcInnerParam() / 2.f : candidateHe3.tpcInnerParam(); - - l4Cand.tpcSignalHe3 = candidateHe3.tpcSignal(); - l4Cand.momHe3TPC = correctedTPCinnerParamHe3; - l4Cand.tpcSignalPr = candidatePr.tpcSignal(); - l4Cand.momPrTPC = candidatePr.tpcInnerParam(); - l4Cand.invMass = invMass; - - l4Cand.itsClSizeHe3 = candidateHe3.itsClusterSizes(); - l4Cand.itsClSizePr = candidatePr.itsClusterSizes(); - - l4Cand.nTPCClustersHe3 = candidateHe3.tpcNClsFound(); - - l4Cand.nSigmaHe3 = computeNSigmaHe3(candidateHe3); - l4Cand.nSigmaPr = candidatePr.tpcNSigmaPr(); - - l4Cand.sharedClustersHe3 = candidateHe3.tpcNClsShared(); - l4Cand.sharedClustersPr = candidatePr.tpcNClsShared(); - - l4Candidates.push_back(l4Cand); - return true; - } - - template - void fillHistograms(const T& l4cand) - { - int candSign = l4cand.sign; - histos.fill(HIST("hHe3Pt"), l4cand.recoPtHe3()); - histos.fill(HIST("hProtonPt"), l4cand.recoPtPr()); - histos.fill(HIST("hLitInvMass"), l4cand.invMass); - histos.fill(HIST("hDCAxyHe3"), l4cand.DCAxyHe3); - histos.fill(HIST("hDCAzHe3"), l4cand.DCAzHe3); - histos.fill(HIST("h2NsigmaHe3TPC"), candSign * l4cand.momHe3TPC, l4cand.nSigmaHe3); - histos.fill(HIST("h2NsigmaProtonTPC"), candSign * l4cand.momPrTPC, l4cand.nSigmaPr); - histos.fill(HIST("h2NsigmaProtonTOF"), l4cand.recoPtPr(), l4cand.nSigmaPr); - } - - 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 TrackCandidatesMC = soa::Filtered>; - o2::pid::tof::Beta responseBeta; - o2::pid::tof::Beta responseBetaMC; - - Preslice perCol = aod::track::collisionId; - Preslice 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}; - SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, &cache}; - - void processSameEvent(soa::Join const& collisions, TrackCandidates const& tracks, aod::BCs const&) - { - l4Candidates.clear(); - - for (auto& collision : collisions) { - if (!collision.sel8() || std::abs(collision.posZ()) > cfgCutVertex) { - continue; - } - histos.fill(HIST("hNcontributor"), collision.numContrib()); - histos.fill(HIST("hVtxZ"), collision.posZ()); - - const uint64_t collIdx = collision.globalIndex(); - auto TrackTable_thisCollision = tracks.sliceBy(perCol, collIdx); - TrackTable_thisCollision.bindExternalIndices(&tracks); - - for (auto track1 : TrackTable_thisCollision) { - - histos.fill(HIST("hTrackSel"), Selections::kNoCuts); - bool heliumPID = track1.pidForTracking() == o2::track::PID::Helium3 || track1.pidForTracking() == o2::track::PID::Alpha; - - float correctedTPCinnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track1.tpcInnerParam() / 2.f : track1.tpcInnerParam(); - histos.fill(HIST("h2dEdxHe3candidates"), correctedTPCinnerParam * 2.f, track1.tpcSignal()); - - if (!track1.isGlobalTrackWoDCA()) { - continue; - } - histos.fill(HIST("hTrackSel"), Selections::kGlobalTrack); - - if (!selectionTrack(track1)) { - continue; - } - histos.fill(HIST("hTrackSel"), Selections::kTrackCuts); - - if (!selectionPIDHe3(track1)) { - continue; - } - histos.fill(HIST("hTrackSel"), Selections::kPID); - - for (auto track2 : TrackTable_thisCollision) { - - if (track1 == track2) { - continue; - } - - if (!cfgEnableBkgUS) { - if (track1.sign() * track2.sign() < 0) { - continue; - } - } - - if (!track2.isGlobalTrackWoDCA()) { - continue; - } - - if (!selectionTrack(track2)) { - continue; - } - - if (!selectionPIDProton(track2)) { - continue; - } - - if (!FillCandidateInfo(track1, track2, false)) { - continue; - } - // fill TOF info outside to avoide responseBeta crash - auto& cand = l4Candidates.back(); - if (track1.hasTOF()) { - float beta = responseBeta.GetBeta(track1); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - bool heliumPID = track1.pidForTracking() == o2::track::PID::Helium3 || track1.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParamHe3 = (heliumPID && cfgCompensatePIDinTracking) ? track1.tpcInnerParam() / 2.f : track1.tpcInnerParam(); - cand.massTOFHe3 = correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); - } - if (track2.hasTOF()) { - float beta = responseBeta.GetBeta(track2); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - cand.massTOFPr = track2.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); - } - fillHistograms(cand); - } - } - } - - for (auto& l4Cand : l4Candidates) { - outputDataTable(l4Cand.recoPtHe3(), l4Cand.recoEtaHe3(), l4Cand.recoPhiHe3(), - l4Cand.recoPtPr(), l4Cand.recoEtaPr(), l4Cand.recoPhiPr(), - l4Cand.DCAxyHe3, l4Cand.DCAzHe3, l4Cand.DCAxyPr, l4Cand.DCAzPr, - l4Cand.tpcSignalHe3, l4Cand.momHe3TPC, l4Cand.tpcSignalPr, l4Cand.momPrTPC, - l4Cand.nTPCClustersHe3, - l4Cand.nSigmaHe3, l4Cand.nSigmaPr, l4Cand.massTOFHe3, l4Cand.massTOFPr, - l4Cand.PIDtrkHe3, l4Cand.PIDtrkPr, l4Cand.itsClSizeHe3, l4Cand.itsClSizePr, - l4Cand.sharedClustersHe3, l4Cand.sharedClustersPr, - l4Cand.isBkgUS, l4Cand.isBkgEM); - } - } - PROCESS_SWITCH(lithium4analysis, processSameEvent, "Process Same event", false); - - void processMixedEvent(EventCandidates& /*collisions*/, TrackCandidates const& /*tracks*/) - { - l4Candidates.clear(); - for (auto& [c1, tracks1, c2, tracks2] : pair) { - if (!c1.sel8()) { - continue; - } - if (!c2.sel8()) { - continue; - } - histos.fill(HIST("hNcontributor"), c1.numContrib()); - histos.fill(HIST("hVtxZ"), c1.posZ()); - - for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - - if (!t1.isGlobalTrackWoDCA()) { - continue; - } - - if (!selectionTrack(t1)) { - continue; - } - - if (!t2.isGlobalTrackWoDCA()) { - continue; - } - - if (!selectionTrack(t2)) { - continue; - } - - TrackCandidates::iterator he3Cand, protonCand; - bool passPID = false; - if (selectionPIDHe3(t1) && selectionPIDProton(t2)) { - he3Cand = t1, protonCand = t2; - passPID = true; - } - if (selectionPIDHe3(t2) && selectionPIDProton(t1)) { - he3Cand = t2, protonCand = t1; - passPID = true; - } - if (!passPID) { - continue; - } - - bool heliumPID = he3Cand.pidForTracking() == o2::track::PID::Helium3 || he3Cand.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParam = (heliumPID && cfgCompensatePIDinTracking) ? he3Cand.tpcInnerParam() / 2.f : he3Cand.tpcInnerParam(); - histos.fill(HIST("h2dEdxHe3candidates"), correctedTPCinnerParam * 2.f, he3Cand.tpcSignal()); - - if (!FillCandidateInfo(he3Cand, protonCand, true)) { - continue; - } - // fill TOF info outside to avoide responseBeta crash - auto& cand = l4Candidates.back(); - if (he3Cand.hasTOF()) { - float beta = responseBeta.GetBeta(he3Cand); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - - bool heliumPID = t1.pidForTracking() == o2::track::PID::Helium3 || he3Cand.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParamHe3 = (heliumPID && cfgCompensatePIDinTracking) ? he3Cand.tpcInnerParam() / 2.f : he3Cand.tpcInnerParam(); - cand.massTOFHe3 = correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); - } - if (protonCand.hasTOF()) { - float beta = responseBeta.GetBeta(protonCand); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - cand.massTOFPr = protonCand.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); - } - fillHistograms(cand); - } - } - - for (auto& l4Cand : l4Candidates) { - outputDataTable(l4Cand.recoPtHe3(), l4Cand.recoEtaHe3(), l4Cand.recoPhiHe3(), - l4Cand.recoPtPr(), l4Cand.recoEtaPr(), l4Cand.recoPhiPr(), - l4Cand.DCAxyHe3, l4Cand.DCAzHe3, l4Cand.DCAxyPr, l4Cand.DCAzPr, - l4Cand.tpcSignalHe3, l4Cand.momHe3TPC, l4Cand.tpcSignalPr, l4Cand.momPrTPC, - l4Cand.nTPCClustersHe3, - l4Cand.nSigmaHe3, l4Cand.nSigmaPr, l4Cand.massTOFHe3, l4Cand.massTOFPr, - l4Cand.PIDtrkHe3, l4Cand.PIDtrkPr, l4Cand.itsClSizeHe3, l4Cand.itsClSizePr, - l4Cand.sharedClustersHe3, l4Cand.sharedClustersPr, - l4Cand.isBkgUS, l4Cand.isBkgEM); - } - } - PROCESS_SWITCH(lithium4analysis, processMixedEvent, "Process Mixed event", false); - - void processMC(soa::Join const& collisions, aod::BCs const&, TrackCandidatesMC const& tracks, aod::McParticles const& mcParticles) - { - std::vector filledMothers; - l4Candidates.clear(); - - for (auto& collision : collisions) { - - if (!collision.sel8() || std::abs(collision.posZ()) > cfgCutVertex) { - continue; - } - - histos.fill(HIST("hNcontributor"), collision.numContrib()); - histos.fill(HIST("hVtxZ"), collision.posZ()); - - const uint64_t collIdx = collision.globalIndex(); - auto TrackTable_thisCollision = tracks.sliceBy(perColMC, collIdx); - TrackTable_thisCollision.bindExternalIndices(&tracks); - - for (auto track1 : TrackTable_thisCollision) { - - if (!track1.has_mcParticle()) { - continue; - } - - histos.fill(HIST("hTrackSel"), Selections::kNoCuts); - - if (!track1.isGlobalTrackWoDCA()) { - continue; - } - histos.fill(HIST("hTrackSel"), Selections::kGlobalTrack); - - if (!selectionTrack(track1)) { - continue; - } - histos.fill(HIST("hTrackSel"), Selections::kTrackCuts); - - if (!selectionPIDHe3(track1)) { - continue; - } - histos.fill(HIST("hTrackSel"), Selections::kPID); - - for (auto track2 : TrackTable_thisCollision) { - if (!track2.has_mcParticle()) { - continue; - } - - if (!track2.isGlobalTrackWoDCA()) { - continue; - } - - if (!selectionTrack(track2)) { - continue; - } - - if (!selectionPIDProton(track2)) { - continue; - } - - if (track1.sign() * track2.sign() < 0) { - continue; - } - - const auto mctrackHe3 = track1.mcParticle(); - const auto mctrackPr = track2.mcParticle(); - - if (std::abs(mctrackHe3.pdgCode()) != he3PDG || std::abs(mctrackPr.pdgCode()) != protonPDG) { - continue; - } - - for (auto& mothertrack : mctrackHe3.mothers_as()) { - for (auto& mothertrackPr : mctrackPr.mothers_as()) { - - if (mothertrack != mothertrackPr || std::abs(mothertrack.pdgCode()) != lithium4PDG) { - continue; - } - - if (std::abs(mothertrack.y()) > 1) { - continue; - } - - if (!FillCandidateInfo(track1, track2, false, true)) { - continue; - } - - // fill TOF info outside to avoide responseBeta crash - auto& cand = l4Candidates.back(); - if (track1.hasTOF()) { - float beta = responseBetaMC.GetBeta(track1); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - bool heliumPID = track1.pidForTracking() == o2::track::PID::Helium3 || track1.pidForTracking() == o2::track::PID::Alpha; - float correctedTPCinnerParamHe3 = (heliumPID && cfgCompensatePIDinTracking) ? track1.tpcInnerParam() / 2.f : track1.tpcInnerParam(); - cand.massTOFHe3 = correctedTPCinnerParamHe3 * 2.f * std::sqrt(1.f / (beta * beta) - 1.f); - } - if (track2.hasTOF()) { - float beta = responseBetaMC.GetBeta(track2); - beta = std::min(1.f - 1.e-6f, std::max(1.e-4f, beta)); /// sometimes beta > 1 or < 0, to be checked - cand.massTOFPr = track2.tpcInnerParam() * std::sqrt(1.f / (beta * beta) - 1.f); - } - - cand.momHe3MC = mctrackHe3.pt() * (mctrackHe3.pdgCode() > 0 ? 1 : -1); - cand.momPrMC = mctrackPr.pt() * (mctrackPr.pdgCode() > 0 ? 1 : -1); - cand.l4PtMC = mothertrack.pt() * (mothertrack.pdgCode() > 0 ? 1 : -1); - double eLit = mctrackHe3.e() + mctrackPr.e(); - cand.l4MassMC = std::sqrt(eLit * eLit - mothertrack.p() * mothertrack.p()); - filledMothers.push_back(mothertrack.globalIndex()); - fillHistograms(cand); - } - } - } - } - } - - for (auto& mcParticle : mcParticles) { - - if (std::abs(mcParticle.pdgCode()) != lithium4PDG) { - continue; - } - - if (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(); - auto daughtHe3 = false; - auto daughtPr = false; - double eLit = 0; - int signHe3 = 0, signPr = 0; - double ptHe3 = 0, ptPr = 0; - for (auto kCurrentDaughter : kDaughters) { - if (std::abs(kCurrentDaughter.pdgCode()) == he3PDG) { - daughtHe3 = true; - signHe3 = kCurrentDaughter.pdgCode() > 0 ? 1 : -1; - ptHe3 = kCurrentDaughter.pt(); - eLit += kCurrentDaughter.e(); - } else if (std::abs(kCurrentDaughter.pdgCode()) == protonPDG) { - daughtPr = true; - signPr = kCurrentDaughter.pdgCode() > 0 ? 1 : -1; - ptPr = kCurrentDaughter.pt(); - eLit += kCurrentDaughter.e(); - } - } - if (daughtHe3 && daughtPr) { - lithium4Candidate l4Candidate; - int signLi = mcParticle.pdgCode() > 0 ? 1 : -1; - l4Candidate.l4PtMC = mcParticle.pt() * signLi; - l4Candidate.momHe3MC = ptHe3 * signHe3; - l4Candidate.momPrMC = ptPr * signPr; - l4Candidate.l4MassMC = std::sqrt(eLit * eLit - mcParticle.p() * mcParticle.p()); - l4Candidates.push_back(l4Candidate); - } - } - - for (auto& l4Cand : l4Candidates) { - outputMCTable(l4Cand.recoPtHe3(), l4Cand.recoEtaHe3(), l4Cand.recoPhiHe3(), - l4Cand.recoPtPr(), l4Cand.recoEtaPr(), l4Cand.recoPhiPr(), - l4Cand.DCAxyHe3, l4Cand.DCAzHe3, l4Cand.DCAxyPr, l4Cand.DCAzPr, - l4Cand.tpcSignalHe3, l4Cand.momHe3TPC, l4Cand.tpcSignalPr, l4Cand.momPrTPC, - l4Cand.nTPCClustersHe3, - l4Cand.nSigmaHe3, l4Cand.nSigmaPr, l4Cand.massTOFHe3, l4Cand.massTOFPr, - l4Cand.PIDtrkHe3, l4Cand.PIDtrkPr, l4Cand.itsClSizeHe3, l4Cand.itsClSizePr, - l4Cand.sharedClustersHe3, l4Cand.sharedClustersPr, - l4Cand.isBkgUS, l4Cand.isBkgEM, - l4Cand.momHe3MC, l4Cand.momPrMC, - l4Cand.l4PtMC, l4Cand.l4MassMC); - } - } - PROCESS_SWITCH(lithium4analysis, processMC, "Process MC", false); -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"lithium4analysis"})}; -} diff --git a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx index 86f0609f662..6d8e13e69a6 100644 --- a/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/lnnRecoTask.cxx @@ -12,6 +12,12 @@ // Build \Lambda-n-n candidates from V0s and tracks // ============================================================================== #include +#include +#include +#include +#include + +#include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -30,17 +36,25 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" +#include "Common/DataModel/PIDResponse.h" + #include "Common/Core/PID/TPCPIDResponse.h" #include "DataFormatsTPC/BetheBlochAleph.h" #include "DCAFitter/DCAFitterN.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Common/Core/PID/PIDTOF.h" +#include "Common/TableProducer/PID/pidTOFBase.h" + #include "PWGLF/DataModel/LFLnnTables.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using std::array; -using TracksFull = soa::Join; +using TracksFull = soa::Join; +using TracksFullMC = soa::Join; using CollisionsFull = soa::Join; using CollisionsFullMC = soa::Join; @@ -48,8 +62,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{"3H"}; - +static const std::vector NucleiName{"3H"}; std::shared_ptr hEvents; std::shared_ptr hZvtx; std::shared_ptr hCentFT0A; @@ -57,12 +70,27 @@ std::shared_ptr hCentFT0C; std::shared_ptr hCentFT0M; std::shared_ptr hCentFV0A; std::shared_ptr hNsigma3HSel; +std::shared_ptr hNsigma3HSelTOF; std::shared_ptr hdEdx3HSel; -std::shared_ptr hdEdx3HTPCMom; +std::shared_ptr hdEdx3HPosTrack; std::shared_ptr hdEdxTot; +std::shared_ptr h3HMassPtTOF; +std::shared_ptr h3HSignalPtTOF; 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) +{ + std::array momA = {momB[0] + momC[0], momB[1] + momC[1], momB[2] + momC[2]}; + float momTot = std::sqrt(momA[0] * momA[0] + momA[1] * momA[1] + momA[2] * momA[2]); + float lQlPos = (momB[0] * momA[0] + momB[1] * momA[1] + momB[2] * momA[2]) / momTot; + float lQlNeg = (momC[0] * momA[0] + momC[1] * momA[1] + momC[2] * momA[2]) / momTot; + return (lQlPos - lQlNeg) / (lQlPos + lQlNeg); +} } // namespace @@ -87,6 +115,11 @@ struct lnnCandidate { float piDCAXY = -10; float mom3HTPC = -10.f; float momPiTPC = -10.f; + float mass2TrTOF = -10.f; + float DCAPvto3H = -10.f; + float DCAPvtoPi = -10.f; + float beta = -10.f; + float tpcChi3H = -10.f; std::array mom3H; std::array momPi; std::array decVtx; @@ -115,13 +148,20 @@ struct lnnRecoTask { // Selection criteria Configurable v0cospa{"lnncospa", 0.95, "V0 CosPA"}; - Configurable masswidth{"lnnmasswidth", 0.006, "Mass width (GeV/c^2)"}; - Configurable dcav0dau{"lnndcaDau", 1.0, "DCA V0 Daughters"}; + Configurable masswidth{"lnnmasswidth", 0.1, "Mass width (GeV/c^2)"}; + Configurable dcav0dau{"lnndcaDau", 0.6, "DCA V0 Daughters"}; + Configurable Chi2nClusTPCMax{"Chi2NClusTPCMax", 4, "Chi2 / nClusTPC for triton track max"}; + Configurable Chi2nClusTPCMin{"Chi2NClusTPC", 0.5, "Chi2 / nClusTPC for triton track min"}; + Configurable Chi2nClusITS{"Chi2NClusITS", 36., "Chi2 / nClusITS for triton track"}; Configurable ptMin{"ptMin", 0.5, "Minimum pT of the lnncandidate"}; - Configurable TPCRigidityMin3H{"TPCRigidityMin3H", 1, "Minimum rigidity of the triton candidate"}; - Configurable etaMax{"eta", 1., "eta daughter"}; - Configurable nSigmaMax3H{"nSigmaMax3H", 5, "triton dEdx cut (n sigma)"}; + Configurable etaMax{"eta", 0.8, "eta daughter"}; + Configurable TPCRigidityMin3H{"TPCRigidityMin3H", 0.2, "Minimum rigidity of the triton candidate"}; + Configurable nSigmaCutMinTPC{"nSigmaCutMinTPC", -5, "triton dEdx cut (n sigma)"}; + Configurable nSigmaCutMaxTPC{"nSigmaCutMaxTPC", 5, "triton dEdx cut (n sigma)"}; 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) @@ -132,7 +172,7 @@ struct lnnRecoTask { float piMass = o2::constants::physics::MassPionCharged; // bethe bloch parameters - Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, particleNames, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for 3H"}; + Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 1, 6, NucleiName, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for 3H"}; Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"}; // CCDB options @@ -149,12 +189,17 @@ struct lnnRecoTask { Configurable lnnPdg{"lnnPdg", 1010000030, "PDG Lnn"}; // PDG Lnn // histogram axes - ConfigurableAxis rigidityBins{"rigidityBins", {200, -6.f, 6.f}, "Binning for rigidity #it{p}^{TPC}/#it{z}"}; - ConfigurableAxis dEdxBins{"dEdxBins", {1000, 0.f, 1000.f}, "Binning for dE/dx"}; + ConfigurableAxis rigidityBins{"rigidityBins", {200, -10.f, 10.f}, "Binning for rigidity #it{p}^{TPC}/#it{z}"}; + ConfigurableAxis dEdxBins{"dEdxBins", {5000, 0.f, 1000.f}, "Binning for dE/dx"}; 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{"TritMom", {100, 0.f, 6.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 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"}; // std vector of candidates std::vector lnnCandidates; @@ -198,16 +243,36 @@ 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)"}; - - hNsigma3HSel = qaRegistry.add("hNsigma3HSel", "; p_{TPC}/z (GeV/#it{c}); n_{#sigma} ({}^{3}H)", HistType::kTH2F, {rigidityAxis, nSigma3HAxis}); - hdEdx3HSel = qaRegistry.add("hdEdx3HSel", ";p_{TPC}/z (GeV/#it{c}); dE/dx", HistType::kTH2F, {rigidityAxis, dEdxAxis}); - hdEdx3HTPCMom = qaRegistry.add("hdEdx3HTPCMom", "; #it{p}^{TPC}({}^{3}H); dE/dx", HistType::kTH2F, {TritMomAxis, dEdxAxis}); + 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}"}; + const AxisSpec BetaAxis{BetaBins, "#beta (TOF)"}; + const AxisSpec DCAxyAxis(DCAxyBins, "DCAxy ({}^{3}H) (cm)"); + + hNsigma3HSel = qaRegistry.add("hNsigma3HSel", "; #it{p}_{TPC}/z (GeV/#it{c}); n_{#sigma} ({}^{3}H)", HistType::kTH2F, {rigidityAxis, nSigma3HAxis}); + hNsigma3HSelTOF = qaRegistry.add("hNsigma3HSelTOF", "; Signed p_{T} ({}^{3}H) (GeV/#it{c^2}); n#sigma_{TOF} ({}^{3}H)", HistType::kTH2F, {PtTrAxis, nSigma3HAxis}); + hdEdx3HSel = qaRegistry.add("hdEdx3HSel", ";#it{p}_{TPC}/z (GeV/#it{c}); dE/dx", HistType::kTH2F, {rigidityAxis, dEdxAxis}); + hdEdx3HPosTrack = qaRegistry.add("hdEdx3HPosTrack", "; #it{p}^{TPC}({}^{3}H); dE/dx", HistType::kTH2F, {TritMomAxis, dEdxAxis}); hdEdxTot = qaRegistry.add("hdEdxTot", ";p_{TPC}/z (GeV/#it{c}); dE/dx", HistType::kTH2F, {rigidityAxis, dEdxAxis}); + h3HMassPtTOF = qaRegistry.add("hTrMassPtTOF", "; #it{p}_{T}({}^{3}H) (#it{GeV}^2/#it{c}^4); m^{2}/z", HistType::kTH2F, {PtTrAxis, MassTOFAxis}); + 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"); @@ -278,6 +343,7 @@ struct lnnRecoTask { if (mBBparams3H[5] < 0) { LOG(fatal) << "Bethe-Bloch parameters for 3H not set, please check your CCDB and configuration"; } + for (auto& v0 : V0s) { auto posTrack = v0.posTrack_as(); @@ -290,9 +356,6 @@ struct lnnRecoTask { float posRigidity = posTrack.tpcInnerParam(); float negRigidity = negTrack.tpcInnerParam(); - hdEdxTot->Fill(posRigidity, posTrack.tpcSignal()); - hdEdxTot->Fill(-negRigidity, negTrack.tpcSignal()); - // Bethe-Bloch calcution for 3H & nSigma calculation double expBethePos{tpc::BetheBlochAleph(static_cast(posRigidity / constants::physics::MassTriton), mBBparams3H[0], mBBparams3H[1], mBBparams3H[2], mBBparams3H[3], mBBparams3H[4])}; double expBetheNeg{tpc::BetheBlochAleph(static_cast(negRigidity / constants::physics::MassTriton), mBBparams3H[0], mBBparams3H[1], mBBparams3H[2], mBBparams3H[3], mBBparams3H[4])}; @@ -301,29 +364,51 @@ struct lnnRecoTask { auto nSigmaTPCpos = static_cast((posTrack.tpcSignal() - expBethePos) / expSigmaPos); auto nSigmaTPCneg = static_cast((negTrack.tpcSignal() - expBetheNeg) / expSigmaNeg); + hdEdxTot->Fill(posRigidity, posTrack.tpcSignal()); + hdEdxTot->Fill(-negRigidity, negTrack.tpcSignal()); + // ITS only tracks do not have TPC information. TPCnSigma: only lower cut to allow for triton reconstruction - bool is3H = posTrack.hasTPC() && nSigmaTPCpos > -1 * nSigmaMax3H; - bool isAnti3H = negTrack.hasTPC() && nSigmaTPCneg > -1 * nSigmaMax3H; + bool is3H = posTrack.hasTPC() && nSigmaTPCpos > nSigmaCutMinTPC && nSigmaTPCpos < nSigmaCutMaxTPC; + bool isAnti3H = negTrack.hasTPC() && nSigmaTPCneg > nSigmaCutMinTPC && nSigmaTPCneg < nSigmaCutMaxTPC; - if (!is3H && !isAnti3H) + if (!is3H && !isAnti3H) // discard if both tracks are not 3H candidates continue; - // Describing lnn as matter candidate + // if alphaAP is > 0 the candidate is 3H, if < 0 it is anti-3H + std::array momPos = std::array{posTrack.px(), posTrack.py(), posTrack.pz()}; + std::array momNeg = std::array{negTrack.px(), negTrack.py(), negTrack.pz()}; + float alpha = alphaAP(momPos, momNeg); lnnCandidate lnnCand; - lnnCand.isMatter = is3H && isAnti3H ? std::abs(nSigmaTPCpos) < std::abs(nSigmaTPCneg) : is3H; + 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; - if (h3track.tpcNClsFound() < nTPCClusMin3H || h3Rigidity < TPCRigidityMin3H) { + + if (h3Rigidity < TPCRigidityMin3H || + h3track.tpcNClsFound() < nTPCClusMin3H || + h3track.tpcChi2NCl() < Chi2nClusTPCMin || + h3track.tpcChi2NCl() > Chi2nClusTPCMax || + h3track.itsChi2NCl() > Chi2nClusITS) { continue; } + lnnCand.tpcChi3H = lnnCand.isMatter ? h3track.tpcChi2NCl() : negTrack.tpcChi2NCl(); lnnCand.nSigma3H = lnnCand.isMatter ? nSigmaTPCpos : nSigmaTPCneg; - lnnCand.nTPCClusters3H = lnnCand.isMatter ? posTrack.tpcNClsFound() : negTrack.tpcNClsFound(); - lnnCand.tpcSignal3H = lnnCand.isMatter ? posTrack.tpcSignal() : negTrack.tpcSignal(); - lnnCand.clusterSizeITS3H = lnnCand.isMatter ? posTrack.itsClusterSizes() : negTrack.itsClusterSizes(); - lnnCand.nTPCClustersPi = !lnnCand.isMatter ? posTrack.tpcNClsFound() : negTrack.tpcNClsFound(); - lnnCand.tpcSignalPi = !lnnCand.isMatter ? posTrack.tpcSignal() : negTrack.tpcSignal(); - lnnCand.clusterSizeITSPi = !lnnCand.isMatter ? posTrack.itsClusterSizes() : negTrack.itsClusterSizes(); + lnnCand.nTPCClusters3H = lnnCand.isMatter ? h3track.tpcNClsFound() : negTrack.tpcNClsFound(); + lnnCand.tpcSignal3H = lnnCand.isMatter ? h3track.tpcSignal() : negTrack.tpcSignal(); + lnnCand.clusterSizeITS3H = lnnCand.isMatter ? h3track.itsClusterSizes() : negTrack.itsClusterSizes(); + lnnCand.nTPCClustersPi = !lnnCand.isMatter ? h3track.tpcNClsFound() : negTrack.tpcNClsFound(); + lnnCand.tpcSignalPi = !lnnCand.isMatter ? h3track.tpcSignal() : negTrack.tpcSignal(); + lnnCand.clusterSizeITSPi = !lnnCand.isMatter ? h3track.itsClusterSizes() : negTrack.itsClusterSizes(); lnnCand.mom3HTPC = lnnCand.isMatter ? posRigidity : negRigidity; lnnCand.momPiTPC = !lnnCand.isMatter ? posRigidity : negRigidity; @@ -332,6 +417,21 @@ struct lnnRecoTask { auto posTrackCov = getTrackParCov(posTrack); auto negTrackCov = getTrackParCov(negTrack); + int chargeFactor = -1 + 2 * lnnCand.isMatter; + + 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 || beta < BetaTrTOF) { + continue; + } + } int nCand = 0; try { @@ -367,24 +467,26 @@ struct lnnRecoTask { float lnnPt = std::hypot(lnnMom[0], lnnMom[1]); if (lnnPt < ptMin) { + hLnnCandLoss->Fill(3.); continue; } // Definition of lnn mass - float mLNN_HypHI = 2.994; // value in GeV, but 2993.7 MeV/c**2 - + float mLNN_HypHI = 3.00; // , but 2993.7 MeV/c**2 float massLNNL = std::sqrt(h3lE * h3lE - lnnMom[0] * lnnMom[0] - lnnMom[1] * lnnMom[1] - lnnMom[2] * lnnMom[2]); bool isLNNMass = false; if (massLNNL > mLNN_HypHI - masswidth && massLNNL < mLNN_HypHI + masswidth) { 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; } @@ -392,6 +494,7 @@ struct lnnRecoTask { double cosPA = RecoDecay::cpa(primVtx, lnnCand.decVtx, lnnMom); if (cosPA < v0cospa) { + hLnnCandLoss->Fill(6.); continue; } @@ -401,25 +504,27 @@ struct lnnRecoTask { // if survived all selections, propagate decay daughters to PV gpu::gpustd::array dcaInfo; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, h3PropTrack, 2.f, fitter.getMatCorrType(), &dcaInfo); + lnnCand.h3DCAXY = dcaInfo[0]; - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, posTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo); - lnnCand.isMatter ? lnnCand.h3DCAXY = dcaInfo[0] : lnnCand.piDCAXY = dcaInfo[0]; - - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, negTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo); - lnnCand.isMatter ? lnnCand.piDCAXY = dcaInfo[0] : lnnCand.h3DCAXY = dcaInfo[0]; + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, piPropTrack, 2.f, fitter.getMatCorrType(), &dcaInfo); + lnnCand.piDCAXY = dcaInfo[0]; // finally, push back the candidate lnnCand.isReco = true; lnnCand.posTrackID = posTrack.globalIndex(); lnnCand.negTrackID = negTrack.globalIndex(); - int chargeFactor = -1 + 2 * lnnCand.isMatter; - hdEdx3HSel->Fill(chargeFactor * lnnCand.mom3HTPC, h3track.tpcSignal()); - hNsigma3HSel->Fill(chargeFactor * lnnCand.mom3HTPC, lnnCand.nSigma3H); lnnCandidates.push_back(lnnCand); - if (is3H) { - hdEdx3HTPCMom->Fill(lnnCand.mom3HTPC, h3track.tpcSignal()); + // Fill QA histograms + hdEdx3HSel->Fill(chargeFactor * lnnCand.mom3HTPC, h3track.tpcSignal()); + hNsigma3HSel->Fill(chargeFactor * lnnCand.mom3HTPC, lnnCand.nSigma3H); + hDCAxy3H->Fill(h3track.pt(), h3track.dcaXY()); + if (h3track.hasTOF()) { + h3HSignalPtTOF->Fill(chargeFactor * h3track.pt(), beta); + hNsigma3HSelTOF->Fill(chargeFactor * h3track.p(), h3track.tofNSigmaTr()); + h3HMassPtTOF->Fill(chargeFactor * h3track.pt(), lnnCand.mass2TrTOF); } } } @@ -435,6 +540,7 @@ struct lnnRecoTask { if (mcLabPos.has_mcParticle() && mcLabNeg.has_mcParticle()) { auto mcTrackPos = mcLabPos.mcParticle_as(); auto mcTrackNeg = mcLabNeg.mcParticle_as(); + if (mcTrackPos.has_mothers() && mcTrackNeg.has_mothers()) { for (auto& negMother : mcTrackNeg.mothers_as()) { for (auto& posMother : mcTrackPos.mothers_as()) { @@ -460,7 +566,6 @@ struct lnnRecoTask { lnnCand.isSignal = true; lnnCand.pdgCode = posMother.pdgCode(); lnnCand.survEvSelection = isGoodCollision[posMother.mcCollisionId()]; - filledMothers.push_back(posMother.globalIndex()); } } @@ -504,6 +609,7 @@ struct lnnRecoTask { lnnCand.dcaV0dau, lnnCand.h3DCAXY, lnnCand.piDCAXY, lnnCand.nSigma3H, lnnCand.nTPCClusters3H, lnnCand.nTPCClustersPi, lnnCand.mom3HTPC, lnnCand.momPiTPC, lnnCand.tpcSignal3H, lnnCand.tpcSignalPi, + lnnCand.mass2TrTOF, lnnCand.tpcChi3H, lnnCand.clusterSizeITS3H, lnnCand.clusterSizeITSPi, lnnCand.flags); } } @@ -511,7 +617,7 @@ struct lnnRecoTask { PROCESS_SWITCH(lnnRecoTask, processData, "Data analysis", true); // MC process - void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) + void processMC(CollisionsFullMC const& collisions, aod::McCollisions const& mcCollisions, aod::V0s const& V0s, aod::BCsWithTimestamps const&, TracksFull const& tracks, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { filledMothers.clear(); @@ -525,7 +631,7 @@ struct lnnRecoTask { hEvents->Fill(0.); - if ((collision.posZ()) > 10) { + if (std::abs(collision.posZ()) > 10) { continue; } hEvents->Fill(1.); @@ -560,6 +666,7 @@ struct lnnRecoTask { lnnCand.dcaV0dau, lnnCand.h3DCAXY, lnnCand.piDCAXY, lnnCand.nSigma3H, lnnCand.nTPCClusters3H, lnnCand.nTPCClustersPi, lnnCand.mom3HTPC, lnnCand.momPiTPC, lnnCand.tpcSignal3H, lnnCand.tpcSignalPi, + lnnCand.mass2TrTOF, lnnCand.tpcChi3H, lnnCand.clusterSizeITS3H, lnnCand.clusterSizeITSPi, lnnCand.flags, chargeFactor * lnnCand.genPt(), lnnCand.genPhi(), lnnCand.genEta(), lnnCand.genPt3H(), lnnCand.gDecVtx[0], lnnCand.gDecVtx[1], lnnCand.gDecVtx[2], lnnCand.isReco, lnnCand.isSignal, lnnCand.survEvSelection); @@ -629,6 +736,7 @@ struct lnnRecoTask { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, chargeFactor * lnnCand.genPt(), lnnCand.genPhi(), lnnCand.genEta(), lnnCand.genPt3H(), lnnCand.gDecVtx[0], lnnCand.gDecVtx[1], lnnCand.gDecVtx[2], lnnCand.isReco, lnnCand.isSignal, lnnCand.survEvSelection); diff --git a/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx b/PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx index 09b2e909ec1..b6e85e94367 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" @@ -79,6 +83,7 @@ struct NucleusCandidate { float TPCsignal; float ITSchi2; float TPCchi2; + float TOFchi2; std::array nSigmaTPC; std::array tofMasses; bool fillTree; @@ -249,6 +254,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"}; @@ -259,6 +266,8 @@ struct nucleiSpectra { Configurable> cfgDCAHists{"cfgDCAHists", {nuclei::DCAHistDefault[0], 5, 2, nuclei::names, nuclei::DCAConfigNames}, "DCA hist configuration"}; Configurable> cfgFlowHist{"cfgFlowHist", {nuclei::FlowHistDefault[0], 5, 1, nuclei::names, nuclei::flowConfigNames}, "Flow hist configuration"}; + Configurable cfgNsigmaTPCcutDCAhists{"cfgNsigmaTPCcutDCAhists", 3., "TPC nsigma cut for DCA hists"}; + Configurable cfgDeltaTOFmassCutDCAhists{"cfgDeltaTOFmassCutDCAhists", 0.2, "Delta TOF mass cut for DCA hists"}; ConfigurableAxis cfgDCAxyBinsProtons{"cfgDCAxyBinsProtons", {1500, -1.5f, 1.5f}, "DCAxy binning for Protons"}; ConfigurableAxis cfgDCAxyBinsDeuterons{"cfgDCAxyBinsDeuterons", {1500, -1.5f, 1.5f}, "DCAxy binning for Deuterons"}; ConfigurableAxis cfgDCAxyBinsTritons{"cfgDCAxyBinsTritons", {1500, -1.5f, 1.5f}, "DCAxy binning for Tritons"}; @@ -293,13 +302,14 @@ struct nucleiSpectra { // CCDB options Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"}; Configurable cfgCCDBurl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable cfgZorroCCDBpath{"cfgZorroCCDBpath", "/Users/m/mpuccio/EventFiltering/OTS/", "path to the zorro ccdb objects"}; int mRunNumber = 0; float mBz = 0.f; Filter trackFilter = nabs(aod::track::eta) < cfgCutEta && aod::track::tpcInnerParam > cfgCutTpcMom; using TrackCandidates = soa::Filtered>; - + using TrackCandidatesMC = soa::Filtered>; // Collisions with chentrality using CollWithCent = soa::Join::iterator; @@ -374,6 +384,7 @@ struct nucleiSpectra { void init(o2::framework::InitContext&) { zorroSummary.setObject(zorro.getZorroSummary()); + zorro.setBaseCCDBPath(cfgZorroCCDBpath.value); ccdb->setURL(cfgCCDBurl); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); @@ -489,6 +500,9 @@ struct nucleiSpectra { o2::pid::tof::Beta responseBeta; auto bc = collision.template bc_as(); initCCDB(bc); + if (cfgSkimmedProcessing) { + zorro.isSelected(bc.globalBC()); /// Just let Zorro do the accounting + } gRandom->SetSeed(bc.timestamp()); spectra.fill(HIST("hRecVtxZData"), collision.posZ()); @@ -518,7 +532,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(); @@ -600,26 +613,26 @@ struct nucleiSpectra { } ROOT::Math::LorentzVector> fvector{mTrackParCov.getPt() * nuclei::charges[iS], mTrackParCov.getEta(), mTrackParCov.getPhi(), nuclei::masses[iS]}; float y{fvector.Rapidity() + cfgCMrapidity}; - for (int iPID{0}; iPID < 2; ++iPID) { + for (int iPID{0}; iPID < 2; ++iPID) { /// 0 TPC, 1 TOF if (selectedTPC[iS]) { if (iPID && !track.hasTOF()) { continue; } else if (iPID) { - selectedTOF = true; + selectedTOF = true; /// temporarly skipped + float charge{1.f + static_cast(iS == 3 || iS == 4)}; + tofMasses[iS] = correctedTpcInnerParam * charge * std::sqrt(1.f / (beta * beta) - 1.f) - nuclei::masses[iS]; } if (!cfgCutOnReconstructedRapidity || (y > cfgCutRapidityMin && y < cfgCutRapidityMax)) { - nuclei::hDCAxy[iPID][iS][iC]->Fill(centrality, fvector.pt(), dcaInfo[0]); - nuclei::hDCAz[iPID][iS][iC]->Fill(centrality, fvector.pt(), dcaInfo[1]); + if (std::abs(nSigmaTPC[iS]) < cfgNsigmaTPCcutDCAhists && (!iPID || std::abs(tofMasses[iS]) < cfgDeltaTOFmassCutDCAhists)) { + nuclei::hDCAxy[iPID][iS][iC]->Fill(centrality, fvector.pt(), dcaInfo[0]); + nuclei::hDCAz[iPID][iS][iC]->Fill(centrality, fvector.pt(), dcaInfo[1]); + } if (std::abs(dcaInfo[0]) < cfgDCAcut->get(iS, 0u)) { if (!iPID) { /// temporary exclusion of the TOF nsigma PID for the He3 and Alpha nuclei::hNsigma[iPID][iS][iC]->Fill(centrality, fvector.pt(), nSigma[iPID][iS]); nuclei::hNsigmaEta[iPID][iS][iC]->Fill(fvector.eta(), fvector.pt(), nSigma[iPID][iS]); } if (iPID) { - float charge{1}; - if (iS == 3 || iS == 4) - charge = 2; - tofMasses[iS] = correctedTpcInnerParam * charge * std::sqrt(1.f / (beta * beta) - 1.f) - nuclei::masses[iS]; nuclei::hTOFmass[iS][iC]->Fill(centrality, fvector.pt(), tofMasses[iS]); nuclei::hTOFmassEta[iS][iC]->Fill(fvector.eta(), fvector.pt(), tofMasses[iS]); } @@ -686,9 +699,13 @@ struct nucleiSpectra { computeEventPlane(collision.qvecBPosIm(), collision.qvecBPosRe()), collision.multTPC()}); } + if (fillTree) { + if (track.pt() < cfgCutPtMinTree || track.pt() > cfgCutPtMaxTree) + 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())}); } @@ -704,14 +721,11 @@ struct nucleiSpectra { if (!eventSelection(collision)) { return; } - if (cfgSkimmedProcessing) { - zorro.isSelected(collision.bc_as().globalBC()); /// Just let Zorro do the accounting - } 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) { @@ -737,7 +751,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) { @@ -766,7 +780,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) { @@ -783,7 +797,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, soa::Join const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&) + void processMC(soa::Join const& collisions, aod::McCollisions const& mcCollisions, TrackCandidatesMC const& tracks, aod::McParticles const& particlesMC, aod::BCsWithTimestamps const&) { nuclei::candidates.clear(); for (auto& c : mcCollisions) { @@ -840,7 +854,7 @@ struct nucleiSpectra { 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(), goodCollisions[particle.mcCollisionId()], absoDecL); } int index{0}; @@ -861,7 +875,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(), goodCollisions[particle.mcCollisionId()], absDecL); } break; } diff --git a/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx b/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx index 9951b79e70c..9997d4d27c8 100644 --- a/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx +++ b/PWGLF/TableProducer/Nuspex/pidTOFGeneric.cxx @@ -62,9 +62,10 @@ template o2::tof::eventTimeContainer evTimeMakerForTracks(const trackTypeContainer& tracks, const responseParametersType& responseParameters, - const float& diamond = 6.0) + const float& diamond = 6.0, + bool isFast = false) { - return o2::tof::evTimeMakerFromParam(tracks, responseParameters, diamond); + return o2::tof::evTimeMakerFromParam(tracks, responseParameters, diamond, isFast); } /// Task to produce the event time tables for generic TOF PID @@ -81,6 +82,7 @@ struct pidTOFGeneric { o2::pid::tof::TOFResoParamsV2 mRespParamsV2; Service ccdb; Configurable inheritFromBaseTask{"inheritFromBaseTask", true, "Flag to iherit all common configurables from the TOF base task"}; + Configurable fastTOFPID{"fastTOFPID", false, "Flag to enable computeEvTimeFast for evTimeMaker"}; // CCDB configuration (inherited from TOF signal task) Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable timestamp{"ccdb-timestamp", -1, "timestamp of the object"}; @@ -130,7 +132,7 @@ struct pidTOFGeneric { LOGF(fatal, "Cannot enable more process functions at the same time. Please choose one."); } // Checking that the table is requested in the workflow and enabling it - enableTable = isTableRequiredInWorkflow(initContext, "EvTimeTOFFT0"); + enableTable = isTableRequiredInWorkflow(initContext, "EvTimeTOFFT0") || isTableRequiredInWorkflow(initContext, "EvTimeTOFFT0ForTrack"); if (!enableTable) { LOG(info) << "Table for global Event time is not required, disabling it"; return; @@ -232,7 +234,7 @@ struct pidTOFGeneric { } // First make table for event time - const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond); + const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond, fastTOFPID); int nGoodTracksForTOF = 0; // count for ntrackIndex for removeBias() float et = evTimeTOF.mEventTime; float erret = evTimeTOF.mEventTimeError; @@ -293,7 +295,7 @@ struct pidTOFGeneric { } // Compute the TOF event time - const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond); + const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond, fastTOFPID); float t0TOF[2] = {static_cast(evTimeTOF.mEventTime), static_cast(evTimeTOF.mEventTimeError)}; // Value and error of TOF float t0AC[2] = {.0f, 999.f}; // Value and error of T0A or T0C or T0AC diff --git a/PWGLF/TableProducer/Nuspex/spectraDerivedMaker.cxx b/PWGLF/TableProducer/Nuspex/spectraDerivedMaker.cxx index c96b8b1fbb6..bce0c9153d1 100644 --- a/PWGLF/TableProducer/Nuspex/spectraDerivedMaker.cxx +++ b/PWGLF/TableProducer/Nuspex/spectraDerivedMaker.cxx @@ -178,7 +178,7 @@ struct spectraDerivedMaker { histos.fill(HIST("evsel"), 6.f); } } - if (abs(collision.posZ()) > cfgCutVertex) { + if (std::abs(collision.posZ()) > cfgCutVertex) { return false; } if constexpr (fillHistograms) { @@ -235,7 +235,7 @@ struct spectraDerivedMaker { if constexpr (fillHistograms) { histos.fill(HIST("tracksel"), 1); } - if (abs(track.eta()) > cfgCutEta) { + if (std::abs(track.eta()) > cfgCutEta) { return false; } if constexpr (fillHistograms) { @@ -388,4 +388,4 @@ struct spectraDerivedMaker { PROCESS_SWITCH(spectraDerivedMaker, processMC, "Process MC for derived dataset production", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } \ No newline at end of file +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx b/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx new file mode 100644 index 00000000000..b24e14a6115 --- /dev/null +++ b/PWGLF/TableProducer/Nuspex/threebodyKFTask.cxx @@ -0,0 +1,420 @@ +// 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 Analysis task for KFVtx3BodyDatas (3body candidates reconstructed with KF) +/// \author Carolina Reetz --> partly copied from threebodyRecoTask.cxx +// ======================== + +#include +#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 "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/Vtx3BodyTables.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" +#include "CommonConstants/PhysicsConstants.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; + +using MCLabeledTracksIU = soa::Join; + +struct threebodyKFTask { + + Produces outputMCTable; + std::vector filledMothers; + std::vector isGoodCollision; + + // Configurables + Configurable bachelorPdgCode{"bachelorPdgCode", 1000010020, "pdgCode of bachelor daughter"}; + Configurable motherPdgCode{"motherPdgCode", 1010010030, "pdgCode of mother"}; + + ConfigurableAxis m2PrPiBins{"m2PrPiBins", {60, 1., 3.3}, "Binning for m2(p,pi) axis"}; + ConfigurableAxis m2PiDeBins{"m2PiDeBins", {120, 4.0, 8.0}, "Binning for m2(pi,d) axis"}; + + // collision filter and preslice + Filter collisionFilter = (aod::evsel::sel8 == true && nabs(aod::collision::posZ) < 10.f); + Preslice> perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; + + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(InitContext const&) + { + const AxisSpec axisM2PrPi{m2PrPiBins, "#it{m}^{2}(p,#pi^{-}) ((GeV/#it{c}^{2})^{2})"}; + const AxisSpec axisM2PiDe{m2PiDeBins, "#it{m}^{2}(#pi^{+},#bar{d}) ((GeV/#it{c}^{2})^{2})"}; + + registry.add("hCentFT0C", "hCentFT0C", HistType::kTH1F, {{100, 0.0f, 100.0f, "FT0C Centrality"}}); + + // mass spectrum of reco candidates + registry.add("hMassHypertriton", "Mass hypertriton", HistType::kTH1F, {{80, 2.96f, 3.04f, "#it{m}(p,#pi^{-},d) (GeV/#it{c}^{2})"}}); + registry.add("hMassAntiHypertriton", "Mass anti-hypertriton", HistType::kTH1F, {{80, 2.96f, 3.04f, "#it{m}(#bar{p},#pi^{+},#bar{d}) (GeV/#it{c}^{2})"}}); + + // Dalitz diagrams of reco candidates + 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"); + LabelHist->GetXaxis()->SetBinLabel(2, "Have Same MotherTrack"); + LabelHist->GetXaxis()->SetBinLabel(3, "True H3L/Anti-H3L"); + registry.add("hTrueHypertritonMCPt", "pT gen. of reco. H3L", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}}); + registry.add("hTrueAntiHypertritonMCPt", "pT gen. of reco. Anti-H3L", HistType::kTH1F, {{100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}}); + registry.add("hTrueHypertritonMCMass", "mass gen. of reco. H3L", HistType::kTH1F, {{40, 2.96f, 3.04f, "#it{m}(p,#pi^{-},d) (GeV/#it{c}^{2})"}}); + registry.add("hTrueAntiHypertritonMCMass", "mass gen. of reco. Anti-H3L", HistType::kTH1F, {{40, 2.96f, 3.04f, "#it{m}(#bar{p},#pi^{+},#bar{d}) (GeV/#it{c}^{2})"}}); + registry.add("hTrueHypertritonMCCTau", "#it{c}#tau gen. of reco. H3L", HistType::kTH1F, {{50, 0.0f, 50.0f, "#it{c}#tau(cm)"}}); + registry.add("hTrueAntiHypertritonMCCTau", "#it{c}#tau gen. of reco. Anti-H3L", HistType::kTH1F, {{50, 0.0f, 50.0f, "#it{c}#tau(cm)"}}); + registry.add("hTrueHypertritonMCMassPrPi", "inv. mass gen. of reco. V0 pair (H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(p,#pi^{-}) (GeV/#it{c}^{2})"}}); + registry.add("hTrueAntiHypertritonMCMassPrPi", "inv. mass gen. of reco. V0 pair (Anti-H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(#bar{p},#pi^{+}) (GeV/#it{c}^{2})"}}); + + // for gen information of non reco candidates + registry.add("hTrueHypertritonMCMassPrPi_nonReco", "inv. mass gen. of non-reco. V0 pair (H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(p,#pi^{-}) (GeV/#it{c}^{2})"}}); + registry.add("hTrueAntiHypertritonMCMassPrPi_nonReco", "inv. mass gen. of non-reco. V0 pair (Anti-H3L)", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{m}(#bar{p},#pi^{+}) (GeV/#it{c}^{2})"}}); + registry.add("hTrueHypertritonMCPtProton_nonReco", "Proton #it{p}_{T} gen. of non-reco. H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(p) (GeV/#it{c})"}}); + registry.add("hTrueHypertritonMCPtPion_nonReco", "Pion #it{p}_{T} gen. of non-reco. H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(#pi) (GeV/#it{c})"}}); + registry.add("hTrueAntiHypertritonMCPtProton_nonReco", "Proton #it{p}_{T} gen. of non-reco. Anti-H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(p) (GeV/#it{c})"}}); + registry.add("hTrueAntiHypertritonMCPtPion_nonReco", "Pion #it{p}_{T} gen. of non-reco. Anti- H3L", HistType::kTH1F, {{100, 0.0f, 6.0f, "#it{p}_{T}(#pi) (GeV/#it{c})"}}); + } + + template + 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) { + if (vtx3body.track2sign() > 0) { // hypertriton + registry.fill(HIST("hDalitzHypertriton"), m2prpi, m2pide); + } else if (vtx3body.track2sign() < 0) { // anti-hypertriton + registry.fill(HIST("hDalitzAntiHypertriton"), m2prpi, m2pide); + } + } + + // ITS cluster sizes + registry.fill(HIST("hAverageITSClusterSizeBachelor"), vtx3body.itsclussizedeuteron()); + registry.fill(HIST("hdEdxBachelor"), vtx3body.tpcdedxdeuteron()); + registry.fill(HIST("hPIDTrackingBachelor"), vtx3body.pidtrackingdeuteron()); + } + + //------------------------------------------------------------------ + // process real data analysis + void processData(soa::Filtered>::iterator const& collision, + aod::KFVtx3BodyDatas const& vtx3bodydatas) + { + registry.fill(HIST("hCentFT0C"), collision.centFT0C()); + + for (auto& vtx3bodydata : vtx3bodydatas) { + // QA histograms + fillQAPlots(vtx3bodydata); + } + } + PROCESS_SWITCH(threebodyKFTask, processData, "Data analysis", true); + + //------------------------------------------------------------------ + // process mc analysis + void processMC(soa::Join const& collisions, + soa::Join const& vtx3bodydatas, + aod::McParticles const& particlesMC, + MCLabeledTracksIU const&, + aod::McCollisions const& mcCollisions) + { + filledMothers.clear(); + isGoodCollision.resize(mcCollisions.size(), false); + + // loop over collisions + for (const auto& collision : collisions) { + // event selection + if (!collision.sel8() || abs(collision.posZ()) > 10.f) { + continue; + } + // reco collision survived event selection filter --> fill value for MC collision if collision is "true" MC collision + if (collision.mcCollisionId() >= 0) { + isGoodCollision[collision.mcCollisionId()] = true; + } + + // fill MC table with reco MC candidate information and gen information if matched to MC particle + auto Decay3BodyTable_thisCollision = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); + for (auto& vtx3bodydata : Decay3BodyTable_thisCollision) { + registry.fill(HIST("hLabelCounter"), 0.5); + + // fill QA histograms for all reco candidates + fillQAPlots(vtx3bodydata); + + double MClifetime = -1.; + bool isTrueH3L = false; + bool isTrueAntiH3L = false; + float genPhi = -1.; + float genEta = -1.; + float genRap = -1.; + float genP = -1.; + float genPt = -1.; + std::array genDecVtx{-1.f}; + int vtx3bodyPDGcode = -1; + double MCmassPrPi = -1.; + + auto track0 = vtx3bodydata.track0_as(); + auto track1 = vtx3bodydata.track1_as(); + auto track2 = vtx3bodydata.track2_as(); + + if (vtx3bodydata.has_mcParticle() && vtx3bodydata.mcParticleId() > -1 && vtx3bodydata.mcParticleId() <= particlesMC.size()) { // mother to daughter association already checked in decay3bodybuilder + auto MCvtx3body = vtx3bodydata.mcParticle(); + registry.fill(HIST("hLabelCounter"), 1.5); + if (MCvtx3body.has_daughters()) { + auto lMCTrack0 = track0.mcParticle_as(); + auto lMCTrack1 = track1.mcParticle_as(); + auto lMCTrack2 = track2.mcParticle_as(); + // check PDG codes + if ((MCvtx3body.pdgCode() == motherPdgCode && lMCTrack0.pdgCode() == 2212 && lMCTrack1.pdgCode() == -211 && lMCTrack2.pdgCode() == bachelorPdgCode) || + (MCvtx3body.pdgCode() == -motherPdgCode && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -bachelorPdgCode)) { + vtx3bodyPDGcode = MCvtx3body.pdgCode(); + genDecVtx = {lMCTrack0.vx(), lMCTrack0.vy(), lMCTrack0.vz()}; + MClifetime = RecoDecay::sqrtSumOfSquares(lMCTrack2.vx() - MCvtx3body.vx(), lMCTrack2.vy() - MCvtx3body.vy(), lMCTrack2.vz() - MCvtx3body.vz()) * o2::constants::physics::MassHyperTriton / MCvtx3body.p(); + genPhi = MCvtx3body.phi(); + genEta = MCvtx3body.eta(); + genRap = MCvtx3body.y(); + genP = MCvtx3body.p(); + genPt = MCvtx3body.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) { + isTrueH3L = true; + double hypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); + MCmassPrPi = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + registry.fill(HIST("hLabelCounter"), 2.5); + registry.fill(HIST("hTrueHypertritonMCPt"), MCvtx3body.pt()); + registry.fill(HIST("hTrueHypertritonMCCTau"), MClifetime); + registry.fill(HIST("hTrueHypertritonMCMass"), hypertritonMCMass); + registry.fill(HIST("hTrueHypertritonMCMassPrPi"), MCmassPrPi); + } // end is H3L + if (MCvtx3body.pdgCode() == -motherPdgCode && lMCTrack0.pdgCode() == 211 && lMCTrack1.pdgCode() == -2212 && lMCTrack2.pdgCode() == -bachelorPdgCode) { + isTrueAntiH3L = true; + double antiHypertritonMCMass = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}, array{lMCTrack2.px(), lMCTrack2.py(), lMCTrack2.pz()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}); + MCmassPrPi = RecoDecay::m(array{array{lMCTrack0.px(), lMCTrack0.py(), lMCTrack0.pz()}, array{lMCTrack1.px(), lMCTrack1.py(), lMCTrack1.pz()}}, array{o2::constants::physics::MassPionCharged, o2::constants::physics::MassProton}); + registry.fill(HIST("hLabelCounter"), 2.5); + registry.fill(HIST("hTrueAntiHypertritonMCPt"), MCvtx3body.pt()); + registry.fill(HIST("hTrueAntiHypertritonMCCTau"), MClifetime); + registry.fill(HIST("hTrueAntiHypertritonMCMass"), antiHypertritonMCMass); + registry.fill(HIST("hTrueAntiHypertritonMCMassPrPi"), MCmassPrPi); + } // end is Anti-H3L + } // end has daughters + } // end has matched MC particle + + outputMCTable( // filled for each reconstructed candidate (in KFVtx3BodyDatas) + vtx3bodydata.mass(), + vtx3bodydata.x(), vtx3bodydata.y(), vtx3bodydata.z(), + vtx3bodydata.xerr(), vtx3bodydata.yerr(), vtx3bodydata.zerr(), + vtx3bodydata.px(), vtx3bodydata.py(), vtx3bodydata.pz(), vtx3bodydata.pt(), + vtx3bodydata.pxerr(), vtx3bodydata.pyerr(), vtx3bodydata.pzerr(), vtx3bodydata.pterr(), + vtx3bodydata.sign(), + vtx3bodydata.dcavtxtopvkf(), vtx3bodydata.dcaxyvtxtopvkf(), + vtx3bodydata.vtxcospakf(), vtx3bodydata.vtxcosxypakf(), + vtx3bodydata.vtxcospakftopo(), vtx3bodydata.vtxcosxypakftopo(), + vtx3bodydata.decaylkf(), vtx3bodydata.decaylxykf(), vtx3bodydata.decayldeltal(), + vtx3bodydata.chi2geondf(), vtx3bodydata.chi2topondf(), + vtx3bodydata.ctaukftopo(), + vtx3bodydata.massv0(), vtx3bodydata.chi2massv0(), + 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.tpcdedxproton(), vtx3bodydata.tpcdedxpion(), vtx3bodydata.tpcdedxdeuteron(), + vtx3bodydata.tofnsigmadeuteron(), + vtx3bodydata.itsclussizedeuteron(), + vtx3bodydata.pidtrackingdeuteron(), + // MC info (-1 if not matched to MC particle) + genP, + genPt, + genDecVtx[0], genDecVtx[1], genDecVtx[2], + MClifetime, + genPhi, + genEta, + genRap, + isTrueH3L, isTrueAntiH3L, + vtx3bodyPDGcode, + true, // is reconstructed + true); // reco event passed event selection + } // end vtx3bodydatas loop + } // end collision loop + + // generated MC particle analysis + // fill MC table with gen information for all generated but not reconstructed particles + for (auto& mcparticle : particlesMC) { + + double genMCmassPrPi = -1.; + bool isTrueGenH3L = false; + bool isTrueGenAntiH3L = false; + + // check if mcparticle was reconstructed and already filled in the table + if (std::find(filledMothers.begin(), filledMothers.end(), mcparticle.globalIndex()) != std::end(filledMothers)) { + continue; + } + + // set flag if corresponding reco collision survived event selection + bool survEvSel = isGoodCollision[mcparticle.mcCollisionId()]; + + // check if MC particle is hypertriton with 3-body decay + if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { + continue; + } + bool haveProton = false, havePion = false, haveBachelor = false; + bool haveAntiProton = false, haveAntiPion = false, haveAntiBachelor = false; + for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { + if (mcparticleDaughter.pdgCode() == 2212) + haveProton = true; + if (mcparticleDaughter.pdgCode() == -2212) + haveAntiProton = true; + if (mcparticleDaughter.pdgCode() == 211) + havePion = true; + if (mcparticleDaughter.pdgCode() == -211) + haveAntiPion = true; + if (mcparticleDaughter.pdgCode() == bachelorPdgCode) + haveBachelor = true; + if (mcparticleDaughter.pdgCode() == -bachelorPdgCode) + haveAntiBachelor = true; + } + + // check if particle or anti-particle + if (haveProton && haveAntiPion && haveBachelor && mcparticle.pdgCode() > 0) { + isTrueGenH3L = true; + // get proton and pion daughter + std::array protonMom{0.f}; + std::array piMinusMom{0.f}; + for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { + if (mcparticleDaughter.pdgCode() == 2212) { + protonMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + } else if (mcparticleDaughter.pdgCode() == -211) { + piMinusMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + } + } + genMCmassPrPi = RecoDecay::m(array{protonMom, piMinusMom}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + registry.fill(HIST("hTrueHypertritonMCMassPrPi_nonReco"), genMCmassPrPi); + registry.fill(HIST("hTrueHypertritonMCPtProton_nonReco"), RecoDecay::sqrtSumOfSquares(protonMom[0], protonMom[1])); + registry.fill(HIST("hTrueHypertritonMCPtPion_nonReco"), RecoDecay::sqrtSumOfSquares(piMinusMom[0], piMinusMom[1])); + } else if (haveAntiProton && havePion && haveAntiBachelor && mcparticle.pdgCode() < 0) { + isTrueGenAntiH3L = true; + // get anti-proton and pion daughter + std::array antiProtonMom{0.f}; + std::array piPlusMom{0.f}; + for (auto& mcparticleDaughter : mcparticle.template daughters_as()) { + if (mcparticleDaughter.pdgCode() == -2212) { + antiProtonMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + } else if (mcparticleDaughter.pdgCode() == 211) { + piPlusMom = {mcparticleDaughter.px(), mcparticleDaughter.py(), mcparticleDaughter.pz()}; + } + } + genMCmassPrPi = RecoDecay::m(array{antiProtonMom, piPlusMom}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged}); + registry.fill(HIST("hTrueAntiHypertritonMCMassPrPi_nonReco"), genMCmassPrPi); + registry.fill(HIST("hTrueAntiHypertritonMCPtProton_nonReco"), RecoDecay::sqrtSumOfSquares(antiProtonMom[0], antiProtonMom[1])); + registry.fill(HIST("hTrueAntiHypertritonMCPtPion_nonReco"), RecoDecay::sqrtSumOfSquares(piPlusMom[0], piPlusMom[1])); + } else { + continue; // stop if particle is no true H3L or Anti-H3L + } + + // get gen decay vertex and calculate ctau + std::array genDecayVtx{0.f}; + for (auto& mcDaughter : mcparticle.daughters_as()) { + if (std::abs(mcDaughter.pdgCode()) == bachelorPdgCode) { + genDecayVtx = {mcDaughter.vx(), mcDaughter.vy(), mcDaughter.vz()}; + } + } + double genMClifetime = RecoDecay::sqrtSumOfSquares(genDecayVtx[0] - mcparticle.vx(), genDecayVtx[1] - mcparticle.vy(), genDecayVtx[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); + outputMCTable( // reco information (-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, + // gen information + mcparticle.p(), + mcparticle.pt(), + genDecayVtx[0], genDecayVtx[1], genDecayVtx[2], + genMClifetime, + mcparticle.phi(), + mcparticle.eta(), + mcparticle.y(), + isTrueGenH3L, isTrueGenAntiH3L, + mcparticle.pdgCode(), + false, // is reconstructed + survEvSel); + } // end mcparticles loop + } + PROCESS_SWITCH(threebodyKFTask, processMC, "MC analysis", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx b/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx index 857a02e1cf2..b0a53668d4f 100644 --- a/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx +++ b/PWGLF/TableProducer/Nuspex/threebodyRecoTask.cxx @@ -42,28 +42,32 @@ using FullTracksExtIU = soa::Join; struct Candidate3body { + // Index int mcmotherId; int track0Id; int track1Id; int track2Id; - std::array posSV; - TLorentzVector lcand; - TLorentzVector lproton; - TLorentzVector lpion; - TLorentzVector lbachelor; - // 0 - proton, 1 - pion, 2 - bachelor - uint8_t dautpcNclusters[3]; - uint8_t dauitsclussize[3]; - uint8_t daudcaxytopv[3]; - uint8_t daudcatopv[3]; - float dautpcNsigma[3]; + // sv and candidate bool isMatter; float invmass; float ct; float cosPA; float dcadaughters; float dcacandtopv; + float vtxradius; + // daughter tracks + TLorentzVector lcand; + TLorentzVector lproton; + TLorentzVector lpion; + TLorentzVector lbachelor; + uint8_t dautpcNclusters[3]; // 0 - proton, 1 - pion, 2 - bachelor + uint32_t dauitsclussize[3]; // 0 - proton, 1 - pion, 2 - bachelor + float daudcaxytopv[3]; // 0 - proton, 1 - pion, 2 - bachelor + float daudcatopv[3]; // 0 - proton, 1 - pion, 2 - bachelor + float dautpcNsigma[3]; // 0 - proton, 1 - pion, 2 - bachelor + float dauinnermostR[3]; // 0 - proton, 1 - pion, 2 - bachelor !!! TracksIU required !!! float bachelortofNsigma; + // MC infomartion TLorentzVector lgencand = {0, 0, 0, 0}; float genct = -1; float genrapidity = -999; @@ -81,6 +85,9 @@ struct threebodyRecoTask { std::vector filledMothers; std::vector isGoodCollision; + //------------------------------------------------------------------ + 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 @@ -91,6 +98,7 @@ struct threebodyRecoTask { 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"}; Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; // ct Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; @@ -110,6 +118,10 @@ struct threebodyRecoTask { 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", { @@ -119,27 +131,7 @@ struct threebodyRecoTask { {"hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, {"hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, {"hMassHypertritonTotal", "hMassHypertritonTotal", {HistType::kTH1F, {{300, 2.9f, 3.2f}}}}, - {"hPtProton", "hPtProton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtPionMinus", "hPtPionMinus", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtDeuteron", "hPtDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtAntiProton", "hPtAntiProton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtPionPlus", "hPtPionPlus", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hPtAntiDeuteron", "hPtAntiDeuteron", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hDCAXYProtonToPV", "hDCAXYProtonToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAXYPionToPV", "hDCAXYPionToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAXYDeuteronToPV", "hDCAXYDeuteronToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAProtonToPV", "hDCAProtonToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCAPionToPV", "hDCAPionToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hDCADeuteronToPV", "hDCADeuteronToPV", {HistType::kTH1F, {{1000, -10.0f, 10.0f, "cm"}}}}, - {"hProtonTPCNcls", "hProtonTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hPionTPCNcls", "hPionTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hDeuteronTPCNcls", "hDeuteronTPCNcls", {HistType::kTH1F, {{180, 0, 180, "TPC cluster"}}}}, - {"hVtxCosPA", "hVtxCosPA", {HistType::kTH1F, {{1000, 0.9f, 1.0f}}}}, - {"hDCAVtxDau", "hDCAVtxDau", {HistType::kTH1F, {{1000, 0.0f, 10.0f, "cm^{2}"}}}}, {"hTOFPIDDeuteron", "hTOFPIDDeuteron", {HistType::kTH1F, {{2000, -100.0f, 100.0f}}}}, - {"hTPCPIDProton", "hTPCPIDProton", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, - {"hTPCPIDPion", "hTPCPIDPion", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, - {"hTPCPIDDeuteron", "hTPCPIDDeuteron", {HistType::kTH1F, {{240, -6.0f, 6.0f}}}}, {"hProtonTPCBB", "hProtonTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, {"hPionTPCBB", "hPionTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, {"hDeuteronTPCBB", "hDeuteronTPCBB", {HistType::kTH2F, {{160, -8.0f, 8.0f, "p/z(GeV/c)"}, {200, 0.0f, 1000.0f, "TPCSignal"}}}}, @@ -150,41 +142,22 @@ struct threebodyRecoTask { {"hDeuteronTOFVsPAtferTOFCut", "hDeuteronTOFVsPAtferTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, {"hDalitz", "hDalitz", {HistType::kTH2F, {{120, 7.85, 8.45, "M^{2}(dp) (GeV^{2}/c^{4})"}, {60, 1.1, 1.4, "M^{2}(p#pi) (GeV^{2}/c^{4})"}}}}, - {"h3dMassHypertriton", "h3dMassHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"h3dMassAntiHypertriton", "h3dMassAntiHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"h3dTotalHypertriton", "h3dTotalHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - - {"hTrueHypertritonCounter", "hTrueHypertritonCounter", {HistType::kTH1F, {{12, 0.0f, 12.0f}}}}, - {"hDeuteronTOFVsPBeforeTOFCutSig", "hDeuteronTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"hDeuteronTOFVsPAtferTOFCutSig", "hDeuteronTOFVsPAtferTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, - {"h3dTotalTrueHypertriton", "h3dTotalTrueHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - - // for mcparticles information - {"hGeneratedHypertritonCounter", "hGeneratedHypertritonCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - {"hPtGeneratedHypertriton", "hPtGeneratedHypertriton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hctGeneratedHypertriton", "hctGeneratedHypertriton", {HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}}}, - {"hEtaGeneratedHypertriton", "hEtaGeneratedHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, - {"hRapidityGeneratedHypertriton", "hRapidityGeneratedHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, - {"hPtGeneratedAntiHypertriton", "hPtGeneratedAntiHypertriton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hctGeneratedAntiHypertriton", "hctGeneratedAntiHypertriton", {HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}}}, - {"hEtaGeneratedAntiHypertriton", "hEtaGeneratedAntiHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, - {"hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, }, }; //------------------------------------------------------------------ // 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 }; @@ -211,7 +184,9 @@ struct threebodyRecoTask { { for (Int_t ii = 0; ii < kNCandSteps; ii++) { registry.fill(HIST("hCandidatesCounter"), ii, statisticsRegistry.candstats[ii]); - registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); + if (doprocessMC == true) { + registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); + } } } @@ -220,28 +195,47 @@ struct threebodyRecoTask { void init(InitContext const&) { - AxisSpec dcaAxis = {dcaBinning, "DCA (cm)"}; - AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/c)"}; - AxisSpec massAxisHypertriton = {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}; - 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"); - TString CandCounterbinLabel[12] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID", "TPCNcls", "DauPt", "PionDcatoPV", "InvMass"}; + // 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 + registry.add("hDiffRVtxPion", "hDiffRVtxPion", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of pion + 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}}); + hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(1, "Total"); + hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(2, "3-body decay"); + registry.add("hPtGeneratedHypertriton", "hPtGeneratedHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); + registry.add("hctGeneratedHypertriton", "hctGeneratedHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); + registry.add("hEtaGeneratedHypertriton", "hEtaGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + registry.add("hRapidityGeneratedHypertriton", "hRapidityGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + registry.add("hPtGeneratedAntiHypertriton", "hPtGeneratedAntiHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); + registry.add("hctGeneratedAntiHypertriton", "hctGeneratedAntiHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); + registry.add("hEtaGeneratedAntiHypertriton", "hEtaGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + registry.add("hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + } + + 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("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + if (doprocessMC == true) { + registry.get(HIST("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + } } - - registry.get(HIST("hGeneratedHypertritonCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hGeneratedHypertritonCounter"))->GetXaxis()->SetBinLabel(2, "3-body decay"); } //------------------------------------------------------------------ - Preslice perCollisionVtx3BodyDatas = o2::aod::vtx3body::collisionId; - //------------------------------------------------------------------ + // Check if the mcparticle is hypertriton which decays into 3 daughters template bool is3bodyDecayed(TMCParticle const& particle) { @@ -273,148 +267,35 @@ 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; - - float cospa = candData.vtxcosPA(dCollision.posX(), dCollision.posY(), dCollision.posZ()); - if (cospa < vtxcospa) { - return; - } - FillCandCounter(kCandCosPA, isTrueCand); - if (TMath::Abs(trackProton.eta()) > etacut || TMath::Abs(trackPion.eta()) > etacut || TMath::Abs(trackDeuteron.eta()) > etacut) { - return; - } - FillCandCounter(kCandDauEta, isTrueCand); - if (TMath::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 (isTrueCand) { - registry.fill(HIST("hDeuteronTOFVsPBeforeTOFCutSig"), 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 (isTrueCand) { - registry.fill(HIST("hDeuteronTOFVsPAtferTOFCutSig"), trackDeuteron.sign() * trackDeuteron.p(), candData.tofNSigmaBachDe()); - } - - if (TMath::Abs(trackProton.tpcNSigmaPr()) > TpcPidNsigmaCut || TMath::Abs(trackPion.tpcNSigmaPi()) > TpcPidNsigmaCut || TMath::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 (TMath::Abs(dcapion) < dcapiontopv) { - return; - } - FillCandCounter(kCandDcaToPV, isTrueCand); - - // 3sigma region for Dalitz plot - double lowersignallimit = o2::constants::physics::MassHyperTriton - 3 * mcsigma; - double uppersignallimit = o2::constants::physics::MassHyperTriton + 3 * mcsigma; + 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("hPtProton"), trackProton.pt()); - registry.fill(HIST("hPtPionMinus"), trackPion.pt()); - registry.fill(HIST("hPtDeuteron"), trackDeuteron.pt()); - registry.fill(HIST("hDCAXYProtonToPV"), candData.dcaXYtrack0topv()); - registry.fill(HIST("hDCAXYPionToPV"), candData.dcaXYtrack1topv()); - registry.fill(HIST("hDCAProtonToPV"), candData.dcatrack0topv()); - registry.fill(HIST("hDCAPionToPV"), candData.dcatrack1topv()); - - 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("h3dTotalHypertriton"), ct, candData.pt(), 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})); - } - if (isTrueCand) { - registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lmother.Pt(), candData.mHypertriton()); - } - } 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("hPtAntiProton"), trackProton.pt()); - registry.fill(HIST("hPtPionPlus"), trackPion.pt()); - registry.fill(HIST("hPtAntiDeuteron"), trackDeuteron.pt()); - registry.fill(HIST("hDCAXYProtonToPV"), candData.dcaXYtrack1topv()); - registry.fill(HIST("hDCAXYPionToPV"), candData.dcaXYtrack0topv()); - registry.fill(HIST("hDCAProtonToPV"), candData.dcatrack1topv()); - registry.fill(HIST("hDCAPionToPV"), candData.dcatrack0topv()); - - 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("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})); - } - if (isTrueCand) { - registry.fill(HIST("h3dTotalTrueHypertriton"), MClifetime, lmother.Pt(), candData.mHypertriton()); - } - } else { - return; } - if_hasvtx = true; cand3body.mcmotherId = lLabel; cand3body.track0Id = candData.track0Id(); cand3body.track1Id = candData.track1Id(); cand3body.track2Id = candData.track2Id(); cand3body.invmass = cand3body.isMatter ? candData.mHypertriton() : candData.mAntiHypertriton(); - cand3body.posSV[0] = candData.x(); - cand3body.posSV[1] = candData.y(); - cand3body.posSV[2] = candData.z(); + cand3body.lcand.SetXYZM(candData.px(), candData.py(), candData.pz(), o2::constants::physics::MassHyperTriton); + cand3body.ct = ct; + cand3body.cosPA = cospa; + cand3body.dcadaughters = candData.dcaVtxdaughters(); + 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(); cand3body.dautpcNclusters[1] = trackPion.tpcNClsFound(); @@ -431,11 +312,10 @@ struct threebodyRecoTask { cand3body.daudcatopv[0] = cand3body.isMatter ? candData.dcatrack0topv() : candData.dcatrack1topv(); cand3body.daudcatopv[1] = cand3body.isMatter ? candData.dcatrack1topv() : candData.dcatrack0topv(); cand3body.daudcatopv[2] = candData.dcatrack2topv(); - cand3body.lcand.SetXYZM(candData.px(), candData.py(), candData.pz(), o2::constants::physics::MassHyperTriton); - cand3body.ct = ct; - cand3body.cosPA = cospa; - cand3body.dcadaughters = candData.dcaVtxdaughters(); - cand3body.dcacandtopv = candData.dcavtxtopv(dCollision.posX(), dCollision.posY(), dCollision.posZ()); + cand3body.dauinnermostR[0] = trackProton.x(); + cand3body.dauinnermostR[1] = trackPion.x(); + cand3body.dauinnermostR[2] = trackDeuteron.x(); + cand3body.bachelortofNsigma = candData.tofNSigmaBachDe(); if (isTrueCand) { cand3body.mcmotherId = lLabel; @@ -451,15 +331,6 @@ struct threebodyRecoTask { Candidates3body.push_back(cand3body); - registry.fill(HIST("hDCADeuteronToPV"), candData.dcatrack2topv()); - registry.fill(HIST("hVtxCosPA"), candData.vtxcosPA(dCollision.posX(), dCollision.posY(), dCollision.posZ())); - registry.fill(HIST("hDCAVtxDau"), candData.dcaVtxdaughters()); - registry.fill(HIST("hProtonTPCNcls"), trackProton.tpcNClsFound()); - registry.fill(HIST("hPionTPCNcls"), trackPion.tpcNClsFound()); - registry.fill(HIST("hDeuteronTPCNcls"), trackDeuteron.tpcNClsFound()); - registry.fill(HIST("hTPCPIDProton"), trackProton.tpcNSigmaPr()); - registry.fill(HIST("hTPCPIDPion"), trackPion.tpcNSigmaPi()); - registry.fill(HIST("hTPCPIDDeuteron"), trackDeuteron.tpcNSigmaDe()); registry.fill(HIST("hProtonTPCBB"), trackProton.sign() * trackProton.p(), trackProton.tpcSignal()); registry.fill(HIST("hPionTPCBB"), trackPion.sign() * trackPion.p(), trackPion.tpcSignal()); registry.fill(HIST("hDeuteronTPCBB"), trackDeuteron.sign() * trackDeuteron.p(), trackDeuteron.tpcSignal()); @@ -467,6 +338,148 @@ struct threebodyRecoTask { registry.fill(HIST("hPionTPCVsPt"), trackProton.pt(), trackPion.tpcNSigmaPi()); registry.fill(HIST("hDeuteronTPCVsPt"), trackDeuteron.pt(), trackDeuteron.tpcNSigmaDe()); registry.fill(HIST("hTOFPIDDeuteron"), candData.tofNSigmaBachDe()); + registry.fill(HIST("hDiffRVtxProton"), trackProton.x() - candData.vtxradius()); + registry.fill(HIST("hDiffRVtxPion"), trackPion.x() - candData.vtxradius()); + registry.fill(HIST("hDiffRVtxDeuteron"), trackDeuteron.x() - candData.vtxradius()); + float diffTrackR = trackDeuteron.x() - std::min(trackProton.x(), trackPion.x()); + 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(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 ((!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(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 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()); + } + } } //------------------------------------------------------------------ @@ -474,7 +487,7 @@ struct threebodyRecoTask { void GetGeneratedH3LInfo(aod::McParticles const& particlesMC) { for (auto& mcparticle : particlesMC) { - if (mcparticle.pdgCode() != motherPdgCode && mcparticle.pdgCode() != -motherPdgCode) { + if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { continue; } registry.fill(HIST("hGeneratedHypertritonCounter"), 0.5); @@ -518,60 +531,104 @@ struct threebodyRecoTask { //------------------------------------------------------------------ // process real data analysis - void processData(soa::Join::iterator const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) + void processData(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) { - Candidates3body.clear(); - registry.fill(HIST("hEventCounter"), 0.5); - if (event_sel8_selection && !collision.sel8()) { - return; - } - registry.fill(HIST("hEventCounter"), 1.5); - if (event_posZ_selection && abs(collision.posZ()) > 10.f) { // 10cm - return; - } - registry.fill(HIST("hEventCounter"), 2.5); - registry.fill(HIST("hCentFT0C"), collision.centFT0C()); + for (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 + continue; + } + registry.fill(HIST("hEventCounter"), 2.5); + registry.fill(HIST("hCentFT0C"), collision.centFT0C()); - bool if_hasvtx = false; + bool if_hasvtx = false; + auto d3bodyCands = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); + for (auto vtx : d3bodyCands) { + CandidateAnalysis(collision, vtx, if_hasvtx); + } + if (if_hasvtx) + registry.fill(HIST("hEventCounter"), 3.5); + fillHistos(); + resetHistos(); - for (auto& vtx : vtx3bodydatas) { - CandidateAnalysis(collision, vtx, if_hasvtx); + for (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); - if (if_hasvtx) - registry.fill(HIST("hEventCounter"), 3.5); - fillHistos(); - resetHistos(); + //------------------------------------------------------------------ + // process like-sign signal + void processDataLikeSign(soa::Join const& collisions, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) + { + for (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 + continue; + } + registry.fill(HIST("hEventCounter"), 2.5); + registry.fill(HIST("hCentFT0C"), collision.centFT0C()); - for (auto& cand3body : Candidates3body) { - outputDataTable(collision.centFT0C(), collision.posX(), collision.posY(), collision.posZ(), - cand3body.isMatter, cand3body.invmass, cand3body.lcand.P(), cand3body.lcand.Pt(), cand3body.ct, - cand3body.posSV[0], cand3body.posSV[1], cand3body.posSV[2], - cand3body.cosPA, cand3body.dcadaughters, cand3body.dcacandtopv, - cand3body.lproton.P(), cand3body.lproton.Pt(), cand3body.lproton.Eta(), cand3body.lproton.Phi(), - cand3body.lpion.P(), cand3body.lpion.Pt(), cand3body.lpion.Eta(), cand3body.lpion.Phi(), - cand3body.lbachelor.P(), cand3body.lbachelor.Pt(), cand3body.lbachelor.Eta(), cand3body.lbachelor.Phi(), - 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]); + bool if_hasvtx = false; + auto d3bodyCands = vtx3bodydatas.sliceBy(perCollisionVtx3BodyDatas, collision.globalIndex()); + for (auto vtx : d3bodyCands) { + LikeSignAnalysis(collision, vtx, if_hasvtx); + } + if (if_hasvtx) + registry.fill(HIST("hEventCounter"), 3.5); + fillHistos(); + resetHistos(); + + for (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_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) { - Candidates3body.clear(); filledMothers.clear(); GetGeneratedH3LInfo(particlesMC); isGoodCollision.resize(mcCollisions.size(), false); for (const auto& collision : collisions) { + Candidates3body.clear(); registry.fill(HIST("hEventCounter"), 0.5); - if (event_sel8_selection && !collision.sel8()) { + if (mc_event_selection && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { continue; } registry.fill(HIST("hEventCounter"), 1.5); @@ -628,13 +685,12 @@ struct threebodyRecoTask { resetHistos(); for (auto& cand3body : Candidates3body) { - outputMCTable(collision.centFT0C(), collision.posX(), collision.posY(), collision.posZ(), // centV0M() instead of 0. once available + outputMCTable(collision.centFT0C(), cand3body.isMatter, cand3body.invmass, cand3body.lcand.P(), cand3body.lcand.Pt(), cand3body.ct, - cand3body.posSV[0], cand3body.posSV[1], cand3body.posSV[2], - cand3body.cosPA, cand3body.dcadaughters, cand3body.dcacandtopv, - cand3body.lproton.P(), cand3body.lproton.Pt(), cand3body.lproton.Eta(), cand3body.lproton.Phi(), - cand3body.lpion.P(), cand3body.lpion.Pt(), cand3body.lpion.Eta(), cand3body.lpion.Phi(), - cand3body.lbachelor.P(), cand3body.lbachelor.Pt(), cand3body.lbachelor.Eta(), cand3body.lbachelor.Phi(), + 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, @@ -661,10 +717,9 @@ struct threebodyRecoTask { } } double MClifetime = RecoDecay::sqrtSumOfSquares(posSV[0] - mcparticle.vx(), posSV[1] - mcparticle.vy(), posSV[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - outputMCTable(-1, -1, -1, -1, + outputMCTable(-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, diff --git a/PWGLF/TableProducer/Resonances/CMakeLists.txt b/PWGLF/TableProducer/Resonances/CMakeLists.txt index baa9b98325a..b8a16e14c53 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 diff --git a/PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx b/PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx index a453b6edeb5..0fa31113667 100644 --- a/PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx +++ b/PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx @@ -15,6 +15,8 @@ /// /// \author Bong-Hwi Lim +#include +#include #include "Common/DataModel/PIDResponse.h" #include "Common/Core/TrackSelection.h" #include "Common/DataModel/Centrality.h" @@ -511,6 +513,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 posTrack_as().tofNSigmaPi(), + v0.template posTrack_as().tofNSigmaKa(), + v0.template posTrack_as().tofNSigmaPr(), + 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.v0cosPA(), v0.dcaV0daughters(), v0.dcapostopv(), @@ -545,6 +559,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 posTrack_as().tofNSigmaPi(), + casc.template posTrack_as().tofNSigmaKa(), + casc.template posTrack_as().tofNSigmaPr(), + casc.template negTrack_as().tpcNSigmaPi(), + casc.template negTrack_as().tpcNSigmaKa(), + casc.template negTrack_as().tpcNSigmaPr(), + casc.template negTrack_as().tofNSigmaPi(), + casc.template negTrack_as().tofNSigmaKa(), + casc.template negTrack_as().tofNSigmaPr(), + casc.template bachelor_as().tpcNSigmaPi(), + casc.template bachelor_as().tpcNSigmaKa(), + casc.template bachelor_as().tpcNSigmaPr(), + 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(), @@ -1015,7 +1047,7 @@ 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); } @@ -1032,7 +1064,7 @@ struct reso2initializer { 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); } @@ -1049,7 +1081,7 @@ 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()); + 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()); fillTracks(collision, tracks); } @@ -1067,7 +1099,7 @@ 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); @@ -1086,7 +1118,7 @@ struct reso2initializer { 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); @@ -1106,7 +1138,7 @@ 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); @@ -1127,7 +1159,7 @@ struct reso2initializer { 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillTracks(collision, tracks); fillV0s(collision, V0s, tracks); @@ -1144,7 +1176,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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); auto mccollision = collision.mcCollision_as(); float impactpar = mccollision.impactParameter(); @@ -1167,7 +1199,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()); + 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()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1187,7 +1219,7 @@ struct reso2initializer { initCCDB(bc); 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1208,7 +1240,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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1230,7 +1262,7 @@ struct reso2initializer { initCCDB(bc); 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1253,7 +1285,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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), CentEst(collision), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks @@ -1278,7 +1310,7 @@ struct reso2initializer { initCCDB(bc); 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()); + resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange()); fillMCCollision(collision, mcParticles); // Loop over tracks 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/Strangeness/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/CMakeLists.txt index 27aec6b4e62..04e614c1811 100644 --- a/PWGLF/TableProducer/Strangeness/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/CMakeLists.txt @@ -107,6 +107,11 @@ o2physics_add_dpl_workflow(strangederivedbuilder PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsBase COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(v0-selector + SOURCES v0selector.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(v0qaanalysis SOURCES v0qaanalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore diff --git a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt index 035c4ca6581..e75fbd9e573 100644 --- a/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt +++ b/PWGLF/TableProducer/Strangeness/Converters/CMakeLists.txt @@ -29,6 +29,31 @@ o2physics_add_dpl_workflow(straevselsconverter PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(straevselsconverter2 + SOURCES straevselsconverter2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(straevselsconverter3 + SOURCES straevselsconverter3.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::ITStracking + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(straevselsconverter2rawcents + SOURCES straevselsconverter2rawcents.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(straevselsconverter2rawcents2 + SOURCES straevselsconverter2rawcents2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(straevselsconverter2rawcents3 + SOURCES straevselsconverter2rawcents3.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(v0coresconverter SOURCES v0coresconverter.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -37,4 +62,9 @@ o2physics_add_dpl_workflow(v0coresconverter o2physics_add_dpl_workflow(v0coresconverter2 SOURCES v0coresconverter2.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(v0mlscoresconverter + SOURCES v0mlscoresconverter.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2.cxx new file mode 100644 index 00000000000..401b04bbc83 --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2.cxx @@ -0,0 +1,64 @@ +// 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 straevselsconverter2 { + Produces straEvSels_002; + + void process(aod::StraEvSels_001 const& straEvSels_001) + { + for (auto& values : straEvSels_001) { + straEvSels_002(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(), + values.gapSide(), + values.totalFT0AmplitudeA(), + values.totalFT0AmplitudeC(), + values.totalFV0AmplitudeA(), + values.totalFDDAmplitudeA(), + values.totalFDDAmplitudeC(), + values.energyCommonZNA(), + values.energyCommonZNC(), + o2::its::Vertex::FlagsMask /*dummy flag value*/); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents.cxx new file mode 100644 index 00000000000..deeafa8eeca --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents.cxx @@ -0,0 +1,50 @@ +// 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 straevselsconverter2rawcents { + Produces straRawCents_004; + + void process(aod::StraEvSels_001 const& straEvSels_001) + { + for (auto& values : straEvSels_001) { + straRawCents_004(values.multFT0A(), + values.multFT0C(), + values.multFT0A(), + 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()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents2.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents2.cxx new file mode 100644 index 00000000000..ffed58e9072 --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents2.cxx @@ -0,0 +1,50 @@ +// 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 straevselsconverter2rawcents2 { + Produces straRawCents_004; + + void process(aod::StraEvSels_002 const& straEvSels_002) + { + for (auto& values : straEvSels_002) { + straRawCents_004(values.multFT0A(), + values.multFT0C(), + values.multFT0A(), + 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()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents3.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents3.cxx new file mode 100644 index 00000000000..8d92146d6f7 --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter2rawcents3.cxx @@ -0,0 +1,50 @@ +// 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 straevselsconverter2rawcents3 { + Produces straRawCents_004; + + void process(aod::StraEvSels_003 const& straEvSels_003) + { + for (auto& values : straEvSels_003) { + straRawCents_004(values.multFT0A(), + values.multFT0C(), + values.multFT0A(), + 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()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter3.cxx b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter3.cxx new file mode 100644 index 00000000000..ecbd738f5fa --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/straevselsconverter3.cxx @@ -0,0 +1,65 @@ +// 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 straevselsconverter3 { + Produces straEvSels_003; + + void process(aod::StraEvSels_002 const& straEvSels_002) + { + for (auto& values : straEvSels_002) { + straEvSels_003(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(), + o2::its::Vertex::FlagsMask /*dummy flag 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 new file mode 100644 index 00000000000..f7e901e780f --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/Converters/v0mlscoresconverter.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. +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessMLTables.h" + +using namespace o2; +using namespace o2::framework; + +// Converts V0 version 001 to 002 +struct v0mlscoresconverter { + Produces gammaMLSelections; // gamma scores + Produces lambdaMLSelections; // lambda scores + Produces antiLambdaMLSelections; // AntiLambda scores + Produces k0ShortMLSelections; // K0Short scores + + void process(aod::V0Cores const& v0cores) + { + for (auto& values : v0cores) { + gammaMLSelections(-1); + lambdaMLSelections(-1); + antiLambdaMLSelections(-1); + k0ShortMLSelections(-1); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx b/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx index 5a5fbde811c..ed2e5f32820 100644 --- a/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadebuilder.cxx @@ -53,6 +53,7 @@ #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessMLTables.h" #include "PWGLF/DataModel/LFParticleIdentification.h" #include "Common/Core/TrackSelection.h" #include "Common/DataModel/TrackSelectionTables.h" @@ -123,15 +124,20 @@ 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 + Produces xiMLSelections; // Xi scores + Produces omegaMLSelections; // Omega scores + o2::ccdb::CcdbApi ccdbApi; Service ccdb; 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 @@ -1573,6 +1579,13 @@ struct cascadeBuilder { cascTrackXs(cascadecandidate.positiveX, cascadecandidate.negativeX, cascadecandidate.bachelorX); } cascbb(cascadecandidate.bachBaryonCosPA, cascadecandidate.bachBaryonDCAxyToPV); + if (cascadecandidate.charge < 0) { + xiMLSelections(cascadecandidate.mlXiMinusScore); + omegaMLSelections(cascadecandidate.mlOmegaMinusScore); + } else { + xiMLSelections(cascadecandidate.mlXiPlusScore); + omegaMLSelections(cascadecandidate.mlOmegaPlusScore); + } // populate cascade covariance matrices if required by any other task if (createCascCovMats) { @@ -1589,15 +1602,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); } } @@ -1743,6 +1760,13 @@ struct cascadeBuilder { cascTrackXs(cascadecandidate.positiveX, cascadecandidate.negativeX, cascadecandidate.bachelorX); } cascbb(cascadecandidate.bachBaryonCosPA, cascadecandidate.bachBaryonDCAxyToPV); + if (cascadecandidate.charge < 0) { + xiMLSelections(cascadecandidate.mlXiMinusScore); + omegaMLSelections(cascadecandidate.mlOmegaMinusScore); + } else { + xiMLSelections(cascadecandidate.mlXiPlusScore); + omegaMLSelections(cascadecandidate.mlOmegaPlusScore); + } // populate cascade covariance matrices if required by any other task if (createCascCovMats) { @@ -1759,15 +1783,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; @@ -1811,7 +1839,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 @@ -1891,6 +1919,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 @@ -2337,9 +2378,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 c3a1060f3cf..73cb3950016 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" @@ -35,8 +38,11 @@ using namespace o2::framework::expressions; using std::array; using DauTracks = soa::Join; -using CollEventPlane = soa::Join::iterator; -using CollEventPlaneCentralFW = soa::Join::iterator; +using CollEventPlane = soa::Join::iterator; +using CollEventPlaneCentralFW = soa::Join::iterator; +using MCCollisionsStra = soa::Join; +using CascCandidates = soa::Join; +using CascMCCandidates = soa::Join; namespace cascadev2 { @@ -123,6 +129,7 @@ struct cascadeFlow { ConfigurableAxis axisQVsNorm{"axisQVsNorm", {200, -1.f, 1.f}, "axisQVsNorm"}; // Event selection criteria + Configurable isStoreTrueCascOnly{"isStoreTrueCascOnly", 1, ""}; Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; Configurable sel8{"sel8", 1, "Apply sel8 event selection"}; Configurable isNoSameBunchPileupCut{"isNoSameBunchPileupCut", 1, "Same found-by-T0 bunch crossing rejection"}; @@ -142,6 +149,8 @@ struct cascadeFlow { Configurable nsigmatpcPr{"nsigmatpcPr", 5, "nsigmatpcPr"}; Configurable nsigmatpcPi{"nsigmatpcPi", 5, "nsigmatpcPi"}; Configurable mintpccrrows{"mintpccrrows", 70, "mintpccrrows"}; + Configurable etaCascMCGen{"etaCascMCGen", 0.8, "etaCascMCGen"}; + Configurable yCascMCGen{"yCascMCGen", 0.5, "yCascMCGen"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable> modelPathsCCDBXi{"modelPathsCCDBXi", std::vector{"Users/c/chdemart/CascadesFlow"}, "Paths of models on CCDB"}; @@ -165,43 +174,50 @@ 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) { return false; } - histos.fill(HIST("hNEvents"), 5.5); + if (isFillHisto) + histos.fill(HIST("hNEvents"), 5.5); if (isCollInStandardTimeRange && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return false; @@ -210,11 +226,14 @@ struct cascadeFlow { if (isCollInNarrowTimeRange && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { return false; } - histos.fill(HIST("hNEvents"), 6.5); + if (isFillHisto) + 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("hEventNchCorrelation"), collision.multNTracksPVeta1(), collision.multNTracksGlobal()); + histos.fill(HIST("hEventPVcontributorsVsCentrality"), collision.centFT0C(), collision.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentrality"), collision.centFT0C(), collision.multNTracksGlobal()); + } return true; } @@ -252,8 +271,9 @@ struct cascadeFlow { return phi; } - HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - HistogramRegistry resolution{"resolution", {}, OutputObjHandlingPolicy::AnalysisObject}; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry histosMCGen{"histosMCGen", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + HistogramRegistry resolution{"resolution", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; // Tables to produce Produces trainingSample; @@ -296,7 +316,7 @@ struct cascadeFlow { } template - void fillAnalysedTable(collision_t coll, cascade_t casc, float v2CSP, float v2CEP, float PsiT0C, float BDTresponseXi, float BDTresponseOmega) + void fillAnalysedTable(collision_t coll, cascade_t casc, float v2CSP, float v2CEP, float PsiT0C, float BDTresponseXi, float BDTresponseOmega, int pdgCode) { double masses[2]{o2::constants::physics::MassXiMinus, o2::constants::physics::MassOmegaMinus}; ROOT::Math::PxPyPzMVector cascadeVector[2], lambdaVector, protonVector; @@ -331,7 +351,8 @@ struct cascadeFlow { BDTresponseOmega, cosThetaStarLambda[0], cosThetaStarLambda[1], - cosThetaStarProton); + cosThetaStarProton, + pdgCode); } void init(InitContext const&) @@ -345,6 +366,8 @@ struct cascadeFlow { 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[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}); @@ -370,14 +393,34 @@ 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}, {200, 0, 20}}); + histos.add("hOmegaPtvsCent", "hOmegaPtvsCent", HistType::kTH2F, {{100, 0, 100}, {200, 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("hGenXiY", "hGenXiY", HistType::kTH1F, {{100, -1, 1}}); + histosMCGen.add("hGenOmegaY", "hGenOmegaY", HistType::kTH1F, {{100, -1, 1}}); + 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}); cascadev2::hMassAfterSelVsPt[iS] = histos.add(Form("hMassAfterSelVsPt%s", cascadev2::speciesNames[iS].data()), "hMassAfterSelVsPt", HistType::kTH2F, {massCascAxis[iS], ptAxis}); @@ -405,12 +448,12 @@ struct cascadeFlow { } } - void processTrainingBackground(soa::Join::iterator const& coll, soa::Join const& Cascades, DauTracks const&) + void processTrainingBackground(soa::Join::iterator const& coll, soa::Join const& Cascades, DauTracks const&) { int counter = 0; - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } @@ -458,19 +501,23 @@ struct cascadeFlow { } } - void processTrainingSignal(soa::Join::iterator const& coll, soa::Join const& Cascades, DauTracks const&) + 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()); histos.fill(HIST("hEventVertexZ"), coll.posZ()); for (auto& casc : Cascades) { - int pdgCode{casc.pdgCode()}; - if (!(std::abs(pdgCode) == 3312 && std::abs(casc.pdgCodeV0()) == 3122 && std::abs(casc.pdgCodeBachelor()) == 211) // Xi - && !(std::abs(pdgCode) == 3334 && std::abs(casc.pdgCodeV0()) == 3122 && std::abs(casc.pdgCodeBachelor()) == 321)) // Omega + if (!casc.has_cascMCCore()) + continue; + + auto cascMC = casc.cascMCCore_as>(); + int pdgCode{cascMC.pdgCode()}; + if (!(std::abs(pdgCode) == 3312 && std::abs(cascMC.pdgCodeV0()) == 3122 && std::abs(cascMC.pdgCodeBachelor()) == 211) // Xi + && !(std::abs(pdgCode) == 3334 && std::abs(cascMC.pdgCodeV0()) == 3122 && std::abs(cascMC.pdgCodeBachelor()) == 321)) // Omega continue; auto negExtra = casc.negTrackExtra_as(); @@ -486,10 +533,10 @@ struct cascadeFlow { } } - void processAnalyseData(CollEventPlane const& coll, soa::Join const& Cascades, DauTracks const&) + void processAnalyseData(CollEventPlane const& coll, CascCandidates const& Cascades, DauTracks const&) { - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } @@ -604,14 +651,14 @@ struct cascadeFlow { BDTresponse[1] = bdtScore[1][1]; } if (isSelectedCasc[0] || isSelectedCasc[1]) - fillAnalysedTable(coll, casc, v2CSP, v2CEP, PsiT0C, BDTresponse[0], BDTresponse[1]); + fillAnalysedTable(coll, casc, v2CSP, v2CEP, PsiT0C, BDTresponse[0], BDTresponse[1], 0); } } - void processAnalyseDataEPCentralFW(CollEventPlaneCentralFW const& coll, soa::Join const& Cascades, DauTracks const&) + void processAnalyseDataEPCentralFW(CollEventPlaneCentralFW const& coll, CascCandidates const& Cascades, DauTracks const&) { - if (!AcceptEvent(coll)) { + if (!AcceptEvent(coll, 1)) { return; } @@ -732,7 +779,216 @@ struct cascadeFlow { BDTresponse[1] = bdtScore[1][1]; } if (isSelectedCasc[0] || isSelectedCasc[1]) - fillAnalysedTable(coll, casc, v2CSP, v2CEP, PsiT0C, BDTresponse[0], BDTresponse[1]); + fillAnalysedTable(coll, casc, v2CSP, v2CEP, PsiT0C, BDTresponse[0], BDTresponse[1], 0); + } + } + + void processAnalyseMC(soa::Join::iterator const& coll, CascMCCandidates const& Cascades, DauTracks const&, soa::Join const&) + { + + if (!AcceptEvent(coll, 1)) { + return; + } + + histos.fill(HIST("hNEvents"), 7.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) { + + if (!casc.has_cascMCCore()) + continue; + + auto cascMC = casc.cascMCCore_as>(); + + int pdgCode{cascMC.pdgCode()}; + if (!(std::abs(pdgCode) == 3312 && std::abs(cascMC.pdgCodeV0()) == 3122 && std::abs(cascMC.pdgCodeBachelor()) == 211) // Xi + && !(std::abs(pdgCode) == 3334 && std::abs(cascMC.pdgCodeV0()) == 3122 && std::abs(cascMC.pdgCodeBachelor()) == 321)) // Omega + { + pdgCode = 0; + } + + // 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()); + } else if (std::abs(pdgCode) == 3334 && std::abs(cascMC.pdgCodeV0()) == 3122 && std::abs(cascMC.pdgCodeBachelor()) == 321) { + histos.fill(HIST("hOmegaPtvsCent"), 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(); + auto bachExtra = casc.bachTrackExtra_as(); + + int counter = 0; + IsCascAccepted(casc, negExtra, posExtra, bachExtra, counter); + histos.fill(HIST("hCascade"), counter); + + // ML selections + bool isSelectedCasc[2]{false, false}; + + std::vector inputFeaturesCasc{casc.cascradius(), + casc.v0radius(), + casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()), + casc.v0cosPA(coll.posX(), coll.posY(), coll.posZ()), + casc.dcapostopv(), + casc.dcanegtopv(), + casc.dcabachtopv(), + casc.dcacascdaughters(), + casc.dcaV0daughters(), + casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ()), + casc.bachBaryonCosPA(), + casc.bachBaryonDCAxyToPV()}; + + float massCasc[2]{casc.mXi(), casc.mOmega()}; + + if (casc.pt() < MinPt || casc.pt() > MaxPt) { + continue; + } + + cascadev2::hMassBeforeSelVsPt[0]->Fill(massCasc[0], casc.pt()); + cascadev2::hMassBeforeSelVsPt[1]->Fill(massCasc[1], casc.pt()); + + if (isApplyML) { + // Retrieve model output and selection outcome + isSelectedCasc[0] = mlResponseXi.isSelectedMl(inputFeaturesCasc, casc.pt(), bdtScore[0]); + isSelectedCasc[1] = mlResponseOmega.isSelectedMl(inputFeaturesCasc, casc.pt(), bdtScore[1]); + + for (int iS{0}; iS < 2; ++iS) { + // Fill BDT score histograms before selection + cascadev2::hSignalScoreBeforeSel[iS]->Fill(bdtScore[0][1]); + cascadev2::hBkgScoreBeforeSel[iS]->Fill(bdtScore[1][0]); + + // Fill histograms for selected candidates + if (isSelectedCasc[iS]) { + cascadev2::hSignalScoreAfterSel[iS]->Fill(bdtScore[0][1]); + cascadev2::hBkgScoreAfterSel[iS]->Fill(bdtScore[1][0]); + cascadev2::hMassAfterSelVsPt[iS]->Fill(massCasc[iS], casc.pt()); + } + } + } else { + isSelectedCasc[0] = true; + isSelectedCasc[1] = true; + } + + histos.fill(HIST("hCascadePhi"), casc.phi()); + + float BDTresponse[2]{0.f, 0.f}; + const float PsiT0C = 0; // not defined in MC for now + auto v2CSP = 0; // not defined in MC for now + auto v2CEP = 0; // not defined in MC for now + + if (isApplyML) { + BDTresponse[0] = bdtScore[0][1]; + BDTresponse[1] = bdtScore[1][1]; + } + if (isStoreTrueCascOnly) { + if (pdgCode == 0) + continue; + } + if (isSelectedCasc[0] || isSelectedCasc[1]) + fillAnalysedTable(coll, casc, v2CSP, v2CEP, PsiT0C, BDTresponse[0], BDTresponse[1], pdgCode); + } + } + + void processMCGen(MCCollisionsStra::iterator const& mcCollision, const soa::SmallGroups>& collisions, const soa::SmallGroups>& cascMC) + { + + 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; + int bestCollisionIndex = -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(); + bestCollisionIndex = coll.globalIndex(); + centrality = coll.centFT0C(); + } + nCollisions++; + } + if (nCollisions < 1) { + return; + } + + histosMCGen.fill(HIST("hNEventsMC"), 5.5); + + 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); + + 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); + 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); + } } } @@ -740,6 +996,8 @@ struct cascadeFlow { PROCESS_SWITCH(cascadeFlow, processTrainingSignal, "Process to create the training dataset for the signal", false); PROCESS_SWITCH(cascadeFlow, processAnalyseData, "Process to apply ML model to the data", false); PROCESS_SWITCH(cascadeFlow, processAnalyseDataEPCentralFW, "Process to apply ML model to the data - event plane calibration from central framework", false); + PROCESS_SWITCH(cascadeFlow, processAnalyseMC, "Process to apply ML model to the MC", false); + PROCESS_SWITCH(cascadeFlow, processMCGen, "Process to store MC generated particles", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/TableProducer/Strangeness/cascadepid.cxx b/PWGLF/TableProducer/Strangeness/cascadepid.cxx index c9faa24a4ed..3c7c82dacdd 100644 --- a/PWGLF/TableProducer/Strangeness/cascadepid.cxx +++ b/PWGLF/TableProducer/Strangeness/cascadepid.cxx @@ -101,6 +101,10 @@ struct cascadepid { Configurable geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; Configurable nSigmaPath{"nSigmaPath", "Users/d/ddobrigk/stratof", "Path of information for n-sigma calculation"}; + // manual + Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; + Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; + ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; ConfigurableAxis axisNSigma{"axisNSigma", {200, -10.0f, +10.0f}, "N(#sigma)"}; @@ -296,10 +300,9 @@ struct cascadepid { } } - template - void initCCDB(TInformationClass const& infoObject) + void initCCDB(int runNumber) { - if (mRunNumber == infoObject.runNumber()) { + if (mRunNumber == runNumber) { return; } @@ -311,32 +314,31 @@ struct cascadepid { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } o2::base::Propagator::initFieldFromGRP(&grpmag); - mRunNumber = infoObject.runNumber(); + mRunNumber = runNumber; return; } - auto run3grp_timestamp = infoObject.timestamp(); - o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + o2::parameters::GRPObject* grpo = ccdb->getForRun(grpPath, runNumber); 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"; + LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + grpmag = ccdb->getForRun(grpmagPath, runNumber); 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 run " << runNumber; } 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"; + LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; } // if TOF Nsigma desired if (doNSigmas) { - nSigmaCalibObjects = ccdb->getForTimeStamp(nSigmaPath, infoObject.timestamp()); + nSigmaCalibObjects = ccdb->getForRun(nSigmaPath, runNumber); if (nSigmaCalibObjects) { LOGF(info, "loaded TList with this many objects: %i", nSigmaCalibObjects->GetEntries()); @@ -372,7 +374,7 @@ struct cascadepid { LOG(info) << "Problems finding omega sigma histograms!"; } } - mRunNumber = infoObject.runNumber(); + mRunNumber = runNumber; } float velocity(float lMomentum, float lMass) @@ -568,10 +570,15 @@ struct cascadepid { void processStandardData(aod::Collisions const& collisions, CascOriginalDatas const& Cascades, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) { - auto collision = collisions.begin(); - auto bc = collision.bc_as(); - // Fire up CCDB - based on standard collisions - initCCDB(bc); + // Fire up CCDB with first collision in record. If no collisions, bypass + if (useCustomRunNumber || collisions.size() < 1) { + initCCDB(manualRunNumber); + } else { + auto collision = collisions.begin(); + auto bc = collision.bc_as(); + initCCDB(bc.runNumber()); + } + for (const auto& collision : collisions) { // Do analysis with collision-grouped V0s, retain full collision information const uint64_t collIdx = collision.globalIndex(); @@ -590,9 +597,15 @@ struct cascadepid { void processDerivedData(soa::Join const& collisions, CascDerivedDatas const& Cascades, dauTracks const&) { + // Fire up CCDB with first collision in record. If no collisions, bypass + if (useCustomRunNumber || collisions.size() < 1) { + initCCDB(manualRunNumber); + } else { + auto collision = collisions.begin(); + initCCDB(collision.runNumber()); + } + for (const auto& collision : collisions) { - // Fire up CCDB - based on StraCollisions for derived analysis - initCCDB(collision); // Do analysis with collision-grouped V0s, retain full collision information const uint64_t collIdx = collision.globalIndex(); auto CascTable_thisCollision = Cascades.sliceBy(perCollisionDerived, collIdx); 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/hStrangeCorrelationFilter.cxx b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx index 3bed2ca7e8e..0dd6cf1d4ec 100644 --- a/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx +++ b/PWGLF/TableProducer/Strangeness/hStrangeCorrelationFilter.cxx @@ -217,7 +217,8 @@ struct hstrangecorrelationfilter { triggerTrack( track.collisionId(), false, // if you decide to check real data for primaries, you'll have a hard time - track.globalIndex()); + track.globalIndex(), + 0); } } @@ -239,14 +240,17 @@ struct hstrangecorrelationfilter { if (!isValidTrigger(track)) continue; bool physicalPrimary = false; + float origPt = -1; if (track.has_mcParticle()) { auto mcParticle = track.mcParticle(); physicalPrimary = mcParticle.isPhysicalPrimary(); + origPt = mcParticle.pt(); } triggerTrack( track.collisionId(), physicalPrimary, - track.globalIndex()); + track.globalIndex(), + origPt); } } diff --git a/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx b/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx index cffe2c54282..d4a87d2f502 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzerobuilder.cxx @@ -263,6 +263,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 +978,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 +997,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 +1009,8 @@ struct lambdakzeroBuilder { keepCandidate = true; if (passML2P_Lambda && dEdxAntiLambda && desiredMassAntiLambda) keepCandidate = true; + if (dEdxGamma && desiredMassGamma) + keepCandidate = true; if (!keepCandidate) return false; @@ -1182,16 +1189,11 @@ struct lambdakzeroBuilder { if (V0.v0Type() > 1 && !storePhotonCandidates) continue; - if (mlConfigurations.calculateK0ShortScores || - mlConfigurations.calculateLambdaScores || - mlConfigurations.calculateAntiLambdaScores || - mlConfigurations.calculateGammaScores) { - // at this stage, the candidate is interesting -> populate table - gammaMLSelections(gammaScore); - lambdaMLSelections(lambdaScore); - antiLambdaMLSelections(antiLambdaScore); - k0ShortMLSelections(k0ShortScore); - } + // at this stage, the candidate is interesting -> populate table + gammaMLSelections(gammaScore); + lambdaMLSelections(lambdaScore); + antiLambdaMLSelections(antiLambdaScore); + k0ShortMLSelections(k0ShortScore); // populates the various tables for analysis statisticsRegistry.v0stats[kCountStandardV0]++; diff --git a/PWGLF/TableProducer/Strangeness/lambdakzerofinder.cxx b/PWGLF/TableProducer/Strangeness/lambdakzerofinder.cxx index c1085762b6f..60d331ea61d 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzerofinder.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzerofinder.cxx @@ -270,11 +270,11 @@ struct lambdakzerofinder { int collisionIndex = -1; // float getDCAtoPV(float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ){ for (auto const& collision : collisions) { - float thisDCA = TMath::Abs(getDCAtoPV(vtx[0], vtx[1], vtx[2], pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2], collision.posX(), collision.posY(), collision.posY())); + float thisDCA = TMath::Abs(getDCAtoPV(vtx[0], vtx[1], vtx[2], pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2], collision.posX(), collision.posY(), collision.posZ())); if (thisDCA < smallestDCA) { collisionIndex = collision.globalIndex(); smallestDCA = thisDCA; - cosPA = RecoDecay::cpa(std::array{collision.posX(), collision.posY(), collision.posY()}, array{vtx[0], vtx[1], vtx[2]}, array{pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2]}); + cosPA = RecoDecay::cpa(std::array{collision.posX(), collision.posY(), collision.posZ()}, array{vtx[0], vtx[1], vtx[2]}, array{pvec0[0] + pvec1[0], pvec0[1] + pvec1[1], pvec0[2] + pvec1[2]}); } } if (smallestDCA > maxV0DCAtoPV) diff --git a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx index 8871c983668..c6041aa0e02 100644 --- a/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx +++ b/PWGLF/TableProducer/Strangeness/lambdakzeropid.cxx @@ -107,8 +107,8 @@ struct lambdakzeropid { Configurable mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"}; // manual + Configurable useCustomRunNumber{"useCustomRunNumber", false, "Use custom timestamp"}; Configurable manualRunNumber{"manualRunNumber", 544122, "manual run number if no collisions saved"}; - Configurable manualTimeStamp{"manualTimeStamp", 1696549226920, "manual time stamp if no collisions saved"}; ConfigurableAxis axisEta{"axisEta", {20, -1.0f, +1.0f}, "#eta"}; ConfigurableAxis axisDeltaTime{"axisDeltaTime", {2000, -1000.0f, +1000.0f}, "delta-time (ps)"}; @@ -327,7 +327,7 @@ struct lambdakzeropid { } } - void initCCDB(int runNumber, uint64_t timeStamp) + void initCCDB(int runNumber) { if (mRunNumber == runNumber) { return; @@ -341,34 +341,33 @@ struct lambdakzeropid { grpmag.setL3Current(30000.f / (d_bz / 5.0f)); } o2::base::Propagator::initFieldFromGRP(&grpmag); - mVtx = ccdb->getForTimeStamp(mVtxPath, timeStamp); + mVtx = ccdb->getForRun(mVtxPath, runNumber); mRunNumber = runNumber; return; } - auto run3grp_timestamp = timeStamp; - o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(grpPath, run3grp_timestamp); + o2::parameters::GRPObject* grpo = ccdb->getForRun(grpPath, runNumber); 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"; + LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; } else { - grpmag = ccdb->getForTimeStamp(grpmagPath, run3grp_timestamp); + grpmag = ccdb->getForRun(grpmagPath, runNumber); 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 run " << runNumber; } o2::base::Propagator::initFieldFromGRP(grpmag); // Fetch magnetic field from ccdb for current collision d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); - mVtx = ccdb->getForTimeStamp(mVtxPath, timeStamp); - LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG"; + mVtx = ccdb->getForRun(mVtxPath, runNumber); + LOG(info) << "Retrieved GRP for run " << runNumber << " with magnetic field of " << d_bz << " kZG"; } // if TOF Nsigma desired if (doNSigmas) { - nSigmaCalibObjects = ccdb->getForTimeStamp(nSigmaPath, timeStamp); + nSigmaCalibObjects = ccdb->getForRun(nSigmaPath, runNumber); if (nSigmaCalibObjects) { LOGF(info, "loaded TList with this many objects: %i", nSigmaCalibObjects->GetEntries()); @@ -593,12 +592,12 @@ struct lambdakzeropid { void processStandardData(aod::Collisions const& collisions, V0OriginalDatas const& V0s, TracksWithAllExtras const&, aod::BCsWithTimestamps const& /*bcs*/) { // Fire up CCDB with first collision in record. If no collisions, bypass - if (collisions.size() > 0) { + if (useCustomRunNumber || collisions.size() < 1) { + initCCDB(manualRunNumber); + } else { auto collision = collisions.begin(); auto bc = collision.bc_as(); - initCCDB(bc.runNumber(), bc.timestamp()); - } else { - initCCDB(manualRunNumber, manualTimeStamp); + initCCDB(bc.runNumber()); } for (const auto& V0 : V0s) { @@ -621,11 +620,11 @@ struct lambdakzeropid { void processDerivedData(soa::Join const& collisions, V0DerivedDatas const& V0s, dauTracks const&) { // Fire up CCDB with first collision in record. If no collisions, bypass - if (collisions.size() > 0) { - auto collision = collisions.begin(); - initCCDB(collision.runNumber(), collision.timestamp()); + if (useCustomRunNumber || collisions.size() < 1) { + initCCDB(manualRunNumber); } else { - initCCDB(manualRunNumber, manualTimeStamp); + auto collision = collisions.begin(); + initCCDB(collision.runNumber()); } for (const auto& V0 : V0s) { diff --git a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx index 19a0dbd77ae..edd4bdfa5e8 100644 --- a/PWGLF/TableProducer/Strangeness/sigma0builder.cxx +++ b/PWGLF/TableProducer/Strangeness/sigma0builder.cxx @@ -54,8 +54,6 @@ 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; @@ -64,12 +62,12 @@ using V0StandardDerivedDatas = soa::Join v0sigma0Coll; // characterises collisions - Produces v0Sigma0CollRefs; // characterises collisions - Produces v0Sigmas; // save sigma0 candidates for analysis - Produces v0SigmaPhotonExtras; // save sigma0 candidates for analysis - Produces v0SigmaLambdaExtras; // save sigma0 candidates for analysis - Produces v0MCSigmas; + Produces sigma0Coll; // characterises collisions + Produces sigma0CollRefs; // characterises collisions + Produces sigma0cores; // save sigma0 candidates for analysis + Produces sigmaPhotonExtras; // save sigma0 candidates for analysis + Produces sigmaLambdaExtras; // save sigma0 candidates for analysis + Produces sigma0mccores; // For manual sliceBy Preslice perCollisionMCDerived = o2::aod::v0data::straCollisionId; @@ -86,45 +84,113 @@ 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 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 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("hCandidateBuilderSelection", "hCandidateBuilderSelection", kTH1F, {{11, -0.5f, +10.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.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 efficiency calculation (and QA): + histos.add("GeneralQA/hPhotonMass", "hPhotonMass", kTH1F, {axisPhotonMass}); + histos.add("GeneralQA/hPhotonNegEta", "hPhotonNegEta", kTH1F, {axisRapidity}); + histos.add("GeneralQA/hPhotonPosEta", "hPhotonPosEta", kTH1F, {axisRapidity}); + histos.add("GeneralQA/hPhotonDCANegToPV", "hPhotonDCANegToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hPhotonDCAPosToPV", "hPhotonDCAPosToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hPhotonDCADau", "hPhotonDCADau", kTH1F, {axisDCAdau}); + histos.add("GeneralQA/hPhotonRadius", "hPhotonRadius", kTH1F, {axisRadius}); + histos.add("GeneralQA/hLambdaMass", "hLambdaMass", kTH1F, {axisLambdaMass}); + histos.add("GeneralQA/hAntiLambdaMass", "hAntiLambdaMass", kTH1F, {axisLambdaMass}); + histos.add("GeneralQA/hLambdaNegEta", "hLambdaNegEta", kTH1F, {axisRapidity}); + histos.add("GeneralQA/hLambdaPosEta", "hLambdaPosEta", kTH1F, {axisRapidity}); + histos.add("GeneralQA/hLambdaDCANegToPV", "hLambdaDCANegToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hLambdaDCAPosToPV", "hLambdaDCAPosToPV", kTH1F, {axisDCAtoPV}); + histos.add("GeneralQA/hLambdaDCADau", "hLambdaDCADau", kTH1F, {axisDCAdau}); + histos.add("GeneralQA/hLambdaRadius", "hLambdaRadius", kTH1F, {axisRadius}); + histos.add("GeneralQA/hSigmaMass", "hSigmaMass", kTH1F, {axisSigmaMass}); + histos.add("GeneralQA/hSigmaMassWindow", "hSigmaMassWindow", kTH1F, {{1000, -0.09f, 0.11f}}); + histos.add("GeneralQA/hSigmaY", "hSigmaY", kTH1F, {axisRapidity}); + + 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("h3dMassSigmasAfterSel", "h3dMassSigmasAfterSel", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); } // Process sigma candidate and store properties in object @@ -151,48 +217,76 @@ struct sigma0builder { } else { // Standard selection // Gamma basic selection criteria: - if (TMath::Abs(gamma.mGamma()) > PhotonMaxMass) + histos.fill(HIST("hCandidateBuilderSelection"), 1.); + histos.fill(HIST("GeneralQA/hPhotonMass"), gamma.mGamma()); + if ((gamma.mGamma() < 0) || (gamma.mGamma() > PhotonMaxMass)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 0.); + histos.fill(HIST("GeneralQA/hPhotonNegEta"), gamma.negativeeta()); + histos.fill(HIST("GeneralQA/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("GeneralQA/hPhotonDCANegToPV"), TMath::Abs(gamma.dcanegtopv())); + histos.fill(HIST("GeneralQA/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("GeneralQA/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("GeneralQA/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("GeneralQA/hLambdaMass"), lambda.mLambda()); + histos.fill(HIST("GeneralQA/hAntiLambdaMass"), lambda.mAntiLambda()); // Lambda basic selection criteria: - if (TMath::Abs(lambda.mLambda() - 1.115683) > LambdaWindow) + 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("GeneralQA/hLambdaNegEta"), lambda.negativeeta()); + histos.fill(HIST("GeneralQA/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("GeneralQA/hLambdaDCANegToPV"), lambda.dcanegtopv()); + histos.fill(HIST("GeneralQA/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("GeneralQA/hLambdaRadius"), lambda.v0radius()); + histos.fill(HIST("hCandidateBuilderSelection"), 9.); if ((lambda.v0radius() < LambdaMinv0radius) || (lambda.v0radius() > LambdaMaxv0radius)) return false; - histos.fill(HIST("hCandidateBuilderSelection"), 8.); - if (lambda.dcaV0daughters() > LambdaMaxDCAV0Dau) + histos.fill(HIST("GeneralQA/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()}; 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 sigmarap = RecoDecay::y(std::array{gamma.px() + lambda.px(), gamma.py() + lambda.py(), gamma.pz() + lambda.pz()}, o2::constants::physics::MassSigma0); + + histos.fill(HIST("GeneralQA/hSigmaMass"), sigmamass); + histos.fill(HIST("GeneralQA/hSigmaMassWindow"), sigmamass - 1.192642); if (TMath::Abs(sigmamass - 1.192642) > Sigma0Window) return false; + histos.fill(HIST("hCandidateBuilderSelection"), 12.); + histos.fill(HIST("GeneralQA/hSigmaY"), sigmarap); + + if (TMath::Abs(sigmarap) > SigmaMaxRap) + return false; + + histos.fill(HIST("hCandidateBuilderSelection"), 13.); + return true; } // Helper struct to pass v0 information @@ -274,6 +368,7 @@ struct sigma0builder { float fLambdaPt = lambda.pt(); float fLambdaMass = lambda.mLambda(); + float fAntiLambdaMass = lambda.mAntiLambda(); float fLambdaQt = lambda.qtarm(); float fLambdaAlpha = lambda.alpha(); float fLambdaRadius = lambda.v0radius(); @@ -304,27 +399,27 @@ struct sigma0builder { uint8_t fLambdaV0Type = lambda.v0Type(); // Filling TTree for ML analysis - v0Sigmas(fSigmapT, fSigmaMass, fSigmaRap); - - v0SigmaPhotonExtras(fPhotonPt, fPhotonMass, fPhotonQt, fPhotonAlpha, fPhotonRadius, - fPhotonCosPA, fPhotonDCADau, fPhotonDCANegPV, fPhotonDCAPosPV, fPhotonZconv, - fPhotonEta, fPhotonY, fPhotonPosTPCNSigma, fPhotonNegTPCNSigma, fPhotonPosTPCCrossedRows, - fPhotonNegTPCCrossedRows, fPhotonPosPt, fPhotonNegPt, fPhotonPosEta, - fPhotonNegEta, fPhotonPosY, fPhotonNegY, fPhotonPsiPair, - fPhotonPosITSCls, fPhotonNegITSCls, fPhotonPosITSClSize, fPhotonNegITSClSize, - fPhotonV0Type, GammaBDTScore); - - v0SigmaLambdaExtras(fLambdaPt, fLambdaMass, fLambdaQt, fLambdaAlpha, - fLambdaRadius, fLambdaCosPA, fLambdaDCADau, fLambdaDCANegPV, - fLambdaDCAPosPV, fLambdaEta, fLambdaY, fLambdaPosPrTPCNSigma, - fLambdaPosPiTPCNSigma, fLambdaNegPrTPCNSigma, fLambdaNegPiTPCNSigma, fLambdaPosTPCCrossedRows, - fLambdaNegTPCCrossedRows, fLambdaPosPt, fLambdaNegPt, fLambdaPosEta, - fLambdaNegEta, fLambdaPosPrY, fLambdaPosPiY, fLambdaNegPrY, fLambdaNegPiY, - fLambdaPosITSCls, fLambdaNegITSCls, fLambdaPosITSClSize, fLambdaNegITSClSize, - fLambdaV0Type, LambdaBDTScore, AntiLambdaBDTScore); + sigma0cores(fSigmapT, fSigmaMass, fSigmaRap); + + sigmaPhotonExtras(fPhotonPt, fPhotonMass, fPhotonQt, fPhotonAlpha, fPhotonRadius, + fPhotonCosPA, fPhotonDCADau, fPhotonDCANegPV, fPhotonDCAPosPV, fPhotonZconv, + fPhotonEta, fPhotonY, fPhotonPosTPCNSigma, fPhotonNegTPCNSigma, fPhotonPosTPCCrossedRows, + fPhotonNegTPCCrossedRows, fPhotonPosPt, fPhotonNegPt, fPhotonPosEta, + fPhotonNegEta, fPhotonPosY, fPhotonNegY, fPhotonPsiPair, + fPhotonPosITSCls, fPhotonNegITSCls, fPhotonPosITSClSize, fPhotonNegITSClSize, + fPhotonV0Type, GammaBDTScore); + + sigmaLambdaExtras(fLambdaPt, fLambdaMass, fAntiLambdaMass, fLambdaQt, fLambdaAlpha, + fLambdaRadius, fLambdaCosPA, fLambdaDCADau, fLambdaDCANegPV, + fLambdaDCAPosPV, fLambdaEta, fLambdaY, fLambdaPosPrTPCNSigma, + fLambdaPosPiTPCNSigma, fLambdaNegPrTPCNSigma, fLambdaNegPiTPCNSigma, fLambdaPosTPCCrossedRows, + fLambdaNegTPCCrossedRows, fLambdaPosPt, fLambdaNegPt, fLambdaPosEta, + fLambdaNegEta, fLambdaPosPrY, fLambdaPosPiY, fLambdaNegPrY, fLambdaNegPiY, + fLambdaPosITSCls, fLambdaNegITSCls, fLambdaPosITSClSize, fLambdaNegITSClSize, + fLambdaV0Type, LambdaBDTScore, AntiLambdaBDTScore); } - void processMonteCarlo(aod::StraCollisions const& collisions, V0DerivedMCDatas const& V0s, dauTracks const&) + void processMonteCarlo(soa::Join const& collisions, V0DerivedMCDatas const& V0s) { for (const auto& coll : collisions) { // Do analysis with collision-grouped V0s, retain full collision information @@ -333,15 +428,80 @@ struct sigma0builder { // V0 table sliced for (auto& gamma : V0Table_thisCollision) { // selecting photons from Sigma0 + + float centrality = coll.centFT0C(); + + // Auxiliary histograms: + if (gamma.pdgCode() == 22) { + 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 + + if (gamma.pdgCodeMother() == 3212) { + histos.fill(HIST("Efficiency/h2dPtVsCentrality_GammaSigma0"), centrality, gamma.pt()); // isgamma from sigma + } + if (gamma.pdgCodeMother() == -3212) { + histos.fill(HIST("Efficiency/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 + if (gamma.pdgCodeMother() == 3212) { + histos.fill(HIST("Efficiency/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()); + if (gamma.pdgCodeMother() == -3212) { + histos.fill(HIST("Efficiency/h2dPtVsCentrality_LambdaAntiSigma0"), centrality, gamma.pt()); // isantilambda from antisigma + } + } + } + for (auto& lambda : V0Table_thisCollision) { // selecting lambdas from Sigma0 - if (!processSigmaCandidate(lambda, gamma)) + + // 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}; + 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("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()); + } + 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); + + if (!processSigmaCandidate(lambda, gamma)) // basic selection continue; bool fIsSigma = false; - if ((gamma.pdgCode() == 22) && (gamma.pdgCodeMother() == 3212) && (lambda.pdgCode() == 3122) && (lambda.pdgCodeMother() == 3212) && (gamma.motherMCPartId() == lambda.motherMCPartId())) + bool fIsAntiSigma = false; + histos.fill(HIST("h3dMassSigmasAfterSel"), centrality, SigmapT, SigmaMass); + if ((gamma.pdgCode() == 22) && (gamma.pdgCodeMother() == 3212) && (lambda.pdgCode() == 3122) && (lambda.pdgCodeMother() == 3212) && (gamma.motherMCPartId() == lambda.motherMCPartId())) { fIsSigma = true; - - v0MCSigmas(fIsSigma); + histos.fill(HIST("Efficiency/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()})); + } + sigma0mccores(fIsSigma, fIsAntiSigma); } } } @@ -355,7 +515,8 @@ struct sigma0builder { auto V0Table_thisCollision = V0s.sliceBy(perCollisionSTDDerived, collIdx); histos.fill(HIST("hEventVertexZ"), coll.posZ()); - v0sigma0Coll(coll.posX(), coll.posY(), coll.posZ(), coll.centFT0M(), coll.centFT0A(), coll.centFT0C(), coll.centFV0A()); + 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 @@ -367,7 +528,8 @@ struct sigma0builder { if (nSigmaCandidates % 5000 == 0) { LOG(info) << "Sigma0 Candidates built: " << nSigmaCandidates; } - v0Sigma0CollRefs(v0sigma0Coll.lastIndex()); + + sigma0CollRefs(collIdx); fillTables(lambda, gamma); // filling tables with accepted candidates } } @@ -382,7 +544,7 @@ struct sigma0builder { auto V0Table_thisCollision = V0s.sliceBy(perCollisionMLDerived, collIdx); histos.fill(HIST("hEventVertexZ"), coll.posZ()); - v0sigma0Coll(coll.posX(), coll.posY(), coll.posZ(), coll.centFT0M(), coll.centFT0A(), coll.centFT0C(), coll.centFV0A()); + 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 @@ -394,7 +556,7 @@ struct sigma0builder { if (nSigmaCandidates % 5000 == 0) { LOG(info) << "Sigma0 Candidates built: " << nSigmaCandidates; } - v0Sigma0CollRefs(v0sigma0Coll.lastIndex()); + sigma0CollRefs(collIdx); fillTables(lambda, gamma); // filling tables with accepted candidates } } diff --git a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx index c651eb31007..177786c6d5c 100644 --- a/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx +++ b/PWGLF/TableProducer/Strangeness/strangederivedbuilder.cxx @@ -129,6 +129,10 @@ struct strangederivedbuilder { Produces v0FoundTags; Produces cascFoundTags; + //__________________________________________________ + // Debug + Produces straOrigin; + // histogram registry for bookkeeping HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -164,15 +168,17 @@ struct strangederivedbuilder { Configurable roundNSigmaVariables{"roundNSigmaVariables", false, "round NSigma variables"}; Configurable precisionNSigmas{"precisionNSigmas", 0.1f, "precision to keep NSigmas"}; - Configurable fillRawFT0A{"fillRawFT0A", false, "Fill raw FT0A information for debug"}; - Configurable fillRawFT0C{"fillRawFT0C", true, "Fill raw FT0C information for debug"}; - Configurable fillRawFV0A{"fillRawFV0A", false, "Fill raw FV0A information for debug"}; - Configurable fillRawFDDA{"fillRawFDDA", false, "Fill raw FDDA information for debug"}; - Configurable fillRawFDDC{"fillRawFDDC", false, "Fill raw FDDC information for debug"}; - Configurable fillRawZDC{"fillRawZDC", false, "Fill raw ZDC information for debug"}; - Configurable fillRawNTracksEta1{"fillRawNTracksEta1", true, "Fill raw NTracks |eta|<1 information for debug"}; - Configurable fillRawNTracksForCorrelation{"fillRawNTracksForCorrelation", true, "Fill raw NTracks for correlation cuts"}; - Configurable fillTOFInformation{"fillTOFInformation", true, "Fill Daughter Track TOF information"}; + struct : ConfigurableGroup { + Configurable fillRawFT0A{"fillRawFT0A", false, "Fill raw FT0A information for debug"}; + Configurable fillRawFT0C{"fillRawFT0C", true, "Fill raw FT0C information for debug"}; + Configurable fillRawFV0A{"fillRawFV0A", false, "Fill raw FV0A information for debug"}; + Configurable fillRawFDDA{"fillRawFDDA", false, "Fill raw FDDA information for debug"}; + Configurable fillRawFDDC{"fillRawFDDC", false, "Fill raw FDDC information for debug"}; + Configurable fillRawZDC{"fillRawZDC", false, "Fill raw ZDC information for debug"}; + Configurable fillRawNTracksEta1{"fillRawNTracksEta1", true, "Fill raw NTracks |eta|<1 information for debug"}; + Configurable fillRawNTracksForCorrelation{"fillRawNTracksForCorrelation", true, "Fill raw NTracks for correlation cuts"}; + Configurable fillTOFInformation{"fillTOFInformation", true, "Fill Daughter Track TOF information"}; + } fillTruncationOptions; Configurable qaCentrality{"qaCentrality", false, "qa centrality flag: check base raw values"}; struct : ConfigurableGroup { @@ -270,76 +276,9 @@ struct strangederivedbuilder { } } - void processCollisionsV0sOnly(soa::Join const& collisions, aod::V0Datas const& V0s, aod::BCsWithTimestamps const& /*bcs*/, UDCollisionsFull const& udCollisions) - { - for (const auto& collision : collisions) { - const uint64_t collIdx = collision.globalIndex(); - auto V0Table_thisColl = V0s.sliceBy(V0perCollision, collIdx); - bool strange = V0Table_thisColl.size() > 0; - - auto bc = collision.bc_as(); - - int gapSide = -1; - float totalFT0AmplitudeA = -999; - float totalFT0AmplitudeC = -999; - float totalFV0AmplitudeA = -999; - float totalFDDAmplitudeA = -999; - float totalFDDAmplitudeC = -999; - float energyCommonZNA = -999; - float energyCommonZNC = -999; - if (udCollisions.size() > 0) { // check that the UD collision table is not empty - auto udCollision = udCollisions.sliceBy(udCollisionsPerCollision, collIdx); - if (udCollision.size() == 1) { // check that the slicing provide a unique UD collision - for (auto& udColl : udCollision) { - gapSide = udColl.gapSide(); - totalFT0AmplitudeA = udColl.totalFT0AmplitudeA(); - totalFT0AmplitudeC = udColl.totalFT0AmplitudeC(); - totalFV0AmplitudeA = udColl.totalFV0AmplitudeA(); - totalFDDAmplitudeA = udColl.totalFDDAmplitudeA(); - totalFDDAmplitudeC = udColl.totalFDDAmplitudeC(); - energyCommonZNA = udColl.energyCommonZNA(); - energyCommonZNC = udColl.energyCommonZNC(); - } - } - } - - // casc table sliced - if (strange || fillEmptyCollisions) { - strangeColl(collision.posX(), collision.posY(), collision.posZ()); - strangeCents(collision.centFT0M(), collision.centFT0A(), - collision.centFT0C(), collision.centFV0A()); - strangeEvSels(collision.sel8(), collision.selection_raw(), - collision.multFT0A() * static_cast(fillRawFT0A), - collision.multFT0C() * static_cast(fillRawFT0C), - collision.multFV0A() * static_cast(fillRawFV0A), - collision.multFDDA() * static_cast(fillRawFDDA), - collision.multFDDC() * static_cast(fillRawFDDC), - collision.multNTracksPVeta1() * static_cast(fillRawNTracksEta1), - collision.multPVTotalContributors() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksGlobal() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksTPCOnly() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multZNA() * static_cast(fillRawZDC), - collision.multZNC() * static_cast(fillRawZDC), - collision.multZEM1() * static_cast(fillRawZDC), - collision.multZEM2() * static_cast(fillRawZDC), - collision.multZPA() * static_cast(fillRawZDC), - collision.multZPC() * static_cast(fillRawZDC), - collision.trackOccupancyInTimeRange(), - // UPC info - gapSide, - totalFT0AmplitudeA, totalFT0AmplitudeC, totalFV0AmplitudeA, - totalFDDAmplitudeA, totalFDDAmplitudeC, - energyCommonZNA, energyCommonZNC); - strangeStamps(bc.runNumber(), bc.timestamp()); - } - for (int i = 0; i < V0Table_thisColl.size(); i++) - v0collref(strangeColl.lastIndex()); - } - } - - void processCollisions(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, UDCollisionsFull const& udCollisions) + // master function to process a collision + template + void populateCollisionTables(coll const& collisions, udcoll const& udCollisions, v0d const& V0s, cad const& Cascades, kfcad const& KFCascades, tracad const& TraCascades) { // create collision indices beforehand std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision @@ -347,6 +286,7 @@ struct strangederivedbuilder { std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision std::vector TraCascadeCollIndices(TraCascades.size(), -1); // index -1: no collision + // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ for (const auto& collision : collisions) { const uint64_t collIdx = collision.globalIndex(); @@ -365,7 +305,7 @@ struct strangederivedbuilder { KFCascTable_thisColl.size() > 0 || TraCascTable_thisColl.size() > 0; - auto bc = collision.bc_as(); + auto bc = collision.template bc_as(); int gapSide = -1; float totalFT0AmplitudeA = -999; @@ -375,7 +315,11 @@ struct strangederivedbuilder { float totalFDDAmplitudeC = -999; float energyCommonZNA = -999; float energyCommonZNC = -999; - if (udCollisions.size() > 0) { // check that the UD collision table is not empty + + // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ + // set UD information in case present at this stage + auto udCollIterator = udCollisions.begin(); + if constexpr (requires { udCollIterator.gapSide(); }) { // check if this table is the expected one auto udCollision = udCollisions.sliceBy(udCollisionsPerCollision, collIdx); if (udCollision.size() == 1) { // check that the slicing provide a unique UD collision for (auto& udColl : udCollision) { @@ -399,38 +343,44 @@ struct strangederivedbuilder { } } - // casc table sliced + // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ + // fill collision tables if (strange || fillEmptyCollisions) { strangeColl(collision.posX(), collision.posY(), collision.posZ()); + if constexpr (requires { collision.mcCollisionId(); }) { // check if MC information is available and if so fill labels + strangeCollLabels(collision.mcCollisionId()); + } strangeCents(collision.centFT0M(), collision.centFT0A(), centrality, collision.centFV0A()); strangeEvSels(collision.sel8(), collision.selection_raw(), - collision.multFT0A() * static_cast(fillRawFT0A), - collision.multFT0C() * static_cast(fillRawFT0C), - collision.multFV0A() * static_cast(fillRawFV0A), - collision.multFDDA() * static_cast(fillRawFDDA), - collision.multFDDC() * static_cast(fillRawFDDC), - collision.multNTracksPVeta1() * static_cast(fillRawNTracksEta1), - collision.multPVTotalContributors() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksGlobal() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksTPCOnly() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multZNA() * static_cast(fillRawZDC), - collision.multZNC() * static_cast(fillRawZDC), - collision.multZEM1() * static_cast(fillRawZDC), - collision.multZEM2() * static_cast(fillRawZDC), - collision.multZPA() * static_cast(fillRawZDC), - collision.multZPC() * static_cast(fillRawZDC), + collision.multFT0A() * static_cast(fillTruncationOptions.fillRawFT0A), + collision.multFT0C() * static_cast(fillTruncationOptions.fillRawFT0C), + collision.multFV0A() * static_cast(fillTruncationOptions.fillRawFV0A), + collision.multFDDA() * static_cast(fillTruncationOptions.fillRawFDDA), + collision.multFDDC() * static_cast(fillTruncationOptions.fillRawFDDC), + collision.multNTracksPVeta1() * static_cast(fillTruncationOptions.fillRawNTracksEta1), + collision.multPVTotalContributors() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multNTracksGlobal() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multNTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multAllTracksTPCOnly() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multAllTracksITSTPC() * static_cast(fillTruncationOptions.fillRawNTracksForCorrelation), + collision.multZNA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZNC() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM1() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZEM2() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPA() * static_cast(fillTruncationOptions.fillRawZDC), + collision.multZPC() * static_cast(fillTruncationOptions.fillRawZDC), collision.trackOccupancyInTimeRange(), + collision.ft0cOccupancyInTimeRange(), // UPC info gapSide, totalFT0AmplitudeA, totalFT0AmplitudeC, totalFV0AmplitudeA, totalFDDAmplitudeA, totalFDDAmplitudeC, - energyCommonZNA, energyCommonZNC); + energyCommonZNA, energyCommonZNC, + // Collision flags + collision.flags()); strangeStamps(bc.runNumber(), bc.timestamp()); } - for (const auto& v0 : V0Table_thisColl) V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); for (const auto& casc : CascTable_thisColl) @@ -441,27 +391,26 @@ struct strangederivedbuilder { TraCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); } + // +-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+-<*>-+ // populate references, including those that might not be assigned - for (const auto& v0 : V0s) + for (const auto& v0 : V0s) { v0collref(V0CollIndices[v0.globalIndex()]); - for (const auto& casc : Cascades) + } + for (const auto& casc : Cascades) { casccollref(CascadeCollIndices[casc.globalIndex()]); - for (const auto& casc : KFCascades) + } + for (const auto& casc : KFCascades) { kfcasccollref(KFCascadeCollIndices[casc.globalIndex()]); - for (const auto& casc : KFCascades) + } + for (const auto& casc : TraCascades) { tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); + } } - void processCollisionsMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, UDCollisionsFull const& udCollisions, soa::Join const& mcCollisions, aod::McParticles const&) + // master function to process a collision + template + void populateMCCollisionTable(mccoll const& mcCollisions) { - // create collision indices beforehand - std::vector V0CollIndices(V0s.size(), -1); // index -1: no collision - std::vector V0MCCollIndices(V0s.size(), -1); // index -1: no collision - std::vector CascadeCollIndices(Cascades.size(), -1); // index -1: no collision - std::vector CascadeMCCollIndices(Cascades.size(), -1); // index -1: no collision - std::vector KFCascadeCollIndices(KFCascades.size(), -1); // index -1: no collision - std::vector TraCascadeCollIndices(TraCascades.size(), -1); // index -1: no collision - // ______________________________________________ // fill all MC collisions, correlate via index later on for (const auto& mccollision : mcCollisions) { @@ -471,113 +420,28 @@ struct strangederivedbuilder { mccollision.multMCNParticlesEta08(), mccollision.multMCNParticlesEta10()); } + } - // ______________________________________________ - for (const auto& collision : collisions) { - const uint64_t collIdx = collision.globalIndex(); - - float centrality = collision.centFT0C(); - if (qaCentrality) { - auto hRawCentrality = histos.get(HIST("hRawCentrality")); - centrality = hRawCentrality->GetBinContent(hRawCentrality->FindBin(collision.multFT0C())); - } - - auto V0Table_thisColl = V0s.sliceBy(V0perCollision, collIdx); - auto CascTable_thisColl = Cascades.sliceBy(CascperCollision, collIdx); - auto KFCascTable_thisColl = KFCascades.sliceBy(KFCascperCollision, collIdx); - auto TraCascTable_thisColl = TraCascades.sliceBy(TraCascperCollision, collIdx); - bool strange = V0Table_thisColl.size() > 0 || - CascTable_thisColl.size() > 0 || - KFCascTable_thisColl.size() > 0 || - TraCascTable_thisColl.size() > 0; - - auto bc = collision.bc_as(); - - int gapSide = -1; - float totalFT0AmplitudeA = -999; - float totalFT0AmplitudeC = -999; - float totalFV0AmplitudeA = -999; - float totalFDDAmplitudeA = -999; - float totalFDDAmplitudeC = -999; - float energyCommonZNA = -999; - float energyCommonZNC = -999; - if (udCollisions.size() > 0) { // check that the UD collision table is not empty - auto udCollision = udCollisions.sliceBy(udCollisionsPerCollision, collIdx); - if (udCollision.size() == 1) { // check that the slicing provide a unique UD collision - for (auto& udColl : udCollision) { - gapSide = udColl.gapSide(); - totalFT0AmplitudeA = udColl.totalFT0AmplitudeA(); - totalFT0AmplitudeC = udColl.totalFT0AmplitudeC(); - totalFV0AmplitudeA = udColl.totalFV0AmplitudeA(); - totalFDDAmplitudeA = udColl.totalFDDAmplitudeA(); - totalFDDAmplitudeC = udColl.totalFDDAmplitudeC(); - energyCommonZNA = udColl.energyCommonZNA(); - energyCommonZNC = udColl.energyCommonZNC(); + void processCollisions(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/) + { + populateCollisionTables(collisions, collisions, V0s, Cascades, KFCascades, TraCascades); + } - histos.fill(HIST("hFT0AMultVsFT0AUD"), collision.multFT0A(), udColl.totalFT0AmplitudeA()); - histos.fill(HIST("hFT0CMultVsFT0CUD"), collision.multFT0C(), udColl.totalFT0AmplitudeC()); - histos.fill(HIST("hFV0AMultVsFV0AUD"), collision.multFV0A(), udColl.totalFV0AmplitudeA()); - histos.fill(HIST("hFDDAMultVsFDDAUD"), collision.multFDDA(), udColl.totalFDDAmplitudeA()); - histos.fill(HIST("hFDDCMultVsFDDCUD"), collision.multFDDC(), udColl.totalFDDAmplitudeC()); - histos.fill(HIST("hZNAMultVsZNAUD"), collision.multZNA(), udColl.energyCommonZNA()); - histos.fill(HIST("hZNCMultVsZNCUD"), collision.multZNC(), udColl.energyCommonZNC()); - } - } - } + void processCollisionsWithUD(soa::Join const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, UDCollisionsFull const& udCollisions) + { + populateCollisionTables(collisions, udCollisions, V0s, Cascades, KFCascades, TraCascades); + } - // casc table sliced - if (strange || fillEmptyCollisions) { - strangeColl(collision.posX(), collision.posY(), collision.posZ()); - strangeCollLabels(collision.mcCollisionId()); - strangeCents(collision.centFT0M(), collision.centFT0A(), - centrality, collision.centFV0A()); - strangeEvSels(collision.sel8(), collision.selection_raw(), - collision.multFT0A() * static_cast(fillRawFT0A), - collision.multFT0C() * static_cast(fillRawFT0C), - collision.multFV0A() * static_cast(fillRawFV0A), - collision.multFDDA() * static_cast(fillRawFDDA), - collision.multFDDC() * static_cast(fillRawFDDC), - collision.multNTracksPVeta1() * static_cast(fillRawNTracksEta1), - collision.multPVTotalContributors() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksGlobal() * static_cast(fillRawNTracksForCorrelation), - collision.multNTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksTPCOnly() * static_cast(fillRawNTracksForCorrelation), - collision.multAllTracksITSTPC() * static_cast(fillRawNTracksForCorrelation), - collision.multZNA() * static_cast(fillRawZDC), - collision.multZNC() * static_cast(fillRawZDC), - collision.multZEM1() * static_cast(fillRawZDC), - collision.multZEM2() * static_cast(fillRawZDC), - collision.multZPA() * static_cast(fillRawZDC), - collision.multZPC() * static_cast(fillRawZDC), - collision.trackOccupancyInTimeRange(), - // UPC info - gapSide, - totalFT0AmplitudeA, totalFT0AmplitudeC, totalFV0AmplitudeA, - totalFDDAmplitudeA, totalFDDAmplitudeC, - energyCommonZNA, energyCommonZNC); - strangeStamps(bc.runNumber(), bc.timestamp()); - } - for (const auto& v0 : V0Table_thisColl) - V0CollIndices[v0.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : CascTable_thisColl) - CascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : KFCascTable_thisColl) - KFCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); - for (const auto& casc : TraCascTable_thisColl) - TraCascadeCollIndices[casc.globalIndex()] = strangeColl.lastIndex(); - } + void processCollisionsWithMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, soa::Join const& mcCollisions, aod::McParticles const&) + { + populateMCCollisionTable(mcCollisions); + populateCollisionTables(collisions, collisions, V0s, Cascades, KFCascades, TraCascades); + } - // populate references, including those that might not be assigned - for (const auto& v0 : V0s) { - v0collref(V0CollIndices[v0.globalIndex()]); - } - for (const auto& casc : Cascades) { - casccollref(CascadeCollIndices[casc.globalIndex()]); - } - for (const auto& casc : KFCascades) - kfcasccollref(KFCascadeCollIndices[casc.globalIndex()]); - for (const auto& casc : KFCascades) - tracasccollref(TraCascadeCollIndices[casc.globalIndex()]); + void processCollisionsWithUDWithMC(soa::Join const& collisions, soa::Join const& V0s, soa::Join const& /*V0MCCores*/, soa::Join const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades, aod::BCsWithTimestamps const& /*bcs*/, UDCollisionsFull const& udCollisions, soa::Join const& mcCollisions, aod::McParticles const&) + { + populateMCCollisionTable(mcCollisions); + populateCollisionTables(collisions, udCollisions, V0s, Cascades, KFCascades, TraCascades); } void processTrackExtrasV0sOnly(aod::V0Datas const& V0s, TracksWithExtra const& tracksExtra) @@ -1007,9 +871,22 @@ struct strangederivedbuilder { } } - PROCESS_SWITCH(strangederivedbuilder, processCollisionsV0sOnly, "Produce collisions (V0s only)", true); - PROCESS_SWITCH(strangederivedbuilder, processCollisions, "Produce collisions (V0s + casc)", true); - PROCESS_SWITCH(strangederivedbuilder, processCollisionsMC, "Produce collisions (V0s + casc)", false); + void processDataframeIDs(aod::Origins const& origins) + { + auto origin = origins.begin(); + straOrigin(origin.dataframeID()); + } + + // debug processing + PROCESS_SWITCH(strangederivedbuilder, processDataframeIDs, "Produce data frame ID tags", false); + + // collision processing + PROCESS_SWITCH(strangederivedbuilder, processCollisions, "Produce collisions", true); + PROCESS_SWITCH(strangederivedbuilder, processCollisionsWithUD, "Produce collisions with UD info", true); + PROCESS_SWITCH(strangederivedbuilder, processCollisionsWithMC, "Produce collisions with MC info", true); + PROCESS_SWITCH(strangederivedbuilder, processCollisionsWithUDWithMC, "Produce collisions with UD + MC info", true); + + // detailed information processing PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasV0sOnly, "Produce track extra information (V0s only)", true); PROCESS_SWITCH(strangederivedbuilder, processTrackExtras, "Produce track extra information (V0s + casc)", true); PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasMC, "Produce track extra information (V0s + casc)", false); diff --git a/PWGLF/TableProducer/Strangeness/v0qaanalysis.cxx b/PWGLF/TableProducer/Strangeness/v0qaanalysis.cxx index 875d0f1c671..1d0c3e50187 100644 --- a/PWGLF/TableProducer/Strangeness/v0qaanalysis.cxx +++ b/PWGLF/TableProducer/Strangeness/v0qaanalysis.cxx @@ -248,7 +248,7 @@ struct LfV0qaanalysis { v0.negTrack_as().tofNSigmaPr(), v0.posTrack_as().tofNSigmaPr(), v0.negTrack_as().tofNSigmaPi(), v0.posTrack_as().tofNSigmaPi(), v0.posTrack_as().hasTOF(), v0.negTrack_as().hasTOF(), lPDG, isPhysicalPrimary, - collision.centFT0M(), collision.centFV0A(), evFlag); + collision.centFT0M(), collision.centFV0A(), evFlag, v0.alpha(), v0.qtarm()); } } } @@ -294,7 +294,7 @@ struct LfV0qaanalysis { } auto v0mcparticle = v0.mcParticle(); - if (abs(v0mcparticle.y()) > 0.5f) { + if (std::abs(v0mcparticle.y()) > 0.5f) { continue; } @@ -360,7 +360,7 @@ struct LfV0qaanalysis { v0.negTrack_as().tofNSigmaPr(), v0.posTrack_as().tofNSigmaPr(), v0.negTrack_as().tofNSigmaPi(), v0.posTrack_as().tofNSigmaPi(), v0.posTrack_as().hasTOF(), v0.negTrack_as().hasTOF(), lPDG, isprimary, - mcCollision.centFT0M(), cent, evFlag); + mcCollision.centFT0M(), cent, evFlag, v0.alpha(), v0.qtarm()); } } @@ -372,7 +372,7 @@ struct LfV0qaanalysis { continue; } - if (abs(mcParticle.y()) > 0.5f) { + if (std::abs(mcParticle.y()) > 0.5f) { continue; } @@ -432,7 +432,7 @@ struct LfV0qaanalysis { if (!mcParticle.isPhysicalPrimary()) { continue; } - if (abs(mcParticle.y()) > 0.5f) { + if (std::abs(mcParticle.y()) > 0.5f) { continue; } @@ -491,7 +491,7 @@ struct LfV0qaanalysis { continue; } - if (abs(mcParticle.y()) > 0.5f) { + if (std::abs(mcParticle.y()) > 0.5f) { continue; } @@ -543,7 +543,7 @@ struct LfV0qaanalysis { continue; } - if (abs(mcParticle.y()) > 0.5f) { + if (std::abs(mcParticle.y()) > 0.5f) { continue; } diff --git a/PWGLF/TableProducer/Strangeness/v0selector.cxx b/PWGLF/TableProducer/Strangeness/v0selector.cxx new file mode 100644 index 00000000000..454fce2c6da --- /dev/null +++ b/PWGLF/TableProducer/Strangeness/v0selector.cxx @@ -0,0 +1,261 @@ +// 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 Task to select V0s based on cuts +/// +/// \author Gijs van Weelden + +#include +#include +#include + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" + +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/RecoDecay.h" + +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/V0SelectorTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct V0SelectorTask { + Produces v0FlagTable; + + Configurable> K0SPtBins{"K0SPtBins", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0}, "K0S pt Vals"}; + Configurable> K0SRVals{"K0SRVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "K0S min R values"}; + Configurable> K0SCtauVals{"K0SCtauVals", {20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0}, "K0S max ctau values"}; + Configurable> K0SCosPAVals{"K0SCosPAVals", {0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997}, "K0S min cosPA values"}; + Configurable> K0SDCAVals{"K0SDCAVals", {0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.15, 0.15, 0.10, 0.10}, "K0S min DCA +- values"}; + Configurable> K0SDCAdVals{"K0SDCAdVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "K0S max DCAd values"}; + + Configurable> LambdaPtBins{"LambdaPtBins", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0}, "Lambda pt Vals"}; + Configurable> LambdaRVals{"LambdaRVals", {1.0, 10.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0}, "Lambda min R values"}; + Configurable> LambdaCtauVals{"LambdaCtauVals", {22.5, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0}, "Lambda max ctau values"}; + Configurable> LambdaCosPAVals{"LambdaCosPAVals", {0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997}, "Lambda min cosPA values"}; + Configurable> LambdaDCApVals{"LambdaDCApVals", {0.20, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10}, "Lambda min DCA+ values"}; + Configurable> LambdaDCAnVals{"LambdaDCAnVals", {0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.15, 0.15}, "Lambda min DCA- values"}; + Configurable> LambdaDCAdVals{"LambdaDCAdVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "Lambda max DCAd values"}; + + Configurable> AntiLambdaPtBins{"AntiLambdaPtBins", {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 15.0, 20.0}, "AntiLambda pt Vals"}; + Configurable> AntiLambdaRVals{"AntiLambdaRVals", {10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0, 20.0}, "AntiLambda min R values"}; + Configurable> AntiLambdaCtauVals{"AntiLambdaCtauVals", {22.5, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0, 25.0}, "AntiLambda max ctau values"}; + Configurable> AntiLambdaCosPAVals{"AntiLambdaCosPAVals", {0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997, 0.997}, "AntiLambda min cosPA values"}; + Configurable> AntiLambdaDCApVals{"AntiLambdaDCApVals", {0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.20, 0.20}, "AntiLambda min DCA+ values"}; + Configurable> AntiLambdaDCAnVals{"AntiLambdaDCAnVals", {0.20, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10}, "AntiLambda min DCA- values"}; + Configurable> AntiLambdaDCAdVals{"AntiLambdaDCAdVals", {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}, "AntiLambda max DCAd values"}; + + Configurable massCuts{"massCuts", true, "Apply mass cuts"}; + Configurable competingMassCuts{"competingMassCuts", true, "Apply competing mass cuts"}; + Configurable> K0SMassLowVals{"K0SMassLowVals", {0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4}, "K0S mass cut lower values (MeV)"}; + Configurable> K0SMassHighVals{"K0SMassHighVals", {0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6}, "K0S mass cut upper values (MeV)"}; + Configurable> LambdaMassLowVals{"LambdaMassLowVals", {1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08}, "Lambda mass cut lower values (MeV)"}; + Configurable> LambdaMassHighVals{"LambdaMassHighVals", {1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125}, "Lambda mass cut upper values (MeV)"}; + Configurable> AntiLambdaMassLowVals{"AntiLambdaMassLowVals", {1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08, 1.08}, "AntiLambda mass cut lower values (MeV)"}; + Configurable> AntiLambdaMassHighVals{"AntiLambdaMassHighVals", {1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125, 1.125}, "AntiLambda mass cut upper values (MeV)"}; + + Configurable randomSelection{"randomSelection", true, "Randomly select V0s"}; + Configurable> K0SFraction{"randomSelectionFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of K0S to randomly select"}; + Configurable> LambdaFraction{"LambdaFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of Lambda to randomly select"}; + Configurable> AntiLambdaFraction{"AntiLambdaFraction", {2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0}, "Fraction of AntiLambda to randomly select"}; + + void init(InitContext const&) + { + } + + template + bool K0SCuts(T const& collision, U const& v0) + { + if (v0.pt() < K0SPtBins->at(0) || v0.pt() > K0SPtBins->at(K0SPtBins->size() - 1)) { + return false; + } + int ptBin = std::distance(K0SPtBins->begin(), std::upper_bound(K0SPtBins->begin(), K0SPtBins->end(), v0.pt())) - 1; + if (v0.v0radius() < K0SRVals->at(ptBin)) { + return false; + } + if (v0.v0cosPA() < K0SCosPAVals->at(ptBin)) { + return false; + } + if (v0.dcaV0daughters() > K0SDCAdVals->at(ptBin)) { + return false; + } + if (TMath::Abs(v0.dcapostopv()) < K0SDCAVals->at(ptBin)) { + return false; + } + if (TMath::Abs(v0.dcanegtopv()) < K0SDCAVals->at(ptBin)) { + return false; + } + float ctau = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short; + if (ctau < K0SCtauVals->at(ptBin)) { + return false; + } + // Apply mass cuts only if requested + if (!massCuts) { + return true; + } + if (v0.mK0Short() < K0SMassLowVals->at(ptBin) || v0.mK0Short() > K0SMassHighVals->at(ptBin)) { + return false; + } + if (!competingMassCuts) { + return true; + } + if (v0.mLambda() > LambdaMassLowVals->at(ptBin) && v0.mLambda() < LambdaMassHighVals->at(ptBin)) { + return false; + } + if (v0.mAntiLambda() > AntiLambdaMassLowVals->at(ptBin) && v0.mAntiLambda() < AntiLambdaMassHighVals->at(ptBin)) { + return false; + } + return true; + } + template + bool LambdaCuts(T const& collision, U const& v0) + { + if (v0.pt() < LambdaPtBins->at(0) || v0.pt() > LambdaPtBins->at(LambdaPtBins->size() - 1)) { + return false; + } + int ptBin = std::distance(LambdaPtBins->begin(), std::upper_bound(LambdaPtBins->begin(), LambdaPtBins->end(), v0.pt())) - 1; + if (v0.v0radius() < LambdaRVals->at(ptBin)) { + return false; + } + if (v0.v0cosPA() < LambdaCosPAVals->at(ptBin)) { + return false; + } + if (v0.dcaV0daughters() > LambdaDCAdVals->at(ptBin)) { + return false; + } + if (TMath::Abs(v0.dcapostopv()) < LambdaDCApVals->at(ptBin)) { + return false; + } + if (TMath::Abs(v0.dcanegtopv()) < LambdaDCAnVals->at(ptBin)) { + return false; + } + float ctau = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; + if (ctau < LambdaCtauVals->at(ptBin)) { + return false; + } + // Apply mass cuts only if requested + if (!massCuts) { + return true; + } + if (v0.mLambda() < LambdaMassLowVals->at(ptBin) || v0.mLambda() > LambdaMassHighVals->at(ptBin)) { + return false; + } + if (!competingMassCuts) { + return true; + } + if (v0.mK0Short() > K0SMassLowVals->at(ptBin) && v0.mK0Short() < K0SMassHighVals->at(ptBin)) { + return false; + } + return true; + } + template + bool AntiLambdaCuts(T const& collision, U const& v0) + { + if (v0.pt() < AntiLambdaPtBins->at(0) || v0.pt() > AntiLambdaPtBins->at(AntiLambdaPtBins->size() - 1)) { + return false; + } + int ptBin = std::distance(AntiLambdaPtBins->begin(), std::upper_bound(AntiLambdaPtBins->begin(), AntiLambdaPtBins->end(), v0.pt())) - 1; + if (v0.v0radius() < AntiLambdaRVals->at(ptBin)) { + return false; + } + if (v0.v0cosPA() < AntiLambdaCosPAVals->at(ptBin)) { + return false; + } + if (v0.dcaV0daughters() > AntiLambdaDCAdVals->at(ptBin)) { + return false; + } + if (TMath::Abs(v0.dcapostopv()) < AntiLambdaDCApVals->at(ptBin)) { + return false; + } + if (TMath::Abs(v0.dcanegtopv()) < AntiLambdaDCAnVals->at(ptBin)) { + return false; + } + float ctau = v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0; + if (ctau < AntiLambdaCtauVals->at(ptBin)) { + return false; + } + // Apply mass cuts only if requested + if (!massCuts) { + return true; + } + if (v0.mAntiLambda() < AntiLambdaMassLowVals->at(ptBin) || v0.mAntiLambda() > AntiLambdaMassHighVals->at(ptBin)) { + return false; + } + if (!competingMassCuts) { + return true; + } + if (v0.mK0Short() > K0SMassLowVals->at(ptBin) && v0.mK0Short() < K0SMassHighVals->at(ptBin)) { + return false; + } + return true; + } + template + bool RandomlyReject(T const& v0, uint8_t flag) + { + if (!(flag & aod::v0flags::FK0S || flag & aod::v0flags::FLAMBDA || flag & aod::v0flags::FANTILAMBDA)) { + return true; + } + + // In case of multiple candidate types, only check the lowest threshold value + float threshold = 2.; + if (flag & aod::v0flags::FK0S) { + int ptBin = std::distance(K0SPtBins->begin(), std::upper_bound(K0SPtBins->begin(), K0SPtBins->end(), v0.pt())) - 1; + if (threshold > K0SFraction->at(ptBin)) { + threshold = K0SFraction->at(ptBin); + } + } + if (flag & aod::v0flags::FLAMBDA) { + int ptBin = std::distance(LambdaPtBins->begin(), std::upper_bound(LambdaPtBins->begin(), LambdaPtBins->end(), v0.pt())) - 1; + if (threshold > LambdaFraction->at(ptBin)) { + threshold = LambdaFraction->at(ptBin); + } + } + if (flag & aod::v0flags::FANTILAMBDA) { + int ptBin = std::distance(AntiLambdaPtBins->begin(), std::upper_bound(AntiLambdaPtBins->begin(), AntiLambdaPtBins->end(), v0.pt())) - 1; + if (threshold > AntiLambdaFraction->at(ptBin)) { + threshold = AntiLambdaFraction->at(ptBin); + } + } + return (gRandom->Uniform() > threshold); + } + + void processV0(aod::Collision const& collision, aod::V0Datas const& v0s) + { + for (const auto& v0 : v0s) { + bool candidateK0S = K0SCuts(collision, v0); + bool candidateLambda = LambdaCuts(collision, v0); + bool candidateAntiLambda = AntiLambdaCuts(collision, v0); + uint8_t flag = 0; + flag += candidateK0S * aod::v0flags::FK0S; + flag += candidateLambda * aod::v0flags::FLAMBDA; + flag += candidateAntiLambda * aod::v0flags::FANTILAMBDA; + + if (candidateK0S + candidateLambda + candidateAntiLambda == 0) { + flag += aod::v0flags::FREJECTED; + } else if (randomSelection) { + flag += RandomlyReject(v0, flag) * aod::v0flags::FREJECTED; + } + v0FlagTable(flag); + } + } + PROCESS_SWITCH(V0SelectorTask, processV0, "flags V0 candidates as potential signal", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"v0-selector"})}; +} diff --git a/PWGLF/Tasks/CMakeLists.txt b/PWGLF/Tasks/CMakeLists.txt index 972d36a7251..f4c5eea7f02 100644 --- a/PWGLF/Tasks/CMakeLists.txt +++ b/PWGLF/Tasks/CMakeLists.txt @@ -13,6 +13,7 @@ add_subdirectory(QC) # PAGs +add_subdirectory(GlobalEventProperties) add_subdirectory(Nuspex) add_subdirectory(Resonances) add_subdirectory(Strangeness) diff --git a/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt new file mode 100644 index 00000000000..17bb6e42f65 --- /dev/null +++ b/PWGLF/Tasks/GlobalEventProperties/CMakeLists.txt @@ -0,0 +1,11 @@ +# 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. + diff --git a/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx b/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx index 6a0a8eec581..51a48b3902e 100644 --- a/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx +++ b/PWGLF/Tasks/Nuspex/AngularCorrelationsInJets.cxx @@ -29,9 +29,10 @@ #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 "fastjet/Selector.hh" +// #include "fastjet/tools/Subtractor.hh" +// #include "fastjet/tools/JetMedianBackgroundEstimator.hh" +#include "PWGJE/Core/JetBkgSubUtils.h" #include "TVector2.h" #include "TVector3.h" @@ -40,11 +41,12 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct AxisSpecs { - AxisSpec ptAxis = {1000, 0, 100, "#it{p}_{T} [GeV/#it{c}]"}; + 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 dcazAxis = {200, -3, 3, "DCA_{z} [cm]"}; - AxisSpec dcaxyAxis = {200, -2, 2, "DCA_{xy} [cm]"}; + 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"}; AxisSpec angDistEtaAxis = {1000, -2, 2, "#Delta#eta"}; }; @@ -54,102 +56,79 @@ struct AngularCorrelationsInJets { Configurable fMinNCrossedRowsTPC{"minNCrossedRowsTPC", 70, "min number of crossed rows TPC"}; Configurable fMinReqClusterITS{"minReqClusterITS", 2, "min number of clusters required in ITS"}; Configurable fMinReqClusterTPC{"minReqClusterTPC", 70, "min number of clusters required in TPC"}; - Configurable fMinRatioCrossedRowsTPC{"minRatioCrossedRowsTPC", 0.7f, "min ratio of crossed rows over findable clusters TPC"}; - Configurable fMaxChi2ITS{"maxChi2ITS", 36.0f, "max chi2 per cluster ITS"}; - Configurable fMaxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; - Configurable fMaxDCAxy{"maxDCA_xy", 0.5f, "max DCA to vertex xy"}; - Configurable fMaxDCAz{"maxDCA_z", 2.4f, "max DCA to vertex z"}; + Configurable fMinRatioCrossedRowsTPC{"minRatioCrossedRowsTPC", 0.7, "min ratio of crossed rows over findable clusters TPC"}; + Configurable fMaxChi2ITS{"maxChi2ITS", 36.0, "max chi2 per cluster ITS"}; + Configurable fMaxChi2TPC{"maxChi2TPC", 4.0, "max chi2 per cluster TPC"}; + Configurable fMaxDCAxy{"maxDCA_xy", 0.5, "max DCA to vertex xy"}; + Configurable fMaxDCAz{"maxDCA_z", 1.0, "max DCA to vertex z"}; Configurable fMaxEta{"maxEta", 0.8, "max pseudorapidity"}; // consider jet cone? // Jet Cuts Configurable fJetR{"jetR", 0.4, "jet resolution parameter"}; - Configurable fMinJetPt{"minJetPt", 10.0, "minimum total pT to accept jet"}; + 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"}; + // Configurable fMinLeadingPt{"minLeadingPt", 5.0, "minimum pT for leading track"}; + // float fMinLeadingPt = 5.0; // Proton Cuts - Configurable fProtonDCAxy{"protonDCAxy", 0.5, "[proton] DCAxy cut"}; - Configurable fProtonDCAz{"protonDCAz", 1.0, "[proton] DCAz cut"}; + Configurable fProtonDCAxyYield{"protonDCAxyYield", 0.05, "[proton] DCAxy cut for yield"}; + Configurable fProtonDCAzYield{"protonDCAzYield", 1.0, "[proton] DCAz cut for yield"}; + Configurable fProtonDCAxyCF{"protonDCAxyCF", 0.05, "[proton] DCAxy cut for CF"}; + Configurable fProtonDCAzCF{"protonDCAzCF", 1.0, "[proton] DCAz cut for CF"}; Configurable fProtonTPCTOFpT{"protonTPCTOFswitchpT", 0.7, "[proton] pT for switch in TPC/TOF nsigma"}; - Configurable fProtonTPCnsigLowMin{"protonTPCnsigmaLowPtMin", -4.0, "[proton] min TPC nsigma with low pT"}; - Configurable fProtonTPCnsigHighMin{"protonTPCnsigmaHighPtMin", -4.0, "[proton] min TPC nsigma with high pT"}; - Configurable fProtonTPCnsigLowMax{"protonTPCnsigmaLowPtMax", 4.0, "[proton] max TPC nsigma with low pT"}; - Configurable fProtonTPCnsigHighMax{"protonTPCnsigmaHighPtMax", 4.0, "[proton] max TPC nsigma with high pT"}; - Configurable fProtonTOFnsigLowMin{"protonTOFnsigmaLowPtMin", -15.0, "[proton] min TOF nsigma with low pT"}; - Configurable fProtonTOFnsigHighMin{"protonTOFnsigmaHighPtMin", -15.0, "[proton] min TOF nsigma with high pT"}; - Configurable fProtonTOFnsigLowMax{"protonTOFnsigmaLowPtMax", 15.0, "[proton] max TOF nsigma with low pT"}; - Configurable fProtonTOFnsigHighMax{"protonTOFnsigmaHighPtMax", 15.0, "[proton] max TOF nsigma with high pT"}; + Configurable fProtonTPCnsigLowYield{"protonTPCnsigmaLowPtYield", 4.0, "[proton] max TPC nsigma with low pT for yield"}; + Configurable fProtonTPCnsigHighYield{"protonTPCnsigmaHighPtYield", 4.0, "[proton] max TPC nsigma with high pT for yield"}; + Configurable fProtonTPCnsigLowCF{"protonTPCnsigmaLowPtCF", 2.0, "[proton] max TPC nsigma with low pT for CF"}; + Configurable fProtonTPCnsigHighCF{"protonTPCnsigmaHighPtCF", 3.0, "[proton] max TPC nsigma with high pT for CF"}; + Configurable fProtonTOFnsigYield{"protonTOFnsigmaHighPtYield", 4.0, "[proton] max TOF nsigma with high pT yield"}; + Configurable fProtonTOFnsigCF{"protonTOFnsigmaHighPtCF", 4.0, "[proton] max TOF nsigma for CF"}; // Antiproton Cuts - Configurable fAntiprotonDCAxy{"antiprotonDCAxy", 0.5, "[antiproton] DCAxy cut"}; - Configurable fAntiprotonDCAz{"antiprotonDCAz", 1.0, "[antiproton] DCAz cut"}; + Configurable fAntiprotonDCAxyYield{"antiprotonDCAxyYield", 0.05, "[antiproton] DCAxy cut for yield"}; + Configurable fAntiprotonDCAzYield{"antiprotonDCAzYield", 1.0, "[antiproton] DCAz cut for yield"}; + Configurable fAntiprotonDCAxyCF{"antiprotonDCAxyCF", 0.05, "[antiproton] DCAxy cut for CF"}; + Configurable fAntiprotonDCAzCF{"antiprotonDCAzCF", 1.0, "[antiproton] DCAz cut for CF"}; Configurable fAntiprotonTPCTOFpT{"antiprotonTPCTOFswitchpT", 0.7, "[antiproton] pT for switch in TPC/TOF nsigma"}; - Configurable fAntiprotonTPCnsigLowMin{"antiprotonTPCnsigmaLowPtMin", -4.0, "[antiproton] min TPC nsigma with low pT"}; - Configurable fAntiprotonTPCnsigHighMin{"antiprotonTPCnsigmaHighPtMin", -4.0, "[antiproton] min TPC nsigma with high pT"}; - Configurable fAntiprotonTPCnsigLowMax{"antiprotonTPCnsigmaLowPtMax", 4.0, "[antiproton] max TPC nsigma with low pT"}; - Configurable fAntiprotonTPCnsigHighMax{"antiprotonTPCnsigmaHighPtMax", 4.0, "[antiproton] max TPC nsigma with high pT"}; - Configurable fAntiprotonTOFnsigLowMin{"antiprotonTOFnsigmaLowPtMin", -15.0, "[antiproton] min TOF nsigma with low pT"}; - Configurable fAntiprotonTOFnsigHighMin{"antiprotonTOFnsigmaHighPtMin", -15.0, "[antiproton] min TOF nsigma with high pT"}; - Configurable fAntiprotonTOFnsigLowMax{"antiprotonTOFnsigmaLowPtMax", 15.0, "[antiproton] max TOF nsigma with low pT"}; - Configurable fAntiprotonTOFnsigHighMax{"antiprotonTOFnsigmaHighPtMax", 15.0, "[antiproton] max TOF nsigma with high pT"}; - - // Deuteron Cuts - Configurable fDeuteronDCAxy{"deuteronDCAxy", 0.5, "[deuteron] DCAxy cut"}; - Configurable fDeuteronDCAz{"deuteronDCAz", 1.0, "[deuteron] DCAz cut"}; - Configurable fDeuteronTPCTOFpT{"deuteronTPCTOFswitchpT", 0.7, "[deuteron] pT for switch in TPC/TOF nsigma"}; - Configurable fDeuteronTPCnsigLowMin{"deuteronTPCnsigmaLowPtMin", -4.0, "[deuteron] min TPC nsigma with low pT"}; - Configurable fDeuteronTPCnsigHighMin{"deuteronTPCnsigmaHighPtMin", -4.0, "[deuteron] min TPC nsigma with high pT"}; - Configurable fDeuteronTPCnsigLowMax{"deuteronTPCnsigmaLowPtMax", 4.0, "[deuteron] max TPC nsigma with low pT"}; - Configurable fDeuteronTPCnsigHighMax{"deuteronTPCnsigmaHighPtMax", 4.0, "[deuteron] max TPC nsigma with high pT"}; - Configurable fDeuteronTOFnsigLowMin{"deuteronTOFnsigmaLowPtMin", -15.0, "[deuteron] min TOF nsigma with low pT"}; - Configurable fDeuteronTOFnsigHighMin{"deuteronTOFnsigmaHighPtMin", -15.0, "[deuteron] min TOF nsigma with high pT"}; - Configurable fDeuteronTOFnsigLowMax{"deuteronTOFnsigmaLowPtMax", 15.0, "[deuteron] max TOF nsigma with low pT"}; - Configurable fDeuteronTOFnsigHighMax{"deuteronTOFnsigmaHighPtMax", 15.0, "[deuteron] max TOF nsigma with high pT"}; - - // Antideuteron Cuts - Configurable fAntideuteronDCAxy{"antideuteronDCAxy", 0.5, "[antideuteron] DCAxy cut"}; - Configurable fAntideuteronDCAz{"antideuteronDCAz", 1.0, "[antideuteron] DCAz cut"}; - Configurable fAntideuteronTPCTOFpT{"antideuteronTPCTOFswitchpT", 0.7, "[antideuteron] pT for switch in TPC/TOF nsigma"}; - Configurable fAntideuteronTPCnsigLowMin{"antideuteronTPCnsigmaLowPtMin", -4.0, "[antideuteron] min TPC nsigma with low pT"}; - Configurable fAntideuteronTPCnsigHighMin{"antideuteronTPCnsigmaHighPtMin", -4.0, "[antideuteron] min TPC nsigma with high pT"}; - Configurable fAntideuteronTPCnsigLowMax{"antideuteronTPCnsigmaLowPtMax", 4.0, "[antideuteron] max TPC nsigma with low pT"}; - Configurable fAntideuteronTPCnsigHighMax{"antideuteronTPCnsigmaHighPtMax", 4.0, "[antideuteron] max TPC nsigma with high pT"}; - Configurable fAntideuteronTOFnsigLowMin{"antideuteronTOFnsigmaLowPtMin", -15.0, "[antideuteron] min TOF nsigma with low pT"}; - Configurable fAntideuteronTOFnsigHighMin{"antideuteronTOFnsigmaHighPtMin", -15.0, "[antideuteron] min TOF nsigma with high pT"}; - Configurable fAntideuteronTOFnsigLowMax{"antideuteronTOFnsigmaLowPtMax", 15.0, "[antideuteron] max TOF nsigma with low pT"}; - Configurable fAntideuteronTOFnsigHighMax{"antideuteronTOFnsigmaHighPtMax", 15.0, "[antideuteron] max TOF nsigma with high pT"}; - - // Helium-3 Cuts - Configurable fHeliumDCAxy{"heliumDCAxy", 0.5, "[helium] DCAxy cut"}; - Configurable fHeliumDCAz{"heliumDCAz", 1.0, "[helium] DCAz cut"}; - Configurable fHeliumTPCTOFpT{"heliumTPCTOFswitchpT", 0.7, "[helium] pT for switch in TPC/TOF nsigma"}; - Configurable fHeliumTPCnsigLowMin{"heliumTPCnsigmaLowPtMin", -4.0, "[helium] min TPC nsigma with low pT"}; - Configurable fHeliumTPCnsigHighMin{"heliumTPCnsigmaHighPtMin", -4.0, "[helium] min TPC nsigma with high pT"}; - Configurable fHeliumTPCnsigLowMax{"heliumTPCnsigmaLowPtMax", 4.0, "[helium] max TPC nsigma with low pT"}; - Configurable fHeliumTPCnsigHighMax{"heliumTPCnsigmaHighPtMax", 4.0, "[helium] max TPC nsigma with high pT"}; - Configurable fHeliumTOFnsigLowMin{"heliumTOFnsigmaLowPtMin", -15.0, "[helium] min TOF nsigma with low pT"}; - Configurable fHeliumTOFnsigHighMin{"heliumTOFnsigmaHighPtMin", -15.0, "[helium] min TOF nsigma with high pT"}; - Configurable fHeliumTOFnsigLowMax{"heliumTOFnsigmaLowPtMax", 15.0, "[helium] max TOF nsigma with low pT"}; - Configurable fHeliumTOFnsigHighMax{"heliumTOFnsigmaHighPtMax", 15.0, "[helium] max TOF nsigma with high pT"}; - - // Antihelium-3 Cuts - Configurable fAntiheliumDCAxy{"antiheliumDCAxy", 0.5, "[antihelium] DCAxy cut"}; - Configurable fAntiheliumDCAz{"antiheliumDCAz", 1.0, "[antihelium] DCAz cut"}; - Configurable fAntiheliumTPCTOFpT{"antiheliumTPCTOFswitchpT", 0.7, "[antihelium] pT for switch in TPC/TOF nsigma"}; - Configurable fAntiheliumTPCnsigLowMin{"antiheliumTPCnsigmaLowPtMin", -4.0, "[antihelium] min TPC nsigma with low pT"}; - Configurable fAntiheliumTPCnsigHighMin{"antiheliumTPCnsigmaHighPtMin", -4.0, "[antihelium] min TPC nsigma with high pT"}; - Configurable fAntiheliumTPCnsigLowMax{"antiheliumTPCnsigmaLowPtMax", 4.0, "[antihelium] max TPC nsigma with low pT"}; - Configurable fAntiheliumTPCnsigHighMax{"antiheliumTPCnsigmaHighPtMax", 4.0, "[antihelium] max TPC nsigma with high pT"}; - Configurable fAntiheliumTOFnsigLowMin{"antiheliumTOFnsigmaLowPtMin", -15.0, "[antihelium] min TOF nsigma with low pT"}; - Configurable fAntiheliumTOFnsigHighMin{"antiheliumTOFnsigmaHighPtMin", -15.0, "[antihelium] min TOF nsigma with high pT"}; - Configurable fAntiheliumTOFnsigLowMax{"antiheliumTOFnsigmaLowPtMax", 15.0, "[antihelium] max TOF nsigma with low pT"}; - Configurable fAntiheliumTOFnsigHighMax{"antiheliumTOFnsigmaHighPtMax", 15.0, "[antihelium] max TOF nsigma with high pT"}; + Configurable fAntiprotonTPCnsigLowYield{"antiprotonTPCnsigmaLowPtYield", 4.0, "[antiproton] max TPC nsigma with low pT for yield"}; + Configurable fAntiprotonTPCnsigHighYield{"antiprotonTPCnsigmaHighPtYield", 4.0, "[antiproton] max TPC nsigma with high pT for yield"}; + Configurable fAntiprotonTPCnsigLowCF{"antiprotonTPCnsigmaLowPtCF", 2.0, "[antiproton] max TPC nsigma with low pT for CF"}; + Configurable fAntiprotonTPCnsigHighCF{"antiprotonTPCnsigmaHighPtCF", 3.0, "[antiproton] max TPC nsigma with high pT for CF"}; + Configurable fAntiprotonTOFnsigYield{"antiprotonTOFnsigmaHighPtYield", 4.0, "[antiproton] min TOF nsigma with high pT for yield"}; + Configurable fAntiprotonTOFnsigCF{"antiprotonTOFnsigmaHighPtCF", 4.0, "[antiproton] max TOF nsigma for CF"}; + + // Nuclei Cuts + Configurable fNucleiDCAxyYield{"nucleiDCAxyYield", 0.05, "[nuclei] DCAxy cut for yield"}; + Configurable fNucleiDCAzYield{"nucleiDCAzYield", 1.0, "[nuclei] DCAz cut for yield"}; + Configurable fNucleiDCAxyCF{"nucleiDCAxyCF", 0.05, "[nuclei] DCAxy cut for CF"}; + Configurable fNucleiDCAzCF{"nucleiDCAzCF", 1.0, "[nuclei] DCAz cut for CF"}; + Configurable fNucleiTPCTOFpT{"nucleiTPCTOFswitchpT", 0.7, "[nuclei] pT for switch in TPC/TOF nsigma"}; + Configurable fNucleiTPCnsigLowYield{"nucleiTPCnsigmaLowPtYield", 4.0, "[nuclei] max TPC nsigma with low pT for yield"}; + Configurable fNucleiTPCnsigHighYield{"nucleiTPCnsigmaHighPtYield", 4.0, "[nuclei] max TPC nsigma with high pT for yield"}; + Configurable fNucleiTPCnsigLowCF{"nucleiTPCnsigmaLowPtCF", 2.0, "[nuclei] max TPC nsigma with low pT for CF"}; + Configurable fNucleiTPCnsigHighCF{"nucleiTPCnsigmaHighPtCF", 3.0, "[nuclei] max TPC nsigma with high pT for CF"}; + Configurable fNucleiTOFnsigYield{"nucleiTOFnsigmaHighPtYield", 4.0, "[nuclei] min TOF nsigma with high pT for yield"}; + Configurable fNucleiTOFnsigCF{"nucleiTOFnsigmaHighPtCF", 4.0, "[nuclei] max TOF nsigma for CF"}; + + // Antinuclei Cuts + Configurable fAntinucleiDCAxyYield{"antinucleiDCAxyYield", 0.05, "[antinuclei] DCAxy cut for yield"}; + Configurable fAntinucleiDCAzYield{"antinucleiDCAzYield", 1.0, "[antinuclei] DCAz cut for yield"}; + Configurable fAntinucleiDCAxyCF{"antinucleiDCAxyCF", 0.05, "[antinuclei] DCAxy cut for CF"}; + Configurable fAntinucleiDCAzCF{"antinucleiDCAzCF", 1.0, "[antinuclei] DCAz cut for CF"}; + Configurable fAntinucleiTPCTOFpT{"antinucleiTPCTOFswitchpT", 0.7, "[antinuclei] pT for switch in TPC/TOF nsigma"}; + Configurable fAntinucleiTPCnsigLowYield{"antinucleiTPCnsigmaLowPtYield", 4.0, "[antinuclei] max TPC nsigma with low pT for yield"}; + Configurable fAntinucleiTPCnsigHighYield{"antinucleiTPCnsigmaHighPtYield", 4.0, "[antinuclei] max TPC nsigma with high pT for yield"}; + Configurable fAntinucleiTPCnsigLowCF{"antinucleiTPCnsigmaLowPtCF", 2.0, "[antinuclei] max TPC nsigma with low pT for CF"}; + Configurable fAntinucleiTPCnsigHighCF{"antinucleiTPCnsigmaHighPtCF", 3.0, "[antinuclei] max TPC nsigma with high pT for CF"}; + 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"}; // QC Configurables Configurable fZVtx{"zVtx", 9999, "max zVertex"}; - Configurable fRmax{"Rmax", 0.3, "Maximum radius for jet and UE regions"}; + Configurable fRmax{"Rmax", 0.4, "Maximum radius for jet and UE regions"}; Service ccdb; int mRunNumber; @@ -164,7 +143,7 @@ struct AngularCorrelationsInJets { aod::track::tpcChi2NCl < fMaxChi2TPC && nabs(aod::track::dcaXY) < fMaxDCAxy && nabs(aod::track::dcaZ) < fMaxDCAz && - nabs(aod::track::eta) < fMaxEta); + nabs(aod::track::eta) < fMaxEta); // add more preliminary cuts to filter if possible Preslice perCollisionFullTracksRun2 = o2::aod::track::collisionId; Preslice perCollisionFullTracksRun3 = o2::aod::track::collisionId; @@ -174,6 +153,8 @@ struct AngularCorrelationsInJets { HistogramRegistry registryData{"dataOutput", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; HistogramRegistry registryQA{"dataQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, true}; + JetBkgSubUtils bkgSub; + void init(o2::framework::InitContext&) { mRunNumber = 0; @@ -188,102 +169,136 @@ struct AngularCorrelationsInJets { registryData.add("hEventProtocol", "Event protocol", HistType::kTH1I, {{20, 0, 20}}); registryData.add("hTrackProtocol", "Track protocol", HistType::kTH1I, {{20, 0, 20}}); registryData.add("hNumPartInJet", "Number of particles in a jet", HistType::kTH1I, {{200, 0, 200}}); + registryData.add("hNumJetsInEvent", "Number of jets selected", HistType::kTH1I, {{10, 0, 10}}); // (Pseudo)Rapidity registryData.add("hJetRapidity", "Jet rapidity;#it{y}", HistType::kTH1F, {{200, -1, 1}}); // pT - registryData.add("hPtJetParticle", "p_{T} of particles in jets", HistType::kTH1D, {axisSpecs.ptAxis}); - registryData.add("hPtSubtractedJet", "Subtracted jet p_{T}", HistType::kTH1D, {axisSpecs.ptAxis}); - registryData.add("hPtJetProton", "p_{T} of (anti)p", HistType::kTH1D, {axisSpecs.ptAxis}); - registryData.add("hPtJetDeuteron", "p_{T} of (anti)d", HistType::kTH1D, {axisSpecs.ptAxis}); - registryData.add("hPtJetHelium", "p_{T} of (anti)He", HistType::kTH1D, {axisSpecs.ptAxis}); + registryData.add("hPtJetParticle", "p_{T} of particles in jets", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryData.add("hPtTotalSubJetArea", "Subtracted full jet p_{T} (area)", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryData.add("hPtTotalSubJetPerp", "Subtracted full jet p_{T} (perpendicular)", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryData.add("hPtJetProton", "p_{T} of protons", HistType::kTH1D, {axisSpecs.ptAxisPos}); + 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", "pT difference PseudoJet/original track;#it{p}_{T} [GeV/#it{c}]", HistType::kTH1D, {{100, -5, 5}}); + 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}); + registryQA.add("hPtJetProton_50", "Proton p_{T} for jet p_{T} < 50 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetAntiproton_15", "Antiproton p_{T} for jet p_{T} < 15 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetAntiproton_20", "Antiproton p_{T} for jet p_{T} < 20 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetAntiproton_30", "Antiproton p_{T} for jet p_{T} < 30 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetAntiproton_50", "Antiproton p_{T} for jet p_{T} < 50 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetNuclei_15", "Nuclei p_{T} for jet p_{T} < 15 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetNuclei_20", "Nuclei p_{T} for jet p_{T} < 20 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetNuclei_30", "Nuclei p_{T} for jet p_{T} < 30 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetNuclei_50", "Nuclei p_{T} for jet p_{T} < 50 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetAntinuclei_15", "Antinuclei p_{T} for jet p_{T} < 15 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetAntinuclei_20", "Antinuclei p_{T} for jet p_{T} < 20 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + registryQA.add("hPtJetAntinuclei_30", "Antinuclei p_{T} for jet p_{T} < 30 GeV", HistType::kTH1D, {axisSpecs.ptAxisPos}); + 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("hTPCsignalProton", "TPC n#sigma for (anti)proton without cuts", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFsignalProton", "TOF n#sigma for (anti)proton without cuts", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTPCsignalNuclei", "TPC n#sigma for (anti)nuclei without cuts", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); + registryData.add("hTOFsignalNuclei", "TOF n#sigma for (anti)nuclei without cuts", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); 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("hTPCnsigmaDeuteron", "TPC n#sigma for (anti)deuteron", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); - registryData.add("hTOFnsigmaDeuteron", "TOF n#sigma for (anti)deuteron", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); - registryData.add("hTPCnsigmaHelium", "TPC n#sigma for (anti)helium", HistType::kTH2F, {axisSpecs.nsigmapTAxis, axisSpecs.nsigmaAxis}); - registryData.add("hTOFnsigmaHelium", "TOF n#sigma for (anti)helium", 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}); // DCA - registryData.add("hDCAxyFullJet", "DCA_{xy} of full jet", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcaxyAxis}); - registryData.add("hDCAzFullJet", "DCA_{z} of full jet", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); - registryData.add("hDCAzJetProton", "DCA_{z} of protons after TPC cut", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); - registryData.add("hDCAzJetAntiproton", "DCA_{z} of antiprotons after TPC cut", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); - registryData.add("hDCAzJetDeuteron", "DCA_{z} of deuterons after TPC cut", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); - registryData.add("hDCAzJetAntideuteron", "DCA_{z} of antideuterons after TPC cut", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); - registryData.add("hDCAzJetHelium", "DCA_{z} of helium after TPC cut", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); - registryData.add("hDCAzJetAntihelium", "DCA_{z} of antihelium after TPC cut", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); + registryData.add("hDCAxyFullJet", "DCA_{xy} of full jet", HistType::kTH2F, {axisSpecs.ptAxisFull, axisSpecs.dcaxyAxis}); + registryData.add("hDCAzFullJet", "DCA_{z} of full jet", HistType::kTH2F, {axisSpecs.ptAxisFull, axisSpecs.dcazAxis}); + registryData.add("hDCAzJetProton", "DCA_{z} of high purity protons", HistType::kTH2F, {axisSpecs.ptAxisPos, axisSpecs.dcazAxis}); + registryData.add("hDCAzJetAntiproton", "DCA_{z} of high purity antiprotons", HistType::kTH2F, {axisSpecs.ptAxisPos, axisSpecs.dcazAxis}); + registryData.add("hDCAzJetNuclei", "DCA_{z} of high purity nuclei", HistType::kTH2F, {axisSpecs.ptAxisPos, axisSpecs.dcazAxis}); + registryData.add("hDCAzJetAntinuclei", "DCA_{z} of high purity antinuclei", HistType::kTH2F, {axisSpecs.ptAxisPos, axisSpecs.dcazAxis}); // Angular Distributions + registryQA.add("hPhiFullEvent", "#varphi in full event", HistType::kTH1F, {{1000, -6.3, 6.3}}); + registryQA.add("hPhiPtFullEvent", "#varphi vs. p_{T} in full event", HistType::kTH2F, {axisSpecs.ptAxisPos, {1000, -6.3, 6.3}}); + registryQA.add("hPhiJet", "#varphi in jet", HistType::kTH1F, {{1000, -6.3, 6.3}}); + registryQA.add("hPhiPtJet", "#varphi vs. p_{T} in jet", HistType::kTH2F, {axisSpecs.ptAxisPos, {1000, -6.3, 6.3}}); + registryQA.add("hEtaFullEvent", "#eta in full event", HistType::kTH1F, {{1000, -1, 1}}); + registryQA.add("hEtaPtFullEvent", "#eta vs. p_{T} in full event", HistType::kTH2F, {axisSpecs.ptAxisPos, {1000, -1, 1}}); + registryQA.add("hEtaJet", "#eta in jet", HistType::kTH1F, {{1000, -1, 1}}); + registryQA.add("hEtaPtJet", "#eta vs. p_{T} in jet", HistType::kTH2F, {axisSpecs.ptAxisPos, {1000, -1, 1}}); + + registryData.add("hDeltaPhiSEFull", "#Delta#varphi of particles in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiSEJet", "#Delta#varphi of jet particles in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); registryData.add("hDeltaPhiSEProton", "#Delta#varphi of protons in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); registryData.add("hDeltaPhiSEAntiproton", "#Delta#varphi of antiprotons in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); - registryData.add("hDeltaPhiSEDeuteron", "#Delta#varphi of deuterons in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); - registryData.add("hDeltaPhiSEAntideuteron", "#Delta#varphi of antideuterons in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiSENuclei", "#Delta#varphi of nuclei in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiSEAntinuclei", "#Delta#varphi of antinuclei in single event", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiMEFull", "#Delta#varphi of particles in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiMEJet", "#Delta#varphi of jet particles in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); registryData.add("hDeltaPhiMEProton", "#Delta#varphi of protons in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); registryData.add("hDeltaPhiMEAntiproton", "#Delta#varphi of antiprotons in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); - registryData.add("hDeltaPhiMEDeuteron", "#Delta#varphi of deuterons in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); - registryData.add("hDeltaPhiMEAntideuteron", "#Delta#varphi of antideuterons in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiMENuclei", "#Delta#varphi of nuclei in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiMEAntinuclei", "#Delta#varphi of antinuclei in mixed events", HistType::kTH1D, {axisSpecs.angDistPhiAxis}); + registryData.add("hDeltaPhiEtaSEFull", "#Delta#varphi vs #Delta#eta of full particles in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); + registryData.add("hDeltaPhiEtaSEJet", "#Delta#varphi vs #Delta#eta of jet particles in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); registryData.add("hDeltaPhiEtaSEProton", "#Delta#varphi vs #Delta#eta of protons in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); registryData.add("hDeltaPhiEtaSEAntiproton", "#Delta#varphi vs #Delta#eta of antiprotons in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); - registryData.add("hDeltaPhiEtaSEDeuteron", "#Delta#varphi vs #Delta#eta of deuterons in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); - registryData.add("hDeltaPhiEtaSEAntideuteron", "#Delta#varphi vs #Delta#eta of antideuterons in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); + registryData.add("hDeltaPhiEtaSENuclei", "#Delta#varphi vs #Delta#eta of nuclei in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); + registryData.add("hDeltaPhiEtaSEAntinuclei", "#Delta#varphi vs #Delta#eta of antinuclei in single event", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); + registryData.add("hDeltaPhiEtaMEFull", "#Delta#varphi vs #Delta#eta of particles in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); + registryData.add("hDeltaPhiEtaMEJet", "#Delta#varphi vs #Delta#eta of jet particles in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); registryData.add("hDeltaPhiEtaMEProton", "#Delta#varphi vs #Delta#eta of protons in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); registryData.add("hDeltaPhiEtaMEAntiproton", "#Delta#varphi vs #Delta#eta of antiprotons in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); - registryData.add("hDeltaPhiEtaMEDeuteron", "#Delta#varphi vs #Delta#eta of deuterons in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); - registryData.add("hDeltaPhiEtaMEAntideuteron", "#Delta#varphi vs #Delta#eta of antideuterons in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); - - registryData.add("hJetConeRadius", "Jet Radius;#it{R}", HistType::kTH1F, {{100, 0, 1}}); + registryData.add("hDeltaPhiEtaMENuclei", "#Delta#varphi vs #Delta#eta of nuclei in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); + registryData.add("hDeltaPhiEtaMEAntinuclei", "#Delta#varphi vs #Delta#eta of antinuclei in mixed events", HistType::kTH2D, {axisSpecs.angDistPhiAxis, axisSpecs.angDistEtaAxis}); // QA - registryQA.add("hTOFmass", "TOF mass", HistType::kTH2F, {axisSpecs.ptAxis, {1000, 0, 5, "#it{m} [GeV/#it{c}^{2}]"}}); + 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}}); + registryQA.add("hRhoMEstimatePerp", "Background #rho_{m} (perp)", HistType::kTH2F, {{axisSpecs.ptAxisPos}, {200, 0, 20}}); + registryQA.add("hRhoEstimateArea", "Background #rho (area)", HistType::kTH2F, {{axisSpecs.ptAxisPos}, {200, 0, 20}}); + 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.get(HIST("hTOFmass"))->Sumw2(); - registryQA.add("hPtFullEvent", "p_{T} after basic cuts", HistType::kTH1F, {axisSpecs.ptAxis}); - registryQA.add("hEtaFullEvent", "Particle pseudorapidity;#eta", HistType::kTH1F, {{200, -1, 1}}); - registryQA.add("hCrossedRowsTPC", "Crossed rows TPC", HistType::kTH2I, {axisSpecs.ptAxis, {135, 65, 200}}); - registryQA.add("hClusterITS", "ITS clusters", HistType::kTH2I, {axisSpecs.ptAxis, {10, 0, 10}}); - registryQA.add("hClusterTPC", "TPC clusters", HistType::kTH2I, {axisSpecs.ptAxis, {135, 65, 200}}); - registryQA.add("hRatioCrossedRowsTPC", "Ratio crossed rows/findable TPC", HistType::kTH2F, {axisSpecs.ptAxis, {100, 0.5, 1.5}}); - registryQA.add("hChi2ITS", "ITS #chi^{2}", HistType::kTH2F, {axisSpecs.ptAxis, {400, 0, 40}}); - registryQA.add("hChi2TPC", "TPC #chi^{2}", HistType::kTH2F, {axisSpecs.ptAxis, {50, 0, 5}}); - registryQA.add("hDCAxyFullEvent", "DCA_{xy} of full event", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcaxyAxis}); - registryQA.add("hDCAzFullEvent", "DCA_{z} of full event", HistType::kTH2F, {axisSpecs.ptAxis, axisSpecs.dcazAxis}); + 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}}); + registryQA.add("hClusterITS", "ITS clusters", HistType::kTH2I, {axisSpecs.ptAxisPos, {10, 0, 10}}); + registryQA.add("hClusterTPC", "TPC clusters", HistType::kTH2I, {axisSpecs.ptAxisPos, {135, 65, 200}}); + registryQA.add("hRatioCrossedRowsTPC", "Ratio crossed rows/findable TPC", HistType::kTH2F, {axisSpecs.ptAxisPos, {100, 0.5, 1.5}}); + registryQA.add("hChi2ITS", "ITS #chi^{2}", HistType::kTH2F, {axisSpecs.ptAxisPos, {400, 0, 40}}); + registryQA.add("hChi2TPC", "TPC #chi^{2}", HistType::kTH2F, {axisSpecs.ptAxisPos, {50, 0, 5}}); + registryQA.add("hDCAxyFullEvent", "DCA_{xy} of full event", HistType::kTH2F, {axisSpecs.ptAxisPos, axisSpecs.dcaxyAxis}); + registryQA.add("hDCAzFullEvent", "DCA_{z} of full event", HistType::kTH2F, {axisSpecs.ptAxisPos, axisSpecs.dcazAxis}); + registryQA.add("hJetPtVsNumPart", "Total jet p_{T} vs number of constituents", HistType::kTH2F, {axisSpecs.ptAxisPos, {100, 0, 100}}); // QA Histograms for Comparison with nuclei_in_jets.cxx registryQA.add("hMultiplicityJetPlusUE", "hMultiplicityJetPlusUE", HistType::kTH1F, {{100, 0, 100, "#it{N}_{ch}"}}); registryQA.add("hMultiplicityJet", "hMultiplicityJet", HistType::kTH1F, {{100, 0, 100, "#it{N}_{ch}"}}); registryQA.add("hMultiplicityUE", "hMultiplicityUE", HistType::kTH1F, {{100, 0, 100, "#it{N}_{ch}"}}); - registryQA.add("hPtLeading", "hPtLeading", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); - registryQA.add("hEtaLeading", "hEtaLeading", HistType::kTH1F, {{100, -0.8, 0.8, "#eta"}}); - registryQA.add("hPhiLeading", "hPhiLeading", HistType::kTH1F, {{100, 0, TMath::TwoPi(), "#phi"}}); - registryQA.add("hRJet", "hRJet", HistType::kTH1F, {{100, 0.0, 0.5, "#it{R}"}}); - registryQA.add("hRUE", "hRUE", HistType::kTH1F, {{100, 0.0, 0.5, "#it{R}"}}); - registryQA.add("hAngleJetLeadingTrack", "hAngleJetLeadingTrack", HistType::kTH1F, {{200, 0.0, 50.0, "#theta"}}); registryQA.add("hPtJetPlusUE", "hPtJetPlusUE", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); registryQA.add("hPtJet", "hPtJet", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); registryQA.add("hPtUE", "hPtUE", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); registryQA.add("hDeltaEtadeltaPhiJet", "hDeltaEtadeltaPhiJet", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); registryQA.add("hDeltaEtadeltaPhiUE", "hDeltaEtadeltaPhiUE", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); - registryQA.add("hDeltaEtadeltaPhiLeadingJet", "hDeltaEtadeltaPhiLeadingJet", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); registryQA.add("hDeltaJetPt", "hDeltaJetPt", HistType::kTH1F, {{200, -2, 2, "#Delta#it{p}_{T} (GeV/#it{c})"}}); - // QC Histograms for ptJet < ptLeading registryQA.add("hNParticlesClusteredInJet", "hNParticlesClusteredInJet", HistType::kTH1F, {{50, 0, 50, "#it{N}_{ch}"}}); registryQA.add("hPtParticlesClusteredInJet", "hPtParticlesClusteredInJet", HistType::kTH1F, {{200, 0, 10, "#it{p}_{T} (GeV/#it{c})"}}); - registryQA.add("hDeltaEtaDeltaPhiJetAxis", "hDeltaEtaDeltaPhiJetAxis", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); - registryQA.add("hDeltaEtaDeltaPhiJetAxisLeading", "hDeltaEtaDeltaPhiJetAxisLeading", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); } std::vector> fBufferProton; std::vector> fBufferAntiproton; - std::vector> fBufferDeuteron; - std::vector> fBufferAntideuteron; + std::vector> fBufferNuclei; + std::vector> fBufferAntinuclei; + std::vector> fBufferJet; + std::vector> fBufferFull; template void initCCDB(Bc const& bc) @@ -304,10 +319,9 @@ struct AngularCorrelationsInJets { return false; } if (doprocessRun2) { - if (!(track.trackType() & o2::aod::track::Run2Track) //|| - //!(track.flags() & o2::aod::track::TPCrefit) || - //!(track.flags() & o2::aod::track::ITSrefit) - ) { + if (!(track.trackType() & o2::aod::track::Run2Track) || + !(track.flags() & o2::aod::track::TPCrefit) || + !(track.flags() & o2::aod::track::ITSrefit)) { return false; } } @@ -315,163 +329,244 @@ struct AngularCorrelationsInJets { } template - bool isProton(const T& track) + bool isProton(const T& track, bool tightCuts) { if (track.sign() < 0) return false; - // TPC - if (track.pt() < fProtonTPCTOFpT && (track.tpcNSigmaPr() < fProtonTPCnsigLowMin || track.tpcNSigmaPr() > fProtonTPCnsigLowMax)) - return false; - if (track.pt() > fProtonTPCTOFpT && (track.tpcNSigmaPr() < fProtonTPCnsigHighMin || track.tpcNSigmaPr() > fProtonTPCnsigHighMax)) - return false; - - // DCA - if (TMath::Abs(track.dcaXY()) > fProtonDCAxy) - return false; - if (TMath::Abs(track.dcaZ()) > fProtonDCAz) - return false; - - // TOF - if (track.pt() < fProtonTPCTOFpT && (track.tofNSigmaPr() < fProtonTOFnsigLowMin || track.tofNSigmaPr() > fProtonTOFnsigLowMax)) - return false; - if (track.pt() > fProtonTPCTOFpT && (track.tofNSigmaPr() < fProtonTOFnsigHighMin || track.tofNSigmaPr() > fProtonTOFnsigHighMax)) - return false; - - return true; - } + if (tightCuts) { // for correlation function + // TPC + if (track.pt() < fProtonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fProtonTPCnsigLowCF) + return false; + if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fProtonTPCnsigHighCF) + return false; - template - bool isAntiproton(const T& track) - { - if (track.sign() > 0) - return false; + // DCA + if (TMath::Abs(track.dcaXY()) > fProtonDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fProtonDCAzCF) + return false; - // TPC - if (track.pt() < fAntiprotonTPCTOFpT && (track.tpcNSigmaPr() < fAntiprotonTPCnsigLowMin || track.tpcNSigmaPr() > fAntiprotonTPCnsigLowMax)) - return false; - if (track.pt() > fAntiprotonTPCTOFpT && (track.tpcNSigmaPr() < fAntiprotonTPCnsigHighMin || track.tpcNSigmaPr() > fAntiprotonTPCnsigHighMax)) - return false; + // TOF + if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fProtonTOFnsigCF) + return false; + } else { // for yields + // 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()) > fAntiprotonDCAxy) - return false; - if (TMath::Abs(track.dcaZ()) > fAntiprotonDCAz) - return false; + // DCA + if (TMath::Abs(track.dcaXY()) > fProtonDCAxyYield) + return false; + if (TMath::Abs(track.dcaZ()) > fProtonDCAzYield) + return false; - // TOF - if (track.pt() < fAntiprotonTPCTOFpT && (track.tofNSigmaPr() < fAntiprotonTOFnsigLowMin || track.tofNSigmaPr() > fAntiprotonTOFnsigLowMax)) - return false; - if (track.pt() > fAntiprotonTPCTOFpT && (track.tofNSigmaPr() < fAntiprotonTOFnsigHighMin || track.tofNSigmaPr() > fAntiprotonTOFnsigHighMax)) - return false; + // TOF + if (track.pt() > fProtonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fProtonTOFnsigYield) + return false; + } return true; } template - bool isDeuteron(const T& track) + bool isAntiproton(const T& track, bool tightCuts) { - if (track.sign() < 0) - return false; - - // TPC - if (track.pt() < fDeuteronTPCTOFpT && (track.tpcNSigmaDe() < fDeuteronTPCnsigLowMin || track.tpcNSigmaDe() > fDeuteronTPCnsigLowMax)) - return false; - if (track.pt() > fDeuteronTPCTOFpT && (track.tpcNSigmaDe() < fDeuteronTPCnsigHighMin || track.tpcNSigmaDe() > fDeuteronTPCnsigHighMax)) - return false; - - // DCA - if (TMath::Abs(track.dcaXY()) > fDeuteronDCAxy) - return false; - if (TMath::Abs(track.dcaZ()) > fDeuteronDCAz) - return false; - - // TOF - if (track.pt() < fDeuteronTPCTOFpT && (track.tofNSigmaDe() < fDeuteronTOFnsigLowMin || track.tofNSigmaDe() > fDeuteronTOFnsigLowMax)) - return false; - if (track.pt() > fDeuteronTPCTOFpT && (track.tofNSigmaDe() < fDeuteronTOFnsigHighMin || track.tofNSigmaDe() > fDeuteronTOFnsigHighMax)) + if (track.sign() > 0) return false; - return true; - } + if (tightCuts) { // for correlation function + // TPC + if (track.pt() < fAntiprotonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fAntiprotonTPCnsigLowCF) + return false; + if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tpcNSigmaPr()) > fAntiprotonTPCnsigHighCF) + return false; - template - bool isAntideuteron(const T& track) - { - if (track.sign() > 0) - return false; + // DCA + if (TMath::Abs(track.dcaXY()) > fAntiprotonDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fAntiprotonDCAzCF) + return false; - // TPC - if (track.pt() < fAntideuteronTPCTOFpT && (track.tpcNSigmaDe() < fAntideuteronTPCnsigLowMin || track.tpcNSigmaDe() > fAntideuteronTPCnsigLowMax)) - return false; - if (track.pt() > fAntideuteronTPCTOFpT && (track.tpcNSigmaDe() < fAntideuteronTPCnsigHighMin || track.tpcNSigmaDe() > fAntideuteronTPCnsigHighMax)) - return false; + // TOF + if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fAntiprotonTOFnsigCF) + return false; + } else { // for yields + // 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()) > fAntideuteronDCAxy) - return false; - if (TMath::Abs(track.dcaZ()) > fAntideuteronDCAz) - return false; + // DCA + if (TMath::Abs(track.dcaXY()) > fAntiprotonDCAxyYield) + return false; + if (TMath::Abs(track.dcaZ()) > fAntiprotonDCAzYield) + return false; - // TOF - if (track.pt() < fAntideuteronTPCTOFpT && (track.tofNSigmaDe() < fAntideuteronTOFnsigLowMin || track.tofNSigmaDe() > fAntideuteronTOFnsigLowMax)) - return false; - if (track.pt() > fAntideuteronTPCTOFpT && (track.tofNSigmaDe() < fAntideuteronTOFnsigHighMin || track.tofNSigmaDe() > fAntideuteronTOFnsigHighMax)) - return false; + // TOF + if (track.pt() > fAntiprotonTPCTOFpT && TMath::Abs(track.tofNSigmaPr()) > fAntiprotonTOFnsigYield) + return false; + } return true; } template - bool isHelium(const T& track) + bool isNucleus(const T& track, bool tightCuts) { if (track.sign() < 0) return false; - - // TPC - if (track.pt() < fHeliumTPCTOFpT && (track.tpcNSigmaHe() < fHeliumTPCnsigLowMin || track.tpcNSigmaHe() > fHeliumTPCnsigLowMax)) - return false; - if (track.pt() > fHeliumTPCTOFpT && (track.tpcNSigmaHe() < fHeliumTPCnsigHighMin || track.tpcNSigmaHe() > fHeliumTPCnsigHighMax)) - return false; - - // DCA - if (TMath::Abs(track.dcaXY()) > fHeliumDCAxy) - return false; - if (TMath::Abs(track.dcaZ()) > fHeliumDCAz) - return false; - - // TOF - if (track.pt() < fHeliumTPCTOFpT && (track.tofNSigmaHe() < fHeliumTOFnsigLowMin || track.tofNSigmaHe() > fHeliumTOFnsigLowMax)) - return false; - if (track.pt() > fHeliumTPCTOFpT && (track.tofNSigmaHe() < fHeliumTOFnsigHighMin || track.tofNSigmaHe() > fHeliumTOFnsigHighMax)) - return false; + if (fDeuteronAnalysis) { + if (tightCuts) { // for correlation function + // TPC + if (track.pt() < fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fNucleiTPCnsigLowCF) + return false; + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaDe()) > fNucleiTPCnsigHighCF) + return false; + + // DCA + if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fNucleiDCAzCF) + return false; + + // TOF + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fNucleiTOFnsigCF) + return false; + } else { // for yields + // 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; + + // TOF + 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 + // TPC + if (track.pt() < fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fNucleiTPCnsigLowCF) + return false; + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tpcNSigmaHe()) > fNucleiTPCnsigHighCF) + return false; + + // DCA + if (TMath::Abs(track.dcaXY()) > fNucleiDCAxyCF) + return false; + if (TMath::Abs(track.dcaZ()) > fNucleiDCAzCF) + return false; + + // TOF + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fNucleiTOFnsigCF) + return false; + } else { // for yields + // 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; + + // TOF + if (track.pt() > fNucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fNucleiTOFnsigYield) + return false; + } + } return true; } template - bool isAntihelium(const T& track) + bool isAntinucleus(const T& track, bool tightCuts) { if (track.sign() > 0) return false; - // TPC - if (track.pt() < fAntiheliumTPCTOFpT && (track.tpcNSigmaHe() < fAntiheliumTPCnsigLowMin || track.tpcNSigmaHe() > fAntiheliumTPCnsigLowMax)) - return false; - if (track.pt() > fAntiheliumTPCTOFpT && (track.tpcNSigmaHe() < fAntiheliumTPCnsigHighMin || track.tpcNSigmaHe() > fAntiheliumTPCnsigHighMax)) - return false; - - // DCA - if (TMath::Abs(track.dcaXY()) > fAntiheliumDCAxy) - return false; - if (TMath::Abs(track.dcaZ()) > fAntiheliumDCAz) - return false; - - // TOF - if (track.pt() < fAntiheliumTPCTOFpT && (track.tofNSigmaHe() < fAntiheliumTOFnsigLowMin || track.tofNSigmaHe() > fAntiheliumTOFnsigLowMax)) - return false; - if (track.pt() > fAntiheliumTPCTOFpT && (track.tofNSigmaHe() < fAntiheliumTOFnsigHighMin || track.tofNSigmaHe() > fAntiheliumTOFnsigHighMax)) - return false; + if (fDeuteronAnalysis) { + if (tightCuts) { // for correlation function + // 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; + + // TOF + if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fAntinucleiTOFnsigCF) + return false; + } else { // for yields + // 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; + + // TOF + if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaDe()) > fAntinucleiTOFnsigYield) + return false; + } + } else { + if (tightCuts) { // for correlation function - including for antihelium just in case, but realistically, angular correlations won't be a thing here + // 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; + + // TOF + if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fAntinucleiTOFnsigCF) + return false; + } else { // for yields + // 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; + + // TOF + if (track.pt() > fAntinucleiTPCTOFpT && TMath::Abs(track.tofNSigmaHe()) > fAntinucleiTOFnsigYield) + return false; + } + } return true; } @@ -498,7 +593,7 @@ struct AngularCorrelationsInJets { if (std::isnan(buffer.at(i).first)) continue; if (buffer.at(i).first > 2 * TMath::Pi() || buffer.at(i).first < -2 * TMath::Pi()) { - registryData.fill(HIST("hTrackProtocol"), 12); + registryData.fill(HIST("hTrackProtocol"), 16); continue; } @@ -511,6 +606,14 @@ struct AngularCorrelationsInJets { double DeltaEta = etaToAxis - buffer.at(i).second; switch (particleType) { + case -1: + registryData.fill(HIST("hDeltaPhiMEFull"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaMEFull"), DeltaPhi, DeltaEta); + break; + case 0: + registryData.fill(HIST("hDeltaPhiMEJet"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaMEJet"), DeltaPhi, DeltaEta); + break; case 1: registryData.fill(HIST("hDeltaPhiMEProton"), DeltaPhi); registryData.fill(HIST("hDeltaPhiEtaMEProton"), DeltaPhi, DeltaEta); @@ -520,12 +623,12 @@ struct AngularCorrelationsInJets { registryData.fill(HIST("hDeltaPhiEtaMEAntiproton"), DeltaPhi, DeltaEta); break; case 3: - registryData.fill(HIST("hDeltaPhiMEDeuteron"), DeltaPhi); - registryData.fill(HIST("hDeltaPhiEtaMEDeuteron"), DeltaPhi, DeltaEta); + registryData.fill(HIST("hDeltaPhiMENuclei"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaMENuclei"), DeltaPhi, DeltaEta); break; case 4: - registryData.fill(HIST("hDeltaPhiMEAntideuteron"), DeltaPhi); - registryData.fill(HIST("hDeltaPhiEtaMEAntideuteron"), DeltaPhi, DeltaEta); + registryData.fill(HIST("hDeltaPhiMEAntinuclei"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaMEAntinuclei"), DeltaPhi, DeltaEta); break; } } // for (int i = 0; i < static_cast(buffer.size()); i++) @@ -541,23 +644,31 @@ struct AngularCorrelationsInJets { double phiToAxis = TVector2::Phi_0_2pi(particleVector.at(i).phi() - jetAxis.Phi()); double etaToAxis = particleVector.at(i).eta() - jetAxis.Eta(); if (TMath::Abs(particleVector.at(i).phi()) > 2 * TMath::Pi()) { - registryData.fill(HIST("hTrackProtocol"), 10); + registryData.fill(HIST("hTrackProtocol"), 14); continue; } for (int j = i + 1; j < static_cast(particleVector.size()); j++) { if ((j == static_cast(particleVector.size())) || std::isnan(particleVector.at(j).phi())) continue; if (TMath::Abs(particleVector.at(j).phi()) > 2 * TMath::Pi()) { - registryData.fill(HIST("hTrackProtocol"), 11); + registryData.fill(HIST("hTrackProtocol"), 15); continue; } double DeltaPhi = TVector2::Phi_0_2pi(particleVector.at(i).phi() - particleVector.at(j).phi()); - double DeltaEta = TMath::Abs(particleVector.at(i).eta() - particleVector[j].eta()); + double DeltaEta = particleVector.at(i).eta() - particleVector[j].eta(); if (DeltaPhi > (1.5 * TMath::Pi())) { DeltaPhi = DeltaPhi - 2 * TMath::Pi(); } switch (particleType) { + case -1: + registryData.fill(HIST("hDeltaPhiSEFull"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaSEFull"), DeltaPhi, DeltaEta); + break; + case 0: + registryData.fill(HIST("hDeltaPhiSEJet"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaSEJet"), DeltaPhi, DeltaEta); + break; case 1: registryData.fill(HIST("hDeltaPhiSEProton"), DeltaPhi); registryData.fill(HIST("hDeltaPhiEtaSEProton"), DeltaPhi, DeltaEta); @@ -567,12 +678,12 @@ struct AngularCorrelationsInJets { registryData.fill(HIST("hDeltaPhiEtaSEAntiproton"), DeltaPhi, DeltaEta); break; case 3: - registryData.fill(HIST("hDeltaPhiSEDeuteron"), DeltaPhi); - registryData.fill(HIST("hDeltaPhiEtaSEDeuteron"), DeltaPhi, DeltaEta); + registryData.fill(HIST("hDeltaPhiSENuclei"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaSENuclei"), DeltaPhi, DeltaEta); break; case 4: - registryData.fill(HIST("hDeltaPhiSEAntideuteron"), DeltaPhi); - registryData.fill(HIST("hDeltaPhiEtaSEAntideuteron"), DeltaPhi, DeltaEta); + registryData.fill(HIST("hDeltaPhiSEAntinuclei"), DeltaPhi); + registryData.fill(HIST("hDeltaPhiEtaSEAntinuclei"), DeltaPhi, DeltaEta); break; } } @@ -647,150 +758,64 @@ struct AngularCorrelationsInJets { return; } - template - void fillHistogramsRun2(T const& collision, U const& allTracks) + int analyseJet(int jetCounter, fastjet::PseudoJet jet, const auto& particles, auto& jetProtons, auto& jetAntiprotons, auto& jetNuclei, auto& jetAntinuclei, auto& jetAll, double rho, double rhoM, double rhoPerp, double rhoMPerp) { - std::vector> fTempBufferProton; - std::vector> fTempBufferAntiproton; - std::vector> fTempBufferDeuteron; - std::vector> fTempBufferAntideuteron; - fTempBufferProton.clear(); - fTempBufferAntiproton.clear(); - fTempBufferDeuteron.clear(); - fTempBufferAntideuteron.clear(); - std::vector jetInput; - std::map particles; - jetInput.clear(); - particles.clear(); - int index = 0; - int leadingID = 0; - fastjet::PseudoJet hardestJet(0., 0., 0., 0.); - fastjet::PseudoJet subtractedJet(0., 0., 0., 0.); - std::vector jets; - std::vector constituents; - jets.clear(); - constituents.clear(); - - auto tracks = allTracks.sliceBy(perCollisionFullTracksRun2, collision.globalIndex()); - - for (const auto& track : tracks) { - if (!selectTrack(track)) - 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); - } else { - mass = 0.139; // pion mass as default, ~80% are pions - registryData.fill(HIST("hTrackProtocol"), 2); - } - - if (track.pt() > fMinLeadingPt) { - leadingID = track.globalIndex(); - } - - if (track.tpcNClsFindable() != 0) { - registryQA.fill(HIST("hRatioCrossedRowsTPC"), track.pt(), track.tpcNClsCrossedRows() / track.tpcNClsFindable()); - } - registryQA.fill(HIST("hPtFullEvent"), track.pt()); - registryQA.fill(HIST("hEtaFullEvent"), track.eta()); - registryQA.fill(HIST("hCrossedRowsTPC"), track.pt(), track.tpcNClsCrossedRows()); - registryQA.fill(HIST("hClusterITS"), track.pt(), track.itsNCls()); - registryQA.fill(HIST("hClusterTPC"), track.pt(), track.tpcNClsFound()); - registryQA.fill(HIST("hChi2ITS"), track.pt(), track.itsChi2NCl()); - registryQA.fill(HIST("hChi2TPC"), track.pt(), track.tpcChi2NCl()); - registryQA.fill(HIST("hDCAxyFullEvent"), track.pt(), track.dcaXY()); - registryQA.fill(HIST("hDCAzFullEvent"), track.pt(), track.dcaZ()); - fastjet::PseudoJet inputPseudoJet(track.px(), track.py(), track.pz(), track.energy(mass)); - inputPseudoJet.set_user_index(index); - particles[index] = track; - jetInput.emplace_back(inputPseudoJet); - - index++; - } // for (const auto& track : tracks) - - if (jetInput.size() < 2) - return; - registryData.fill(HIST("hEventProtocol"), 2); - - // Reconstruct Jets - double ghost_maxrap = 1.0; - double ghost_area = 0.005; - int ghost_repeat = 1; - fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, fJetR); - fastjet::JetDefinition jetDefBkg(fastjet::kt_algorithm, 0.5); - fastjet::AreaDefinition areaDef(fastjet::active_area, fastjet::GhostedAreaSpec(ghost_maxrap, ghost_repeat, ghost_area)); - fastjet::AreaDefinition areaDefBkg(fastjet::active_area_explicit_ghosts, fastjet::GhostedAreaSpec(ghost_maxrap)); - fastjet::ClusterSequenceArea clusterSeq(jetInput, jetDef, areaDef); - jets = sorted_by_pt(clusterSeq.inclusive_jets()); - - if (jets.size() == 0) - return; - - registryData.fill(HIST("hEventProtocol"), 3); - - hardestJet = jets[0]; - - if (hardestJet.pt() < fMinJetPt) - return; + if (!jet.has_constituents()) + return jetCounter; + fastjet::PseudoJet subtractedJetPerp(0., 0., 0., 0.); + subtractedJetPerp = bkgSub.doRhoAreaSub(jet, rhoPerp, rhoMPerp); + fastjet::PseudoJet subtractedJetArea(0., 0., 0., 0.); + subtractedJetArea = bkgSub.doRhoAreaSub(jet, rho, rhoM); + + 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); + registryQA.fill(HIST("hRhoMEstimatePerp"), jet.pt(), rhoMPerp); + double jetBkgDeltaPt = jet.pt() - subtractedJetPerp.pt(); + registryQA.fill(HIST("hJetBkgDeltaPt"), jetBkgDeltaPt); registryData.fill(HIST("hEventProtocol"), 4); - if (hardestJet.constituents().size() < 2) - return; + std::vector constituents = jet.constituents(); registryData.fill(HIST("hEventProtocol"), 5); registryData.fill(HIST("hNumberOfJets"), 0); - registryData.fill(HIST("hPtTotalJet"), hardestJet.pt()); - registryData.fill(HIST("hJetRapidity"), hardestJet.rap()); - registryData.fill(HIST("hNumPartInJet"), hardestJet.constituents().size()); + registryData.fill(HIST("hPtTotalJet"), jet.pt()); + registryData.fill(HIST("hJetRapidity"), jet.rap()); + registryData.fill(HIST("hNumPartInJet"), jet.constituents().size()); + registryQA.fill(HIST("hJetPtVsNumPart"), jet.pt(), jet.constituents().size()); - for (const auto& constituent : hardestJet.constituents()) { + double maxRadius = 0; + for (const auto& constituent : constituents) { registryData.fill(HIST("hPtJetParticle"), constituent.pt()); - if (std::isnan(constituent.phi()) || std::isnan(hardestJet.phi())) + registryQA.fill(HIST("hPhiJet"), constituent.phi()); + registryQA.fill(HIST("hPhiPtJet"), constituent.pt(), constituent.phi()); + registryQA.fill(HIST("hEtaJet"), constituent.eta()); + registryQA.fill(HIST("hEtaPtJet"), constituent.pt(), constituent.eta()); + + if (std::isnan(constituent.phi()) || std::isnan(jet.phi())) // geometric jet cone continue; - double DeltaPhi = TVector2::Phi_0_2pi(constituent.phi() - hardestJet.phi()); - double DeltaEta = constituent.eta() - hardestJet.eta(); + 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); - registryData.fill(HIST("hJetConeRadius"), Delta); - } - - fastjet::Selector selector = fastjet::SelectorAbsEtaMax(1.0) * (!fastjet::SelectorNHardest(2)); // TODO: fix subtraction - fastjet::JetMedianBackgroundEstimator bkgEst(selector, jetDefBkg, areaDefBkg); - fastjet::Subtractor subtractor(&bkgEst); - subtractor.set_use_rho_m(true); - bkgEst.set_particles(jetInput); - - subtractedJet = subtractor(hardestJet); - if (subtractedJet.has_constituents()) { - for (const auto& subConstituent : subtractedJet.constituents()) { - registryData.fill(HIST("hPtSubtractedJet"), subConstituent.pt()); - } + registryQA.fill(HIST("hJetConeRadius"), Delta); + if (Delta > maxRadius) + maxRadius = Delta; } - - if (!hardestJet.has_constituents()) - return; - constituents = hardestJet.constituents(); + registryQA.fill(HIST("hMaxRadiusVsPt"), jet.pt(), maxRadius); // no entries - weird! // QA for comparison with nuclei_in_jets - const auto& leadingTrack = tracks.iteratorAt(leadingID); - TVector3 pLeading(leadingTrack.px(), leadingTrack.py(), leadingTrack.pz()); - TVector3 pJet(hardestJet.px(), hardestJet.py(), hardestJet.pz()); + TVector3 pJet(0., 0., 0.); + pJet.SetXYZ(jet.px(), jet.py(), jet.pz()); TVector3 UEAxis1(0.0, 0.0, 0.0); TVector3 UEAxis2(0.0, 0.0, 0.0); getPerpendicularAxis(pJet, UEAxis1, +1.0); getPerpendicularAxis(pJet, UEAxis2, -1.0); - if (UEAxis1.Mag() == 0 || UEAxis2.Mag() == 0) - return; - double deltaEta = pLeading.Eta() - pJet.Eta(); - double deltaPhi = getDeltaPhi(pLeading.Phi(), pJet.Phi()); - registryQA.fill(HIST("hPtLeading"), leadingTrack.pt()); - registryQA.fill(HIST("hPhiLeading"), leadingTrack.phi()); - registryQA.fill(HIST("hEtaLeading"), leadingTrack.eta()); - registryQA.fill(HIST("hAngleJetLeadingTrack"), (180.0 / TMath::Pi()) * pLeading.Angle(pJet)); - if (deltaPhi != -999) - registryQA.fill(HIST("hDeltaEtadeltaPhiLeadingJet"), deltaEta, deltaPhi); double NchJetPlusUE(0); double NchJet(0); @@ -814,21 +839,18 @@ struct AngularCorrelationsInJets { if (deltaRJet < fRmax) { if (deltaPhiJet != -999) registryQA.fill(HIST("hDeltaEtadeltaPhiJet"), deltaEtaJet, deltaPhiJet); - registryQA.fill(HIST("hRJet"), deltaRJet); NchJetPlusUE++; ptJetPlusUE = ptJetPlusUE + track.pt(); } if (deltaRUE1 < fRmax) { if (deltaPhiUE1 != -999) registryQA.fill(HIST("hDeltaEtadeltaPhiUE"), deltaEtaUE1, deltaPhiUE1); - registryQA.fill(HIST("hRUE"), deltaRUE1); NchUE++; ptUE = ptUE + track.pt(); } if (deltaRUE2 < fRmax) { if (deltaPhiUE2 != -999) registryQA.fill(HIST("hDeltaEtadeltaPhiUE"), deltaEtaUE2, deltaPhiUE2); - registryQA.fill(HIST("hRUE"), deltaRUE2); NchUE++; ptUE = ptUE + track.pt(); } @@ -842,100 +864,169 @@ struct AngularCorrelationsInJets { registryQA.fill(HIST("hPtJetPlusUE"), ptJetPlusUE); registryQA.fill(HIST("hPtJet"), ptJet); registryQA.fill(HIST("hPtUE"), 0.5 * ptUE); - registryQA.fill(HIST("hDeltaJetPt"), hardestJet.pt() - ptJetPlusUE); + registryQA.fill(HIST("hDeltaJetPt"), jet.pt() - ptJetPlusUE); int nPartClusteredJet = static_cast(constituents.size()); // Fill QA Histograms - if (ptJetPlusUE < fMinJetPt) { + if (ptJetPlusUE < fMinJetPt) { // swap for sub pt? registryQA.fill(HIST("hNParticlesClusteredInJet"), nPartClusteredJet); - double dEta = pLeading.Eta() - pJet.Eta(); - double dPhi = getDeltaPhi(pLeading.Phi(), pJet.Phi()); - if (dPhi != -999) - registryQA.fill(HIST("hDeltaEtaDeltaPhiJetAxisLeading"), dEta, dPhi); for (const auto& track : constituents) { - TVector3 particleDir(track.px(), track.py(), track.pz()); - double dEta = particleDir.Eta() - pJet.Eta(); - double dPhi = getDeltaPhi(particleDir.Phi(), pJet.Phi()); registryQA.fill(HIST("hPtParticlesClusteredInJet"), track.pt()); - if (dPhi != -999) - registryQA.fill(HIST("hDeltaEtaDeltaPhiJetAxis"), dEta, dPhi); } } - std::vector jetProtons; - std::vector jetAntiprotons; - std::vector jetDeuterons; - std::vector jetAntideuterons; - std::vector jetHelium; - std::vector jetAntihelium; + std::vector> fTempBufferProton; + std::vector> fTempBufferAntiproton; + std::vector> fTempBufferNuclei; + std::vector> fTempBufferAntinuclei; + std::vector> fTempBufferJet; + fTempBufferProton.clear(); + fTempBufferAntiproton.clear(); + fTempBufferNuclei.clear(); + fTempBufferAntinuclei.clear(); + fTempBufferJet.clear(); - for (int i = 0; i < static_cast(constituents.size()); i++) { + for (int i = 0; i < static_cast(constituents.size()); i++) { // analyse jet constituents - this is where the magic happens registryData.fill(HIST("hTrackProtocol"), 3); fastjet::PseudoJet pseudoParticle = constituents.at(i); int id = pseudoParticle.user_index(); - const auto& jetParticle = particles[id]; + const auto& jetParticle = particles.at(id); + jetAll.emplace_back(jetParticle); 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()); - + registryData.fill(HIST("hTOFsignalProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaPr()); + } + registryData.fill(HIST("hTPCsignalProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaPr()); + if (fDeuteronAnalysis) { + registryData.fill(HIST("hTPCsignalNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaDe()); + if (jetParticle.hasTOF()) + registryData.fill(HIST("hTOFsignalNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaDe()); + } else { + registryData.fill(HIST("hTPCsignalNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaHe()); + if (jetParticle.hasTOF()) + registryData.fill(HIST("hTOFsignalNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaHe()); + } double ptDiff = pseudoParticle.pt() - jetParticle.pt(); - registryData.fill(HIST("hPtDiff"), ptDiff); + registryQA.fill(HIST("hPtDiff"), ptDiff); if (jetParticle.pt() < fMinJetParticlePt) continue; - if (isProton(jetParticle) || isAntiproton(jetParticle)) { // collect (anti)protons in jet - registryData.fill(HIST("hPtJetProton"), jetParticle.pt() * jetParticle.sign()); + if (isProton(jetParticle, false)) { // collect protons in jet + registryData.fill(HIST("hPtJetProton"), jetParticle.pt()); + if (subtractedJetPerp.pt() < 15) { + registryQA.fill(HIST("hPtJetProton_15"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 20) { + registryQA.fill(HIST("hPtJetProton_20"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 30) { + registryQA.fill(HIST("hPtJetProton_30"), jetParticle.pt()); + } 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()); - if (isProton(jetParticle)) { - registryData.fill(HIST("hTrackProtocol"), 4); // # protons + registryData.fill(HIST("hTrackProtocol"), 4); // # protons + if (isProton(jetParticle, true)) { + registryData.fill(HIST("hTrackProtocol"), 5); // # high purity protons jetProtons.emplace_back(jetParticle); registryData.fill(HIST("hDCAzJetProton"), jetParticle.pt(), jetParticle.dcaZ()); - } else { - registryData.fill(HIST("hTrackProtocol"), 5); // # antiprotons + } + } else if (isAntiproton(jetParticle, false)) { // collect antiprotons in jet + registryData.fill(HIST("hPtJetAntiproton"), jetParticle.pt()); + if (subtractedJetPerp.pt() < 15) { + registryQA.fill(HIST("hPtJetAntiproton_15"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 20) { + registryQA.fill(HIST("hPtJetAntiproton_20"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 30) { + registryQA.fill(HIST("hPtJetAntiproton_30"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 50) { + registryQA.fill(HIST("hPtJetAntiproton_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("hTrackProtocol"), 6); // # antiprotons + if (isAntiproton(jetParticle, true)) { + registryData.fill(HIST("hTrackProtocol"), 7); // # high purity antiprotons jetAntiprotons.emplace_back(jetParticle); registryData.fill(HIST("hDCAzJetAntiproton"), jetParticle.pt(), jetParticle.dcaZ()); } - } else if (isDeuteron(jetParticle) || isAntideuteron(jetParticle)) { // collect (anti)deuterons in jet - registryData.fill(HIST("hPtJetDeuteron"), jetParticle.pt() * jetParticle.sign()); - registryData.fill(HIST("hTPCnsigmaDeuteron"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaDe()); - if (jetParticle.hasTOF()) - registryData.fill(HIST("hTOFnsigmaDeuteron"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaDe()); - if (isDeuteron(jetParticle)) { - registryData.fill(HIST("hTrackProtocol"), 6); // # deuterons - jetDeuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetDeuteron"), jetParticle.pt(), jetParticle.dcaZ()); + } else if (isNucleus(jetParticle, false)) { // collect nuclei in jet + registryData.fill(HIST("hPtJetNuclei"), jetParticle.pt()); + if (subtractedJetPerp.pt() < 15) { + registryQA.fill(HIST("hPtJetNuclei_15"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 20) { + registryQA.fill(HIST("hPtJetNuclei_20"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 30) { + registryQA.fill(HIST("hPtJetNuclei_30"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 50) { + registryQA.fill(HIST("hPtJetNuclei_50"), jetParticle.pt()); + } + if (fDeuteronAnalysis) { + registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaDe()); } else { - registryData.fill(HIST("hTrackProtocol"), 7); // # antideuterons - jetAntideuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetAntideuteron"), jetParticle.pt(), jetParticle.dcaZ()); + registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaHe()); } - } else if (isHelium(jetParticle) || isAntihelium(jetParticle)) { // collect (anti)helium in jet - registryData.fill(HIST("hPtJetHelium"), jetParticle.pt() * jetParticle.sign()); - registryData.fill(HIST("hTPCnsigmaHelium"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaHe()); - if (jetParticle.hasTOF()) - registryData.fill(HIST("hTOFnsigmaHelium"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaHe()); - if (isHelium(jetParticle)) { - registryData.fill(HIST("hTrackProtocol"), 8); // # helium - jetDeuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetHelium"), jetParticle.pt(), jetParticle.dcaZ()); + if (jetParticle.hasTOF()) { + if (fDeuteronAnalysis) { + registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaDe()); + } else { + registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaHe()); + } + } + registryData.fill(HIST("hTrackProtocol"), 8); // # nuclei + if (isNucleus(jetParticle, true)) { + registryData.fill(HIST("hTrackProtocol"), 9); // # high purity nuclei + jetNuclei.emplace_back(jetParticle); + registryData.fill(HIST("hDCAzJetNuclei"), jetParticle.pt(), jetParticle.dcaZ()); + } + } else if (isAntinucleus(jetParticle, false)) { + registryData.fill(HIST("hPtJetAntinuclei"), jetParticle.pt()); + if (subtractedJetPerp.pt() < 15) { + registryQA.fill(HIST("hPtJetAntinuclei_15"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 20) { + registryQA.fill(HIST("hPtJetAntinuclei_20"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 30) { + registryQA.fill(HIST("hPtJetAntinuclei_30"), jetParticle.pt()); + } else if (subtractedJetPerp.pt() < 50) { + registryQA.fill(HIST("hPtJetAntinuclei_50"), jetParticle.pt()); + } + if (fDeuteronAnalysis) { + registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaDe()); } else { - registryData.fill(HIST("hTrackProtocol"), 9); // # antihelium - jetAntideuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetAntihelium"), jetParticle.pt(), jetParticle.dcaZ()); + registryData.fill(HIST("hTPCnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaHe()); + } + if (jetParticle.hasTOF()) { + if (fDeuteronAnalysis) { + registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaDe()); + } else { + registryData.fill(HIST("hTOFnsigmaNuclei"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaHe()); + } + } + registryData.fill(HIST("hTrackProtocol"), 10); // # antinuclei + if (isAntinucleus(jetParticle, true)) { + registryData.fill(HIST("hTrackProtocol"), 11); // # high purity antinuclei + jetAntinuclei.emplace_back(jetParticle); + registryData.fill(HIST("hDCAzJetAntinuclei"), jetParticle.pt(), jetParticle.dcaZ()); } } } // for (int i=0; i(constituents.size()); i++) - if ((jetProtons.size() < 2) && (jetAntiprotons.size() < 2) && (jetDeuterons.size() < 2) && (jetAntideuterons.size() < 2)) - return; + if (jetAll.size() > 1) { // general correlation function + doCorrelations(jetAll, fBufferJet, fTempBufferJet, 0, pJet); + setTrackBuffer(fTempBufferJet, fBufferJet); + } + jetCounter++; + + if ((jetProtons.size() < 2) && (jetAntiprotons.size() < 2) && (jetNuclei.size() < 2) && (jetAntinuclei.size() < 2)) + return jetCounter; registryData.fill(HIST("hEventProtocol"), 6); if (jetProtons.size() > 1) { @@ -946,65 +1037,64 @@ struct AngularCorrelationsInJets { doCorrelations(jetAntiprotons, fBufferAntiproton, fTempBufferAntiproton, 2, pJet); setTrackBuffer(fTempBufferAntiproton, fBufferAntiproton); } - if (jetDeuterons.size() > 1) { - doCorrelations(jetDeuterons, fBufferDeuteron, fTempBufferDeuteron, 3, pJet); - setTrackBuffer(fTempBufferDeuteron, fBufferDeuteron); + if (jetNuclei.size() > 1) { + doCorrelations(jetNuclei, fBufferNuclei, fTempBufferNuclei, 3, pJet); + setTrackBuffer(fTempBufferNuclei, fBufferNuclei); } - if (jetAntideuterons.size() > 1) { - doCorrelations(jetAntideuterons, fBufferAntideuteron, fTempBufferAntideuteron, 4, pJet); - setTrackBuffer(fTempBufferAntideuteron, fBufferAntideuteron); + if (jetAntinuclei.size() > 1) { + doCorrelations(jetAntinuclei, fBufferAntinuclei, fTempBufferAntinuclei, 4, pJet); + setTrackBuffer(fTempBufferAntinuclei, fBufferAntinuclei); } + return jetCounter; } - template - void fillHistogramsRun3(T const& collision, U const& allTracks) + template + void fillHistograms(U const& tracks) { - std::vector> fTempBufferProton; - std::vector> fTempBufferAntiproton; - std::vector> fTempBufferDeuteron; - std::vector> fTempBufferAntideuteron; - fTempBufferProton.clear(); - fTempBufferAntiproton.clear(); - fTempBufferDeuteron.clear(); - fTempBufferAntideuteron.clear(); - std::vector jetInput; - std::map particles; + std::vector jetProtons; + std::vector jetAntiprotons; + std::vector jetNuclei; + std::vector jetAntinuclei; + std::vector jetAll; + std::vector> fTempBufferFull; + fTempBufferFull.clear(); + std::vector jetInput; // input for jet finder + std::map particles; // all selected particles in event + std::vector particlesForCF; // particles for full event angular correlations jetInput.clear(); particles.clear(); int index = 0; - int leadingID = 0; + int jetCounter = 0; + // int leadingID = 0; std::vector jets; - std::vector constituents; jets.clear(); - constituents.clear(); - fastjet::PseudoJet hardestJet(0., 0., 0., 0.); - fastjet::PseudoJet subtractedJet(0., 0., 0., 0.); - - auto tracks = allTracks.sliceBy(perCollisionFullTracksRun2, collision.globalIndex()); for (const auto& track : tracks) { if (!selectTrack(track)) 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; } - if (track.pt() > fMinLeadingPt) { - leadingID = track.globalIndex(); - } + // if (track.pt() > fMinLeadingPt) { + // leadingID = track.globalIndex(); + // } if (track.tpcNClsFindable() != 0) { registryQA.fill(HIST("hRatioCrossedRowsTPC"), track.pt(), track.tpcNClsCrossedRows() / track.tpcNClsFindable()); } registryQA.fill(HIST("hPtFullEvent"), track.pt()); - registryQA.fill(HIST("hEtaFullEvent"), track.eta()); registryQA.fill(HIST("hCrossedRowsTPC"), track.pt(), track.tpcNClsCrossedRows()); registryQA.fill(HIST("hClusterITS"), track.pt(), track.itsNCls()); registryQA.fill(HIST("hClusterTPC"), track.pt(), track.tpcNClsFound()); @@ -1012,9 +1102,15 @@ struct AngularCorrelationsInJets { registryQA.fill(HIST("hChi2TPC"), track.pt(), track.tpcChi2NCl()); registryQA.fill(HIST("hDCAxyFullEvent"), track.pt(), track.dcaXY()); registryQA.fill(HIST("hDCAzFullEvent"), track.pt(), track.dcaZ()); + registryQA.fill(HIST("hPhiFullEvent"), track.phi()); + registryQA.fill(HIST("hPhiPtFullEvent"), track.pt(), track.phi()); + registryQA.fill(HIST("hEtaFullEvent"), track.eta()); + registryQA.fill(HIST("hEtaPtFullEvent"), track.pt(), track.eta()); + fastjet::PseudoJet inputPseudoJet(track.px(), track.py(), track.pz(), track.energy(mass)); inputPseudoJet.set_user_index(index); particles[index] = track; + particlesForCF.emplace_back(track); jetInput.emplace_back(inputPseudoJet); index++; @@ -1040,230 +1136,18 @@ struct AngularCorrelationsInJets { registryData.fill(HIST("hEventProtocol"), 3); - hardestJet = jets[0]; - - if (hardestJet.pt() < fMinJetPt) - return; - - registryData.fill(HIST("hEventProtocol"), 4); - if (hardestJet.constituents().size() < 2) - return; - - registryData.fill(HIST("hEventProtocol"), 5); - registryData.fill(HIST("hNumberOfJets"), 0); - registryData.fill(HIST("hPtTotalJet"), hardestJet.pt()); - registryData.fill(HIST("hJetRapidity"), hardestJet.rap()); - registryData.fill(HIST("hNumPartInJet"), hardestJet.constituents().size()); - - for (const auto& constituent : hardestJet.constituents()) { - registryData.fill(HIST("hPtJetParticle"), constituent.pt()); - if (std::isnan(constituent.phi()) || std::isnan(hardestJet.phi())) - continue; - double DeltaPhi = TVector2::Phi_0_2pi(constituent.phi() - hardestJet.phi()); - double DeltaEta = constituent.eta() - hardestJet.eta(); - double Delta = TMath::Sqrt(DeltaPhi * DeltaPhi + DeltaEta * DeltaEta); - registryData.fill(HIST("hJetConeRadius"), Delta); - } - - fastjet::Selector selector = fastjet::SelectorAbsEtaMax(1.0) * (!fastjet::SelectorNHardest(2)); // TODO: fix subtraction - fastjet::JetMedianBackgroundEstimator bkgEst(selector, jetDefBkg, areaDefBkg); - fastjet::Subtractor subtractor(&bkgEst); - subtractor.set_use_rho_m(true); - bkgEst.set_particles(jetInput); - - subtractedJet = subtractor(hardestJet); - if (subtractedJet.has_constituents()) { - for (const auto& subConstituent : subtractedJet.constituents()) { - registryData.fill(HIST("hPtSubtractedJet"), subConstituent.pt()); - } - } - - if (!hardestJet.has_constituents()) - return; - constituents = hardestJet.constituents(); - - // QA for comparison with nuclei_in_jets - const auto& leadingTrack = tracks.iteratorAt(leadingID); - TVector3 pLeading(leadingTrack.px(), leadingTrack.py(), leadingTrack.pz()); - TVector3 pJet(hardestJet.px(), hardestJet.py(), hardestJet.pz()); - TVector3 UEAxis1(0.0, 0.0, 0.0); - TVector3 UEAxis2(0.0, 0.0, 0.0); - getPerpendicularAxis(pJet, UEAxis1, +1.0); - getPerpendicularAxis(pJet, UEAxis2, -1.0); - if (UEAxis1.Mag() == 0 || UEAxis2.Mag() == 0) - return; - double deltaEta = pLeading.Eta() - pJet.Eta(); - double deltaPhi = getDeltaPhi(pLeading.Phi(), pJet.Phi()); - registryQA.fill(HIST("hPtLeading"), leadingTrack.pt()); - registryQA.fill(HIST("hPhiLeading"), leadingTrack.phi()); - registryQA.fill(HIST("hEtaLeading"), leadingTrack.eta()); - registryQA.fill(HIST("hAngleJetLeadingTrack"), (180.0 / TMath::Pi()) * pLeading.Angle(pJet)); - if (deltaPhi != -999) - registryQA.fill(HIST("hDeltaEtadeltaPhiLeadingJet"), deltaEta, deltaPhi); - - double NchJetPlusUE(0); - double NchJet(0); - double NchUE(0); - double ptJetPlusUE(0); - double ptJet(0); - double ptUE(0); - - for (const auto& [index, track] : particles) { - TVector3 particleDir(track.px(), track.py(), track.pz()); - double deltaEtaJet = particleDir.Eta() - pJet.Eta(); - double deltaPhiJet = getDeltaPhi(particleDir.Phi(), pJet.Phi()); - double deltaRJet = sqrt(deltaEtaJet * deltaEtaJet + deltaPhiJet * deltaPhiJet); - double deltaEtaUE1 = particleDir.Eta() - UEAxis1.Eta(); - double deltaPhiUE1 = getDeltaPhi(particleDir.Phi(), UEAxis1.Phi()); - double deltaRUE1 = sqrt(deltaEtaUE1 * deltaEtaUE1 + deltaPhiUE1 * deltaPhiUE1); - double deltaEtaUE2 = particleDir.Eta() - UEAxis2.Eta(); - double deltaPhiUE2 = getDeltaPhi(particleDir.Phi(), UEAxis2.Phi()); - double deltaRUE2 = sqrt(deltaEtaUE2 * deltaEtaUE2 + deltaPhiUE2 * deltaPhiUE2); - - if (deltaRJet < fRmax) { - if (deltaPhiJet != -999) - registryQA.fill(HIST("hDeltaEtadeltaPhiJet"), deltaEtaJet, deltaPhiJet); - registryQA.fill(HIST("hRJet"), deltaRJet); - NchJetPlusUE++; - ptJetPlusUE = ptJetPlusUE + track.pt(); - } - if (deltaRUE1 < fRmax) { - if (deltaPhiUE1 != -999) - registryQA.fill(HIST("hDeltaEtadeltaPhiUE"), deltaEtaUE1, deltaPhiUE1); - registryQA.fill(HIST("hRUE"), deltaRUE1); - NchUE++; - ptUE = ptUE + track.pt(); - } - if (deltaRUE2 < fRmax) { - if (deltaPhiUE2 != -999) - registryQA.fill(HIST("hDeltaEtadeltaPhiUE"), deltaEtaUE2, deltaPhiUE2); - registryQA.fill(HIST("hRUE"), deltaRUE2); - NchUE++; - ptUE = ptUE + track.pt(); - } - } // for (const auto& [index, track] : particles) - - NchJet = NchJetPlusUE - 0.5 * NchUE; - ptJet = ptJetPlusUE - 0.5 * ptUE; - registryQA.fill(HIST("hMultiplicityJetPlusUE"), NchJetPlusUE); - registryQA.fill(HIST("hMultiplicityJet"), NchJet); - registryQA.fill(HIST("hMultiplicityUE"), 0.5 * NchUE); - registryQA.fill(HIST("hPtJetPlusUE"), ptJetPlusUE); - registryQA.fill(HIST("hPtJet"), ptJet); - registryQA.fill(HIST("hPtUE"), 0.5 * ptUE); - registryQA.fill(HIST("hDeltaJetPt"), hardestJet.pt() - ptJetPlusUE); - - int nPartClusteredJet = static_cast(constituents.size()); + bool doSparse = true; + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(jetInput, doSparse); + auto [rhoPerp, rhoMPerp] = bkgSub.estimateRhoPerpCone(jetInput, jets); - // Fill QA Histograms - if (ptJetPlusUE < fMinJetPt) { - - registryQA.fill(HIST("hNParticlesClusteredInJet"), nPartClusteredJet); - double dEta = pLeading.Eta() - pJet.Eta(); - double dPhi = getDeltaPhi(pLeading.Phi(), pJet.Phi()); - if (dPhi != -999) - registryQA.fill(HIST("hDeltaEtaDeltaPhiJetAxisLeading"), dEta, dPhi); - - for (const auto& track : constituents) { - TVector3 particleDir(track.px(), track.py(), track.pz()); - double dEta = particleDir.Eta() - pJet.Eta(); - double dPhi = getDeltaPhi(particleDir.Phi(), pJet.Phi()); - registryQA.fill(HIST("hPtParticlesClusteredInJet"), track.pt()); - if (dPhi != -999) - registryQA.fill(HIST("hDeltaEtaDeltaPhiJetAxis"), dEta, dPhi); - } + for (const auto& jet : jets) { + jetCounter = analyseJet(jetCounter, jet, particles, jetProtons, jetAntiprotons, jetNuclei, jetAntinuclei, jetAll, rho, rhoM, rhoPerp, rhoMPerp); } + registryData.fill(HIST("hNumJetsInEvent"), jetCounter); - // PID - std::vector jetProtons; // replace with IDs? - std::vector jetAntiprotons; - std::vector jetDeuterons; - std::vector jetAntideuterons; - std::vector jetHelium; - std::vector jetAntihelium; - - for (int i = 0; i < static_cast(constituents.size()); i++) { - registryData.fill(HIST("hTrackProtocol"), 3); - fastjet::PseudoJet pseudoParticle = constituents.at(i); - int id = pseudoParticle.user_index(); - const auto& jetParticle = particles[id]; - - 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()) - registryData.fill(HIST("hTOFsignal"), jetParticle.pt() * jetParticle.sign(), jetParticle.beta()); - - double ptDiff = pseudoParticle.pt() - jetParticle.pt(); - registryData.fill(HIST("hPtDiff"), ptDiff); - - if (jetParticle.pt() < fMinJetParticlePt) - continue; - if (isProton(jetParticle) || isAntiproton(jetParticle)) { // collect (anti)protons in jet - registryData.fill(HIST("hPtJetProton"), jetParticle.pt() * jetParticle.sign()); - registryData.fill(HIST("hTPCnsigmaProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaPr()); - if (jetParticle.hasTOF()) - registryData.fill(HIST("hTOFnsigmaProton"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaPr()); - if (isProton(jetParticle)) { - registryData.fill(HIST("hTrackProtocol"), 4); // # protons - jetProtons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetProton"), jetParticle.pt(), jetParticle.dcaZ()); - } else { - registryData.fill(HIST("hTrackProtocol"), 5); // # antiprotons - jetAntiprotons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetAntiproton"), jetParticle.pt(), jetParticle.dcaZ()); - } - } else if (isDeuteron(jetParticle) || isAntideuteron(jetParticle)) { // collect (anti)deuterons in jet - registryData.fill(HIST("hPtJetDeuteron"), jetParticle.pt() * jetParticle.sign()); - registryData.fill(HIST("hTPCnsigmaDeuteron"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaDe()); - if (jetParticle.hasTOF()) - registryData.fill(HIST("hTOFnsigmaDeuteron"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaDe()); - if (isDeuteron(jetParticle)) { - registryData.fill(HIST("hTrackProtocol"), 6); // # deuterons - jetDeuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetDeuteron"), jetParticle.pt(), jetParticle.dcaZ()); - } else { - registryData.fill(HIST("hTrackProtocol"), 7); // # antideuterons - jetAntideuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetAntideuteron"), jetParticle.pt(), jetParticle.dcaZ()); - } - } else if (isHelium(jetParticle) || isAntihelium(jetParticle)) { // collect (anti)helium in jet - registryData.fill(HIST("hPtJetHelium"), jetParticle.pt() * jetParticle.sign()); - registryData.fill(HIST("hTPCnsigmaHelium"), jetParticle.pt() * jetParticle.sign(), jetParticle.tpcNSigmaHe()); - if (jetParticle.hasTOF()) - registryData.fill(HIST("hTOFnsigmaHelium"), jetParticle.pt() * jetParticle.sign(), jetParticle.tofNSigmaHe()); - if (isHelium(jetParticle)) { - registryData.fill(HIST("hTrackProtocol"), 8); // # deuterons - jetDeuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetHelium"), jetParticle.pt(), jetParticle.dcaZ()); - } else { - registryData.fill(HIST("hTrackProtocol"), 9); // # antideuterons - jetAntideuterons.emplace_back(jetParticle); - registryData.fill(HIST("hDCAzJetAntihelium"), jetParticle.pt(), jetParticle.dcaZ()); - } - } - } // for (int i=0; i(constituents.size()); i++) - - if ((jetProtons.size() < 2) && (jetAntiprotons.size() < 2) && (jetDeuterons.size() < 2) && (jetAntideuterons.size() < 2)) - return; - registryData.fill(HIST("hEventProtocol"), 6); - - if (jetProtons.size() > 1) { - doCorrelations(jetProtons, fBufferProton, fTempBufferProton, 1, pJet); - setTrackBuffer(fTempBufferProton, fBufferProton); - } - if (jetAntiprotons.size() > 1) { - doCorrelations(jetAntiprotons, fBufferAntiproton, fTempBufferAntiproton, 2, pJet); - setTrackBuffer(fTempBufferAntiproton, fBufferAntiproton); - } - if (jetDeuterons.size() > 1) { - doCorrelations(jetDeuterons, fBufferDeuteron, fTempBufferDeuteron, 3, pJet); - setTrackBuffer(fTempBufferDeuteron, fBufferDeuteron); - } - if (jetAntideuterons.size() > 1) { - doCorrelations(jetAntideuterons, fBufferAntideuteron, fTempBufferAntideuteron, 4, pJet); - setTrackBuffer(fTempBufferAntideuteron, fBufferAntideuteron); - } + 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); } void processRun2(soa::Join const& collisions, @@ -1275,12 +1159,14 @@ 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); - fillHistogramsRun2(collision, tracks); + auto slicedTracks = tracks.sliceBy(perCollisionFullTracksRun2, collision.globalIndex()); + + fillHistograms(slicedTracks); } } PROCESS_SWITCH(AngularCorrelationsInJets, processRun2, "process Run 2 data", true); @@ -1290,13 +1176,16 @@ struct AngularCorrelationsInJets { { for (const auto& collision : collisions) { registryData.fill(HIST("hEventProtocol"), 0); - registryData.fill(HIST("hNumberOfEvents"), 0); if (!collision.sel8()) continue; + registryData.fill(HIST("hNumberOfEvents"), 0); registryData.fill(HIST("hEventProtocol"), 1); if (TMath::Abs(collision.posZ()) > fZVtx) continue; - fillHistogramsRun3(collision, tracks); + + auto slicedTracks = tracks.sliceBy(perCollisionFullTracksRun3, collision.globalIndex()); + + fillHistograms(slicedTracks); } } PROCESS_SWITCH(AngularCorrelationsInJets, processRun3, "process Run 3 data", false); diff --git a/PWGLF/Tasks/Nuspex/CMakeLists.txt b/PWGLF/Tasks/Nuspex/CMakeLists.txt index 8507049a6ad..3ab4d352396 100644 --- a/PWGLF/Tasks/Nuspex/CMakeLists.txt +++ b/PWGLF/Tasks/Nuspex/CMakeLists.txt @@ -139,9 +139,14 @@ o2physics_add_dpl_workflow(nuclei-toward-transv PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(ebye-mult + SOURCES ebyeMult.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 FastJet::FastJet FastJet::Contrib + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib COMPONENT_NAME Analysis) endif() \ No newline at end of file diff --git a/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx b/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx index 8d55234b567..e3bfc1be9ae 100644 --- a/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx +++ b/PWGLF/Tasks/Nuspex/NucleiHistTask.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include "ReconstructionDataFormats/Track.h" #include "Framework/runDataProcessing.h" @@ -67,19 +68,12 @@ struct NucleiHistTask { } 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 +81,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 +119,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 +139,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 +159,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 +179,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 +199,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 +219,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 +239,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 +259,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 +279,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 +299,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 +319,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"}}); @@ -423,19 +342,16 @@ struct NucleiHistTask { // 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}); @@ -466,38 +382,14 @@ struct NucleiHistTask { MC_recon_reg.add("histTofNsigmaDataaHe", "TOF nSigma (^{3}#bar{He})", HistType::kTH2F, {pAxis, {160, -20., +20., "n#sigma_{^{3}He}"}}); 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}"}}); } // Configurables + Configurable use_momentum_getter{"use_momentum_getter", 0, "0: track.p(), 1: track.pt(), 2: track.tpcInnerParam()"}; 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"}; @@ -517,7 +409,6 @@ struct NucleiHistTask { Configurable maxChi2TPC{"maxChi2TPC", 4.0f, "max chi2 per cluster TPC"}; 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 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"}; @@ -525,20 +416,6 @@ struct NucleiHistTask { 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()); } @@ -551,6 +428,25 @@ struct NucleiHistTask { if (event_selection_sel8 && !event.sel8()) 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; + float TPCnumberClsFound = track.tpcNClsFound(); float TPC_nCls_Crossed_Rows = track.tpcNClsCrossedRows(); float RatioCrossedRowsOverFindableTPC = track.tpcCrossedRowsOverFindableCls(); @@ -601,73 +497,36 @@ 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 || 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() < p_min || track.pt() > p_max) continue; - spectra_reg.fill(HIST("histTpcSignalData"), track.p() * track.sign(), track.tpcSignal()); - spectra_reg.fill(HIST("histTpcSignalData_pT"), track.pt() * track.sign(), track.tpcSignal()); + spectra_reg.fill(HIST("histTpcSignalData"), momentum * track.sign(), track.tpcSignal()); 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 * 2.0, nSigmaHe3); + Helium4_reg.fill(HIST("histTpcNsigmaData"), momentum * 2.0, nSigmaHe4); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - 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 * 2.0, nSigmaHe3); + aHelium4_reg.fill(HIST("histTpcNsigmaData"), momentum * 2.0, nSigmaHe4); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - 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 +535,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()); @@ -688,34 +545,18 @@ struct NucleiHistTask { pion_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); @@ -723,42 +564,16 @@ struct NucleiHistTask { apion_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); } } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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 +582,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()); @@ -779,34 +592,18 @@ struct NucleiHistTask { proton_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); @@ -814,42 +611,16 @@ struct NucleiHistTask { aproton_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); } } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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 +629,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()); @@ -870,34 +639,18 @@ struct NucleiHistTask { deuteron_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); @@ -905,42 +658,16 @@ struct NucleiHistTask { adeuteron_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); } } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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 +676,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()); @@ -961,34 +686,18 @@ struct NucleiHistTask { triton_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); @@ -996,42 +705,16 @@ struct NucleiHistTask { atriton_reg.fill(HIST("histChi2ITS"), track.pt(), track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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()); } } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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 +723,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 * 2.0, 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()); @@ -1052,34 +733,18 @@ struct NucleiHistTask { Helium3_reg.fill(HIST("histChi2ITS"), track.pt() * 2.0, track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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 * 2.0, TOFmass2); + Helium3_reg.fill(HIST("histTofSignalData"), momentum * 2.0, beta); + Helium3_reg.fill(HIST("histTofNsigmaData"), momentum * 2.0, 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 * 2.0, 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()); @@ -1087,42 +752,16 @@ struct NucleiHistTask { aHelium3_reg.fill(HIST("histChi2ITS"), track.pt() * 2.0, track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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 * 2.0, TOFmass2); + aHelium3_reg.fill(HIST("histTofSignalData"), momentum * 2.0, beta); + aHelium3_reg.fill(HIST("histTofNsigmaData"), momentum * 2.0, track.tofNSigmaHe()); } } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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 * 2.0 * track.sign(), track.beta()); } } @@ -1131,11 +770,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 * 2.0, 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()); @@ -1143,34 +780,18 @@ struct NucleiHistTask { Helium4_reg.fill(HIST("histChi2ITS"), track.pt() * 2.0, track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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 * 2.0, TOFmass2); + Helium4_reg.fill(HIST("histTofSignalData"), momentum * 2.0, beta); + Helium4_reg.fill(HIST("histTofNsigmaData"), momentum * 2.0, 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 * 2.0, 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()); @@ -1178,58 +799,19 @@ struct NucleiHistTask { aHelium4_reg.fill(HIST("histChi2ITS"), track.pt() * 2.0, track.itsChi2NCl()); if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - if (lastLayer < lastRequiredTrdCluster) - continue; - } 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 * 2.0, TOFmass2); + aHelium4_reg.fill(HIST("histTofSignalData"), momentum * 2.0, beta); + aHelium4_reg.fill(HIST("histTofNsigmaData"), momentum * 2.0, track.tofNSigmaAl()); } } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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 * 2.0 * 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); } //**************************************************************************************************** @@ -1248,6 +830,25 @@ struct NucleiHistTask { 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()); @@ -1288,124 +889,100 @@ struct NucleiHistTask { 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, track.tpcNSigmaPi(), event.centFT0C()); + proton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, track.tpcNSigmaPr(), event.centFT0C()); + deuteron_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, track.tpcNSigmaDe(), event.centFT0C()); + triton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, track.tpcNSigmaTr(), event.centFT0C()); + Helium3_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, track.tpcNSigmaHe(), event.centFT0C()); + Helium4_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, track.tpcNSigmaAl(), 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, track.tpcNSigmaPi(), track.eta()); + proton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, track.tpcNSigmaPr(), track.eta()); + deuteron_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, track.tpcNSigmaDe(), track.eta()); + triton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, track.tpcNSigmaTr(), track.eta()); + Helium3_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, track.tpcNSigmaHe(), track.eta()); + Helium4_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, track.tpcNSigmaAl(), track.eta()); } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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, track.tpcNSigmaPi(), event.centFT0C()); + aproton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, track.tpcNSigmaPr(), event.centFT0C()); + adeuteron_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, track.tpcNSigmaDe(), event.centFT0C()); + atriton_reg.fill(HIST("histTpcNsigmaData_cent"), momentum, track.tpcNSigmaTr(), event.centFT0C()); + aHelium3_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, track.tpcNSigmaHe(), event.centFT0C()); + aHelium4_reg.fill(HIST("histTpcNsigmaData_cent"), momentum * 2.0, track.tpcNSigmaAl(), 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, track.tpcNSigmaPi(), track.eta()); + aproton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, track.tpcNSigmaPr(), track.eta()); + adeuteron_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, track.tpcNSigmaDe(), track.eta()); + atriton_reg.fill(HIST("histTpcNsigmaData_eta"), momentum, track.tpcNSigmaTr(), track.eta()); + aHelium3_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, track.tpcNSigmaHe(), track.eta()); + aHelium4_reg.fill(HIST("histTpcNsigmaData_eta"), momentum * 2.0, track.tpcNSigmaAl(), track.eta()); } if (track.hasTOF()) { - if (track.hasTRD() && (lastRequiredTrdCluster > 0)) { - int lastLayer = 0; - for (int l = 7; l >= 0; l--) { - if (track.trdPattern() & (1 << l)) { - lastLayer = l; - break; - } - } - 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()); } } } @@ -1513,6 +1090,25 @@ struct NucleiHistTask { 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{}; @@ -1544,9 +1140,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 +1152,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); @@ -1585,82 +1179,56 @@ struct NucleiHistTask { float nSigmaHe4 = track.tpcNSigmaAl(); 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()); } } } diff --git a/PWGLF/Tasks/Nuspex/ebyeMult.cxx b/PWGLF/Tasks/Nuspex/ebyeMult.cxx new file mode 100644 index 00000000000..66231c71549 --- /dev/null +++ b/PWGLF/Tasks/Nuspex/ebyeMult.cxx @@ -0,0 +1,500 @@ +// 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 "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoAHelpers.h" +#include "ReconstructionDataFormats/Track.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" +// #include "Common/DataModel/Multiplicity.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/EventSelection.h" +#include "DetectorsBase/Propagator.h" +#include "DetectorsBase/GeometryManager.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "CCDB/BasicCCDBManager.h" + +#include "TDatabasePDG.h" +#include "TFormula.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +using TracksFull = soa::Join; +using BCsWithRun2Info = soa::Join; + +namespace +{ +constexpr float dcaSels[3]{10., 10., 10.}; +static const std::vector dcaSelsNames{"dcaxy", "dcaz", "dca"}; +static const std::vector particleName{"tracks"}; +} // namespace + +struct CandidateTrack { + float pt = -999.f; + float eta = -999.f; + float dcapv = 0; + float dcaxypv = 0; + float dcazpv = 0; + float genpt = -999.f; + float geneta = -999.f; + int pdgcode = -999; + bool isreco = 0; + int64_t mcIndex = -999; + int64_t globalIndex = -999; +}; + +struct CandidateEvent { + int nTrkRec = -1; + int nTklRec = -1; +}; + +struct tagRun2V0MCalibration { + bool mCalibrationStored = false; + TH1* mhVtxAmpCorrV0A = nullptr; + TH1* mhVtxAmpCorrV0C = nullptr; + TH1* mhMultSelCalib = nullptr; + float mMCScalePars[6] = {0.0}; + TFormula* mMCScale = nullptr; +} Run2V0MInfo; + +enum PartTypes { + kPi = 0, + kKa = 1, + kPr = 2, + kEl = 3, + kMu = 4, + kSig = 5, + kXi = 6, + kOm = 7, + kOther = 8 +}; + +struct ebyeMult { + std::vector candidateTracks; + Service ccdb; + CandidateEvent candidateEvent; + + int mRunNumber; + float d_bz; + 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: \"\""}; + + 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 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 trackChi2Cut{"trackChi2Cut", 4.f, "Maximum chi2/ncls in TPC"}; + Configurable> cfgDcaSels{"cfgDcaSels", {dcaSels, 1, 3, particleName, dcaSelsNames}, "DCA selections"}; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + Preslice perCollisionTracksFull = o2::aod::track::collisionId; + Preslice perCollisionMcParts = o2::aod::mcparticle::mcCollisionId; + + // TODO: add function to extract the particle type based on the pdg code + int getPartType(int const pdgCode) + { + switch (std::abs(pdgCode)) { + case 211: + return PartTypes::kPi; + case 321: + return PartTypes::kKa; + case 2212: + return PartTypes::kPr; + case 11: + return PartTypes::kEl; + case 13: + return PartTypes::kMu; + case 3222: + return PartTypes::kSig; + case 3112: + return PartTypes::kSig; + case 3312: + return PartTypes::kXi; + case 3334: + return PartTypes::kOm; + default: + return PartTypes::kOther; + } + } + + template + bool selectTrack(T const& track) + { + if (std::abs(track.eta()) > etaMax) { + return false; + } + if (!(track.itsClusterMap() & 0x01) && !(track.itsClusterMap() & 0x02)) { + return false; + } + if (track.itsNCls() < trackNclusItsCut || + track.tpcNClsFound() < trackNclusTpcCut || + track.tpcNClsCrossedRows() < trackNcrossedRows || + track.tpcNClsCrossedRows() < 0.8 * track.tpcNClsFindable() || + track.tpcChi2NCl() > trackChi2Cut || + track.itsChi2NCl() > 36.f) { + return false; + } + if (doprocessRun2 || doprocessMcRun2) { + if (!(track.trackType() & o2::aod::track::Run2Track) || + !(track.flags() & o2::aod::track::TPCrefit) || + !(track.flags() & o2::aod::track::ITSrefit)) { + return false; + } + } + return true; + } + + template + void initCCDB(Bc const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + + auto timestamp = bc.timestamp(); + o2::parameters::GRPObject* grpo = 0x0; + o2::parameters::GRPMagField* grpmag = 0x0; + if (doprocessRun2 || doprocessMcRun2) { + auto grpPath{"GLO/GRP/GRP"}; + grpo = ccdb->getForTimeStamp("GLO/GRP/GRP", timestamp); + if (!grpo) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpPath << " of object GRPObject for timestamp " << timestamp; + } + o2::base::Propagator::initFieldFromGRP(grpo); + TList* callst = ccdb->getForTimeStamp("Centrality/Estimators", bc.timestamp()); + auto getccdb = [callst](const char* ccdbhname) { + TH1* h = reinterpret_cast(callst->FindObject(ccdbhname)); + return h; + }; + auto getformulaccdb = [callst](const char* ccdbhname) { + TFormula* f = reinterpret_cast(callst->FindObject(ccdbhname)); + return f; + }; + Run2V0MInfo.mhVtxAmpCorrV0A = getccdb("hVtx_fAmplitude_V0A_Normalized"); + Run2V0MInfo.mhVtxAmpCorrV0C = getccdb("hVtx_fAmplitude_V0C_Normalized"); + Run2V0MInfo.mhMultSelCalib = getccdb("hMultSelCalib_V0M"); + Run2V0MInfo.mMCScale = getformulaccdb(TString::Format("%s-V0M", genName->c_str()).Data()); + if ((Run2V0MInfo.mhVtxAmpCorrV0A != nullptr) && (Run2V0MInfo.mhVtxAmpCorrV0C != nullptr) && (Run2V0MInfo.mhMultSelCalib != nullptr)) { + if (genName->length() != 0) { + if (Run2V0MInfo.mMCScale != nullptr) { + for (int ixpar = 0; ixpar < 6; ++ixpar) { + Run2V0MInfo.mMCScalePars[ixpar] = Run2V0MInfo.mMCScale->GetParameter(ixpar); + } + } else { + LOGF(fatal, "MC Scale information from V0M for run %d not available", bc.runNumber()); + } + } + Run2V0MInfo.mCalibrationStored = true; + } else { + LOGF(fatal, "Calibration information from V0M for run %d corrupted", bc.runNumber()); + } + } else { + auto grpmagPath{"GLO/Config/GRPMagField"}; + grpmag = ccdb->getForTimeStamp("GLO/Config/GRPMagField", timestamp); + if (!grpmag) { + LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField for timestamp " << timestamp; + } + 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"; + 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; + // } + + void init(o2::framework::InitContext&) + { + + mRunNumber = 0; + d_bz = 0; + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + + // event QA + histos.add("QA/zVtx", ";#it{z}_{vtx} (cm);Entries", HistType::kTH1F, {zVtxAxis}); + 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/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.}}); + + // 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}}); + + 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}}); + + // 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.}}); + + // 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("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}}); + } + } + + template + void fillRecoEvent(C const& collision, T const& tracksAll /* , float const& centrality */) + { + auto tracks = tracksAll.sliceBy(perCollisionTracksFull, collision.globalIndex()); + candidateTracks.clear(); + + gpu::gpustd::array dcaInfo; + int nTracklets[2]{0, 0}; + int nTracks{0}; + for (const auto& track : tracks) { + + if (track.trackType() == 255 && std::abs(track.eta()) < 1.2) { // tracklet + if (std::abs(track.eta()) < 0.6) + nTracklets[0]++; + else if (std::abs(track.eta()) > 0.7) + nTracklets[1]++; + } + + if (!selectTrack(track)) { + continue; + } + + auto trackParCov = getTrackParCov(track); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCov, 2.f, o2::base::Propagator::MatCorrType::USEMatCorrNONE, &dcaInfo); + auto dca = std::hypot(dcaInfo[0], dcaInfo[1]); + auto trackPt = trackParCov.getPt(); + auto trackEta = trackParCov.getEta(); + if (dca > cfgDcaSels->get("dca")) { // dca + continue; + } + if (std::abs(dcaInfo[1]) > cfgDcaSels->get("dcaz")) { // dcaz + continue; + } + + CandidateTrack candTrack; + candTrack.pt = track.sign() > 0. ? trackPt : -trackPt; + candTrack.eta = trackEta; + candTrack.dcapv = dca; + candTrack.dcaxypv = dcaInfo[0]; + candTrack.dcazpv = dcaInfo[1]; + candTrack.globalIndex = track.globalIndex(); + candidateTracks.push_back(candTrack); + + if (std::abs(dcaInfo[0]) < cfgDcaSels->get("dcaxy")) { // dcaxy + ++nTracks; + } + } + + histos.fill(HIST("QA/nTrklCorrelation"), nTracklets[0], nTracklets[1]); + nTrackletsColl = nTracklets[1]; + + candidateEvent.nTklRec = nTracklets[0]; + histos.fill(HIST("TracksDistr"), nTracklets[1], nTracks); + histos.fill(HIST("TrackletsDistr"), nTracklets[1], nTracklets[0]); + } + + template + void fillMcEvent(C const& collision, T const& tracks /* , float const& centrality */, aod::McParticles const&, aod::McTrackLabels const& mcLabels) + { + fillRecoEvent(collision, tracks /* , centrality */); + + int nTracks{0}; + for (auto& candidateTrack : candidateTracks) { + candidateTrack.isreco = true; + + auto mcLab = mcLabels.rawIteratorAt(candidateTrack.globalIndex); + if (mcLab.has_mcParticle()) { + auto mcTrack = mcLab.template mcParticle_as(); + if (((mcTrack.flags() & 0x8) && (doprocessMcRun2)) || (mcTrack.flags() & 0x2)) + continue; + if (!mcTrack.isPhysicalPrimary()) { + if (mcTrack.has_mothers()) { // sec WD + histos.fill(HIST("SecWDTracks"), nTrackletsColl, candidateTrack.pt, candidateTrack.dcaxypv); + } else { // from material + histos.fill(HIST("SecTracks"), nTrackletsColl, candidateTrack.pt, candidateTrack.dcaxypv); + } + } + if ((mcTrack.flags() & 0x1)) + continue; + if (mcTrack.isPhysicalPrimary()) { // primary + histos.fill(HIST("PrimTracks"), nTrackletsColl, candidateTrack.pt, candidateTrack.dcaxypv); + } + + if (std::abs(candidateTrack.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; + } + } + auto genPt = std::hypot(mcTrack.px(), mcTrack.py()); + candidateTrack.pdgcode = mcTrack.pdgCode(); + candidateTrack.genpt = genPt; + candidateTrack.geneta = mcTrack.eta(); + candidateTrack.mcIndex = mcTrack.globalIndex(); + } + } + candidateEvent.nTrkRec = nTracks; + } + + void fillMcGen(aod::McParticles const& mcParticles, aod::McTrackLabels const& /*mcLab*/, uint64_t const& collisionId) + { + int nParticles = 0; + auto mcParticles_thisCollision = mcParticles.sliceBy(perCollisionMcParts, collisionId); + for (auto& mcPart : mcParticles_thisCollision) { + auto genEta = mcPart.eta(); + if (std::abs(genEta) > etaMax) { + continue; + } + if (((mcPart.flags() & 0x8) && (doprocessMcRun2)) || (mcPart.flags() & 0x2) || (mcPart.flags() & 0x1)) + continue; + if (!mcPart.isPhysicalPrimary() /* && !mcPart.has_mothers() */) + continue; + auto genPt = std::hypot(mcPart.px(), mcPart.py()); + CandidateTrack candTrack; + candTrack.genpt = genPt; + candTrack.geneta = mcPart.eta(); + candTrack.pdgcode = mcPart.pdgCode(); + + int partType = getPartType(mcPart.pdgCode()); + if (partType < PartTypes::kOther) { + ++nParticles; + } + histos.fill(HIST("GenPart"), nTrackletsColl, 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()) { + continue; + } else { + candidateTracks.emplace_back(candTrack); + } + } + histos.fill(HIST("GenRecTracks"), nTrackletsColl, candidateEvent.nTrkRec, nParticles); + histos.fill(HIST("GenRecTracklets"), nTrackletsColl, candidateEvent.nTklRec, nParticles); + } + + void processRun2(soa::Join const& collisions, TracksFull const& tracks /* , aod::FV0As const& fv0as, aod::FV0Cs const& fv0cs */, BCsWithRun2Info const&) + { + + for (const auto& collision : collisions) { + auto bc = collision.bc_as(); + initCCDB(bc); + + if (std::abs(collision.posZ()) > zVtxMax) + continue; + + if (!collision.alias_bit(kINT7)) + continue; + + 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)); + + histos.fill(HIST("QA/zVtx"), collision.posZ()); + + fillRecoEvent(collision, tracks /* , cV0M */); + + for (auto t : candidateTracks) { + histos.fill(HIST("RecTracks"), nTrackletsColl, t.pt, t.dcaxypv); + } + } + } + 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&) + { + + for (const auto& collision : collisions) { + auto bc = collision.bc_as(); + initCCDB(bc); + + if (std::abs(collision.posZ()) > zVtxMax) + continue; + + 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)); + + histos.fill(HIST("QA/zVtx"), collision.posZ()); + + fillMcEvent(collision, tracks /* , cV0M */, mcParticles, mcLab); + fillMcGen(mcParticles, mcLab, collision.mcCollisionId()); + } + } + PROCESS_SWITCH(ebyeMult, processMcRun2, "process mc (Run 2)", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx index 47b9a5eb886..334c952a105 100644 --- a/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx +++ b/PWGLF/Tasks/Nuspex/hadronnucleicorrelation.cxx @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -53,9 +53,9 @@ struct hadronnucleicorrelation { static constexpr int pdgDeuteron = 1000010020; Configurable doQA{"doQA", true, "save QA histograms"}; + Configurable doMCQA{"doMCQA", false, "save MC QA histograms"}; Configurable isMC{"isMC", false, "is MC"}; Configurable mcCorrelation{"mcCorrelation", false, "true: build the correlation function only for SE"}; - Configurable disable_pantip{"disable_pantip", false, "disable_pantip"}; Configurable docorrection{"docorrection", false, "do efficiency correction"}; Configurable fCorrectionPath{"fCorrectionPath", "", "Correction path to file"}; @@ -66,6 +66,8 @@ struct hadronnucleicorrelation { Configurable cutzvertex{"cutzvertex", 10.0, "|vertexZ| value limit"}; // Track selection + Configurable par0{"par0", 0.004, "par 0"}; + Configurable par1{"par1", 0.013, "par 1"}; Configurable min_TPC_nClusters{"min_TPC_nClusters", 80, "minimum number of found TPC clusters"}; Configurable min_TPC_nCrossedRowsOverFindableCls{"min_TPC_nCrossedRowsOverFindableCls", 0.8, "n TPC Crossed Rows Over Findable Cls"}; Configurable max_chi2_TPC{"max_chi2_TPC", 4.0f, "maximum TPC chi^2/Ncls"}; @@ -74,14 +76,16 @@ struct hadronnucleicorrelation { Configurable max_dcaxy{"max_dcaxy", 0.14f, "Maximum DCAxy"}; Configurable max_dcaz{"max_dcaz", 0.1f, "Maximum DCAz"}; Configurable nsigmaTPC{"nsigmaTPC", 3.0f, "cut nsigma TPC"}; + Configurable nsigmaElPr{"nsigmaElPr", 1.0f, "cut nsigma TPC El for protons"}; + Configurable nsigmaElDe{"nsigmaElDe", 3.0f, "cut nsigma TPC El for protons"}; Configurable nsigmaTOF{"nsigmaTOF", 3.5f, "cut nsigma TOF"}; Configurable pTthrpr_TOF{"pTthrpr_TOF", 0.8f, "threshold pT proton to use TOF"}; - Configurable debug_ptthrp{"debug_ptthrp", 2.0f, "threshold pT proton for phi/eta debug"}; - Configurable debug_ptthrd{"debug_ptthrd", 2.0f, "threshold pT deuteron for phi/eta debug"}; + Configurable pTthrpr_TPCEl{"pTthrpr_TPCEl", 1.0f, "threshold pT proton to use TPC El rejection"}; + Configurable pTthrde_TOF{"pTthrde_TOF", 1.0f, "threshold pT deuteron to use TOF"}; + Configurable pTthrde_TPCEl{"pTthrde_TPCEl", 1.0f, "threshold pT deuteron to use TPC El rejection"}; + Configurable rejectionEl{"rejectionEl", true, "use TPC El rejection"}; Configurable max_tpcSharedCls{"max_tpcSharedCls", 0.4, "maximum fraction of TPC shared clasters"}; Configurable min_itsNCls{"min_itsNCls", 0, "minimum allowed number of ITS clasters"}; - Configurable threta{"threta", 0.1, "threshold for debug DeltaEta"}; - Configurable thrphi{"thrphi", 0.5, "threshold for debug DeltaPhi"}; // Mixing parameters Configurable _vertexNbinsToMix{"vertexNbinsToMix", 10, "Number of vertexZ bins for the mixing"}; @@ -89,14 +93,12 @@ struct hadronnucleicorrelation { // pT/A bins Configurable> pTBins{"pTBins", {0.4f, 0.6f, 0.8f}, "p_{T} bins"}; - Configurable> etaBins{"etaBins", {-0.8f, 0.f, 0.8f}, "#eta bins"}; - Configurable> phiBins{"phiBins", {0.f, TMath::Pi(), 2 * TMath::Pi()}, "#phi bins"}; - ConfigurableAxis AxisNSigma{"AxisNSigma", {50, -10.f, 10.f}, "n#sigma"}; + ConfigurableAxis AxisNSigma{"AxisNSigma", {35, -7.f, 7.f}, "n#sigma"}; using FilteredCollisions = soa::Filtered; - using FilteredTracks = soa::Filtered; - using FilteredTracksMC = soa::Filtered>; + using FilteredTracks = soa::Filtered>; + using FilteredTracksMC = soa::Filtered>; HistogramRegistry registry{"registry"}; HistogramRegistry QA{"QA"}; @@ -107,13 +109,16 @@ struct hadronnucleicorrelation { // key: int64_t - value: vector of trkType objects std::map> selectedtracks_p; + std::map> selectedtracks_d; std::map> selectedtracks_antid; std::map> selectedtracks_antip; // key: int64_t - value: vector of trkType objects + std::map> selectedtracksMC_d; std::map> selectedtracksMC_p; std::map> selectedtracksMC_antid; std::map> selectedtracksMC_antip; + std::map> selectedtracksPIDMC_d; std::map> selectedtracksPIDMC_p; std::map> selectedtracksPIDMC_antid; std::map> selectedtracksPIDMC_antip; @@ -121,16 +126,10 @@ struct hadronnucleicorrelation { // key: pair of an integer and a float - value: vector of colType objects // for each key I have a vector of collisions std::map, std::vector> mixbins_antidantip; - std::map, std::vector> mixbins_pantip; std::map, std::vector> mixbinsPID_antidantip; - std::map, std::vector> mixbinsPID_pantip; - std::vector> hEtaPhi_PrAntiPr_SE; - std::vector> hEtaPhi_PrAntiPr_ME; std::vector> hEtaPhi_AntiDeAntiPr_SE; std::vector> hEtaPhi_AntiDeAntiPr_ME; - std::vector> hCorrEtaPhi_PrAntiPr_SE; - std::vector> hCorrEtaPhi_PrAntiPr_ME; std::vector> hCorrEtaPhi_AntiDeAntiPr_SE; std::vector> hCorrEtaPhi_AntiDeAntiPr_ME; @@ -138,20 +137,12 @@ struct hadronnucleicorrelation { std::vector> hEtaPhiGen_AntiDeAntiPr_SE; std::vector> hEtaPhiRec_AntiDeAntiPr_ME; std::vector> hEtaPhiGen_AntiDeAntiPr_ME; - std::vector> hEtaPhiRec_PrAntiPr_SE; - std::vector> hEtaPhiGen_PrAntiPr_SE; - std::vector> hEtaPhiRec_PrAntiPr_ME; - std::vector> hEtaPhiGen_PrAntiPr_ME; std::vector> hPIDEtaPhiRec_AntiDeAntiPr_SE; std::vector> hPIDEtaPhiGen_AntiDeAntiPr_SE; std::vector> hPIDEtaPhiRec_AntiDeAntiPr_ME; std::vector> hPIDEtaPhiGen_AntiDeAntiPr_ME; - std::vector> hPIDEtaPhiRec_PrAntiPr_SE; - std::vector> hPIDEtaPhiGen_PrAntiPr_SE; - std::vector> hPIDEtaPhiRec_PrAntiPr_ME; - std::vector> hPIDEtaPhiGen_PrAntiPr_ME; - int nBinspT, nBinseta, nBinsphi; + int nBinspT; TH2F* hEffpTEta_proton; TH2F* hEffpTEta_antiproton; TH2F* hEffpTEta_deuteron; @@ -178,115 +169,62 @@ struct hadronnucleicorrelation { } AxisSpec ptBinnedAxis = {pTBins, "#it{p}_{T} of #bar{p} (GeV/c)"}; - AxisSpec etaBinnedAxis = {etaBins, "#eta"}; - AxisSpec phiBinnedAxis = {phiBins, "#phi"}; - AxisSpec etaAxis = {100, -1.5, 1.5, "#Delta#eta"}; - AxisSpec phiAxis = {60, -TMath::Pi() / 2, 1.5 * TMath::Pi(), "#Delta#phi"}; + AxisSpec etaAxis = {100, -1., 1., "#eta"}; + AxisSpec phiAxis = {157, 0., 2 * TMath::Pi(), "#phi (rad)"}; AxisSpec pTAxis = {200, -10.f, 10.f, "p_{T} GeV/c"}; + AxisSpec pTAxis_small = {100, -5.f, 5.f, "p_{T} GeV/c"}; - registry.add("hNEvents", "hNEvents", {HistType::kTH1I, {{3, 0.f, 3.f}}}); + AxisSpec DeltaEtaAxis = {100, -1.5, 1.5, "#Delta#eta"}; + AxisSpec DeltaPhiAxis = {60, -TMath::Pi() / 2, 1.5 * TMath::Pi(), "#Delta#phi (rad)"}; + + registry.add("hNEvents", "hNEvents", {HistType::kTH1D, {{5, 0.f, 5.f}}}); registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(1, "Selected"); - registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "#bar{d}-#bar{p}"); - registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "p-#bar{p}"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(2, "events with #bar{d}-#bar{p}"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(3, "events with d-p"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(4, "events with #bar{d}"); + registry.get(HIST("hNEvents"))->GetXaxis()->SetBinLabel(5, "events with d"); nBinspT = pTBins.value.size() - 1; - nBinseta = etaBins.value.size() - 1; - nBinsphi = phiBins.value.size() - 1; if (mcCorrelation) { for (int i = 0; i < nBinspT; i++) { auto htempSERec_AntiDeAntiPr = registry.add(Form("hEtaPhiRec_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiRec_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiRec_PrAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_PrAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiRec_PrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hEtaPhiGen_PrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiRec_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiGen_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiRec_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiGen_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiRec_PrAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiGen_PrAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiRec_PrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Rec #Delta#eta#Delta#phi (%.1f(Form("hPIDEtaPhiGen_PrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), - Form("Gen #Delta#eta#Delta#phi (%.1f(HIST("hDebug"))->GetXaxis()->SetBinLabel(1, "all"); - registry.get(HIST("hDebug"))->GetXaxis()->SetBinLabel(2, "ev. with #bar{d}"); - registry.get(HIST("hDebug"))->GetXaxis()->SetBinLabel(3, "ev. with #bar{p}"); - registry.get(HIST("hDebug"))->GetXaxis()->SetBinLabel(4, "ev. with p"); - - registry.add("hDebugdp", "hDebugdp", {HistType::kTH1I, {{6, 0.f, 6.f}}}); - registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(1, "N coll with #bar{d}"); - registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(2, "N mixing bins"); - registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(3, "N coll with #bar{d}"); - registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(4, "#bar{d}-#bar{p} pairs SE"); - registry.get(HIST("hDebugdp"))->GetXaxis()->SetBinLabel(5, "#bar{d}-#bar{p} pairs ME"); - for (int i = 0; i < nBinspT; i++) { - if (!disable_pantip) { - auto htempSE_PrAntiPr = registry.add(Form("hEtaPhi_PrAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_PrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hEtaPhi_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("Raw #Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_PrAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_PrAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_AntiDeAntiPr_SE_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(Form("hCorrEtaPhi_AntiDeAntiPr_ME_pt%02.0f%02.0f", pTBins.value.at(i) * 10, pTBins.value.at(i + 1) * 10), Form("#Delta#eta#Delta#phi (%.1f(o2::aod::singletrackselector::storedTpcChi2NCl) <= max_chi2_TPC && o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedTpcCrossedRowsOverFindableCls) >= min_TPC_nCrossedRowsOverFindableCls && o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedItsChi2NCl) <= max_chi2_ITS && - // nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY_v1)) <= max_dcaxy && // For now no filtering on the DCAxy or DCAz (casting not supported) - // nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY_v1)) <= max_dcaz && // For now no filtering on the DCAxy or DCAz (casting not supported) + nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY_v2)) <= max_dcaxy && // For now no filtering on the DCAxy or DCAz (casting not supported) + nabs(o2::aod::singletrackselector::unPack(o2::aod::singletrackselector::storedDcaXY_v2)) <= max_dcaz && // For now no filtering on the DCAxy or DCAz (casting not supported) nabs(o2::aod::singletrackselector::eta) <= etacut; + template + bool IsProton(Type const& track, int sign) + { + bool isProton = false; + + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC) { + if (track.pt() < pTthrpr_TOF) { + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; + } + } + } else if (rejectionEl && track.beta() < -100 && track.pt() < pTthrpr_TPCEl && track.tpcNSigmaEl() >= nsigmaElPr) { + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; + } + } + } else if (std::abs(track.tofNSigmaPr()) < nsigmaTOF) { + if (sign > 0) { + if (track.sign() > 0) { + isProton = true; + } else if (track.sign() < 0) { + isProton = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isProton = false; + } else if (track.sign() < 0) { + isProton = true; + } + } + } + } + return isProton; + } + + template + bool IsDeuteron(Type const& track, int sign) + { + bool isDeuteron = false; + + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC) { + if (track.pt() < pTthrde_TOF) { + if (sign > 0) { + if (track.sign() > 0) { + isDeuteron = true; + } else if (track.sign() < 0) { + isDeuteron = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isDeuteron = false; + } else if (track.sign() < 0) { + isDeuteron = true; + } + } + } else if (rejectionEl && track.beta() < -100 && track.pt() < pTthrde_TPCEl && track.tpcNSigmaEl() >= nsigmaElDe) { + if (sign > 0) { + if (track.sign() > 0) { + isDeuteron = true; + } else if (track.sign() < 0) { + isDeuteron = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isDeuteron = false; + } else if (track.sign() < 0) { + isDeuteron = true; + } + } + } else if (std::abs(track.tofNSigmaDe()) < nsigmaTOF) { + if (sign > 0) { + if (track.sign() > 0) { + isDeuteron = true; + } else if (track.sign() < 0) { + isDeuteron = false; + } + } else if (sign < 0) { + if (track.sign() > 0) { + isDeuteron = false; + } else if (track.sign() < 0) { + isDeuteron = true; + } + } + } + } + return isDeuteron; + } + + template + bool applyDCAcut(const T1& track) + { + bool passcut = true; + // pt-dependent selection + if (TMath::Abs(track.dcaXY()) > (par0 + par1 / track.pt())) + passcut = false; + if (TMath::Abs(track.dcaZ()) > (par0 + par1 / track.pt())) + passcut = false; + + return passcut; + } + template - void mixTracks(Type const& tracks1, Type const& tracks2, bool isDe, bool isMCPID) + void mixTracks(Type const& tracks1, Type const& tracks2, bool isMCPID) { // last value: 0 -- SE; 1 -- ME for (auto it1 : tracks1) { for (auto it2 : tracks2) { - // Variables + // Calculate Delta-eta Delta-phi (reco) float deltaEta = it2->eta() - it1->eta(); float deltaPhi = it2->phi() - it1->phi(); deltaPhi = getDeltaPhi(deltaPhi); + // Calculate Delta-eta Delta-phi (gen) float deltaEtaGen = -999.; float deltaPhiGen = -999.; if constexpr (doMC) { @@ -410,114 +485,48 @@ struct hadronnucleicorrelation { deltaPhiGen = getDeltaPhi(deltaPhiGen); } - float pcorr = 1, antipcorr = 1, antidcorr = 1; + float antipcorr = 1, antidcorr = 1; for (int k = 0; k < nBinspT; k++) { - if (!isDe && !disable_pantip) { - if (it1->pt() > pTBins.value.at(k) && it1->pt() <= pTBins.value.at(k + 1)) { - - if (doQA) { - QA.fill(HIST("QA/Pt_Pr"), it1->pt()); - QA.fill(HIST("QA/Pt_AntiPr"), it2->pt()); - } + if (it1->pt() >= pTBins.value.at(k) && it1->pt() < pTBins.value.at(k + 1)) { - if (docorrection) { - pcorr = hEffpTEta_proton->Interpolate(it1->pt(), it1->eta()); - antipcorr = hEffpTEta_antiproton->Interpolate(it2->pt(), it2->eta()); - } - - if (ME) { - if constexpr (!doMC) { - hEtaPhi_PrAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hCorrEtaPhi_PrAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (pcorr * antipcorr)); - } - if constexpr (doMC) { - if (isMCPID) { - hPIDEtaPhiRec_PrAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hPIDEtaPhiGen_PrAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } else { - hEtaPhiRec_PrAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hEtaPhiGen_PrAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } - } - } else { - if constexpr (!doMC) { - hEtaPhi_PrAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hCorrEtaPhi_PrAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (pcorr * antipcorr)); - - if (doQA && abs(deltaEta) < threta && abs(deltaPhi) < thrphi) { - QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_Debug"), it1->pt(), it1->tpcNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_Debug"), -1.f * it2->pt(), it2->tpcNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_Debug"), it1->pt(), it1->tofNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_Debug"), -1.f * it2->pt(), it2->tofNSigmaPr()); - } - } - if constexpr (doMC) { - if (isMCPID) { - hPIDEtaPhiRec_PrAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hPIDEtaPhiGen_PrAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } else { - hEtaPhiRec_PrAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hEtaPhiGen_PrAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } - } - } + if (docorrection) { // Apply corrections + antipcorr = hEffpTEta_antiproton->Interpolate(it2->pt(), it2->eta()); + antidcorr = hEffpTEta_antideuteron->Interpolate(it1->pt(), it1->eta()); } - } else { - if (it1->pt() > pTBins.value.at(k) && it1->pt() <= pTBins.value.at(k + 1)) { - - if (doQA) { - QA.fill(HIST("QA/Pt_AntiDe"), it1->pt()); - QA.fill(HIST("QA/Pt_AntiPr"), it2->pt()); - } - if (docorrection) { - antipcorr = hEffpTEta_antiproton->Interpolate(it2->pt(), it2->eta()); - antidcorr = hEffpTEta_antideuteron->Interpolate(it1->pt(), it1->eta()); - } - - if (ME) { - if constexpr (!doMC) { - hEtaPhi_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hCorrEtaPhi_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (antipcorr * antidcorr)); - } - if constexpr (doMC) { - if (isMCPID) { - hPIDEtaPhiRec_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hPIDEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } else { - hEtaPhiRec_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } - } - } else { - if constexpr (!doMC) { - hEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hCorrEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (antipcorr * antidcorr)); - - if (doQA && abs(deltaEta) < threta && abs(deltaPhi) < thrphi) { - QA.fill(HIST("QA/hnSigmaTPCVsPt_De_Debug"), -1.f * it1->pt(), it1->tpcNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTPCVsPt_APrDe_Debug"), -1.f * it2->pt(), it2->tpcNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTOFVsPt_De_Debug"), -1.f * it1->pt(), it1->tofNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTOFVsPt_APrDe_Debug"), -1.f * it2->pt(), it2->tofNSigmaPr()); - } + if (ME) { + if constexpr (!doMC) { // Data + hEtaPhi_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hCorrEtaPhi_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (antipcorr * antidcorr)); + } else { // MC + if (isMCPID) { + hPIDEtaPhiRec_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hPIDEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + } else { + hEtaPhiRec_AntiDeAntiPr_ME[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hEtaPhiGen_AntiDeAntiPr_ME[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } - if constexpr (doMC) { - if (isMCPID) { - hPIDEtaPhiRec_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hPIDEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } else { - hEtaPhiRec_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); - hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); - } + } + } else { + if constexpr (!doMC) { // Data + hEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hCorrEtaPhi_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt(), 1. / (antipcorr * antidcorr)); + } else { // MC + if (isMCPID) { + hPIDEtaPhiRec_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hPIDEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); + } else { + hEtaPhiRec_AntiDeAntiPr_SE[k]->Fill(deltaEta, deltaPhi, it2->pt()); + hEtaPhiGen_AntiDeAntiPr_SE[k]->Fill(deltaEtaGen, deltaPhiGen, it2->pt()); } - } // SE - } - } + } + } // SE + } // pT condition } // nBinspT loop - } - } + } // tracks 2 + } // tracks 1 } float getDeltaPhi(float deltaPhi) @@ -566,12 +575,14 @@ struct hadronnucleicorrelation { void processData(FilteredCollisions const& collisions, FilteredTracks const& tracks) { for (auto track : tracks) { - if (abs(track.template singleCollSel_as().posZ()) > cutzvertex) + if (std::abs(track.template singleCollSel_as().posZ()) > cutzvertex) + continue; + + if (track.tpcFractionSharedCls() > max_tpcSharedCls) continue; - if (abs(track.dcaXY()) > max_dcaxy || abs(track.dcaZ()) > max_dcaz) { // For now no filtering on the DCAxy or DCAz (casting not supported) + if (track.itsNCls() < min_itsNCls) continue; - } - if (track.tpcFractionSharedCls() > max_tpcSharedCls || track.itsNCls() < min_itsNCls) + if (!applyDCAcut(track)) continue; if (doQA) { @@ -579,94 +590,65 @@ struct hadronnucleicorrelation { QA.fill(HIST("QA/hTPCchi2"), track.tpcChi2NCl()); QA.fill(HIST("QA/hTPCcrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); QA.fill(HIST("QA/hITSchi2"), track.itsChi2NCl()); - QA.fill(HIST("QA/hDCAxy"), track.dcaXY()); - QA.fill(HIST("QA/hDCAz"), track.dcaZ()); + QA.fill(HIST("QA/hDCAxy"), track.dcaXY(), track.pt()); + QA.fill(HIST("QA/hDCAz"), track.dcaZ(), track.pt()); + QA.fill(HIST("QA/TPCChi2VsPZ"), track.tpcInnerParam() / track.sign(), track.tpcChi2NCl()); QA.fill(HIST("QA/hVtxZ_trk"), track.template singleCollSel_as().posZ()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_El"), track.pt() * track.sign(), track.tpcNSigmaEl()); QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr"), track.pt() * track.sign(), track.tpcNSigmaPr()); QA.fill(HIST("QA/hnSigmaTPCVsPt_De"), track.pt() * track.sign(), track.tpcNSigmaDe()); QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr"), track.pt() * track.sign(), track.tofNSigmaPr()); QA.fill(HIST("QA/hnSigmaTOFVsPt_De"), track.pt() * track.sign(), track.tofNSigmaDe()); } + // Discard candidates outside pT of interest if (track.pt() > pTBins.value.at(nBinspT) || track.pt() < pTBins.value.at(0)) continue; - bool isPr = false; - bool isAntiPr = false; - bool isDeTPCTOF = false; - bool isAntiDeTPCTOF = false; - - if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC && track.sign() > 0) { - if (track.pt() < pTthrpr_TOF) { - isPr = true; - } else if (TMath::Abs(track.tofNSigmaPr()) < nsigmaTOF) { - isPr = true; - } - } - if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC && track.sign() < 0) { - if (track.pt() < pTthrpr_TOF) { - isAntiPr = true; - } else if (TMath::Abs(track.tofNSigmaPr()) < nsigmaTOF) { - isAntiPr = true; - } - } - if (TMath::Abs(track.tpcNSigmaDe()) < nsigmaTPC && TMath::Abs(track.tofNSigmaDe()) < nsigmaTOF && TMath::Abs(track.tofNSigmaPr()) >= nsigmaTOF) { - if (track.sign() > 0) { - isDeTPCTOF = true; - } else if (track.sign() < 0) { - isAntiDeTPCTOF = true; - } - } + bool isPr = IsProton(track, +1); + bool isAntiPr = IsProton(track, -1); + bool isDe = IsDeuteron(track, +1); + bool isAntiDe = IsDeuteron(track, -1); - if (!isPr && !isAntiPr && !isDeTPCTOF && !isAntiDeTPCTOF) + if (!isPr && !isAntiPr && !isDe && !isAntiDe) continue; - if (isPr && isDeTPCTOF) { - isDeTPCTOF = 0; + if (isPr && isDe) { + isDe = 0; } - if (isAntiPr && isAntiDeTPCTOF) { - isAntiDeTPCTOF = 0; + if (isAntiPr && isAntiDe) { + isAntiDe = 0; } - // Deuterons - if (isAntiDeTPCTOF) { + // Deuterons Fill & QA + if (isAntiDe) { selectedtracks_antid[track.singleCollSelId()].push_back(std::make_shared(track)); if (doQA) { QA.fill(HIST("QA/hEtaAntiDe"), track.eta()); QA.fill(HIST("QA/hPhiAntiDe"), track.phi()); - QA.fill(HIST("QA/hnSigmaTPCVsPhi_AntiDe"), track.phi(), track.tpcNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTPCVsEta_AntiDe"), track.eta(), track.tpcNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTOFVsPhi_AntiDe"), track.phi(), track.tofNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTOFVsEta_AntiDe"), track.eta(), track.tofNSigmaDe()); QA.fill(HIST("QA/hnSigmaTOFVsPt_De_AfterSel"), track.pt() * track.sign(), track.tofNSigmaDe()); QA.fill(HIST("QA/hnSigmaTPCVsPt_De_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaDe()); } } - if (isDeTPCTOF) { + if (isDe) { + selectedtracks_d[track.singleCollSelId()].push_back(std::make_shared(track)); + if (doQA) { QA.fill(HIST("QA/hEtaDe"), track.eta()); QA.fill(HIST("QA/hPhiDe"), track.phi()); - QA.fill(HIST("QA/hnSigmaTPCVsPhi_De"), track.phi(), track.tpcNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTPCVsEta_De"), track.eta(), track.tpcNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTOFVsPhi_De"), track.phi(), track.tofNSigmaDe()); - QA.fill(HIST("QA/hnSigmaTOFVsEta_De"), track.eta(), track.tofNSigmaDe()); QA.fill(HIST("QA/hnSigmaTOFVsPt_De_AfterSel"), track.pt() * track.sign(), track.tofNSigmaDe()); QA.fill(HIST("QA/hnSigmaTPCVsPt_De_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaDe()); } } - // Protons + // Protons Fill & QA if (isPr) { selectedtracks_p[track.singleCollSelId()].push_back(std::make_shared(track)); if (doQA) { QA.fill(HIST("QA/hEtaPr"), track.eta()); QA.fill(HIST("QA/hPhiPr"), track.phi()); - QA.fill(HIST("QA/hnSigmaTPCVsPhi_Pr"), track.phi(), track.tpcNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTPCVsEta_Pr"), track.eta(), track.tpcNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTOFVsPhi_Pr"), track.phi(), track.tofNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTOFVsEta_Pr"), track.eta(), track.tofNSigmaPr()); QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tofNSigmaPr()); } @@ -676,10 +658,6 @@ struct hadronnucleicorrelation { if (doQA) { QA.fill(HIST("QA/hEtaAntiPr"), track.eta()); QA.fill(HIST("QA/hPhiAntiPr"), track.phi()); - QA.fill(HIST("QA/hnSigmaTPCVsPhi_AntiPr"), track.phi(), track.tpcNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTPCVsEta_AntiPr"), track.eta(), track.tpcNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTOFVsPhi_AntiPr"), track.phi(), track.tofNSigmaPr()); - QA.fill(HIST("QA/hnSigmaTOFVsEta_AntiPr"), track.eta(), track.tofNSigmaPr()); QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tpcNSigmaPr()); QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr_AfterSel"), track.pt() * track.sign(), track.tofNSigmaPr()); } @@ -688,76 +666,28 @@ struct hadronnucleicorrelation { for (auto collision : collisions) { - if (TMath::Abs(collision.posZ()) > cutzvertex) + if (std::abs(collision.posZ()) > cutzvertex) continue; registry.fill(HIST("hNEvents"), 0.5); - registry.fill(HIST("hDebug"), 0.5); - - if (selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end() && - selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { - registry.fill(HIST("hNEvents"), 2.5); - } if (selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end() && selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { registry.fill(HIST("hNEvents"), 1.5); } - int vertexBinToMix = std::floor((collision.posZ() + cutzvertex) / (2 * cutzvertex / _vertexNbinsToMix)); - int centBinToMix = std::floor(collision.multPerc() / (100.0 / _multNsubBins)); - - if (selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) { - registry.fill(HIST("hDebug"), 3.5); - mixbins_pantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); + if (selectedtracks_d.find(collision.globalIndex()) != selectedtracks_d.end() && + selectedtracks_p.find(collision.globalIndex()) != selectedtracks_p.end()) { + registry.fill(HIST("hNEvents"), 2.5); } - if (selectedtracks_antip.find(collision.globalIndex()) != selectedtracks_antip.end()) { - registry.fill(HIST("hDebug"), 2.5); - } + int vertexBinToMix = std::floor((collision.posZ() + cutzvertex) / (2 * cutzvertex / _vertexNbinsToMix)); + int centBinToMix = std::floor(collision.multPerc() / (100.0 / _multNsubBins)); if (selectedtracks_antid.find(collision.globalIndex()) != selectedtracks_antid.end()) { - registry.fill(HIST("hDebug"), 1.5); - registry.fill(HIST("hDebugdp"), 0.5); // numero tot di collisioni nella mappa mixbins_antidantip - mixbins_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); - } - } - - registry.get(HIST("hDebugdp"))->SetBinContent(6, mixbins_antidantip.size()); - - if (!disable_pantip) { - if (!mixbins_pantip.empty()) { - for (auto i = mixbins_pantip.begin(); i != mixbins_pantip.end(); i++) { // iterating over all vertex&mult bins - - int EvPerBin = (i->second).size(); // number of collisions in each vertex&mult bin + registry.fill(HIST("hNEvents"), 3.5); - for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - - auto col1 = (i->second)[indx1]; - - if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) { - mixTracks<0, 0>(selectedtracks_p[col1->index()], selectedtracks_antip[col1->index()], 0, 0); // mixing SE - } - - int indx3 = EvPerBin; - if (indx1 < (EvPerBin - 11)) { - indx3 = indx1 + 11; - } - - for (int indx2 = indx1 + 1; indx2 < indx3; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - - auto col2 = (i->second)[indx2]; - - if (col1 == col2) { - continue; - } - - if (selectedtracks_antip.find(col2->index()) != selectedtracks_antip.end()) { - mixTracks<1, 0>(selectedtracks_p[col1->index()], selectedtracks_antip[col2->index()], 0, 0); // mixing ME - } - } - } - } + mixbins_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); } } @@ -765,20 +695,15 @@ struct hadronnucleicorrelation { for (auto i = mixbins_antidantip.begin(); i != mixbins_antidantip.end(); i++) { // iterating over all vertex&mult bins - registry.fill(HIST("hDebugdp"), 1.5); // numero di keys (vertex&mult bins) nella mappa mixbins_antidantip - std::vector value = i->second; int EvPerBin = value.size(); // number of collisions in each vertex&mult bin for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - registry.fill(HIST("hDebugdp"), 2.5); - auto col1 = value[indx1]; if (selectedtracks_antip.find(col1->index()) != selectedtracks_antip.end()) { - registry.fill(HIST("hDebugdp"), 3.5); - mixTracks<0, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col1->index()], 1, 0); // mixing SE + mixTracks<0, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col1->index()], 0); // mixing SE } for (int indx2 = 0; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -790,8 +715,7 @@ struct hadronnucleicorrelation { } if (selectedtracks_antip.find(col2->index()) != selectedtracks_antip.end()) { - registry.fill(HIST("hDebugdp"), 4.5); - mixTracks<1, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col2->index()], 1, 0); // mixing ME + mixTracks<1, 0>(selectedtracks_antid[col1->index()], selectedtracks_antip[col2->index()], 0); // mixing ME } } } @@ -811,73 +735,65 @@ struct hadronnucleicorrelation { (i->second).clear(); selectedtracks_p.clear(); - for (auto& pair : mixbins_antidantip) { - pair.second.clear(); // Clear the vector associated with the key - } - mixbins_antidantip.clear(); // Then clear the map itself + for (auto i = selectedtracks_d.begin(); i != selectedtracks_d.end(); i++) + (i->second).clear(); + selectedtracks_d.clear(); for (auto& pair : mixbins_antidantip) { pair.second.clear(); // Clear the vector associated with the key } mixbins_antidantip.clear(); // Then clear the map itself - - for (auto& pair : mixbins_pantip) { - pair.second.clear(); // Clear the vector associated with the key - } - mixbins_pantip.clear(); // Then clear the map itself } PROCESS_SWITCH(hadronnucleicorrelation, processData, "processData", true); void processMC(FilteredCollisions const& collisions, FilteredTracksMC const& tracks) { for (auto track : tracks) { - if (abs(track.template singleCollSel_as().posZ()) > cutzvertex) + if (std::abs(track.template singleCollSel_as().posZ()) > cutzvertex) continue; - if (abs(track.dcaXY()) > max_dcaxy || abs(track.dcaZ()) > max_dcaz) { // For now no filtering on the DCAxy or DCAz (casting not supported) + if (track.tpcFractionSharedCls() > max_tpcSharedCls) continue; - } - if (abs(track.pdgCode()) != pdgProton && abs(track.pdgCode()) != pdgDeuteron) + if (track.itsNCls() < min_itsNCls) continue; + if (!applyDCAcut(track)) + continue; + + // Keep only protons and deuterons + // if (std::abs(track.pdgCode()) != pdgProton && std::abs(track.pdgCode()) != pdgDeuteron) + // continue; if (doQA) { QA.fill(HIST("QA/hTPCnClusters"), track.tpcNClsFound()); QA.fill(HIST("QA/hTPCchi2"), track.tpcChi2NCl()); QA.fill(HIST("QA/hTPCcrossedRowsOverFindableCls"), track.tpcCrossedRowsOverFindableCls()); QA.fill(HIST("QA/hITSchi2"), track.itsChi2NCl()); - QA.fill(HIST("QA/hDCAxy"), track.dcaXY()); - QA.fill(HIST("QA/hDCAz"), track.dcaZ()); + QA.fill(HIST("QA/hDCAxy"), track.dcaXY(), track.pt()); + QA.fill(HIST("QA/hDCAz"), track.dcaZ(), track.pt()); QA.fill(HIST("QA/hVtxZ_trk"), track.template singleCollSel_as().posZ()); + QA.fill(HIST("QA/hnSigmaTPCVsPt_El"), track.pt() * track.sign(), track.tpcNSigmaEl()); QA.fill(HIST("QA/hnSigmaTPCVsPt_Pr"), track.pt() * track.sign(), track.tpcNSigmaPr()); QA.fill(HIST("QA/hnSigmaTPCVsPt_De"), track.pt() * track.sign(), track.tpcNSigmaDe()); QA.fill(HIST("QA/hnSigmaTOFVsPt_Pr"), track.pt() * track.sign(), track.tofNSigmaPr()); QA.fill(HIST("QA/hnSigmaTOFVsPt_De"), track.pt() * track.sign(), track.tofNSigmaDe()); } - int s = +1; - if (track.pdgCode() == -pdgProton) { - s = -1; - } + bool isPr = (IsProton(track, +1) && track.pdgCode() == pdgProton); + bool isAntiPr = (IsProton(track, -1) && track.pdgCode() == -pdgProton); + bool isDe = (IsDeuteron(track, +1) && track.pdgCode() == pdgDeuteron); + bool isAntiDe = (IsDeuteron(track, -1) && track.pdgCode() == -pdgDeuteron); - if (track.origin() == 1) { // secondaries - if (TMath::Abs(track.pdgCode()) == pdgProton) { - if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC) { - if (track.pt() < pTthrpr_TOF) { - registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * s); - } else if (TMath::Abs(track.tofNSigmaPr()) < nsigmaTOF) { - registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * s); - } + if (track.origin() == 1 || track.origin() == 0) { // primaries and secondaries + if (isPr) { + registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); + if (track.origin() == 1) { // secondaries + registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * +1); } } - } - if (track.origin() == 1 || track.origin() == 0) { // primaries and secondaries - if (TMath::Abs(track.pdgCode()) == pdgProton) { - if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC) { - if (track.pt() < pTthrpr_TOF) { - registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * s); - } else if (TMath::Abs(track.tofNSigmaPr()) < nsigmaTOF) { - registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * s); - } + if (isAntiPr) { + registry.fill(HIST("hPrimSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); + if (track.origin() == 1) { + registry.fill(HIST("hSec_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); } } } @@ -885,25 +801,16 @@ struct hadronnucleicorrelation { if (track.origin() != 0) continue; - bool isPr = false; - bool isAntiPr = false; - bool isAntiDeTPCTOF = false; - if (track.pdgCode() == pdgProton) { registry.fill(HIST("hReco_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt()); registry.fill(HIST("hReco_EtaPhiPtMC_Proton"), track.eta_MC(), track.phi_MC(), track.pt_MC()); registry.fill(HIST("hResPt_Proton"), track.pt_MC(), track.pt() - track.pt_MC()); - registry.fill(HIST("hResEta_Proton"), track.eta_MC(), track.eta() - track.eta_MC()); - registry.fill(HIST("hResPhi_Proton"), track.phi_MC(), track.phi() - track.phi_MC()); - - if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC) { - if (track.pt() < pTthrpr_TOF) { - isPr = true; - registry.fill(HIST("hReco_PID_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt()); - } else if (TMath::Abs(track.tofNSigmaPr()) < nsigmaTOF) { - isPr = true; - registry.fill(HIST("hReco_PID_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt()); - } + if (doMCQA) { + registry.fill(HIST("hResEta_Proton"), track.eta_MC(), track.eta() - track.eta_MC()); + registry.fill(HIST("hResPhi_Proton"), track.phi_MC(), track.phi() - track.phi_MC()); + } + if (isPr) { + registry.fill(HIST("hReco_PID_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt()); } registry.fill(HIST("hnSigmaTPCVsPt_Pr_MC"), track.pt(), track.tpcNSigmaPr()); registry.fill(HIST("hnSigmaTOFVsPt_Pr_MC"), track.pt(), track.tofNSigmaPr()); @@ -912,17 +819,12 @@ struct hadronnucleicorrelation { registry.fill(HIST("hReco_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); registry.fill(HIST("hReco_EtaPhiPtMC_Proton"), track.eta_MC(), track.phi_MC(), track.pt_MC() * -1); registry.fill(HIST("hResPt_AntiProton"), track.pt_MC(), track.pt() - track.pt_MC()); - registry.fill(HIST("hResEta_AntiProton"), track.eta_MC(), track.eta() - track.eta_MC()); - registry.fill(HIST("hResPhi_AntiProton"), track.phi_MC(), track.phi() - track.phi_MC()); - - if (TMath::Abs(track.tpcNSigmaPr()) < nsigmaTPC) { - if (track.pt() < pTthrpr_TOF) { - isAntiPr = true; - registry.fill(HIST("hReco_PID_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); - } else if (TMath::Abs(track.tofNSigmaPr()) < nsigmaTOF) { - isAntiPr = true; - registry.fill(HIST("hReco_PID_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); - } + if (doMCQA) { + registry.fill(HIST("hResEta_AntiProton"), track.eta_MC(), track.eta() - track.eta_MC()); + registry.fill(HIST("hResPhi_AntiProton"), track.phi_MC(), track.phi() - track.phi_MC()); + } + if (isAntiPr) { + registry.fill(HIST("hReco_PID_EtaPhiPt_Proton"), track.eta(), track.phi(), track.pt() * -1); } registry.fill(HIST("hnSigmaTPCVsPt_Pr_MC"), track.pt() * -1, track.tpcNSigmaPr()); registry.fill(HIST("hnSigmaTOFVsPt_Pr_MC"), track.pt() * -1, track.tofNSigmaPr()); @@ -931,10 +833,11 @@ struct hadronnucleicorrelation { registry.fill(HIST("hReco_EtaPhiPt_Deuteron"), track.eta(), track.phi(), track.pt()); registry.fill(HIST("hReco_EtaPhiPtMC_Deuteron"), track.eta_MC(), track.phi_MC(), track.pt_MC()); registry.fill(HIST("hResPt_Deuteron"), track.pt_MC(), track.pt() - track.pt_MC()); - registry.fill(HIST("hResEta_Deuteron"), track.eta_MC(), track.eta() - track.eta_MC()); - registry.fill(HIST("hResPhi_Deuteron"), track.phi_MC(), track.phi() - track.phi_MC()); - - if (TMath::Abs(track.tpcNSigmaDe()) < nsigmaTPC && TMath::Abs(track.tofNSigmaDe()) < nsigmaTOF && TMath::Abs(track.tofNSigmaPr()) >= nsigmaTOF) { + if (doMCQA) { + registry.fill(HIST("hResEta_Deuteron"), track.eta_MC(), track.eta() - track.eta_MC()); + registry.fill(HIST("hResPhi_Deuteron"), track.phi_MC(), track.phi() - track.phi_MC()); + } + if (isDe) { registry.fill(HIST("hReco_PID_EtaPhiPt_Deuteron"), track.eta(), track.phi(), track.pt()); } registry.fill(HIST("hnSigmaTPCVsPt_De_MC"), track.pt(), track.tpcNSigmaDe()); @@ -944,22 +847,242 @@ struct hadronnucleicorrelation { registry.fill(HIST("hReco_EtaPhiPt_Deuteron"), track.eta(), track.phi(), track.pt() * -1); registry.fill(HIST("hReco_EtaPhiPtMC_Deuteron"), track.eta_MC(), track.phi_MC(), track.pt_MC() * -1); registry.fill(HIST("hResPt_AntiDeuteron"), track.pt_MC(), track.pt() - track.pt_MC()); - registry.fill(HIST("hResEta_AntiDeuteron"), track.eta_MC(), track.eta() - track.eta_MC()); - registry.fill(HIST("hResPhi_AntiDeuteron"), track.phi_MC(), track.phi() - track.phi_MC()); - - if (TMath::Abs(track.tpcNSigmaDe()) < nsigmaTPC && TMath::Abs(track.tofNSigmaDe()) < nsigmaTOF && TMath::Abs(track.tofNSigmaPr()) >= nsigmaTOF) { - isAntiDeTPCTOF = true; + if (doMCQA) { + registry.fill(HIST("hResEta_AntiDeuteron"), track.eta_MC(), track.eta() - track.eta_MC()); + registry.fill(HIST("hResPhi_AntiDeuteron"), track.phi_MC(), track.phi() - track.phi_MC()); + } + if (isAntiDe) { registry.fill(HIST("hReco_PID_EtaPhiPt_Deuteron"), track.eta(), track.phi(), track.pt() * -1); } registry.fill(HIST("hnSigmaTPCVsPt_De_MC"), track.pt() * -1, track.tpcNSigmaDe()); registry.fill(HIST("hnSigmaTOFVsPt_De_MC"), track.pt() * -1, track.tofNSigmaDe()); } + // Purity + // Numerators + if (isPr) { + registry.fill(HIST("hNumeratorPurity_Proton"), track.pt()); + registry.fill(HIST("hReco_Pt_Proton"), track.pt()); + } + if (isAntiPr) { + registry.fill(HIST("hNumeratorPurity_Proton"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Proton"), track.pt() * -1); + } + if (isDe) { + registry.fill(HIST("hNumeratorPurity_Deuteron"), track.pt()); + registry.fill(HIST("hReco_Pt_Deuteron"), track.pt()); + } + if (isAntiDe) { + registry.fill(HIST("hNumeratorPurity_Deuteron"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Deuteron"), track.pt() * -1); + } + if (IsProton(track, +1)) + registry.fill(HIST("hDenominatorPurity_Proton"), track.pt()); + if (IsProton(track, -1)) + registry.fill(HIST("hDenominatorPurity_Proton"), track.pt() * -1); + if (IsDeuteron(track, +1)) + registry.fill(HIST("hDenominatorPurity_Deuteron"), track.pt()); + if (IsDeuteron(track, -1)) + registry.fill(HIST("hDenominatorPurity_Deuteron"), track.pt() * -1); + + if (doMCQA) { + // Proton + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.pdgCode() == pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPC"), track.pt()); + registry.fill(HIST("hReco_Pt_Proton_TPC"), track.pt()); + } + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF && + track.pdgCode() == pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPCTOF"), track.pt()); + registry.fill(HIST("hReco_Pt_Proton_TPCTOF"), track.pt()); + } + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.pdgCode() == pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPC_or_TOF"), track.pt()); + registry.fill(HIST("hReco_Pt_Proton_TPC_or_TOF"), track.pt()); + } + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElPr && track.pdgCode() == pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPCEl"), track.pt()); + registry.fill(HIST("hReco_Pt_Proton_TPCEl"), track.pt()); + } + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElPr && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.pdgCode() == pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPCEl_or_TOF"), track.pt()); + registry.fill(HIST("hReco_Pt_Proton_TPCEl_or_TOF"), track.pt()); + } + + // AntiProton + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.pdgCode() == -pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPC"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Proton_TPC"), track.pt() * -1); + } + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF && + track.pdgCode() == -pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPCTOF"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Proton_TPCTOF"), track.pt() * -1); + } + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.pdgCode() == -pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPC_or_TOF"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Proton_TPC_or_TOF"), track.pt() * -1); + } + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElPr && track.pdgCode() == -pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPCEl"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Proton_TPCEl"), track.pt() * -1); + } + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElPr && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.pdgCode() == -pdgProton) { + registry.fill(HIST("hNumeratorPurity_Proton_TPCEl_or_TOF"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Proton_TPCEl_or_TOF"), track.pt() * -1); + } + + // Deuteron + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.pdgCode() == pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPC"), track.pt()); + registry.fill(HIST("hReco_Pt_Deuteron_TPC"), track.pt()); + } + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF && + track.pdgCode() == pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPCTOF"), track.pt()); + registry.fill(HIST("hReco_Pt_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)) && + track.pdgCode() == pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPC_or_TOF"), track.pt()); + registry.fill(HIST("hReco_Pt_Deuteron_TPC_or_TOF"), track.pt()); + } + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElDe && track.pdgCode() == pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPCEl"), track.pt()); + registry.fill(HIST("hReco_Pt_Deuteron_TPCEl"), track.pt()); + } + if (((std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElDe && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF)) && + track.pdgCode() == pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPCEl_or_TOF"), track.pt()); + registry.fill(HIST("hReco_Pt_Deuteron_TPCEl_or_TOF"), track.pt()); + } + + // AntiDeuteron + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.pdgCode() == -pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPC"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Deuteron_TPC"), track.pt() * -1); + } + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF && + track.pdgCode() == -pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPCTOF"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Deuteron_TPCTOF"), track.pt() * -1); + } + if (((std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF)) && + track.pdgCode() == -pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPC_or_TOF"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Deuteron_TPC_or_TOF"), track.pt() * -1); + } + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElDe && track.pdgCode() == -pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPCEl"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Deuteron_TPCEl"), track.pt() * -1); + } + if (((std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElDe && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF)) && + track.pdgCode() == -pdgDeuteron) { + registry.fill(HIST("hNumeratorPurity_Deuteron_TPCEl_or_TOF"), track.pt() * -1); + registry.fill(HIST("hReco_Pt_Deuteron_TPCEl_or_TOF"), track.pt() * -1); + } + + // Denominators + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.sign() > 0) + registry.fill(HIST("hDenominatorPurity_Proton_TPC"), track.pt()); + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF && track.sign() > 0) + registry.fill(HIST("hDenominatorPurity_Proton_TPCTOF"), track.pt()); + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.sign() > 0) + registry.fill(HIST("hDenominatorPurity_Proton_TPC_or_TOF"), track.pt()); + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElPr && track.sign() > 0) { + registry.fill(HIST("hDenominatorPurity_Proton_TPCEl"), track.pt()); + } + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElPr && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.sign() > 0) { + registry.fill(HIST("hDenominatorPurity_Proton_TPCEl_or_TOF"), track.pt()); + } + + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.sign() < 0) + registry.fill(HIST("hDenominatorPurity_Proton_TPC"), track.pt() * -1); + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF && track.sign() < 0) + registry.fill(HIST("hDenominatorPurity_Proton_TPCTOF"), track.pt() * -1); + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.sign() < 0) + registry.fill(HIST("hDenominatorPurity_Proton_TPC_or_TOF"), track.pt() * -1); + if (std::abs(track.tpcNSigmaPr()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElPr && track.sign() < 0) { + registry.fill(HIST("hDenominatorPurity_Proton_TPCEl"), track.pt() * -1); + } + if (((std::abs(track.tpcNSigmaPr()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElPr && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaPr()) < nsigmaTPC && std::abs(track.tofNSigmaPr()) < nsigmaTOF)) && + track.sign() < 0) { + registry.fill(HIST("hDenominatorPurity_Proton_TPCEl_or_TOF"), track.pt() * -1); + } + + 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.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)) && + track.sign() > 0) { + registry.fill(HIST("hDenominatorPurity_Deuteron_TPC_or_TOF"), track.pt()); + } + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElDe && track.sign() > 0) { + registry.fill(HIST("hDenominatorPurity_Deuteron_TPCEl"), track.pt()); + } + if (((std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElDe && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF)) && + track.sign() > 0) + registry.fill(HIST("hDenominatorPurity_Deuteron_TPCEl_or_TOF"), track.pt()); + + 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.tofNSigmaDe()) < nsigmaTOF && track.sign() < 0) + registry.fill(HIST("hDenominatorPurity_Deuteron_TPCTOF"), track.pt() * -1); + if (( + (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF)) && + track.sign() < 0) + registry.fill(HIST("hDenominatorPurity_Deuteron_TPC_or_TOF"), track.pt() * -1); + if (std::abs(track.tpcNSigmaDe()) < nsigmaTPC && + track.tpcNSigmaEl() >= nsigmaElDe && track.sign() < 0) { + registry.fill(HIST("hDenominatorPurity_Deuteron_TPCEl"), track.pt() * -1); + } + if (((std::abs(track.tpcNSigmaDe()) < nsigmaTPC && track.tpcNSigmaEl() >= nsigmaElDe && track.beta() < -100) || + (track.beta() > -100 && std::abs(track.tpcNSigmaDe()) < nsigmaTPC && std::abs(track.tofNSigmaDe()) < nsigmaTOF)) && + track.sign() < 0) + registry.fill(HIST("hDenominatorPurity_Deuteron_TPCEl_or_TOF"), track.pt() * -1); + } + if (!mcCorrelation) { continue; } - if (isAntiDeTPCTOF) { + if (isDe) { + selectedtracksPIDMC_d[track.singleCollSelId()].push_back(std::make_shared(track)); + } + if (track.pdgCode() == pdgDeuteron) { + selectedtracksMC_d[track.singleCollSelId()].push_back(std::make_shared(track)); + } + if (isAntiDe) { selectedtracksPIDMC_antid[track.singleCollSelId()].push_back(std::make_shared(track)); } if (track.pdgCode() == -pdgDeuteron) { @@ -984,92 +1107,22 @@ struct hadronnucleicorrelation { } for (auto collision : collisions) { - if (TMath::Abs(collision.posZ()) > cutzvertex) + if (std::abs(collision.posZ()) > cutzvertex) continue; registry.fill(HIST("hNEvents"), 0.5); int vertexBinToMix = std::floor((collision.posZ() + cutzvertex) / (2 * cutzvertex / _vertexNbinsToMix)); int centBinToMix = std::floor(collision.multPerc() / (100.0 / _multNsubBins)); - if (selectedtracksMC_p.find(collision.globalIndex()) != selectedtracksMC_p.end()) { - mixbins_pantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); - } - if (selectedtracksMC_antid.find(collision.globalIndex()) != selectedtracksMC_antid.end()) { mixbins_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); } - if (selectedtracksPIDMC_p.find(collision.globalIndex()) != selectedtracksPIDMC_p.end()) { - mixbinsPID_pantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); - } - if (selectedtracksPIDMC_antid.find(collision.globalIndex()) != selectedtracksPIDMC_antid.end()) { mixbinsPID_antidantip[std::pair{vertexBinToMix, centBinToMix}].push_back(std::make_shared(collision)); } } // coll - if (!mixbins_pantip.empty()) { - - for (auto i = mixbins_pantip.begin(); i != mixbins_pantip.end(); i++) { // iterating over all vertex&mult bins - - std::vector value = i->second; - int EvPerBin = value.size(); // number of collisions in each vertex&mult bin - - for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - - auto col1 = value[indx1]; - - if (selectedtracksMC_antip.find(col1->index()) != selectedtracksMC_antip.end()) { - mixTracks<0, 1 /*MC qa*/>(selectedtracksMC_p[col1->index()], selectedtracksMC_antip[col1->index()], 0, 0); // mixing SE - } - - for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - - auto col2 = (i->second)[indx2]; - - if (col1 == col2) { - continue; - } - - if (selectedtracksMC_antip.find(col2->index()) != selectedtracksMC_antip.end()) { - mixTracks<1, 1>(selectedtracksMC_p[col1->index()], selectedtracksMC_antip[col2->index()], 0, 0); // mixing ME - } - } - } // event - } - } - - if (!mixbinsPID_pantip.empty()) { - - for (auto i = mixbinsPID_pantip.begin(); i != mixbinsPID_pantip.end(); i++) { // iterating over all vertex&mult bins - - std::vector value = i->second; - int EvPerBin = value.size(); // number of collisions in each vertex&mult bin - - for (int indx1 = 0; indx1 < EvPerBin; indx1++) { // loop over all the events in each vertex&mult bin - - auto col1 = value[indx1]; - - if (selectedtracksPIDMC_antip.find(col1->index()) != selectedtracksPIDMC_antip.end()) { - mixTracks<0, 1 /*MC qa*/>(selectedtracksPIDMC_p[col1->index()], selectedtracksPIDMC_antip[col1->index()], 0, 1); // mixing SE - } - - for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin - - auto col2 = (i->second)[indx2]; - - if (col1 == col2) { - continue; - } - - if (selectedtracksPIDMC_antip.find(col2->index()) != selectedtracksPIDMC_antip.end()) { - mixTracks<1, 1>(selectedtracksPIDMC_p[col1->index()], selectedtracksPIDMC_antip[col2->index()], 0, 1); // mixing ME - } - } - } - } - } - if (!mixbins_antidantip.empty()) { for (auto i = mixbins_antidantip.begin(); i != mixbins_antidantip.end(); i++) { // iterating over all vertex&mult bins @@ -1082,7 +1135,7 @@ struct hadronnucleicorrelation { auto col1 = value[indx1]; if (selectedtracksMC_antip.find(col1->index()) != selectedtracksMC_antip.end()) { - mixTracks<0, 1 /*MC qa*/>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col1->index()], 1, 0); // mixing SE + mixTracks<0, 1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col1->index()], 0); // mixing SE } for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -1094,7 +1147,7 @@ struct hadronnucleicorrelation { } if (selectedtracksMC_antip.find(col2->index()) != selectedtracksMC_antip.end()) { - mixTracks<1, 1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col2->index()], 1, 0); // mixing ME + mixTracks<1, 1>(selectedtracksMC_antid[col1->index()], selectedtracksMC_antip[col2->index()], 0); // mixing ME } } } @@ -1113,7 +1166,7 @@ struct hadronnucleicorrelation { auto col1 = value[indx1]; if (selectedtracksPIDMC_antip.find(col1->index()) != selectedtracksPIDMC_antip.end()) { - mixTracks<0, 1 /*MC qa*/>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col1->index()], 1, 1); // mixing SE + mixTracks<0, 1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col1->index()], 1); // mixing SE } for (int indx2 = indx1 + 1; indx2 < EvPerBin; indx2++) { // nested loop for all the combinations of collisions in a chosen mult/vertex bin @@ -1125,7 +1178,7 @@ struct hadronnucleicorrelation { } if (selectedtracksPIDMC_antip.find(col2->index()) != selectedtracksPIDMC_antip.end()) { - mixTracks<1, 1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col2->index()], 1, 1); // mixing ME + mixTracks<1, 1>(selectedtracksPIDMC_antid[col1->index()], selectedtracksPIDMC_antip[col2->index()], 1); // mixing ME } } } @@ -1137,6 +1190,10 @@ struct hadronnucleicorrelation { (i->second).clear(); selectedtracksMC_antid.clear(); + for (auto i = selectedtracksMC_d.begin(); i != selectedtracksMC_d.end(); i++) + (i->second).clear(); + selectedtracksMC_d.clear(); + for (auto i = selectedtracksMC_antip.begin(); i != selectedtracksMC_antip.end(); i++) (i->second).clear(); selectedtracksMC_antip.clear(); @@ -1149,6 +1206,10 @@ struct hadronnucleicorrelation { (i->second).clear(); selectedtracksPIDMC_antid.clear(); + for (auto i = selectedtracksPIDMC_d.begin(); i != selectedtracksPIDMC_d.end(); i++) + (i->second).clear(); + selectedtracksPIDMC_d.clear(); + for (auto i = selectedtracksPIDMC_antip.begin(); i != selectedtracksPIDMC_antip.end(); i++) (i->second).clear(); selectedtracksPIDMC_antip.clear(); @@ -1166,16 +1227,6 @@ struct hadronnucleicorrelation { pair.second.clear(); // clear the vector associated with the key } mixbins_antidantip.clear(); // clear the map - - for (auto& pair : mixbinsPID_pantip) { - pair.second.clear(); // clear the vector associated with the key - } - mixbinsPID_pantip.clear(); // clear the map - - for (auto& pair : mixbins_pantip) { - pair.second.clear(); // clear the vector associated with the key - } - mixbins_pantip.clear(); // clear the map } PROCESS_SWITCH(hadronnucleicorrelation, processMC, "processMC", false); }; diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx index 0b25ef70d33..1fe1a563137 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyMCQA.cxx @@ -115,7 +115,7 @@ struct hypertriton3bodyTrackMcinfo { "registry", { {"hEventCounter", "hEventCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hParticleCount", "hParticleCount", {HistType::kTH1F, {{7, 0.0f, 7.0f}}}}, + {"hParticleCounter", "hParticleCounter", {HistType::kTH1F, {{7, 0.0f, 7.0f}}}}, {"hTPCNCls", "hTPCNCls", {HistType::kTH1F, {{160, 0.0f, 160.0f}}}}, {"hTPCNClsCrossedRows", "hTPCNClsCrossedRows", {HistType::kTH1F, {{160, 0.0f, 160.0f}}}}, @@ -130,7 +130,7 @@ struct hypertriton3bodyTrackMcinfo { {"hHypertritonMcRapidity", "hHypertritonMcRapidity", {HistType::kTH1F, {{200, -10.0f, 10.0f}}}}, {"hHypertritonMcPt", "hHypertritonMcPt", {HistType::kTH1F, {{300, 0.0f, 15.0f}}}}, - {"hProtonCount", "hProtonCount", {HistType::kTH1F, {{6, 0.0f, 6.0f}}}}, + {"hProtonCounter", "hProtonCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, {"hProtonPt", "hProtonPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hProtonP", "hProtonP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hProtonMcPt", "hProtonMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, @@ -146,7 +146,7 @@ struct hypertriton3bodyTrackMcinfo { {"hDauProtonNsigmaProton", "hDauProtonNsigmaProton", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, {"hDauProtonTPCVsPt", "hDauProtonTPCVsPt", {HistType::kTH2F, {{50, 0.0f, 5.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, - {"hPionCount", "hPionCount", {HistType::kTH1F, {{7, 0.0f, 7.0f}}}}, + {"hPionCounter", "hPionCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, {"hPionPt", "hPionPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hPionP", "hPionP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hPionMcPt", "hPionMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, @@ -161,8 +161,9 @@ struct hypertriton3bodyTrackMcinfo { {"hDauPionMcPt", "hDauPionMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hDauPionNsigmaPion", "hDauPionNsigmaPion", {HistType::kTH1F, {{120, -6.0f, 6.0f}}}}, {"hDauPionTPCVsPt", "hDauPionTPCVsPt", {HistType::kTH2F, {{20, 0.0f, 2.0f, "#it{p}_{T} (GeV/c)"}, {120, -6.0f, 6.0f, "TPC n#sigma"}}}}, + {"hDauPionDcaXY", "hDauPionDcaXY", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}}, - {"hDeuteronCount", "hDeuteronCount", {HistType::kTH1F, {{6, 0.0f, 6.0f}}}}, + {"hDeuteronCounter", "hDeuteronCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, {"hDeuteronPt", "hDeuteronPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hDeuteronP", "hDeuteronP", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hDeuteronMcPt", "hDeuteronMcPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, @@ -212,21 +213,20 @@ struct hypertriton3bodyTrackMcinfo { void init(InitContext&) { - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(1, "Readin"); - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(2, "Has_mcparticle"); - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(3, "Rapidity Cut"); - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(4, "McisHypertriton"); - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(5, "McisProton"); - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(6, "McisPion"); - registry.get(HIST("hParticleCount"))->GetXaxis()->SetBinLabel(7, "McisDeuteron"); - - TString TrackCounterbinLabel[6] = {"hasMom", "FromHypertriton", "TPCNcls", "Eta", "Pt", "TPCPID"}; - for (int i{0}; i < 6; i++) { - registry.get(HIST("hProtonCount"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); - registry.get(HIST("hDeuteronCount"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); + registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(1, "Readin"); + registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(2, "Has_mcparticle"); + registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(3, "Rapidity Cut"); + registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(4, "McisHypertriton"); + registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(5, "McisProton"); + registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(6, "McisPion"); + registry.get(HIST("hParticleCounter"))->GetXaxis()->SetBinLabel(7, "McisDeuteron"); + + TString TrackCounterbinLabel[2] = {"hasMom", "FromHypertriton"}; + for (int i{0}; i < 2; i++) { + registry.get(HIST("hProtonCounter"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); + registry.get(HIST("hPionCounter"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); + registry.get(HIST("hDeuteronCounter"))->GetXaxis()->SetBinLabel(i + 1, TrackCounterbinLabel[i]); } - registry.get(HIST("hPionCount"))->GetXaxis()->SetBinLabel(7, "DcatoPV"); registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(1, "proton"); registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(2, "pion"); registry.get(HIST("hDuplicatedH3LDaughers"))->GetXaxis()->SetBinLabel(3, "deuteron"); @@ -368,7 +368,7 @@ struct hypertriton3bodyTrackMcinfo { for (auto& track : coltracks) { ++itrack; - registry.fill(HIST("hParticleCount"), 0.5); + registry.fill(HIST("hParticleCounter"), 0.5); registry.fill(HIST("hTrackITSNcls"), track.itsNCls()); registry.fill(HIST("hTPCNCls"), track.tpcNClsFound()); registry.fill(HIST("hTPCNClsCrossedRows"), track.tpcNClsCrossedRows()); @@ -382,16 +382,16 @@ struct hypertriton3bodyTrackMcinfo { auto mcparticle = track.mcParticle_as(); registry.fill(HIST("hTPCBB"), track.p() * track.sign(), track.tpcSignal()); - registry.fill(HIST("hParticleCount"), 1.5); + registry.fill(HIST("hParticleCounter"), 1.5); // if (TMath::Abs(mcparticle.y()) > 0.9) {continue;} - registry.fill(HIST("hParticleCount"), 2.5); + registry.fill(HIST("hParticleCounter"), 2.5); registry.fill(HIST("hTrackEta"), track.eta()); registry.fill(HIST("hTrackMcRapidity"), mcparticle.y()); // Hypertriton detected directly if (mcparticle.pdgCode() == 1010010030 || mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hParticleCount"), 3.5); + registry.fill(HIST("hParticleCounter"), 3.5); registry.fill(HIST("hHypertritonMcPt"), mcparticle.pt()); registry.fill(HIST("hHypertritonEta"), track.eta()); registry.fill(HIST("hHypertritonMcRapidity"), mcparticle.y()); @@ -399,13 +399,13 @@ struct hypertriton3bodyTrackMcinfo { // Proton if (mcparticle.pdgCode() == 2212 || mcparticle.pdgCode() == -2212) { - registry.fill(HIST("hParticleCount"), 4.5); + registry.fill(HIST("hParticleCounter"), 4.5); if (track.tpcNClsFound() > 70) { registry.fill(HIST("hProtonTPCBBAfterTPCNclsCut"), track.p() * track.sign(), track.tpcSignal()); } if (mcparticle.has_mothers()) { - registry.fill(HIST("hProtonCount"), 0.5); + registry.fill(HIST("hProtonCounter"), 0.5); for (auto& particleMother : mcparticle.mothers_as()) { bool flag_H3L = is3bodyDecayedH3L(particleMother); if (!flag_H3L) { @@ -415,27 +415,11 @@ struct hypertriton3bodyTrackMcinfo { auto p = set_proton.insert(mcparticle.globalIndex()); if (p.second == false) registry.fill(HIST("hDuplicatedH3LDaughers"), 0); - registry.fill(HIST("hProtonCount"), 1.5); + registry.fill(HIST("hProtonCounter"), 1.5); registry.fill(HIST("hDauProtonPt"), track.pt()); registry.fill(HIST("hDauProtonMcPt"), mcparticle.pt()); registry.fill(HIST("hDauProtonNsigmaProton"), track.tpcNSigmaPr()); registry.fill(HIST("hDauProtonTPCVsPt"), track.pt(), track.tpcNSigmaPr()); - if (track.tpcNClsFound() < 70) { - continue; - } - registry.fill(HIST("hProtonCount"), 2.5); - if (TMath::Abs(track.eta()) > 0.9) { - continue; - } - registry.fill(HIST("hProtonCount"), 3.5); - if (track.pt() < minProtonPt || track.pt() > maxProtonPt) { - continue; - } - registry.fill(HIST("hProtonCount"), 4.5); - if (TMath::Abs(track.tpcNSigmaPr()) > 5) { - continue; - } - registry.fill(HIST("hProtonCount"), 5.5); } } @@ -453,13 +437,13 @@ struct hypertriton3bodyTrackMcinfo { // Pion if (mcparticle.pdgCode() == 211 || mcparticle.pdgCode() == -211) { - registry.fill(HIST("hParticleCount"), 5.5); + registry.fill(HIST("hParticleCounter"), 5.5); if (track.tpcNClsFound() > 70) { registry.fill(HIST("hPionTPCBBAfterTPCNclsCut"), track.p() * track.sign(), track.tpcSignal()); } if (mcparticle.has_mothers()) { - registry.fill(HIST("hPionCount"), 0.5); + registry.fill(HIST("hPionCounter"), 0.5); for (auto& particleMother : mcparticle.mothers_as()) { bool flag_H3L = is3bodyDecayedH3L(particleMother); if (!flag_H3L) { @@ -470,30 +454,11 @@ struct hypertriton3bodyTrackMcinfo { if (p.second == false) { registry.fill(HIST("hDuplicatedH3LDaughers"), 1); } - registry.fill(HIST("hPionCount"), 1.5); + registry.fill(HIST("hPionCounter"), 1.5); registry.fill(HIST("hDauPionPt"), track.pt()); registry.fill(HIST("hDauPionMcPt"), mcparticle.pt()); registry.fill(HIST("hDauPionTPCVsPt"), track.pt(), track.tpcNSigmaPi()); - if (track.tpcNClsFound() < 70) { - continue; - } - registry.fill(HIST("hPionCount"), 2.5); - if (TMath::Abs(track.eta()) > 0.9) { - continue; - } - registry.fill(HIST("hPionCount"), 3.5); - if (track.pt() < minPionPt || track.pt() > maxPionPt) { - continue; - } - registry.fill(HIST("hPionCount"), 4.5); - if (TMath::Abs(track.tpcNSigmaPi()) > 5) { - continue; - } - registry.fill(HIST("hPionCount"), 5.5); - if (TMath::Abs(track.dcaXY()) < dcapiontopv) { - continue; - } - registry.fill(HIST("hPionCount"), 6.5); + registry.fill(HIST("hDauPionDcaXY"), track.dcaXY()); } } @@ -538,13 +503,13 @@ struct hypertriton3bodyTrackMcinfo { // Deuteron if (mcparticle.pdgCode() == 1000010020 || mcparticle.pdgCode() == -1000010020) { - registry.fill(HIST("hParticleCount"), 6.5); + registry.fill(HIST("hParticleCounter"), 6.5); if (track.tpcNClsFound() > 70) { registry.fill(HIST("hDeuteronTPCBBAfterTPCNclsCut"), track.p() * track.sign(), track.tpcSignal()); } if (mcparticle.has_mothers()) { - registry.fill(HIST("hDeuteronCount"), 0.5); + registry.fill(HIST("hDeuteronCounter"), 0.5); for (auto& particleMother : mcparticle.mothers_as()) { bool flag_H3L = is3bodyDecayedH3L(particleMother); if (!flag_H3L) { @@ -554,7 +519,7 @@ struct hypertriton3bodyTrackMcinfo { auto p = set_deuteron.insert(mcparticle.globalIndex()); if (p.second == false) registry.fill(HIST("hDuplicatedH3LDaughers"), 2); - registry.fill(HIST("hDeuteronCount"), 1.5); + registry.fill(HIST("hDeuteronCounter"), 1.5); registry.fill(HIST("hDauDeuteronPt"), track.pt()); registry.fill(HIST("hDauDeuteronMcPt"), mcparticle.pt()); registry.fill(HIST("hDauDeuteronTPCVsPt"), track.pt(), track.tpcNSigmaDe()); @@ -575,22 +540,6 @@ struct hypertriton3bodyTrackMcinfo { registry.fill(HIST("hDauDeuteronMatchCounter"), 3.5); } } - if (track.tpcNClsFound() < 70) { - continue; - } - registry.fill(HIST("hDeuteronCount"), 2.5); - if (TMath::Abs(track.eta()) > 0.9) { - continue; - } - registry.fill(HIST("hDeuteronCount"), 3.5); - if (track.pt() < minDeuteronPt || track.pt() > maxDeuteronPt) { - continue; - } - registry.fill(HIST("hDeuteronCount"), 4.5); - if (TMath::Abs(track.tpcNSigmaDe()) > 5) { - continue; - } - registry.fill(HIST("hDeuteronCount"), 5.5); } } @@ -738,23 +687,27 @@ struct hypertriton3bodyTrackMcinfo { }; // check the performance of mcparticle -struct hypertriton3bodyMcParticleCount { +struct hypertriton3bodyMcParticleCheck { // Basic checks HistogramRegistry registry{ "registry", { - {"hTotalMcCollCounter", "hTotalMcCollCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, + {"hMcCollCounter", "hMcCollCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, {"h3dMCDecayedHypertriton", "h3dMCDecayedHypertriton", {HistType::kTH3F, {{20, -1.0f, 1.0f, "Rapidity"}, {200, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {50, 0.0f, 50.0f, "ct(cm)"}}}}, - {"hMcPhysicalPrimaryParticleCount", "hMcPhysicalPrimaryParticleCount", {HistType::kTH1F, {{8, 0.0f, 8.0f}}}}, - {"hMcHypertritonCount", "hMcHypertritonCount", {HistType::kTH1F, {{9, 0.0f, 9.0f}}}}, + {"hMcHypertritonCounter", "hMcHypertritonCounter", {HistType::kTH1F, {{9, 0.0f, 9.0f}}}}, {"hMcHypertritonPt", "hMcHypertritonPt", {HistType::kTH1F, {{300, 0.0f, 15.0f}}}}, {"hMcProtonPt", "hMcProtonPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hMcPionPt", "hMcPionPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hMcDeuteronPt", "hMcDeuteronPt", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, {"hMcRecoInvMass", "hMcRecoInvMass", {HistType::kTH1F, {{100, 2.95, 3.05f}}}}, + + {"hDiffDaughterR", "hDiffDaughterR", {HistType::kTH1F, {{10000, -100, 100}}}}, // difference between minR of pion&proton and R of deuteron(bachelor) + {"hTrackX", "hTrackX", {HistType::kTH1F, {{10000, -100, 100}}}}, + {"hTrackY", "hTrackY", {HistType::kTH1F, {{10000, -100, 100}}}}, + {"hTrackZ", "hTrackZ", {HistType::kTH1F, {{10000, -100, 100}}}}, }, }; @@ -762,34 +715,57 @@ struct hypertriton3bodyMcParticleCount { void init(InitContext&) { - registry.get(HIST("hTotalMcCollCounter"))->GetXaxis()->SetBinLabel(1, "Total Count"); - registry.get(HIST("hTotalMcCollCounter"))->GetXaxis()->SetBinLabel(2, "Recoonstructed"); - - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(1, "Readin"); - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(2, "IsPhysicalPrimary"); - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(3, "y<0.9(off)"); - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(4, "(Anti)Proton"); - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(5, "(Anti)Pion"); - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(6, "(Anti)Deuteron"); - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(7, "(Anti)Hypertriton"); - registry.get(HIST("hMcPhysicalPrimaryParticleCount"))->GetXaxis()->SetBinLabel(8, "HasDaughter"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(1, "Hypertriton All"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(2, "Matter All"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(3, "AntiMatter All"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(4, "confirm to 3-body decay"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(5, "Matter"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(6, "AntiMatter"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(7, "Rapidity"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(8, "Lifetime"); - registry.get(HIST("hMcHypertritonCount"))->GetXaxis()->SetBinLabel(9, "PtCut"); + registry.get(HIST("hMcCollCounter"))->GetXaxis()->SetBinLabel(1, "Total Counter"); + registry.get(HIST("hMcCollCounter"))->GetXaxis()->SetBinLabel(2, "Recoonstructed"); + + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(1, "Hypertriton All"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(2, "Matter All"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(3, "AntiMatter All"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(4, "confirm to 3-body decay"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(5, "Matter"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(6, "AntiMatter"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(7, "Rapidity"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(8, "Lifetime"); + registry.get(HIST("hMcHypertritonCounter"))->GetXaxis()->SetBinLabel(9, "PtCut"); } Configurable rapidityMCcut{"rapidityMCcut", 1, "rapidity cut MC count"}; Configurable event_sel8_selection{"event_sel8_selection", false, "event selection count post sel8 cut"}; Configurable event_posZ_selection{"event_posZ_selection", false, "event selection count post poZ cut"}; - void process(aod::McCollision const& mcCollision, aod::McParticles const& particlesMC, const soa::SmallGroups>& collisions) + Preslice permcCollision = o2::aod::mcparticle::mcCollisionId; + + std::vector mcPartIndices; + template + void SetTrackIDForMC(aod::McParticles const& particlesMC, TTrackTable const& tracks) + { + mcPartIndices.clear(); + mcPartIndices.resize(particlesMC.size()); + std::fill(mcPartIndices.begin(), mcPartIndices.end(), -1); + for (auto& track : tracks) { + if (track.has_mcParticle()) { + auto mcparticle = track.template mcParticle_as(); + if (mcPartIndices[mcparticle.globalIndex()] == -1) { + mcPartIndices[mcparticle.globalIndex()] = track.globalIndex(); + } else { + auto candTrack = tracks.rawIteratorAt(mcPartIndices[mcparticle.globalIndex()]); + // Use the track which has innest information (also best quality? + if (track.x() < candTrack.x()) { + mcPartIndices[mcparticle.globalIndex()] = track.globalIndex(); + } + } + + // Checks for TrackR + registry.fill(HIST("hTrackX"), track.x()); + registry.fill(HIST("hTrackY"), track.y()); + registry.fill(HIST("hTrackZ"), track.z()); + } + } + } + + void process(aod::McCollisions const& mcCollisions, aod::McParticles const& particlesMC, const soa::SmallGroups>& collisions, MCLabeledTracksIU const& tracks) { + SetTrackIDForMC(particlesMC, tracks); std::vector SelectedEvents(collisions.size()); int nevts = 0; for (const auto& collision : collisions) { @@ -803,119 +779,116 @@ struct hypertriton3bodyMcParticleCount { } SelectedEvents.resize(nevts); - registry.fill(HIST("hTotalMcCollCounter"), 0.5); - - const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); - if (evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection - registry.fill(HIST("hTotalMcCollCounter"), 1.5); - // return; - } + for (auto mcCollision : mcCollisions) { + registry.fill(HIST("hMcCollCounter"), 0.5); + const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); + if (evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection + registry.fill(HIST("hMcCollCounter"), 1.5); + // return; + } - for (auto& mcparticle : particlesMC) { + const auto& dparticlesMC = particlesMC.sliceBy(permcCollision, mcCollision.globalIndex()); - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 0.5); + for (auto& mcparticle : dparticlesMC) { - if (mcparticle.pdgCode() == 2212 || mcparticle.pdgCode() == -2212) { - registry.fill(HIST("hMcProtonPt"), mcparticle.pt()); - } - if (mcparticle.pdgCode() == 211 || mcparticle.pdgCode() == -211) { - registry.fill(HIST("hMcPionPt"), mcparticle.pt()); - } - if (mcparticle.pdgCode() == 1000010020 || mcparticle.pdgCode() == -1000010020) { - registry.fill(HIST("hMcDeuteronPt"), mcparticle.pt()); - } - if (mcparticle.pdgCode() == 1010010030) { - registry.fill(HIST("hMcHypertritonCount"), 1.5); - } else if (mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hMcHypertritonCount"), 2.5); - } - if (mcparticle.pdgCode() == 1010010030 || mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hMcHypertritonCount"), 0.5); - registry.fill(HIST("hMcHypertritonPt"), mcparticle.pt()); - - double dauDeuteronPos[3] = {-999, -999, -999}; - double dauProtonMom[3] = {-999, -999, -999}; - double dauPionMom[3] = {-999, -999, -999}; - double dauDeuteronMom[3] = {-999, -999, -999}; - double MClifetime = 999; - bool flag_H3L = is3bodyDecayedH3L(mcparticle); - if (!flag_H3L) { - continue; + if (mcparticle.pdgCode() == 2212 || mcparticle.pdgCode() == -2212) { + registry.fill(HIST("hMcProtonPt"), mcparticle.pt()); } - for (auto& mcparticleDaughter : mcparticle.daughters_as()) { - if (std::abs(mcparticleDaughter.pdgCode()) == 2212) { - dauProtonMom[0] = mcparticleDaughter.px(); - dauProtonMom[1] = mcparticleDaughter.py(); - dauProtonMom[2] = mcparticleDaughter.pz(); - } - if (std::abs(mcparticleDaughter.pdgCode()) == 211) { - dauPionMom[0] = mcparticleDaughter.px(); - dauPionMom[1] = mcparticleDaughter.py(); - dauPionMom[2] = mcparticleDaughter.pz(); - } - if (std::abs(mcparticleDaughter.pdgCode()) == 1000010020) { - dauDeuteronPos[0] = mcparticleDaughter.vx(); - dauDeuteronPos[1] = mcparticleDaughter.vy(); - dauDeuteronPos[2] = mcparticleDaughter.vz(); - dauDeuteronMom[0] = mcparticleDaughter.px(); - dauDeuteronMom[1] = mcparticleDaughter.py(); - dauDeuteronMom[2] = mcparticleDaughter.pz(); - } + if (mcparticle.pdgCode() == 211 || mcparticle.pdgCode() == -211) { + registry.fill(HIST("hMcPionPt"), mcparticle.pt()); } - if (mcparticle.pdgCode() == 1010010030) { - registry.fill(HIST("hMcHypertritonCount"), 3.5); - registry.fill(HIST("hMcHypertritonCount"), 4.5); + if (mcparticle.pdgCode() == 1000010020 || mcparticle.pdgCode() == -1000010020) { + registry.fill(HIST("hMcDeuteronPt"), mcparticle.pt()); } - if (mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hMcHypertritonCount"), 3.5); - registry.fill(HIST("hMcHypertritonCount"), 5.5); + if (mcparticle.pdgCode() == 1010010030) { + registry.fill(HIST("hMcHypertritonCounter"), 1.5); + } else if (mcparticle.pdgCode() == -1010010030) { + registry.fill(HIST("hMcHypertritonCounter"), 2.5); } - MClifetime = RecoDecay::sqrtSumOfSquares(dauDeuteronPos[0] - mcparticle.vx(), dauDeuteronPos[1] - mcparticle.vy(), dauDeuteronPos[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); - registry.fill(HIST("hMcRecoInvMass"), RecoDecay::m(array{array{dauProtonMom[0], dauProtonMom[1], dauProtonMom[2]}, array{dauPionMom[0], dauPionMom[1], dauPionMom[2]}, array{dauDeuteronMom[0], dauDeuteronMom[1], dauDeuteronMom[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron})); - registry.fill(HIST("h3dMCDecayedHypertriton"), mcparticle.y(), mcparticle.pt(), MClifetime); - - // int daughterPionCount = 0; - // for (auto& mcparticleDaughter : mcparticle.daughters_as()) { - // if (std::abs(mcparticleDaughter.pdgCode()) == 211) { - // daughterPionCount++; - // } - // } - - // Count for hypertriton N_gen - if (TMath::Abs(mcparticle.y()) < 1) { - registry.fill(HIST("hMcHypertritonCount"), 6.5); - if (MClifetime < 40) { - registry.fill(HIST("hMcHypertritonCount"), 7.5); - if (mcparticle.pt() > 1 && mcparticle.pt() < 10) { - registry.fill(HIST("hMcHypertritonCount"), 8.5); + if (mcparticle.pdgCode() == 1010010030 || mcparticle.pdgCode() == -1010010030) { + registry.fill(HIST("hMcHypertritonCounter"), 0.5); + registry.fill(HIST("hMcHypertritonPt"), mcparticle.pt()); + + double dauDeuteronPos[3] = {-999, -999, -999}; + double dauProtonMom[3] = {-999, -999, -999}; + double dauPionMom[3] = {-999, -999, -999}; + double dauDeuteronMom[3] = {-999, -999, -999}; + double MClifetime = 999; + double dauProtonTrackR = 9999, dauPionTrackR = 99999, dauDeuteronTrackR = 999999; + bool flag_H3L = is3bodyDecayedH3L(mcparticle); + if (!flag_H3L) { + continue; + } + for (auto& mcparticleDaughter : mcparticle.daughters_as()) { + if (std::abs(mcparticleDaughter.pdgCode()) == 2212) { + dauProtonMom[0] = mcparticleDaughter.px(); + dauProtonMom[1] = mcparticleDaughter.py(); + dauProtonMom[2] = mcparticleDaughter.pz(); + if (mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { + auto trackProton = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); + dauProtonTrackR = trackProton.x(); + } + } + if (std::abs(mcparticleDaughter.pdgCode()) == 211) { + dauPionMom[0] = mcparticleDaughter.px(); + dauPionMom[1] = mcparticleDaughter.py(); + dauPionMom[2] = mcparticleDaughter.pz(); + if (mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { + auto trackPion = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); + dauPionTrackR = trackPion.x(); + } + } + if (std::abs(mcparticleDaughter.pdgCode()) == 1000010020) { + dauDeuteronPos[0] = mcparticleDaughter.vx(); + dauDeuteronPos[1] = mcparticleDaughter.vy(); + dauDeuteronPos[2] = mcparticleDaughter.vz(); + dauDeuteronMom[0] = mcparticleDaughter.px(); + dauDeuteronMom[1] = mcparticleDaughter.py(); + dauDeuteronMom[2] = mcparticleDaughter.pz(); + if (mcPartIndices[mcparticleDaughter.globalIndex()] != -1) { + auto trackDeuteron = tracks.rawIteratorAt(mcPartIndices[mcparticleDaughter.globalIndex()]); + dauDeuteronTrackR = trackDeuteron.x(); + } + } + } + if (mcparticle.pdgCode() == 1010010030) { + registry.fill(HIST("hMcHypertritonCounter"), 3.5); + registry.fill(HIST("hMcHypertritonCounter"), 4.5); + } + if (mcparticle.pdgCode() == -1010010030) { + registry.fill(HIST("hMcHypertritonCounter"), 3.5); + registry.fill(HIST("hMcHypertritonCounter"), 5.5); + } + double hypertritonMCMass = RecoDecay::m(array{array{dauProtonMom[0], dauProtonMom[1], dauProtonMom[2]}, array{dauPionMom[0], dauPionMom[1], dauPionMom[2]}, array{dauDeuteronMom[0], dauDeuteronMom[1], dauDeuteronMom[2]}}, array{o2::constants::physics::MassProton, o2::constants::physics::MassPionCharged, o2::constants::physics::MassDeuteron}); + registry.fill(HIST("hMcRecoInvMass"), hypertritonMCMass); + + if (hypertritonMCMass > 2.990 && hypertritonMCMass < 2.993) { + MClifetime = RecoDecay::sqrtSumOfSquares(dauDeuteronPos[0] - mcparticle.vx(), dauDeuteronPos[1] - mcparticle.vy(), dauDeuteronPos[2] - mcparticle.vz()) * o2::constants::physics::MassHyperTriton / mcparticle.p(); + registry.fill(HIST("h3dMCDecayedHypertriton"), mcparticle.y(), mcparticle.pt(), MClifetime); + + double diffTrackR = dauDeuteronTrackR - std::min(dauPionTrackR, dauProtonTrackR); + registry.fill(HIST("hDiffDaughterR"), diffTrackR); + + // int daughterPionCount = 0; + // for (auto& mcparticleDaughter : mcparticle.daughters_as()) { + // if (std::abs(mcparticleDaughter.pdgCode()) == 211) { + // daughterPionCount++; + // } + // } + + // Counter for hypertriton N_gen + if (TMath::Abs(mcparticle.y()) < 1) { + registry.fill(HIST("hMcHypertritonCounter"), 6.5); + if (MClifetime < 40) { + registry.fill(HIST("hMcHypertritonCounter"), 7.5); + if (mcparticle.pt() > 1 && mcparticle.pt() < 10) { + registry.fill(HIST("hMcHypertritonCounter"), 8.5); + } + } } } } } - - if (!mcparticle.isPhysicalPrimary()) { - continue; - } - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 1.5); - if (TMath::Abs(mcparticle.y()) > rapidityMCcut) { - continue; - } - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 2.5); - - if (mcparticle.pdgCode() == 211 || mcparticle.pdgCode() == -211) { - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 3.5); - } else if (mcparticle.pdgCode() == 2212 || mcparticle.pdgCode() == -2212) { - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 4.5); - } else if (mcparticle.pdgCode() == 1000010020 || mcparticle.pdgCode() == -1000010020) { - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 5.5); - } else if (mcparticle.pdgCode() == 1010010030 || mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 6.5); - } - - if (!mcparticle.has_daughters()) { - continue; - } - registry.fill(HIST("hMcPhysicalPrimaryParticleCount"), 7.5); } } }; @@ -924,6 +897,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), }; } diff --git a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx index ba415978df2..6d07b9e1de4 100644 --- a/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx +++ b/PWGLF/Tasks/Nuspex/hypertriton3bodyanalysis.cxx @@ -78,12 +78,19 @@ struct hypertriton3bodyQa { {"hDeuTOFNsigmaWithTPC", "Deuteron TOF Nsigma distribution", {HistType::kTH2F, {{1200, -6, 6, "#it{p} (GeV/#it{c})"}, {1000, -100, 100, "TOF n#sigma"}}}}, }, }; + void init(InitContext const&) { AxisSpec massAxis = {120, 2.9f, 3.2f, "Inv. Mass (GeV/c^{2})"}; registry.add("hMassHypertriton", "hMassHypertriton", {HistType::kTH1F, {massAxis}}); registry.add("hMassAntiHypertriton", "hMassAntiHypertriton", {HistType::kTH1F, {massAxis}}); + // Check for selection criteria + registry.add("hDiffRVtxProton", "hDiffRVtxProton", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of proton + registry.add("hDiffRVtxPion", "hDiffRVtxPion", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of pion + 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) } + void process(aod::Collision const& collision, aod::Vtx3BodyDatas const& vtx3bodydatas, FullTracksExtIU const& /*tracks*/) { for (auto& vtx : vtx3bodydatas) { @@ -97,8 +104,6 @@ struct hypertriton3bodyQa { registry.fill(HIST("hVtxPt"), vtx.pt()); registry.fill(HIST("hMassHypertriton"), vtx.mHypertriton()); registry.fill(HIST("hMassAntiHypertriton"), vtx.mAntiHypertriton()); - registry.fill(HIST("hTOFPIDDeuteron"), vtx.tofNSigmaBachDe()); - registry.fill(HIST("hDeuTOFNsigma"), track2.tpcInnerParam() * track2.sign(), vtx.tofNSigmaBachDe()); if (std::abs(track2.tpcNSigmaDe()) < 5) { registry.fill(HIST("hDeuTOFNsigmaWithTPC"), track2.tpcInnerParam() * track2.sign(), vtx.tofNSigmaBachDe()); } @@ -112,6 +117,8 @@ struct hypertriton3bodyQa { registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack1topv()); registry.fill(HIST("hProtonTPCNcls"), track0.tpcNClsCrossedRows()); registry.fill(HIST("hPionTPCNcls"), track1.tpcNClsCrossedRows()); + registry.fill(HIST("hDiffRVtxProton"), track0.x() - vtx.vtxradius()); + registry.fill(HIST("hDiffRVtxPion"), track1.x() - vtx.vtxradius()); } else { registry.fill(HIST("hPtPionPlus"), track0.pt()); registry.fill(HIST("hPtAntiProton"), track1.pt()); @@ -122,16 +129,25 @@ struct hypertriton3bodyQa { registry.fill(HIST("hDCAPionToPV"), vtx.dcatrack0topv()); registry.fill(HIST("hProtonTPCNcls"), track1.tpcNClsCrossedRows()); registry.fill(HIST("hPionTPCNcls"), track0.tpcNClsCrossedRows()); + registry.fill(HIST("hDiffRVtxProton"), track1.x() - vtx.vtxradius()); + registry.fill(HIST("hDiffRVtxPion"), track0.x() - vtx.vtxradius()); } registry.fill(HIST("hDCAXYDeuteronToPV"), vtx.dcaXYtrack2topv()); registry.fill(HIST("hDCADeuteronToPV"), vtx.dcatrack2topv()); registry.fill(HIST("hDeuteronTPCNcls"), track2.tpcNClsCrossedRows()); + registry.fill(HIST("hTOFPIDDeuteron"), vtx.tofNSigmaBachDe()); + registry.fill(HIST("hDeuTOFNsigma"), track2.tpcInnerParam() * track2.sign(), vtx.tofNSigmaBachDe()); + registry.fill(HIST("hDiffRVtxDeuteron"), track2.x() - vtx.vtxradius()); + float diffTrackR = track2.x() - std::min(track0.x(), track1.x()); + registry.fill(HIST("hDiffDaughterR"), diffTrackR); } } }; 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 @@ -142,6 +158,7 @@ struct hypertriton3bodyAnalysis { 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"}; Configurable lifetimecut{"lifetimecut", 40., "lifetimecut"}; // ct Configurable minProtonPt{"minProtonPt", 0.3, "minProtonPt"}; @@ -158,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", @@ -202,7 +225,6 @@ struct hypertriton3bodyAnalysis { {"h3dMassAntiHypertriton", "h3dMassAntiHypertriton", {HistType::kTH3F, {{20, 0.0f, 100.0f, "Cent (%)"}, {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, {"h3dTotalHypertriton", "h3dTotalHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, - {"hTrueHypertritonCounter", "hTrueHypertritonCounter", {HistType::kTH1F, {{12, 0.0f, 12.0f}}}}, {"hDeuteronTOFVsPBeforeTOFCutSig", "hDeuteronTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, {"hDeuteronTOFVsPAfterTOFCutSig", "hDeuteronTOFVsPAfterTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, {"h3dTotalTrueHypertriton", "h3dTotalTrueHypertriton", {HistType::kTH3F, {{50, 0, 50, "ct(cm)"}, {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/c)"}, {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"}}}}, @@ -211,33 +233,22 @@ struct hypertriton3bodyAnalysis { {"hDeuteronDefaultTOFVsPAtferTOFCut", "hDeuteronDefaultTOFVsPAtferTOFCut", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, {"hDeuteronDefaultTOFVsPBeforeTOFCutSig", "hDeuteronDefaultTOFVsPBeforeTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}}, {"hDeuteronDefaultTOFVsPAfterTOFCutSig", "hDeuteronDefaultTOFVsPAfterTOFCutSig", {HistType::kTH2F, {{40, -10.0f, 10.0f, "p/z (GeV/c)"}, {40, -10.0f, 10.0f, "TOF n#sigma"}}}},*/ - - // for mcparticles information - {"hGeneratedHypertritonCounter", "hGeneratedHypertritonCounter", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}}, - {"hPtGeneratedHypertriton", "hPtGeneratedHypertriton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hctGeneratedHypertriton", "hctGeneratedHypertriton", {HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}}}, - {"hEtaGeneratedHypertriton", "hEtaGeneratedHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, - {"hRapidityGeneratedHypertriton", "hRapidityGeneratedHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, - {"hPtGeneratedAntiHypertriton", "hPtGeneratedAntiHypertriton", {HistType::kTH1F, {{200, 0.0f, 10.0f}}}}, - {"hctGeneratedAntiHypertriton", "hctGeneratedAntiHypertriton", {HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}}}, - {"hEtaGeneratedAntiHypertriton", "hEtaGeneratedAntiHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, - {"hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", {HistType::kTH1F, {{40, -2.0f, 2.0f}}}}, }, }; //------------------------------------------------------------------ // 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 }; @@ -264,7 +275,9 @@ struct hypertriton3bodyAnalysis { { for (Int_t ii = 0; ii < kNCandSteps; ii++) { registry.fill(HIST("hCandidatesCounter"), ii, statisticsRegistry.candstats[ii]); - registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); + if (doprocessMC == true) { + registry.fill(HIST("hTrueHypertritonCounter"), ii, statisticsRegistry.truecandstats[ii]); + } } } @@ -273,64 +286,62 @@ struct hypertriton3bodyAnalysis { void init(InitContext const&) { - /*AxisSpec dcaAxis = {dcaBinning, "DCA (cm)"}; - AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/c)"}; - AxisSpec massAxisHypertriton = {80, 2.96f, 3.04f, "Inv. Mass (GeV/c^{2})"};*/ - 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"); - TString CandCounterbinLabel[12] = {"Total", "VtxCosPA", "TrackEta", "MomRapidity", "Lifetime", "VtxDcaDau", "d TOFPID", "TPCPID", "TPCNcls", "DauPt", "PionDcatoPV", "InvMass"}; + 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}}); + hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(1, "Total"); + hGeneratedHypertritonCounter->GetXaxis()->SetBinLabel(2, "3-body decay"); + registry.add("hPtGeneratedHypertriton", "hPtGeneratedHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); + registry.add("hctGeneratedHypertriton", "hctGeneratedHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); + registry.add("hEtaGeneratedHypertriton", "hEtaGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + registry.add("hRapidityGeneratedHypertriton", "hRapidityGeneratedHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + registry.add("hPtGeneratedAntiHypertriton", "hPtGeneratedAntiHypertriton", HistType::kTH1F, {{200, 0.0f, 10.0f}}); + registry.add("hctGeneratedAntiHypertriton", "hctGeneratedAntiHypertriton", HistType::kTH1F, {{50, 0, 50, "ct(cm)"}}); + registry.add("hEtaGeneratedAntiHypertriton", "hEtaGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + registry.add("hRapidityGeneratedAntiHypertriton", "hRapidityGeneratedAntiHypertriton", HistType::kTH1F, {{40, -2.0f, 2.0f}}); + } + + 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("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + if (doprocessMC == true) { + registry.get(HIST("hTrueHypertritonCounter"))->GetXaxis()->SetBinLabel(i + 1, CandCounterbinLabel[i]); + } } - - registry.get(HIST("hGeneratedHypertritonCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hGeneratedHypertritonCounter"))->GetXaxis()->SetBinLabel(2, "3-body decay"); } //------------------------------------------------------------------ - 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()); @@ -339,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()); @@ -349,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()); @@ -389,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})); @@ -397,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()); @@ -412,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})); @@ -421,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()); @@ -440,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; + } } //------------------------------------------------------------------ @@ -447,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); @@ -464,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); @@ -524,12 +559,12 @@ struct hypertriton3bodyAnalysis { for (const auto& collision : collisions) { registry.fill(HIST("hEventCounter"), 0.5); - if (event_sel8_selection && !collision.sel8()) { + 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 - return; + continue; } registry.fill(HIST("hEventCounter"), 2.5); @@ -557,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(); } @@ -583,45 +618,48 @@ struct hypertriton3bodyAnalysis { // check vtx3body with mclabels struct hypertriton3bodyLabelCheck { - HistogramRegistry registry{ - "registry", - { - {"hLabeledVtxCounter", "hLabeledVtxCounter", {HistType::kTH1F, {{3, 0.0f, 3.0f}}}}, - {"hMassTrueH3L", "hMassTrueH3L", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassTrueH3LMatter", "hMassTrueH3LMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hMassTrueH3LAntiMatter", "hMassTrueH3LAntiMatter", {HistType::kTH1F, {{80, 2.96f, 3.04f}}}}, - {"hPIDCounter", "hPIDCounter", {HistType::kTH1F, {{6, 0.0f, 6.0f}}}}, - {"hHypertritonCounter", "hHypertritonCounter", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}}, - {"hDecay3BodyCounter", "hDecay3BodyCounter", {HistType::kTH1F, {{5, 0.0f, 5.0f}}}}, - }, - }; + + 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&) { - registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(1, "Readin"); - registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(2, "TrueMCH3L"); - registry.get(HIST("hLabeledVtxCounter"))->GetXaxis()->SetBinLabel(3, "Nonrepetitive"); - registry.get(HIST("hPIDCounter"))->GetXaxis()->SetBinLabel(1, "H3L Proton PID > 5"); - registry.get(HIST("hPIDCounter"))->GetXaxis()->SetBinLabel(2, "H3L Pion PID > 5"); - registry.get(HIST("hPIDCounter"))->GetXaxis()->SetBinLabel(3, "H3L Deuteron PID > 5"); - registry.get(HIST("hPIDCounter"))->GetXaxis()->SetBinLabel(4, "#bar{H3L} Proton PID > 5"); - registry.get(HIST("hPIDCounter"))->GetXaxis()->SetBinLabel(5, "#bar{H3L} Pion PID > 5"); - registry.get(HIST("hPIDCounter"))->GetXaxis()->SetBinLabel(6, "#bar{H3L} Deuteron PID > 5"); - registry.get(HIST("hHypertritonCounter"))->GetXaxis()->SetBinLabel(1, "H3L"); - registry.get(HIST("hHypertritonCounter"))->GetXaxis()->SetBinLabel(2, "H3L daughters pass PID"); - registry.get(HIST("hHypertritonCounter"))->GetXaxis()->SetBinLabel(3, "#bar{H3L}"); - registry.get(HIST("hHypertritonCounter"))->GetXaxis()->SetBinLabel(4, "#bar{H3L} daughters pass PID"); - registry.get(HIST("hDecay3BodyCounter"))->GetXaxis()->SetBinLabel(1, "Total"); - registry.get(HIST("hDecay3BodyCounter"))->GetXaxis()->SetBinLabel(2, "True H3L"); - registry.get(HIST("hDecay3BodyCounter"))->GetXaxis()->SetBinLabel(3, "Unduplicated H3L"); - registry.get(HIST("hDecay3BodyCounter"))->GetXaxis()->SetBinLabel(4, "Correct collision"); - registry.get(HIST("hDecay3BodyCounter"))->GetXaxis()->SetBinLabel(4, "Same ColID for daughters"); + if (doprocessData == false) { + auto hLabeledVtxCounter = registry.add("hLabeledVtxCounter", "hLabeledVtxCounter", HistType::kTH1F, {{3, 0.0f, 3.0f}}); + hLabeledVtxCounter->GetXaxis()->SetBinLabel(1, "Readin"); + hLabeledVtxCounter->GetXaxis()->SetBinLabel(2, "TrueMCH3L"); + hLabeledVtxCounter->GetXaxis()->SetBinLabel(3, "Nonrepetitive"); + registry.add("hMassTrueH3L", "hMassTrueH3L", HistType::kTH1F, {{80, 2.96f, 3.04f}}); + registry.add("hMassTrueH3LMatter", "hMassTrueH3LMatter", HistType::kTH1F, {{80, 2.96f, 3.04f}}); + registry.add("hMassTrueH3LAntiMatter", "hMassTrueH3LAntiMatter", HistType::kTH1F, {{80, 2.96f, 3.04f}}); + auto hPIDCounter = registry.add("hPIDCounter", "hPIDCounter", HistType::kTH1F, {{6, 0.0f, 6.0f}}); + hPIDCounter->GetXaxis()->SetBinLabel(1, "H3L Proton PID > 5"); + hPIDCounter->GetXaxis()->SetBinLabel(2, "H3L Pion PID > 5"); + hPIDCounter->GetXaxis()->SetBinLabel(3, "H3L Deuteron PID > 5"); + hPIDCounter->GetXaxis()->SetBinLabel(4, "#bar{H3L} Proton PID > 5"); + hPIDCounter->GetXaxis()->SetBinLabel(5, "#bar{H3L} Pion PID > 5"); + hPIDCounter->GetXaxis()->SetBinLabel(6, "#bar{H3L} Deuteron PID > 5"); + auto hHypertritonCounter = registry.add("hHypertritonCounter", "hHypertritonCounter", HistType::kTH1F, {{4, 0.0f, 4.0f}}); + hHypertritonCounter->GetXaxis()->SetBinLabel(1, "H3L"); + hHypertritonCounter->GetXaxis()->SetBinLabel(2, "H3L daughters pass PID"); + hHypertritonCounter->GetXaxis()->SetBinLabel(3, "#bar{H3L}"); + hHypertritonCounter->GetXaxis()->SetBinLabel(4, "#bar{H3L} daughters pass PID"); + auto hDecay3BodyCounter = registry.add("hDecay3BodyCounter", "hDecay3BodyCounter", HistType::kTH1F, {{5, 0.0f, 5.0f}}); + hDecay3BodyCounter->GetXaxis()->SetBinLabel(1, "Total"); + hDecay3BodyCounter->GetXaxis()->SetBinLabel(2, "True H3L"); + hDecay3BodyCounter->GetXaxis()->SetBinLabel(3, "Unduplicated H3L"); + hDecay3BodyCounter->GetXaxis()->SetBinLabel(4, "Correct collision"); + hDecay3BodyCounter->GetXaxis()->SetBinLabel(5, "Same ColID for daughters"); + registry.add("hDiffRVtxProton", "hDiffRVtxProton", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of proton + registry.add("hDiffRVtxPion", "hDiffRVtxPion", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of pion + registry.add("hDiffRVtxDeuteron", "hDiffRVtxDeuteron", HistType::kTH1F, {{100, -10, 10}}); // difference between the radius of decay vertex and minR of deuteron + } } - Configurable event_sel8_selection{"event_sel8_selection", false, "event selection count post sel8 cut"}; - 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; @@ -632,11 +670,11 @@ struct hypertriton3bodyLabelCheck { } }; - void process(soa::Join::iterator const&) + void processData(soa::Join::iterator const&) { // dummy function } - PROCESS_SWITCH(hypertriton3bodyLabelCheck, process, "Donot check MC label tables", true); + PROCESS_SWITCH(hypertriton3bodyLabelCheck, processData, "Donot check MC label tables", true); void processCheckLabel(soa::Join::iterator const& collision, aod::Decay3Bodys const& decay3bodys, soa::Join const& vtx3bodydatas, MCLabeledTracksIU const& /*tracks*/, aod::McParticles const& /*particlesMC*/, aod::McCollisions const& /*mcCollisions*/) { @@ -681,7 +719,7 @@ struct hypertriton3bodyLabelCheck { } } - if (event_sel8_selection && !collision.sel8()) { + if (mc_event_selection && (!collision.selection_bit(aod::evsel::kIsTriggerTVX) || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder))) { return; } @@ -697,11 +735,17 @@ struct hypertriton3bodyLabelCheck { auto lTrack0 = vtx.track0_as(); auto lTrack1 = vtx.track1_as(); auto lTrack2 = vtx.track2_as(); - if (mcparticle.pdgCode() == 1010010030) { - registry.fill(HIST("hLabeledVtxCounter"), 1.5); + if (std::abs(mcparticle.pdgCode()) != motherPdgCode) { + continue; + } + registry.fill(HIST("hLabeledVtxCounter"), 1.5); + registry.fill(HIST("hDiffRVtxDeuteron"), lTrack2.x() - vtx.vtxradius()); + if (mcparticle.pdgCode() > 0) { registry.fill(HIST("hHypertritonCounter"), 0.5); registry.fill(HIST("hMassTrueH3L"), vtx.mHypertriton()); registry.fill(HIST("hMassTrueH3LMatter"), vtx.mHypertriton()); + registry.fill(HIST("hDiffRVtxProton"), lTrack0.x() - vtx.vtxradius()); + registry.fill(HIST("hDiffRVtxPion"), lTrack1.x() - vtx.vtxradius()); auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); if (p == set_mothertrack.end()) { set_mothertrack.push_back(mcparticle.globalIndex()); @@ -719,11 +763,12 @@ struct hypertriton3bodyLabelCheck { if (TMath::Abs(lTrack0.tpcNSigmaPr()) < TpcPidNsigmaCut && TMath::Abs(lTrack1.tpcNSigmaPi()) < TpcPidNsigmaCut && TMath::Abs(lTrack2.tpcNSigmaDe()) < TpcPidNsigmaCut) { registry.fill(HIST("hHypertritonCounter"), 1.5); } - } else if (mcparticle.pdgCode() == -1010010030) { - registry.fill(HIST("hLabeledVtxCounter"), 1.5); + } else { registry.fill(HIST("hHypertritonCounter"), 2.5); registry.fill(HIST("hMassTrueH3L"), vtx.mAntiHypertriton()); registry.fill(HIST("hMassTrueH3LAntiMatter"), vtx.mAntiHypertriton()); + registry.fill(HIST("hDiffRVtxProton"), lTrack1.x() - vtx.vtxradius()); + registry.fill(HIST("hDiffRVtxPion"), lTrack0.x() - vtx.vtxradius()); auto p = std::find(set_mothertrack.begin(), set_mothertrack.end(), mcparticle.globalIndex()); if (p == set_mothertrack.end()) { set_mothertrack.push_back(mcparticle.globalIndex()); diff --git a/PWGLF/Tasks/Nuspex/nucleiEbye.cxx b/PWGLF/Tasks/Nuspex/nucleiEbye.cxx index 0915320f529..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; } @@ -673,6 +677,8 @@ struct nucleiEbye { void processData(aod::CollEbyeTable const& collision, aod::NucleiEbyeTables const& tracks, aod::LambdaEbyeTables const& v0s) { + if (std::abs(collision.zvtx()) > zVtxMax) + return; histos.fill(HIST("QA/zVtx"), collision.zvtx()); fillRecoEvent(collision, tracks, v0s, collision.centrality()); } @@ -681,6 +687,8 @@ struct nucleiEbye { void processMc(aod::CollEbyeTables const& collisions, aod::McNucleiEbyeTables const& tracksTot, aod::McLambdaEbyeTables const& v0sTot) { for (auto& collision : collisions) { + if (std::abs(collision.zvtx()) > zVtxMax) + continue; auto tracks = tracksTot.sliceBy(perCollTrack, collision.globalIndex()); auto v0s = v0sTot.sliceBy(perCollV0s, collision.globalIndex()); histos.fill(HIST("QA/zVtx"), collision.zvtx()); diff --git a/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx b/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx index 95c2e49e323..a90b4677b61 100644 --- a/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx +++ b/PWGLF/Tasks/Nuspex/nuclei_in_jets.cxx @@ -14,12 +14,18 @@ #include #include +#include #include #include #include #include #include #include +#include "TGrid.h" +#include + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -40,6 +46,8 @@ using namespace std; using namespace o2; +using namespace o2::soa; +using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::physics; @@ -48,7 +56,7 @@ using std::array; using SelectedCollisions = soa::Join; using SimCollisions = soa::Join; -using FullTracks = soa::Join; +using FullNucleiTracks = soa::Join; using MCTracks = soa::Join; @@ -83,8 +91,12 @@ struct nuclei_in_jets { Configurable Rjet{"Rjet", 0.3, "Jet resolution parameter R"}; Configurable zVtx{"zVtx", 10.0, "Maximum zVertex"}; Configurable min_nPartInJet{"min_nPartInJet", 2, "Minimum number of particles inside jet"}; + Configurable n_jets_per_event_max{"n_jets_per_event_max", 1000, "Maximum number of jets per event"}; + Configurable requireNoOverlap{"requireNoOverlap", false, "require no overlap between jets and UE cones"}; // Track Parameters + Configurable par0{"par0", 0.004, "par 0"}; + Configurable par1{"par1", 0.013, "par 1"}; Configurable min_ITS_nClusters{"min_ITS_nClusters", 5, "minimum number of ITS clusters"}; Configurable min_TPC_nClusters{"min_TPC_nClusters", 80, "minimum number of TPC clusters"}; Configurable min_TPC_nCrossedRows{"min_TPC_nCrossedRows", 80, "minimum number of TPC crossed pad rows"}; @@ -99,11 +111,38 @@ 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"}; + + Configurable url_to_ccdb{"url_to_ccdb", "http://alice-ccdb.cern.ch", "url of the personal ccdb"}; + Configurable path_to_file{"path_to_file", "", "path to file with reweighting"}; + Configurable histo_name_weight_antip_jet{"histo_name_weight_antip_jet", "", "reweighting histogram: antip in jet"}; + Configurable histo_name_weight_antip_ue{"histo_name_weight_antip_ue", "", "reweighting histogram: antip in ue"}; + + TH2F* twod_weights_antip_jet; + TH2F* twod_weights_antip_ue; + + Service ccdb; + o2::ccdb::CcdbApi ccdbApi; void init(InitContext const&) { + ccdb->setURL(url_to_ccdb.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdb->setFatalWhenNull(false); + + if (applyReweighting) { + GetReweightingHistograms(ccdb, TString(path_to_file), TString(histo_name_weight_antip_jet), TString(histo_name_weight_antip_ue)); + } else { + twod_weights_antip_jet = nullptr; + twod_weights_antip_ue = nullptr; + } + // 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"}}); registryQC.add("deltaEtadeltaPhi_ue", "deltaEtadeltaPhi_ue", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); @@ -117,6 +156,7 @@ struct nuclei_in_jets { registryQC.add("nJets_selected", "nJets_selected", HistType::kTH1F, {{10, 0, 10, "#it{n}_{Jet}"}}); 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}"}}); // Event Counters registryData.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{10, 0, 10, "counter"}}); @@ -141,10 +181,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})"}}); @@ -208,9 +256,9 @@ struct nuclei_in_jets { // pt-dependent selection if (setDCAselectionPtDep) { - if (TMath::Abs(track.dcaXY()) > (0.004f + 0.013f / track.pt())) + if (TMath::Abs(track.dcaXY()) > (par0 + par1 / track.pt())) return false; - if (TMath::Abs(track.dcaZ()) > (0.004f + 0.013f / track.pt())) + if (TMath::Abs(track.dcaZ()) > (par0 + par1 / track.pt())) return false; } @@ -356,8 +404,39 @@ struct nuclei_in_jets { return distance_jet; } + bool overlap(TVector3 v1, TVector3 v2, double R) + { + double dx = v1.Eta() - v2.Eta(); + double dy = GetDeltaPhi(v1.Phi(), v2.Phi()); + double d = sqrt(dx * dx + dy * dy); + if (d < 2.0 * R) + return true; + return false; + } + + void GetReweightingHistograms(o2::framework::Service const& ccdbObj, TString filepath, TString histname_antip_jet, TString histname_antip_ue) + { + TList* l = ccdbObj->get(filepath.Data()); + if (!l) { + LOGP(error, "Could not open the file {}", Form("%s", filepath.Data())); + return; + } + twod_weights_antip_jet = static_cast(l->FindObject(Form("%s_antiproton", histname_antip_jet.Data()))); + if (!twod_weights_antip_jet) { + LOGP(error, "Could not open histogram {}", Form("%s_antiproton", histname_antip_jet.Data())); + return; + } + twod_weights_antip_ue = static_cast(l->FindObject(Form("%s_antiproton", histname_antip_ue.Data()))); + if (!twod_weights_antip_ue) { + LOGP(error, "Could not open histogram {}", Form("%s_antiproton", histname_antip_ue.Data())); + return; + } + LOGP(info, "Opened histogram {}", Form("%s_antiproton", histname_antip_jet.Data())); + LOGP(info, "Opened histogram {}", Form("%s_antiproton", histname_antip_ue.Data())); + } + // Process Data - void processData(SelectedCollisions::iterator const& collision, FullTracks const& tracks) + void processData(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks) { // Event Counter: before event selection registryData.fill(HIST("number_of_events_data"), 0.5); @@ -370,7 +449,7 @@ struct nuclei_in_jets { registryData.fill(HIST("number_of_events_data"), 1.5); // Cut on z-vertex - if (abs(collision.posZ()) > zVtx) + if (TMath::Abs(collision.posZ()) > zVtx) return; // Event Counter: after z-vertex cut @@ -441,7 +520,7 @@ struct nuclei_in_jets { int n_jets_selected(0); for (int i = 0; i < static_cast(jet.size()); i++) { - if ((abs(jet[i].Eta()) + Rjet) > max_eta) + if ((TMath::Abs(jet[i].Eta()) + Rjet) > max_eta) continue; // Perpendicular cones @@ -512,6 +591,30 @@ struct nuclei_in_jets { if (n_jets_selected == 0) return; registryData.fill(HIST("number_of_events_data"), 3.5); + //************************************************************************************************************************************ + + // Overlaps + int nOverlaps(0); + for (int i = 0; i < static_cast(jet.size()); i++) { + if (isSelected[i] == 0) + continue; + + for (int j = 0; j < static_cast(jet.size()); j++) { + if (isSelected[j] == 0 || i == j) + continue; + if (overlap(jet[i], ue1[j], Rjet) || overlap(jet[i], ue2[j], Rjet)) + nOverlaps++; + } + } + registryQC.fill(HIST("jet_ue_overlaps"), n_jets_selected, nOverlaps); + + if (n_jets_selected > n_jets_per_event_max) + return; + registryData.fill(HIST("number_of_events_data"), 4.5); + + if (requireNoOverlap && nOverlaps > 0) + return; + registryData.fill(HIST("number_of_events_data"), 5.5); //************************************************************************************************************************************ @@ -525,8 +628,6 @@ struct nuclei_in_jets { continue; if (require_PV_contributor && !(track.isPVContributor())) continue; - if (track.sign() > 0) - continue; // Variables double nsigmaTPCPr = track.tpcNSigmaPr(); @@ -550,15 +651,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; @@ -568,39 +670,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); + } } } } @@ -627,9 +751,28 @@ struct nuclei_in_jets { if (particle.eta() < min_eta || particle.eta() > max_eta) continue; + double w_antip_jet(1.0); + double w_antip_ue(1.0); + if (applyReweighting) { + int ix = twod_weights_antip_jet->GetXaxis()->FindBin(particle.pt()); + int iy = twod_weights_antip_jet->GetYaxis()->FindBin(particle.eta()); + w_antip_jet = twod_weights_antip_jet->GetBinContent(ix, iy); + w_antip_ue = twod_weights_antip_ue->GetBinContent(ix, iy); + + // protections + if (ix == 0 || ix > twod_weights_antip_jet->GetNbinsX()) { + w_antip_jet = 1.0; + w_antip_ue = 1.0; + } + if (iy == 0 || iy > twod_weights_antip_jet->GetNbinsY()) { + w_antip_jet = 1.0; + w_antip_ue = 1.0; + } + } + if (particle.pdgCode() == -2212) { - registryMC.fill(HIST("antiproton_jet_gen"), particle.pt()); - registryMC.fill(HIST("antiproton_ue_gen"), particle.pt()); + registryMC.fill(HIST("antiproton_jet_gen"), particle.pt(), w_antip_jet); + registryMC.fill(HIST("antiproton_ue_gen"), particle.pt(), w_antip_ue); } if (particle.pdgCode() == -1000010020) { registryMC.fill(HIST("antideuteron_jet_gen"), particle.pt()); @@ -651,7 +794,7 @@ struct nuclei_in_jets { if (!collision.sel8()) continue; - if (abs(collision.posZ()) > 10) + if (TMath::Abs(collision.posZ()) > 10) continue; // Event Counter (after event sel) @@ -708,25 +851,44 @@ struct nuclei_in_jets { if (!particle.isPhysicalPrimary()) continue; + double w_antip_jet(1.0); + double w_antip_ue(1.0); + if (applyReweighting) { + int ix = twod_weights_antip_jet->GetXaxis()->FindBin(particle.pt()); + int iy = twod_weights_antip_jet->GetYaxis()->FindBin(particle.eta()); + w_antip_jet = twod_weights_antip_jet->GetBinContent(ix, iy); + w_antip_ue = twod_weights_antip_ue->GetBinContent(ix, iy); + + // protection + if (ix == 0 || ix > twod_weights_antip_jet->GetNbinsX()) { + w_antip_jet = 1.0; + w_antip_ue = 1.0; + } + if (iy == 0 || iy > twod_weights_antip_jet->GetNbinsY()) { + w_antip_jet = 1.0; + w_antip_ue = 1.0; + } + } + // Antiproton if (particle.pdgCode() == -2212) { - if (pt < 1.0 && nsigmaTPCPr > min_nsigmaTPC && nsigmaTPCPr < max_nsigmaTPC) { - registryMC.fill(HIST("antiproton_jet_rec_tpc"), pt); - registryMC.fill(HIST("antiproton_ue_rec_tpc"), pt); + 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) { - registryMC.fill(HIST("antiproton_jet_rec_tof"), pt); - registryMC.fill(HIST("antiproton_ue_rec_tof"), pt); + 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); } } // 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); } @@ -755,7 +917,7 @@ struct nuclei_in_jets { continue; registryMC.fill(HIST("number_of_events_mc"), 4.5); - if (abs(collision.posZ()) > zVtx) + if (TMath::Abs(collision.posZ()) > zVtx) continue; registryMC.fill(HIST("number_of_events_mc"), 5.5); @@ -822,7 +984,7 @@ struct nuclei_in_jets { int n_jets_selected(0); for (int i = 0; i < static_cast(jet.size()); i++) { - if ((abs(jet[i].Eta()) + Rjet) > max_eta) + if ((TMath::Abs(jet[i].Eta()) + Rjet) > max_eta) continue; // Perpendicular cones @@ -936,7 +1098,7 @@ struct nuclei_in_jets { registryMC.fill(HIST("number_of_events_mc"), 7.5); // Selection on z_{vertex} - if (abs(mccollision.posZ()) > 10) + if (TMath::Abs(mccollision.posZ()) > 10) continue; registryMC.fill(HIST("number_of_events_mc"), 8.5); @@ -956,12 +1118,12 @@ struct nuclei_in_jets { double dy = particle.vy() - mccollision.posY(); double dz = particle.vz() - mccollision.posZ(); double dcaxy = sqrt(dx * dx + dy * dy); - double dcaz = abs(dz); + double dcaz = TMath::Abs(dz); if (setDCAselectionPtDep) { - if (dcaxy > (0.004f + 0.013f / particle.pt())) + if (dcaxy > (par0 + par1 / particle.pt())) continue; - if (dcaz > (0.004f + 0.013f / particle.pt())) + if (dcaz > (par0 + par1 / particle.pt())) continue; } if (!setDCAselectionPtDep) { @@ -971,13 +1133,13 @@ struct nuclei_in_jets { continue; } - if (abs(particle.eta()) > 0.8) + if (TMath::Abs(particle.eta()) > 0.8) continue; if (particle.pt() < 0.15) continue; // PDG Selection - int pdg = abs(particle.pdgCode()); + int pdg = TMath::Abs(particle.pdgCode()); if ((pdg != 11) && (pdg != 211) && (pdg != 321) && (pdg != 2212)) continue; @@ -1034,7 +1196,7 @@ struct nuclei_in_jets { int n_jets_selected(0); for (int i = 0; i < static_cast(jet.size()); i++) { - if ((abs(jet[i].Eta()) + Rjet) > max_eta) + if ((TMath::Abs(jet[i].Eta()) + Rjet) > max_eta) continue; // Perpendicular cones @@ -1057,12 +1219,12 @@ struct nuclei_in_jets { double dy = particle.vy() - mccollision.posY(); double dz = particle.vz() - mccollision.posZ(); double dcaxy = sqrt(dx * dx + dy * dy); - double dcaz = abs(dz); + double dcaz = TMath::Abs(dz); if (setDCAselectionPtDep) { - if (dcaxy > (0.004f + 0.013f / particle.pt())) + if (dcaxy > (par0 + par1 / particle.pt())) continue; - if (dcaz > (0.004f + 0.013f / particle.pt())) + if (dcaz > (par0 + par1 / particle.pt())) continue; } if (!setDCAselectionPtDep) { @@ -1072,13 +1234,13 @@ struct nuclei_in_jets { continue; } - if (abs(particle.eta()) > 0.8) + if (TMath::Abs(particle.eta()) > 0.8) continue; if (particle.pt() < 0.15) continue; // PDG Selection - int pdg = abs(particle.pdgCode()); + int pdg = TMath::Abs(particle.pdgCode()); if ((pdg != 11) && (pdg != 211) && (pdg != 321) && (pdg != 2212)) continue; diff --git a/PWGLF/Tasks/Nuspex/spectraTOF.cxx b/PWGLF/Tasks/Nuspex/spectraTOF.cxx index e30d511ee88..942175867b7 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" @@ -36,9 +37,8 @@ #include "Framework/O2DatabasePDGPlugin.h" #include "PWGLF/Utils/inelGt.h" #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,6 +52,16 @@ 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 // Spectra task struct tofSpectra { @@ -83,6 +93,7 @@ struct tofSpectra { Configurable enableTPCTOFHistograms{"enableTPCTOFHistograms", true, "Enables TPC TOF histograms"}; Configurable enableDCAxyzHistograms{"enableDCAxyzHistograms", false, "Enables DCAxyz correlation histograms"}; Configurable enableDCAxyphiHistograms{"enableDCAxyphiHistograms", false, "Enables DCAxyphi correlation histograms"}; + Configurable enableDCAvsmotherHistograms{"enableDCAvsmotherHistograms", false, "Enables DCA vs mother histograms"}; struct : ConfigurableGroup { ConfigurableAxis binsPt{"binsPt", {VARIABLE_WIDTH, 0.0, 0.1, 0.12, 0.14, 0.16, 0.18, 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.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.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0}, "Binning of the pT axis"}; @@ -111,6 +122,7 @@ struct tofSpectra { Configurable minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.f, "Additional cut on the minimum number of crossed rows in the TPC"}; Configurable minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"}; Configurable maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 4.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"}; + Configurable minChi2PerClusterTPC{"minChi2PerClusterTPC", 0.5f, "Additional cut on the minimum value of the chi2 per cluster in the TPC"}; Configurable maxChi2PerClusterITS{"maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"}; Configurable maxDcaXYFactor{"maxDcaXYFactor", 1.f, "Additional cut on the maximum value of the DCA xy (multiplicative factor)"}; Configurable maxDcaZ{"maxDcaZ", 2.f, "Additional cut on the maximum value of the DCA z"}; @@ -119,6 +131,7 @@ struct tofSpectra { Configurable enableTPCTOFvsEtaHistograms{"enableTPCTOFvsEtaHistograms", false, "choose if produce TPC tof vs Eta"}; Configurable includeCentralityMC{"includeCentralityMC", true, "choose if include Centrality to MC"}; Configurable enableTPCTOFVsMult{"enableTPCTOFVsMult", false, "Produce TPC-TOF plots vs multiplicity"}; + Configurable includeCentralityToTracks{"includeCentralityToTracks", false, "choose if include Centrality to tracks"}; // Histograms HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -192,6 +205,7 @@ struct tofSpectra { LOG(info) << "\trequireTPC=" << requireTPC.value; LOG(info) << "\trequireGoldenChi2=" << requireGoldenChi2.value; LOG(info) << "\tmaxChi2PerClusterTPC=" << maxChi2PerClusterTPC.value; + LOG(info) << "\tminChi2PerClusterTPC=" << minChi2PerClusterTPC.value; LOG(info) << "\tminNCrossedRowsTPC=" << minNCrossedRowsTPC.value; LOG(info) << "\tminTPCNClsFound=" << minTPCNClsFound.value; LOG(info) << "\tmaxChi2PerClusterITS=" << maxChi2PerClusterITS.value; @@ -400,6 +414,16 @@ struct tofSpectra { histos.add("Data/neg/pt/its", "neg ITS", kTH1D, {ptAxis}); histos.add("Data/pos/pt/tpc", "pos TPC", kTH1D, {ptAxis}); 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", 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) { const AxisSpec nsigmaTPCAxisOccupancy{binsOptions.binsnsigmaTPC, "nsigmaTPC"}; histos.add("nsigmatpc/test_occupancy/Mult_vs_Occupancy", "occuppancy vs Multiplicity", kTHnSparseD, {multAxis, occupancyAxis}); @@ -610,18 +634,19 @@ 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(Form("dcaprm/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); - hDcaXYZStr[i] = histos.add(Form("dcastr/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); - hDcaXYZMat[i] = histos.add(Form("dcamat/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); + hDcaXYZPrm[i] = histos.add("dcaprm" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); + hDcaXYZStr[i] = histos.add("dcastr" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); + hDcaXYZMat[i] = histos.add("dcamat" + cpName, pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); if (enableDcaGoodEvents) { histos.add(hdcaxyprmgoodevs[i].data(), pTCharge[i], kTH3D, {ptAxis, dcaXyAxis, dcaZAxis}); } } else { - hDcaXYWrongCollisionPrm[i] = histos.add(Form("dcaxywrongcollprm/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); - hDcaXYWrongCollisionStr[i] = histos.add(Form("dcaxywrongcollstr/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); - hDcaXYWrongCollisionMat[i] = histos.add(Form("dcaxywrongcollmat/%s/%s", (i < Np) ? "pos" : "neg", pN[i % Np]), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + hDcaXYWrongCollisionPrm[i] = histos.add("dcaxywrongcollprm" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + hDcaXYWrongCollisionStr[i] = histos.add("dcaxywrongcollstr" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + hDcaXYWrongCollisionMat[i] = histos.add("dcaxywrongcollmat" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + histos.add(hdcaxyprm[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); histos.add(hdcazprm[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); histos.add(hdcaxystr[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); @@ -632,6 +657,18 @@ struct tofSpectra { histos.add(hdcaxyprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); histos.add(hdcazprmgoodevs[i].data(), pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); } + if (enableDCAvsmotherHistograms) { + hDcaXYMC[i] = histos.add("dcaxymc" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + hDcaZMC[i] = histos.add("dcazmc" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); + hDcaXYMCNotHF[i] = histos.add("dcaxynothf" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + hDcaZMCNotHF[i] = histos.add("dcaznothf" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); + hDcaXYMCD0[i] = histos.add("dcaxyD0" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + hDcaZMCD0[i] = histos.add("dcazD0" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaZAxis}); + hDcaXYMCCharm[i] = histos.add("dcaxycharm" + cpName, pTCharge[i], kTH2D, {ptAxis, dcaXyAxis}); + 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}); + } } // Mismatched info @@ -675,7 +712,7 @@ struct tofSpectra { template void fillParticleHistos(const T& track, const C& collision) { - if (abs(track.rapidity(PID::getMass(id))) > trkselOptions.cfgCutY) { + if (std::abs(track.rapidity(PID::getMass(id))) > trkselOptions.cfgCutY) { return; } if constexpr (id == PID::Kaon) { @@ -1000,7 +1037,7 @@ struct tofSpectra { histos.fill(HIST("evsel"), 12.f); } } - if (abs(collision.posZ()) > evselOptions.cfgCutVertex) { + if (std::abs(collision.posZ()) > evselOptions.cfgCutVertex) { return false; } if constexpr (fillHistograms) { @@ -1050,7 +1087,7 @@ struct tofSpectra { return false; } } - return (abs(track.dcaXY()) <= (maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f)))); + return (std::abs(track.dcaXY()) <= (maxDcaXYFactor.value * (0.0105f + 0.0350f / pow(track.pt(), 1.1f)))); } return track.isGlobalTrack(); } @@ -1075,8 +1112,8 @@ struct tofSpectra { return track.isGlobalTrackWoDCA(); } - template - bool isTrackSelected(TrackType const& track) + template + bool isTrackSelected(TrackType const& track, CollisionType const& collision) { if constexpr (fillHistograms) { histos.fill(HIST("tracksel"), 1); @@ -1128,6 +1165,10 @@ struct tofSpectra { } } + if (track.tpcChi2NCl() < minChi2PerClusterTPC || track.tpcChi2NCl() > maxChi2PerClusterTPC) { + return false; + } + if (!passesCutWoDCA(track)) { return false; } @@ -1290,9 +1331,33 @@ struct tofSpectra { const float multiplicity = collision.centFT0C(); histos.fill(HIST("nsigmatpc/test_occupancy/Mult_vs_Occupancy"), multiplicity, occupancy); for (const auto& track : tracks) { - if (!isTrackSelected(track)) { + if (!isTrackSelected(track, collision)) { continue; } + 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); + } + } + } 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); @@ -1314,7 +1379,7 @@ struct tofSpectra { histos.fill(HIST("nsigmatof/test_occupancy/neg/pr"), track.pt(), nsigmaTOFPr, multiplicity, occupancy); } // track - } // process function + } // process function PROCESS_SWITCH(tofSpectra, processOccupancy, "check for occupancy plots", false); void processStandard(CollisionCandidates::iterator const& collision, @@ -1325,7 +1390,7 @@ struct tofSpectra { } hMultiplicityvsPercentile->Fill(getMultiplicity(collision), collision.multNTracksPV()); for (const auto& track : tracks) { - if (!isTrackSelected(track)) { + if (!isTrackSelected(track, collision)) { continue; } } @@ -1343,7 +1408,7 @@ struct tofSpectra { } const auto& tracksInCollision = tracks.sliceByCached(aod::spectra::collisionId, collision.globalIndex(), cacheTrk); for (const auto& track : tracksInCollision) { - if (!isTrackSelected(track)) { + if (!isTrackSelected(track, collision)) { continue; } fillParticleHistos(track, collision); @@ -1364,7 +1429,7 @@ struct tofSpectra { return; \ } \ for (const auto& track : tracks) { \ - if (!isTrackSelected(track)) { \ + if (!isTrackSelected(track, collision)) { \ continue; \ } \ fillParticleHistos(track, collision); \ @@ -1525,7 +1590,10 @@ struct tofSpectra { using RecoMCCollisions = soa::Join; // RD template - void fillTrackHistograms_MC(TrackType const& track, ParticleType const& mcParticle, RecoMCCollisions::iterator const& collision) + void fillTrackHistograms_MC(TrackType const& track, + ParticleType::iterator const& mcParticle, + RecoMCCollisions::iterator const& collision, + ParticleType const& mcParticles) { if (!isParticleEnabled()) { // Check if the particle is enabled return; @@ -1549,7 +1617,12 @@ struct tofSpectra { if (std::abs(mcParticle.y()) > trkselOptions.cfgCutY) { return; } - if (!mcParticle.isPhysicalPrimary()) { + + if (enableDCAvsmotherHistograms) { + hDcaXYMC[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMC[i]->Fill(track.pt(), track.dcaZ()); + } + if (!mcParticle.isPhysicalPrimary()) { // Secondaries (weak decays and material) if (mcParticle.getProcess() == 4) { if (enableDCAxyzHistograms) { hDcaXYZStr[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); @@ -1565,18 +1638,61 @@ struct tofSpectra { histos.fill(HIST(hdcazmat[i]), track.pt(), track.dcaZ()); } } - } else { + } else { // Primaries if (enableDCAxyzHistograms) { hDcaXYZPrm[i]->Fill(track.pt(), track.dcaXY(), track.dcaZ()); if (enableDcaGoodEvents.value && collision.has_mcCollision()) { histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY(), track.dcaZ()); } } else { + // DCAxy for all primaries histos.fill(HIST(hdcaxyprm[i]), track.pt(), track.dcaXY()); histos.fill(HIST(hdcazprm[i]), track.pt(), track.dcaZ()); - if (enableDcaGoodEvents.value && collision.has_mcCollision()) { - histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY()); - histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ()); + } + if (enableDcaGoodEvents.value && collision.has_mcCollision()) { + histos.fill(HIST(hdcaxyprmgoodevs[i]), track.pt(), track.dcaXY()); + histos.fill(HIST(hdcazprmgoodevs[i]), track.pt(), track.dcaZ()); + } + + if (enableDCAvsmotherHistograms) { + bool IsD0Mother = false; + bool IsCharmMother = false; + bool IsBeautyMother = 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(); + if (motherPdgCode == 421) { + IsD0Mother = true; + } + if (charmOrigin == RecoDecay::OriginType::NonPrompt) { + if ((motherPdgCode) / 1000 == 5 || (motherPdgCode) / 100 == 5) { + IsBeautyMother = true; + } + } + if (charmOrigin == RecoDecay::OriginType::Prompt) { + if ((motherPdgCode) / 1000 == 4 || (motherPdgCode) / 100 == 4) { + IsCharmMother = true; + } + } + } + } + if (IsD0Mother) { + hDcaXYMCD0[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMCD0[i]->Fill(track.pt(), track.dcaZ()); + } + if (IsCharmMother) { + hDcaXYMCCharm[i]->Fill(track.pt(), track.dcaXY()); + hdcaZMCCharm[i]->Fill(track.pt(), track.dcaZ()); + } + if (IsBeautyMother) { + hDcaXYMCBeauty[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMCBeauty[i]->Fill(track.pt(), track.dcaZ()); + } + if (!IsCharmMother && !IsBeautyMother) { + hDcaXYMCNotHF[i]->Fill(track.pt(), track.dcaXY()); + hDcaZMCNotHF[i]->Fill(track.pt(), track.dcaZ()); } } } @@ -1767,7 +1883,7 @@ struct tofSpectra { const float multiplicity = getMultiplicityMC(mcCollision); if (mcParticle.isPhysicalPrimary()) { - if (abs(mcCollision.posZ()) < evselOptions.cfgCutVertex) { + if (std::abs(mcCollision.posZ()) < evselOptions.cfgCutVertex) { histos.fill(HIST(hpt_den_prm_mcgoodev[i]), mcParticle.pt(), multiplicity); } else { histos.fill(HIST(hpt_den_prm_mcbadev[i]), mcParticle.pt(), multiplicity); @@ -1817,7 +1933,7 @@ struct tofSpectra { const auto& mcParticle = track.mcParticle(); static_for<0, 17>([&](auto i) { - fillTrackHistograms_MC(track, mcParticle, track.collision_as()); + fillTrackHistograms_MC(track, mcParticle, track.collision_as(), mcParticles); }); } if (includeCentralityMC) { @@ -1886,7 +2002,7 @@ struct tofSpectra { // Loop on generated collisions for (const auto& mcCollision : mcCollisions) { - if (abs(mcCollision.posZ()) > evselOptions.cfgCutVertex) { + if (std::abs(mcCollision.posZ()) > evselOptions.cfgCutVertex) { continue; } histos.fill(HIST("MC/Multiplicity"), getMultiplicityMC(mcCollision)); diff --git a/PWGLF/Tasks/Nuspex/spectraTOFRun2.cxx b/PWGLF/Tasks/Nuspex/spectraTOFRun2.cxx index efcc58dd55d..9c31160f0a1 100644 --- a/PWGLF/Tasks/Nuspex/spectraTOFRun2.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTOFRun2.cxx @@ -348,7 +348,7 @@ struct tofSpectraRun2 { template void fillParticleHistos(const T& track, const C& /*collision*/) { - if (abs(track.rapidity(PID::getMass(id))) > cfgCutY) { + if (std::abs(track.rapidity(PID::getMass(id))) > cfgCutY) { return; } const auto& nsigmaTOF = o2::aod::pidutils::tofNSigma(track); @@ -468,7 +468,7 @@ struct tofSpectraRun2 { if constexpr (fillHistograms) { histos.fill(HIST("evsel"), 2); } - if (abs(collision.posZ()) > cfgCutVertex) { + if (std::abs(collision.posZ()) > cfgCutVertex) { return false; } if constexpr (fillHistograms) { @@ -496,7 +496,7 @@ struct tofSpectraRun2 { if constexpr (fillHistograms) { histos.fill(HIST("tracksel"), 1); } - if (abs(track.eta()) > cfgCutEta) { + if (std::abs(track.eta()) > cfgCutEta) { return false; } if constexpr (fillHistograms) { diff --git a/PWGLF/Tasks/Nuspex/spectraTPC.cxx b/PWGLF/Tasks/Nuspex/spectraTPC.cxx index 18f7275e523..fd929553fb6 100644 --- a/PWGLF/Tasks/Nuspex/spectraTPC.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTPC.cxx @@ -117,7 +117,7 @@ struct tpcSpectra { void fillParticleHistos(const T& track) { const float y = TMath::ASinH(track.pt() / TMath::Sqrt(PID::getMass2(id) + track.pt() * track.pt()) * TMath::SinH(track.eta())); - if (abs(y) > 0.5) { + if (std::abs(y) > 0.5) { return; } const auto& nsigma = o2::aod::pidutils::tpcNSigma(track); @@ -131,7 +131,7 @@ struct tpcSpectra { if (!track.isGlobalTrack()) { return; } - if (abs(nsigma) > cfgNSigmaCut) { + if (std::abs(nsigma) > cfgNSigmaCut) { return; } histos.fill(HIST(hp[id]), track.p()); @@ -155,7 +155,7 @@ struct tpcSpectra { return; } histos.fill(HIST("evsel"), 2); - if (abs(collision.posZ()) > cfgCutVertex) { + if (std::abs(collision.posZ()) > cfgCutVertex) { return; } histos.fill(HIST("evsel"), 3); @@ -163,7 +163,7 @@ struct tpcSpectra { for (const auto& track : tracks) { histos.fill(HIST("tracksel"), 1); - if (abs(track.eta()) > cfgCutEta) { + if (std::abs(track.eta()) > cfgCutEta) { continue; } histos.fill(HIST("tracksel"), 2); @@ -279,7 +279,7 @@ struct tpcPidQaSignalwTof { TrackCandidates const& tracks) { histos.fill(HIST("evsel"), 1); - if (abs(collision.posZ()) > cfgCutVertex) { + if (std::abs(collision.posZ()) > cfgCutVertex) { return; } histos.fill(HIST("evsel"), 2); @@ -287,7 +287,7 @@ struct tpcPidQaSignalwTof { for (const auto& track : tracks) { histos.fill(HIST("tracksel"), 1); - if (abs(track.eta()) > cfgCutEta) { + if (std::abs(track.eta()) > cfgCutEta) { continue; } histos.fill(HIST("tracksel"), 2); diff --git a/PWGLF/Tasks/Nuspex/spectraTPCtiny.cxx b/PWGLF/Tasks/Nuspex/spectraTPCtiny.cxx index 12fc53f6bfc..d58a8777771 100644 --- a/PWGLF/Tasks/Nuspex/spectraTPCtiny.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTPCtiny.cxx @@ -58,7 +58,7 @@ struct tpcSpectraTiny { template void fillParticleHistos(const T& track, const float& nsigma) { - if (abs(nsigma) > cfgNSigmaCut) { + if (std::abs(nsigma) > cfgNSigmaCut) { return; } histos.fill(HIST(hp[i]), track.p()); @@ -78,7 +78,7 @@ struct tpcSpectraTiny { TrackCandidates const& tracks) { histos.fill(HIST("evsel"), 1); - if (abs(collision.posZ()) > cfgCutVertex) { + if (std::abs(collision.posZ()) > cfgCutVertex) { return; } histos.fill(HIST("evsel"), 2); @@ -86,7 +86,7 @@ struct tpcSpectraTiny { for (const auto& track : tracks) { histos.fill(HIST("tracksel"), 1); - if (abs(track.eta()) > cfgCutEta) { + if (std::abs(track.eta()) > cfgCutEta) { continue; } histos.fill(HIST("tracksel"), 2); diff --git a/PWGLF/Tasks/Nuspex/spectraTPCtinyPiKaPr.cxx b/PWGLF/Tasks/Nuspex/spectraTPCtinyPiKaPr.cxx index 328b44d5477..9c9a340bfcf 100644 --- a/PWGLF/Tasks/Nuspex/spectraTPCtinyPiKaPr.cxx +++ b/PWGLF/Tasks/Nuspex/spectraTPCtinyPiKaPr.cxx @@ -49,7 +49,7 @@ struct tpcSpectraTinyPiKaPr { template void fillParticleHistos(const T& track, const float& nsigma) { - if (abs(nsigma) > cfgNSigmaCut) { + if (std::abs(nsigma) > cfgNSigmaCut) { return; } histos.fill(HIST(hp[i]), track.p()); diff --git a/PWGLF/Tasks/QC/CMakeLists.txt b/PWGLF/Tasks/QC/CMakeLists.txt index c640ee82586..20377eb08cb 100644 --- a/PWGLF/Tasks/QC/CMakeLists.txt +++ b/PWGLF/Tasks/QC/CMakeLists.txt @@ -44,6 +44,12 @@ o2physics_add_dpl_workflow(its-tpc-matching-qa PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(strangeness-tracking-qc + SOURCES strangenessTrackingQC.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2::ReconstructionDataFormats O2Physics::AnalysisCore O2::DetectorsBase + COMPONENT_NAME Analysis) + + o2physics_add_dpl_workflow(mc-signal-loss SOURCES mcSignalLoss.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -113,3 +119,8 @@ o2physics_add_dpl_workflow(mc-particle-predictions SOURCES mcParticlePrediction.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strange-derived-qa + SOURCES strangederivedqa.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/QC/mcParticlePrediction.cxx b/PWGLF/Tasks/QC/mcParticlePrediction.cxx index 6d769fecae5..8a4a1ec3ac9 100644 --- a/PWGLF/Tasks/QC/mcParticlePrediction.cxx +++ b/PWGLF/Tasks/QC/mcParticlePrediction.cxx @@ -43,21 +43,27 @@ bool enabledParticlesArray[PIDExtended::NIDsTot]; // Estimators struct Estimators { - static const int FT0A = 0; - static const int FT0C = 1; - static const int FT0AC = 2; - static const int FV0A = 3; - static const int FDDA = 4; - static const int FDDC = 5; - static const int FDDAC = 6; - static const int ZNA = 7; - static const int ZNC = 8; - static const int ZEM1 = 9; - static const int ZEM2 = 10; - static const int ZPA = 11; - static const int ZPC = 12; - static const int ITS = 13; - static const int nEstimators = 14; + typedef int estID; + static constexpr estID FT0A = 0; + static constexpr estID FT0C = 1; + static constexpr estID FT0AC = 2; + static constexpr estID FV0A = 3; + static constexpr estID FDDA = 4; + static constexpr estID FDDC = 5; + static constexpr estID FDDAC = 6; + static constexpr estID ZNA = 7; + static constexpr estID ZNC = 8; + static constexpr estID ZEM1 = 9; + static constexpr estID ZEM2 = 10; + static constexpr estID ZPA = 11; + static constexpr estID ZPC = 12; + static constexpr estID ITSIB = 13; + static constexpr estID ETA05 = 14; + static constexpr estID ETA08 = 15; + static constexpr estID V0A = 16; // (Run2) + static constexpr estID V0C = 17; // (Run2) + static constexpr estID V0AC = 18; // (Run2 V0M) + static constexpr estID nEstimators = 19; static constexpr const char* estimatorNames[nEstimators] = {"FT0A", "FT0C", @@ -72,10 +78,18 @@ struct Estimators { "ZEM2", "ZPA", "ZPC", - "ITS"}; + "ITSIB", + "ETA05", + "ETA08", + "V0A", + "V0C", + "V0AC"}; static std::vector arrayNames() { - std::vector names; + static std::vector names; + if (!names.empty()) { + return names; + } for (int i = 0; i < nEstimators; i++) { names.push_back(estimatorNames[i]); } @@ -96,11 +110,18 @@ static const int defaultEstimators[Estimators::nEstimators][nParameters]{{0}, / {0}, // ZEM2 {0}, // ZPA {0}, // ZPC - {0}}; // ITS + {0}, // ITSIB + {0}, // ETA05 + {0}, // ETA08 + {0}, // V0A (Run2) + {0}, // V0C (Run2) + {0}}; // V0AC (Run2 V0M) // Histograms std::array, Estimators::nEstimators> hestimators; std::array, Estimators::nEstimators> hestimatorsVsITS; +std::array, Estimators::nEstimators> hestimatorsVsETA05; +std::array, Estimators::nEstimators> hestimatorsVsETA08; std::array, Estimators::nEstimators> hestimatorsRecoEvGenVsReco; std::array, Estimators::nEstimators> hestimatorsRecoEvGenVsReco_BCMC; std::array, Estimators::nEstimators> hestimatorsRecoEvGenVsRecoITS; @@ -135,7 +156,7 @@ struct mcParticlePrediction { "Estimators enabled"}; Configurable selectInelGt0{"selectInelGt0", true, "Select only inelastic events"}; Configurable selectPrimaries{"selectPrimaries", true, "Select only primary particles"}; - + Configurable requireCoincidenceEstimators{"requireCoincidenceEstimators", false, "Asks for a coincidence when two estimators are used"}; Configurable discardkIsGoodZvtxFT0vsPV{"discardkIsGoodZvtxFT0vsPV", false, "Select only collisions with matching BC and MC BC"}; Configurable discardMismatchedBCs{"discardMismatchedBCs", false, "Select only collisions with matching BC and MC BC"}; Configurable discardMismatchedFoundBCs{"discardMismatchedFoundBCs", false, "Select only collisions with matching found BC and MC BC"}; @@ -145,6 +166,9 @@ struct mcParticlePrediction { Configurable requirekIsVertexITSTPC{"requirekIsVertexITSTPC", false, "Require kIsVertexITSTPC: at least one ITS-TPC track (reject vertices built from ITS-only tracks)"}; Configurable requirekIsVertexTOFmatched{"requirekIsVertexTOFmatched", false, "Require kIsVertexTOFmatched: at least one of vertex contributors is matched to TOF"}; Configurable requirekIsVertexTRDmatched{"requirekIsVertexTRDmatched", false, "Require kIsVertexTRDmatched: at least one of vertex contributors is matched to TRD"}; + Configurable enableVsITSHistograms{"enableVsITSHistograms", true, "Enables the correlation between ITS and other estimators"}; + Configurable enableVsEta05Histograms{"enableVsEta05Histograms", true, "Enables the correlation between ETA05 and other estimators"}; + Configurable enableVsEta08Histograms{"enableVsEta08Histograms", true, "Enables the correlation between ETA08 and other estimators"}; Service pdgDB; o2::pwglf::ParticleCounter mCounter; @@ -160,7 +184,7 @@ struct mcParticlePrediction { const AxisSpec axisPt{binsPt, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec axisMultiplicity{binsMultiplicity, "Multiplicity (undefined)"}; const AxisSpec axisMultiplicityReco{binsMultiplicityReco, "Multiplicity Reco. (undefined)"}; - const AxisSpec axisMultiplicityRecoITS{100, 0, 100, "Multiplicity Reco. ITS"}; + const AxisSpec axisMultiplicityRecoITS{100, 0, 100, "Multiplicity Reco. ITSIB"}; const AxisSpec axisMultiplicityGenV0s{100, 0, 100, "K0s gen"}; const AxisSpec axisMultiplicityRecoV0s{20, 0, 20, "K0s reco"}; const AxisSpec axisBCID{o2::constants::lhc::LHCMaxBunches, -0.5, -0.5 + o2::constants::lhc::LHCMaxBunches, "BC ID in orbit"}; @@ -238,14 +262,32 @@ struct mcParticlePrediction { hestimators[i] = histos.add(Form("multiplicity/%s", name), name, kTH1D, {axisMultiplicity}); hestimators[i]->GetXaxis()->SetTitle(Form("Multiplicity %s", name)); - hestimatorsVsITS[i] = histos.add(Form("multiplicity/vsITS/%s", name), name, kTH2D, {axisMultiplicity, axisMultiplicity}); - hestimatorsVsITS[i]->GetXaxis()->SetTitle(Form("Multiplicity %s", name)); - hestimatorsVsITS[i]->GetYaxis()->SetTitle(Form("Multiplicity %s", Estimators::estimatorNames[Estimators::ITS])); + auto make2DH = [&](const std::string& h, const char* ytitle) { + auto hist = histos.add(Form("%s%s", h.c_str(), name), + name, + kTH2D, + {axisMultiplicity, axisMultiplicity}); + hist->GetXaxis()->SetTitle(Form("Multiplicity %s", name)); + hist->GetXaxis()->SetTitle(Form("Multiplicity %s", ytitle)); + return hist; + }; + if (enableVsITSHistograms) { + hestimatorsVsITS[i] = make2DH("multiplicity/vsITS/", Estimators::estimatorNames[Estimators::ITSIB]); + } + if (enableVsEta05Histograms) { + hestimatorsVsETA05[i] = make2DH("multiplicity/vsETA05/", Estimators::estimatorNames[Estimators::ETA05]); + } + if (enableVsEta08Histograms) { + hestimatorsVsETA08[i] = make2DH("multiplicity/vsETA08/", Estimators::estimatorNames[Estimators::ETA08]); + } hvertexPosZ[i] = histos.add(Form("multiplicity/posZ/%s", name), name, kTH2D, {{200, -20, 20, "pos Z"}, axisMultiplicity}); hvertexPosZ[i]->GetYaxis()->SetTitle(Form("Multiplicity %s", name)); - // Reco events + if (!doprocessReco) { // Reco events + continue; + } + hestimatorsRecoEvGenVsReco[i] = histosRecoEvs.add(Form("multiplicity/Reco/GenVsReco/%s", name), name, kTH2D, {axisMultiplicity, axisMultiplicityReco}); hestimatorsRecoEvGenVsReco[i]->GetXaxis()->SetTitle(Form("Multiplicity %s", name)); hestimatorsRecoEvGenVsReco[i]->GetYaxis()->SetTitle(Form("Multiplicity Reco. %s", name)); @@ -259,7 +301,7 @@ struct mcParticlePrediction { hestimatorsRecoEvRecoVsITS[i] = histosRecoEvs.add(Form("multiplicity/Reco/RecoVsITS/%s", name), name, kTH2D, {axisMultiplicityReco, axisMultiplicity}); hestimatorsRecoEvRecoVsITS[i]->GetXaxis()->SetTitle(Form("Multiplicity Reco. %s", name)); - hestimatorsRecoEvRecoVsITS[i]->GetYaxis()->SetTitle(Form("Multiplicity %s", Estimators::estimatorNames[Estimators::ITS])); + hestimatorsRecoEvRecoVsITS[i]->GetYaxis()->SetTitle(Form("Multiplicity %s", Estimators::estimatorNames[Estimators::ITSIB])); hestimatorsRecoEvRecoVsRecoITS[i] = histosRecoEvs.add(Form("multiplicity/Reco/RecoVsRecoITS/%s", name), name, kTH2D, {axisMultiplicityReco, axisMultiplicityRecoITS}); hestimatorsRecoEvRecoVsRecoITS[i]->GetXaxis()->SetTitle(Form("Multiplicity Reco. %s", name)); @@ -274,8 +316,7 @@ struct mcParticlePrediction { hestimatorsRecoEvRecoVsBCId[i] = histosRecoEvs.add(Form("multiplicity/Reco/RecoVsBCId/%s", name), name, kTH2D, {axisBCID, axisMultiplicityReco}); hestimatorsRecoEvRecoVsBCId[i]->GetYaxis()->SetTitle(Form("Multiplicity Reco. %s", name)); - hestimatorsRecoEvVsBCId[i] = histosRecoEvs.add(Form("multiplicity/Reco/VsBCId/%s", name), name, kTH2D, - {axisBCID, axisMultiplicity}); + hestimatorsRecoEvVsBCId[i] = histosRecoEvs.add(Form("multiplicity/Reco/VsBCId/%s", name), name, kTH2D, {axisBCID, axisMultiplicity}); hestimatorsRecoEvVsBCId[i]->GetYaxis()->SetTitle(Form("Multiplicity %s", name)); } @@ -304,6 +345,66 @@ struct mcParticlePrediction { histosYield.print(); } + std::array genMult(const auto& mcParticles) + { + std::array nMult; + if (enabledEstimatorsArray[Estimators::FT0A] || enabledEstimatorsArray[Estimators::FT0AC]) { + nMult[Estimators::FT0A] = mCounter.countFT0A(mcParticles); + } + if (enabledEstimatorsArray[Estimators::FT0C] || enabledEstimatorsArray[Estimators::FT0AC]) { + nMult[Estimators::FT0C] = mCounter.countFT0C(mcParticles); + } + if (enabledEstimatorsArray[Estimators::FT0AC]) { + nMult[Estimators::FT0AC] = nMult[Estimators::FT0A] + nMult[Estimators::FT0C]; + if (requireCoincidenceEstimators && (nMult[Estimators::FT0A] <= 0.f || nMult[Estimators::FT0C] <= 0.f)) { + nMult[Estimators::FT0AC] = 0; + } + } + if (enabledEstimatorsArray[Estimators::FV0A]) { + nMult[Estimators::FV0A] = mCounter.countFV0A(mcParticles); + } + if (enabledEstimatorsArray[Estimators::FDDA]) { + nMult[Estimators::FDDA] = mCounter.countFDDA(mcParticles); + } + if (enabledEstimatorsArray[Estimators::FDDC]) { + nMult[Estimators::FDDC] = mCounter.countFDDC(mcParticles); + } + if (enabledEstimatorsArray[Estimators::FDDAC]) { + nMult[Estimators::FDDAC] = nMult[Estimators::FDDA] + nMult[Estimators::FDDC]; + if (requireCoincidenceEstimators && (nMult[Estimators::FDDA] <= 0.f || nMult[Estimators::FDDC] <= 0.f)) { + nMult[Estimators::FDDAC] = 0; + } + } + if (enabledEstimatorsArray[Estimators::ZNA]) { + nMult[Estimators::ZNA] = mCounter.countZNA(mcParticles); + } + if (enabledEstimatorsArray[Estimators::ZNC]) { + nMult[Estimators::ZNC] = mCounter.countZNC(mcParticles); + } + if (enabledEstimatorsArray[Estimators::ITSIB] || enableVsITSHistograms) { + nMult[Estimators::ITSIB] = mCounter.countITSIB(mcParticles); + } + if (enabledEstimatorsArray[Estimators::ETA05] || enableVsEta05Histograms) { + nMult[Estimators::ETA05] = mCounter.countEta05(mcParticles); + } + if (enabledEstimatorsArray[Estimators::ETA08] || enableVsEta08Histograms) { + nMult[Estimators::ETA08] = mCounter.countEta08(mcParticles); + } + if (enabledEstimatorsArray[Estimators::V0A] || enabledEstimatorsArray[Estimators::V0AC]) { + nMult[Estimators::V0A] = mCounter.countV0A(mcParticles); + } + if (enabledEstimatorsArray[Estimators::V0C] || enabledEstimatorsArray[Estimators::V0AC]) { + nMult[Estimators::V0C] = mCounter.countV0C(mcParticles); + } + if (enabledEstimatorsArray[Estimators::V0AC]) { + nMult[Estimators::V0AC] = nMult[Estimators::V0A] + nMult[Estimators::V0C]; + if (requireCoincidenceEstimators && (nMult[Estimators::V0A] <= 0 || nMult[Estimators::V0C] <= 0)) { + nMult[Estimators::V0AC] = 0; + } + } + return nMult; + } + void process(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles) { @@ -313,21 +414,12 @@ struct mcParticlePrediction { } histos.fill(HIST("collisions/generated"), 1); - if (abs(mcCollision.posZ()) > 10.f) { + if (std::abs(mcCollision.posZ()) > 10.f) { return; } histos.fill(HIST("collisions/generated"), 2); - float nMult[Estimators::nEstimators]; - nMult[Estimators::FT0A] = mCounter.countFT0A(mcParticles); - nMult[Estimators::FT0C] = mCounter.countFT0C(mcParticles); - nMult[Estimators::FT0AC] = nMult[Estimators::FT0A] + nMult[Estimators::FT0C]; - nMult[Estimators::FV0A] = mCounter.countFV0A(mcParticles); - nMult[Estimators::FDDA] = mCounter.countFDDA(mcParticles); - nMult[Estimators::FDDC] = mCounter.countFDDC(mcParticles); - nMult[Estimators::FDDAC] = nMult[Estimators::FDDA] + nMult[Estimators::FDDC]; - nMult[Estimators::ZNA] = mCounter.countZNA(mcParticles); - nMult[Estimators::ZNC] = mCounter.countZNC(mcParticles); - nMult[Estimators::ITS] = mCounter.countITSIB(mcParticles); + + const std::array& nMult = genMult(mcParticles); for (int i = 0; i < Estimators::nEstimators; i++) { if (!enabledEstimatorsArray[i]) { @@ -335,7 +427,15 @@ struct mcParticlePrediction { } hestimators[i]->Fill(nMult[i]); - hestimatorsVsITS[i]->Fill(nMult[i], nMult[Estimators::ITS]); + if (enableVsITSHistograms) { + hestimatorsVsITS[i]->Fill(nMult[i], nMult[Estimators::ITSIB]); + } + if (enableVsEta05Histograms) { + hestimatorsVsETA05[i]->Fill(nMult[i], nMult[Estimators::ETA05]); + } + if (enableVsEta08Histograms) { + hestimatorsVsETA08[i]->Fill(nMult[i], nMult[Estimators::ETA08]); + } hvertexPosZ[i]->Fill(mcCollision.posZ(), nMult[i]); } @@ -355,14 +455,14 @@ struct mcParticlePrediction { TParticlePDG* p = pdgDB->GetParticle(particle.pdgCode()); if (p) { - if (abs(p->Charge()) > 1e-3) { + if (std::abs(p->Charge()) > 1e-3) { histos.fill(HIST("particles/eta/charged"), particle.eta()); } else { histos.fill(HIST("particles/eta/neutral"), particle.eta()); } } - if (abs(particle.y()) > 0.5) { + if (std::abs(particle.y()) > 0.5) { continue; } @@ -436,7 +536,7 @@ struct mcParticlePrediction { } histos.fill(HIST("collisions/reconstructed"), 8); - if (abs(collision.posZ()) > posZCut.value) { + if (std::abs(collision.posZ()) > posZCut.value) { return; } histos.fill(HIST("collisions/reconstructed"), 9); @@ -511,17 +611,7 @@ struct mcParticlePrediction { histos.fill(HIST("particles/FromCollVsFromCollBad"), particlesFromColl, particlesFromCollWrongBC); histos.fill(HIST("particles/FromCollBadOverFromCollVsVsFromMCColl"), 1.f * particlesFromCollWrongBC / particlesFromColl, particlesInCollision.size()); - float nMult[Estimators::nEstimators]; - nMult[Estimators::FT0A] = mCounter.countFT0A(particlesInCollision); - nMult[Estimators::FT0C] = mCounter.countFT0C(particlesInCollision); - nMult[Estimators::FT0AC] = nMult[Estimators::FT0A] + nMult[Estimators::FT0C]; - nMult[Estimators::FV0A] = mCounter.countFV0A(particlesInCollision); - nMult[Estimators::FDDA] = mCounter.countFDDA(particlesInCollision); - nMult[Estimators::FDDC] = mCounter.countFDDC(particlesInCollision); - nMult[Estimators::FDDAC] = nMult[Estimators::FDDA] + nMult[Estimators::FDDC]; - nMult[Estimators::ZNA] = mCounter.countZNA(particlesInCollision); - nMult[Estimators::ZNC] = mCounter.countZNC(particlesInCollision); - nMult[Estimators::ITS] = mCounter.countITSIB(particlesInCollision); + const std::array& nMult = genMult(mcParticles); float nMultReco[Estimators::nEstimators]; nMultReco[Estimators::FT0A] = collision.multFT0A(); @@ -533,7 +623,7 @@ struct mcParticlePrediction { nMultReco[Estimators::FDDAC] = collision.multFDDM(); nMultReco[Estimators::ZNA] = collision.multZNA(); nMultReco[Estimators::ZNC] = collision.multZNC(); - nMultReco[Estimators::ITS] = collision.multNTracksPV(); + nMultReco[Estimators::ITSIB] = collision.multNTracksPV(); float nMultRecoMCBC[Estimators::nEstimators] = {0}; if (mcBC.has_ft0()) { @@ -556,10 +646,10 @@ struct mcParticlePrediction { } hestimatorsRecoEvGenVsReco[i]->Fill(nMult[i], nMultReco[i]); hestimatorsRecoEvGenVsReco_BCMC[i]->Fill(nMult[i], nMultRecoMCBC[i]); - hestimatorsRecoEvGenVsRecoITS[i]->Fill(nMult[i], nMultReco[Estimators::ITS]); - hestimatorsRecoEvRecoVsITS[i]->Fill(nMultReco[i], nMult[Estimators::ITS]); - hestimatorsRecoEvRecoVsRecoITS[i]->Fill(nMultReco[i], nMultReco[Estimators::ITS]); - hestimatorsRecoEvRecoVsRecoITS_BCMC[i]->Fill(nMultRecoMCBC[i], nMultReco[Estimators::ITS]); + hestimatorsRecoEvGenVsRecoITS[i]->Fill(nMult[i], nMultReco[Estimators::ITSIB]); + hestimatorsRecoEvRecoVsITS[i]->Fill(nMultReco[i], nMult[Estimators::ITSIB]); + hestimatorsRecoEvRecoVsRecoITS[i]->Fill(nMultReco[i], nMultReco[Estimators::ITSIB]); + hestimatorsRecoEvRecoVsRecoITS_BCMC[i]->Fill(nMultRecoMCBC[i], nMultReco[Estimators::ITSIB]); hestimatorsRecoEvRecoVsFT0A[i]->Fill(nMultReco[i], nMult[Estimators::FT0A]); hestimatorsRecoEvRecoVsBCId[i]->Fill(foundBCid, nMult[i]); hestimatorsRecoEvVsBCId[i]->Fill(foundBCid, nMultReco[i]); diff --git a/PWGLF/Tasks/QC/mcinelgt0.cxx b/PWGLF/Tasks/QC/mcinelgt0.cxx index cac4eff5bf7..40acd66a67f 100644 --- a/PWGLF/Tasks/QC/mcinelgt0.cxx +++ b/PWGLF/Tasks/QC/mcinelgt0.cxx @@ -48,7 +48,7 @@ struct mcInelGt0 { if (!track.isPVContributor()) { continue; } - if (abs(track.eta()) > 1) { + if (std::abs(track.eta()) > 1) { LOG(info) << "Track with eta > 1: " << track.eta() << (track.hasTPC() ? "hasTPC" diff --git a/PWGLF/Tasks/QC/strangederivedqa.cxx b/PWGLF/Tasks/QC/strangederivedqa.cxx new file mode 100644 index 00000000000..2e709e07338 --- /dev/null +++ b/PWGLF/Tasks/QC/strangederivedqa.cxx @@ -0,0 +1,158 @@ +// 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 does basic QA of strangeness derived data + +#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 "ReconstructionDataFormats/Track.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Common/Core/trackUtilities.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace std; +using std::array; + +struct strangederivedqa { + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + ConfigurableAxis axisNCollisions{"axisNCollisions", {50000, -0.5f, 49999.5f}, "collisions"}; + ConfigurableAxis axisNV0s{"axisNV0s", {50000, -0.5f, 49999.5f}, "V0s"}; + + Configurable verbose{"verbose", false, "do more printouts"}; + + void init(InitContext const&) + { + auto h = histos.add("hDFCounter", "hDFCounter", kTH1D, {{6, -0.5f, 5.5f}}); + h->GetXaxis()->SetBinLabel(1, "All"); + h->GetXaxis()->SetBinLabel(2, "Ordered"); + h->GetXaxis()->SetBinLabel(3, "Unordered"); + + auto h2 = histos.add("hEventCounter", "hEventCounter", kTH2D, {{1, -0.5f, 0.5f}, {3, -0.5f, 2.5f}}); + auto h3 = histos.add("hEventsPerDF", "hEventsPerDF", kTH2D, {axisNCollisions, {3, -0.5f, 2.5f}}); + auto h4 = histos.add("hV0sPerDF", "hV0sPerDF", kTH2D, {axisNV0s, {3, -0.5f, 2.5f}}); + + h2->GetYaxis()->SetBinLabel(1, "All"); + h2->GetYaxis()->SetBinLabel(2, "Ordered"); + h2->GetYaxis()->SetBinLabel(3, "Unordered"); + h3->GetYaxis()->SetBinLabel(1, "All"); + h3->GetYaxis()->SetBinLabel(2, "Ordered"); + h3->GetYaxis()->SetBinLabel(3, "Unordered"); + h4->GetYaxis()->SetBinLabel(1, "All"); + h4->GetYaxis()->SetBinLabel(2, "Ordered"); + h4->GetYaxis()->SetBinLabel(3, "Unordered"); + } + + // Real data processing + void processOriginal(aod::Collisions const& collisions, aod::Origins const& origins, soa::Join const& fullV0s) + { + histos.fill(HIST("hDFCounter"), 0.0f); + histos.fill(HIST("hEventCounter"), 0.0f, 0.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 0.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 0.0f); + bool ordered = true; + int previousIndex = -100; + for (auto const& v0 : fullV0s) { + if (v0.collisionId() < previousIndex) { + ordered = false; + } + previousIndex = v0.collisionId(); + } + if (ordered) { + histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); + + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + } + } else { + histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); + + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i", origin.dataframeID(), collisions.size(), fullV0s.size()); + } + } + } + + // Real data processing + void processDerived(aod::StraCollisions const& collisions, aod::StraOrigins const& origins, soa::Join const& fullV0s) + { + histos.fill(HIST("hDFCounter"), 0.0f); + histos.fill(HIST("hEventCounter"), 0.0f, 0.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 0.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 0.0f); + bool ordered = true; + int previousIndex = -100; + for (auto const& v0 : fullV0s) { + if (v0.straCollisionId() < previousIndex) { + ordered = false; + } + previousIndex = v0.straCollisionId(); + } + if (ordered) { + histos.fill(HIST("hEventCounter"), 0.0f, 1.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 1.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 1.0f); + + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Sorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); + } + } else { + histos.fill(HIST("hEventCounter"), 0.0f, 2.0f, collisions.size()); + histos.fill(HIST("hEventsPerDF"), collisions.size(), 2.0f); + histos.fill(HIST("hV0sPerDF"), fullV0s.size(), 2.0f); + + if (verbose) { + auto origin = origins.begin(); + LOGF(info, "Unsorted DF ID: %lld collisions: %i V0s: %i Origins size: %i", origin.dataframeID(), collisions.size(), fullV0s.size(), origins.size()); + uint64_t directoryName = origin.dataframeID(); + for (auto const& orig : origins) { + LOGF(info, "Unsorted DF ID: %lld separate origin: %lld", directoryName, orig.dataframeID()); + } + } + } + } + + PROCESS_SWITCH(strangederivedqa, processOriginal, "Process original data", false); + PROCESS_SWITCH(strangederivedqa, processDerived, "Process derived data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/QC/strangenessTrackingQC.cxx b/PWGLF/Tasks/QC/strangenessTrackingQC.cxx new file mode 100644 index 00000000000..09c5698fd92 --- /dev/null +++ b/PWGLF/Tasks/QC/strangenessTrackingQC.cxx @@ -0,0 +1,311 @@ +// 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 "CCDB/BasicCCDBManager.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "DataFormatsParameters/GRPMagField.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsTPC/BetheBlochAleph.h" +#include "DCAFitter/DCAFitterN.h" +#include "DetectorsBase/Propagator.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +// #include "PWGHF/Core/PDG.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "ReconstructionDataFormats/DCA.h" +#include "ReconstructionDataFormats/Track.h" +#include "PWGLF/DataModel/LFNonPromptCascadeTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +namespace +{ + +}; + +struct miniCasc { + bool fillOmega; + float pt; + float eta; + float phi; + float radius; + float massOmega; + float massXi; + float dcaXYCasc; + float dcaXYTracked; +}; + +struct strangenessTrackingQC { + + using TrackCandidates = soa::Join; + using CollisionCandidates = soa::Join; + + Configurable setting_materialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrLUT), "Type of material correction"}; + + Configurable cascsetting_dcaCascDaughters{"casc_setting_dcaV0daughters", 0.1f, "DCA between the V0 daughters"}; + Configurable cascsetting_cosPA{"casc_setting_cosPA", 0.995f, "Cosine of the pointing angle of the V0"}; + Configurable cascsetting_massWindowXi{"casc_setting_massWindowXi", 0.01f, "Mass window for the Xi"}; + + Configurable cfgGRPmagPath{"cfgGRPmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable cfgGRPpath{"cfgGRPpath", "GLO/GRP/GRP", "Path of the grp file"}; + + Configurable cfgCutNclusTPC{"cfgCutNclusTPC", 70, "Minimum number of TPC clusters"}; + + ConfigurableAxis ptBins{"ptBins", {200, -10.f, 10.f}, "Binning for #it{p}_{T} (GeV/#it{c})"}; + ConfigurableAxis dcaBins{"dcaBins", {1e3, -0.1, 0.1}, "Binning for DCA (cm)"}; + ConfigurableAxis decayRadBins{"decayRadBins", {100, 0.f, 40.f}, "Binning for decay radius (cm)"}; + ConfigurableAxis omegaMassBins{"omegaMassBins", {125, 1.650, 1.700}, "Invariant mass (GeV/#it{c}^{2})"}; + ConfigurableAxis xiMassBins{"xiMassBins", {125, 1.296, 1.346}, "Invariant mass (GeV/#it{c}^{2})"}; + + Service ccdb; + int mRunNumber = 0; + float bz = 0.f; + o2::vertexing::DCAFitterN<2> m_fitter; + + HistogramRegistry registry{ + "registry", + { + {"omegaMass", "; Mass (GeV/#it{c}^{2}); Counts", {HistType::kTH1F, {{125, 1.650, 1.700}}}}, + {"xiMass", "; Mass (GeV/#it{c}^{2}); Counts", {HistType::kTH1F, {{125, 1.296, 1.346}}}}, + {"omegaMassTracked", "; Mass (GeV/#it{c}^{2}); Counts", {HistType::kTH1F, {{125, 1.650, 1.700}}}}, + {"xiMassTracked", "; Mass (GeV/#it{c}^{2}); Counts", {HistType::kTH1F, {{125, 1.296, 1.346}}}}, + + {"omegaHist", "; #it{p}_{T} (GeV/#it{c}); Radius (cm); Mass", {HistType::kTH3F, {{ptBins, decayRadBins, omegaMassBins}}}}, + {"xiHist", "; #it{p}_{T} (GeV/#it{c}); Radius (cm); Mass", {HistType::kTH3F, {{ptBins, decayRadBins, xiMassBins}}}}, + {"xiHistTracked", "; #it{p}_{T} (GeV/#it{c}); Radius (cm); Mass", {HistType::kTH3F, {{ptBins, decayRadBins, xiMassBins}}}}, + {"omegaHistTracked", "; #it{p}_{T} (GeV/#it{c}); Radius (cm); Mass", {HistType::kTH3F, {{ptBins, decayRadBins, omegaMassBins}}}}, + + {"xiDCAvsPt", "; #it{p}_{T} (GeV/#it{c}); DCA (cm)", {HistType::kTH2F, {{ptBins, dcaBins}}}}, + {"omegaDCAvsPt", "; #it{p}_{T} (GeV/#it{c}); DCA (cm)", {HistType::kTH2F, {{ptBins, dcaBins}}}}, + {"xiDCAvsPtTracked", "; #it{p}_{T} (GeV/#it{c}); DCA (cm)", {HistType::kTH2F, {{ptBins, dcaBins}}}}, + {"omegaDCAvsPtTracked", "; #it{p}_{T} (GeV/#it{c}); DCA (cm)", {HistType::kTH2F, {{ptBins, dcaBins}}}}, + }}; + + template + float dcaToPV(o2::dataformats::VertexBase& PV, T& trackParCov) + { + auto matCorr = static_cast(setting_materialCorrection.value); + o2::dataformats::DCA impactParameterTrk; + o2::base::Propagator::Instance()->propagateToDCA(PV, trackParCov, bz, 2.f, matCorr, &impactParameterTrk); + return impactParameterTrk.getY(); + } + + template + bool qualityTrackSelection(const T& track) + { + if (std::abs(track.eta()) > 0.9) { + return false; + } + if (track.tpcNClsFound() < cfgCutNclusTPC) { + return false; + } + return true; + } + + float computeMassMother(const float massA, const float massB, const std::array& momA, const std::array& momB) const + { + float eA = std::hypot(massA, std::hypot(momA[0], momA[1], momA[2])); + float eB = std::hypot(massB, std::hypot(momB[0], momB[1], momB[2])); + float momTot = std::hypot(momA[0] + momB[0], momA[1] + momB[1], momA[2] + momB[2]); + float eMother = eA + eB; + return std::sqrt(eMother * eMother - momTot * momTot); + } + + template + bool buildCascade(TCasc const& casc, CollisionCandidates::iterator const& collision, aod::V0s const&, TrackCandidates const&, miniCasc& miniCasc) + { + const auto& v0 = casc.template v0_as(); + const auto& bachelor = casc.template bachelor_as(); + const auto& ptrack = v0.template posTrack_as(); + const auto& ntrack = v0.template negTrack_as(); + if (!qualityTrackSelection(ptrack) || !qualityTrackSelection(ntrack) || !qualityTrackSelection(bachelor)) { + return false; + } + const auto& protonTrack = bachelor.sign() > 0 ? ntrack : ptrack; + const auto& pionTrack = bachelor.sign() > 0 ? ptrack : ntrack; + if (std::abs(protonTrack.tpcNSigmaPr()) > 3 || std::abs(pionTrack.tpcNSigmaPi()) > 3) { + return false; + } + auto primaryVertex = getPrimaryVertex(collision); + std::array pvPos = {primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ()}; + + float cascCpa = -1; + float cascDauDCA = -1; + + std::array cascMom; + std::array v0Mom; + std::array bachelorMom; + + // track propagation + o2::track::TrackParCov trackParCovV0; + o2::track::TrackPar trackParV0; + o2::track::TrackPar trackParBachelor; + o2::track::TrackParCov trackParCovCasc; + if (m_fitter.process(getTrackParCov(pionTrack), getTrackParCov(protonTrack))) { + trackParCovV0 = m_fitter.createParentTrackParCov(0); // V0 track retrieved from p and pi daughters + if (m_fitter.process(trackParCovV0, getTrackParCov(bachelor))) { + trackParV0 = m_fitter.getTrackParamAtPCA(0); + trackParBachelor = m_fitter.getTrackParamAtPCA(1); + trackParV0.getPxPyPzGlo(v0Mom); + trackParBachelor.getPxPyPzGlo(bachelorMom); + trackParCovCasc = m_fitter.createParentTrackParCov(); + trackParCovCasc.getPxPyPzGlo(cascMom); + cascCpa = RecoDecay::cpa(pvPos, m_fitter.getPCACandidate(), cascMom); + cascDauDCA = std::sqrt(std::abs(m_fitter.getChi2AtPCACandidate())); + } else { + return false; + } + } else { + return false; + } + + if (cascCpa < cascsetting_cosPA) { + return false; + } + + if (cascDauDCA > cascsetting_dcaCascDaughters) { + return false; + } + + int chargeFactor = bachelor.sign() > 0 ? 1 : -1; + miniCasc.pt = chargeFactor * std::hypot(cascMom[0], cascMom[1]); + miniCasc.massOmega = computeMassMother(constants::physics::MassLambda0, constants::physics::MassKaonCharged, v0Mom, bachelorMom); + miniCasc.massXi = computeMassMother(constants::physics::MassLambda0, constants::physics::MassPionCharged, v0Mom, bachelorMom); + miniCasc.fillOmega = false; + if (TMath::Abs(miniCasc.massXi - constants::physics::MassXiMinus) > cascsetting_massWindowXi && std::abs(bachelor.tpcNSigmaKa()) < 3) { + miniCasc.fillOmega = true; + } + + miniCasc.dcaXYCasc = dcaToPV(primaryVertex, trackParCovCasc); + auto svPos = m_fitter.getPCACandidate(); + miniCasc.radius = std::hypot(svPos[0], svPos[1]); + + return true; + } + + void initCCDB(aod::BCsWithTimestamps::iterator const& bc) + { + if (mRunNumber == bc.runNumber()) { + return; + } + mRunNumber = bc.runNumber(); + auto timestamp = bc.timestamp(); + + if (o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp(cfgGRPpath, timestamp)) { + o2::base::Propagator::initFieldFromGRP(grpo); + bz = grpo->getNominalL3Field(); + } else if (o2::parameters::GRPMagField* grpmag = ccdb->getForTimeStamp(cfgGRPmagPath, timestamp)) { + o2::base::Propagator::initFieldFromGRP(grpmag); + bz = std::lround(5.f * grpmag->getL3Current() / 30000.f); + LOG(debug) << "bz = " << bz; + } else { + LOG(fatal) << "Got nullptr from CCDB for path " << cfgGRPmagPath << " of object GRPMagField and " << cfgGRPpath << " of object GRPObject for timestamp " << timestamp; + } + } + + void init(InitContext const&) + { + mRunNumber = 0; + bz = 0; + + if (static_cast(setting_materialCorrection.value) == o2::base::Propagator::MatCorrType::USEMatCorrLUT) { + auto* lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(ccdb->get("GLO/Param/MatLUT")); + LOG(info) << "Setting material correction LUT"; + o2::base::Propagator::Instance(true)->setMatLUT(lut); + } + + ccdb->setURL("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setFatalWhenNull(false); + m_fitter.setPropagateToPCA(true); + m_fitter.setMaxR(200.); + m_fitter.setMinParamChange(1e-3); + m_fitter.setMinRelChi2Change(0.9); + m_fitter.setMaxDZIni(4); + m_fitter.setMaxDXYIni(4); + m_fitter.setMaxChi2(1e9); + m_fitter.setUseAbsDCA(true); + m_fitter.setWeightedFinalPCA(false); + // int mat{static_cast(setting_materialCorrection)}; + // m_fitter.setMatCorrType(static_cast(mat)); + } + + void process(CollisionCandidates const&, aod::AssignedTrackedCascades const& trackedCascades, aod::Cascades const& cascades, aod::V0s const& v0s, TrackCandidates const& tracks, aod::BCsWithTimestamps const&) + { + + for (const auto& trackedCascade : trackedCascades) { + miniCasc miniCasc; + const auto& casc = trackedCascade.cascade(); + auto collision = trackedCascade.collision_as(); + if (!collision.sel8() || std::abs(collision.posZ()) > 10) { + continue; + } + initCCDB(collision.bc_as()); + m_fitter.setBz(bz); + if (buildCascade(casc, collision, v0s, tracks, miniCasc)) { + + // compute the dca of the tracked cascade + const auto& track = trackedCascade.track_as(); + auto trackCovTrk = getTrackParCov(track); + + auto primaryVertex = getPrimaryVertex(collision); + miniCasc.dcaXYTracked = dcaToPV(primaryVertex, trackCovTrk); + // fill the histograms + if (miniCasc.fillOmega) { + registry.fill(HIST("omegaMassTracked"), miniCasc.massOmega); + registry.fill(HIST("omegaDCAvsPtTracked"), miniCasc.pt, miniCasc.dcaXYTracked); + registry.fill(HIST("omegaHistTracked"), miniCasc.pt, miniCasc.radius, miniCasc.massOmega); + } + registry.fill(HIST("xiMassTracked"), miniCasc.massXi); + registry.fill(HIST("xiDCAvsPtTracked"), miniCasc.pt, miniCasc.dcaXYTracked); + registry.fill(HIST("xiHistTracked"), miniCasc.pt, miniCasc.radius, miniCasc.massXi); + } + } + + for (auto& cascade : cascades) { + miniCasc miniCasc; + auto collision = cascade.collision_as(); + if (!collision.sel8() || std::abs(collision.posZ()) > 10) { + continue; + } + initCCDB(collision.bc_as()); + m_fitter.setBz(bz); + if (buildCascade(cascade, collision, v0s, tracks, miniCasc)) { + if (miniCasc.fillOmega) { + registry.fill(HIST("omegaMass"), miniCasc.massOmega); + registry.fill(HIST("omegaDCAvsPt"), miniCasc.pt, miniCasc.dcaXYCasc); + registry.fill(HIST("omegaHist"), miniCasc.pt, miniCasc.radius, miniCasc.massOmega); + } + registry.fill(HIST("xiMass"), miniCasc.massXi); + registry.fill(HIST("xiDCAvsPt"), miniCasc.pt, miniCasc.dcaXYCasc); + registry.fill(HIST("xiHist"), miniCasc.pt, miniCasc.radius, miniCasc.massXi); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 5a30b91e5de..e6f7b573f2e 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 @@ -54,6 +59,11 @@ o2physics_add_dpl_workflow(f0980analysis PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(f0980pbpbanalysis + SOURCES f0980pbpbanalysis.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(lambda1520spherocityanalysis SOURCES lambda1520SpherocityAnalysis.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -129,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 diff --git a/PWGLF/Tasks/Resonances/KshortKshort.cxx b/PWGLF/Tasks/Resonances/KshortKshort.cxx index 3fbe2da0bc7..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; @@ -148,6 +152,7 @@ struct strangeness_tutorial { TF1* fMultCutHigh = nullptr; TF1* fMultMultPVCut = nullptr; Service PDGdatabase; + TRandom* rn = new TRandom(); void init(InitContext const&) { @@ -159,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}; @@ -198,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}}); @@ -539,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); @@ -627,8 +638,6 @@ struct strangeness_tutorial { // polarization calculations - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), massK0s); // Kshort ROOT::Math::PxPyPzMVector fourVecMother = ROOT::Math::PxPyPzMVector(lv3.Px(), lv3.Py(), lv3.Pz(), lv3.M()); // mass of KshortKshort pair @@ -636,8 +645,6 @@ struct strangeness_tutorial { ROOT::Math::PxPyPzMVector fourVecDauCM = boost(fourVecDau); // boost the frame of daughter same as mother ROOT::Math::XYZVector threeVecDauCM = fourVecDauCM.Vect(); // get the 3 vector of daughter in the frame of mother - TRandom* rn = new TRandom(); - if (TMath::Abs(lv3.Rapidity() < 0.5)) { if (inv_mass1D) { @@ -647,43 +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); } } } @@ -726,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))) { @@ -771,8 +785,6 @@ struct strangeness_tutorial { lv2.SetPtEtaPhiM(t2.pt(), t2.eta(), t2.phi(), massK0s); lv3 = lv1 + lv2; - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), massK0s); // Kshort ROOT::Math::PxPyPzMVector fourVecMother = ROOT::Math::PxPyPzMVector(lv3.Px(), lv3.Py(), lv3.Pz(), lv3.M()); // mass of KshortKshort pair @@ -785,19 +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); } } @@ -818,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) { @@ -862,8 +881,6 @@ struct strangeness_tutorial { lv2.SetPtEtaPhiM(t2.pt(), t2.eta(), t2.phi(), massK0s); lv3 = lv1 + lv2; - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), massK0s); // Kshort ROOT::Math::PxPyPzMVector fourVecMother = ROOT::Math::PxPyPzMVector(lv3.Px(), lv3.Py(), lv3.Pz(), lv3.M()); // mass of KshortKshort pair @@ -876,19 +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/chargedkstaranalysis.cxx b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx index c3d0437fe54..9daeae66180 100644 --- a/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx +++ b/PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx @@ -48,9 +48,13 @@ #include "PWGLF/DataModel/LFStrangenessTables.h" #include "ReconstructionDataFormats/Track.h" +// For charged kstarpp analysis +#include "PWGLF/DataModel/LFResonanceTables.h" + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::soa; using std::array; struct chargedkstaranalysis { @@ -68,6 +72,15 @@ struct chargedkstaranalysis { SliceCache cache; + // For charged Kstarpp analysis use Resonance Initalizer and THnSparse + ConfigurableAxis binsCent{"binsCent", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Binning of the centrality axis"}; + 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 Etabins{"Etabins", {VARIABLE_WIDTH, -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}, "Eta Binning"}; + Configurable cDCABinsQA{"cDCABinsQA", 150, "DCA binning"}; + 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"}; + + HistogramRegistry histos1{"histos1", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + // Histograms are defined with HistogramRegistry HistogramRegistry rEventSelection{"eventSelection", {}, @@ -84,6 +97,34 @@ struct chargedkstaranalysis { HistogramRegistry rGenParticles{"genParticles", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; HistogramRegistry rRecParticles{"recParticles", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + // Pre-selection cuts + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minimum pt cut"}; + /// PID Selections + Configurable nsigmaCutCombinedPion{"nsigmaCutCombinedPion", -999, "Combined nSigma cut for Pion"}; // Combined + + // DCAr to PV + Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + // 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 cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; // PV Contributor + // V0 selections + Configurable cV0MinCosPA{"cV0MinCosPA", 0.97, "V0 minimum pointing angle cosine"}; + Configurable cV0MaxDaughDCA{"cV0MaxDaughDCA", 1.0, "V0 daughter DCA Maximum"}; + // Competing V0 rejection + Configurable cV0MassWindow{"cV0MassWindow", 0.0043, "Mass window for competing Lambda0 rejection"}; + Configurable cInvMassStart{"cInvMassStart", 0.6, "Invariant mass start"}; + Configurable cInvMassEnd{"cInvMassEnd", 1.5, "Invariant mass end"}; + Configurable cInvMassBins{"cInvMassBins", 900, "Invariant mass binning"}; + + // 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"}; + ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Mixing bins - multiplicity"}; + Configurable cTpcNsigmaPionBinsQA{"cTpcNsigmaPionBinsQA", 140, "tpcNSigmaPi binning"}; + // Configurable for histograms Configurable nBins{"nBins", 100, "N bins in all histos"}; @@ -158,11 +199,57 @@ struct chargedkstaranalysis { void init(InitContext const&) { + AxisSpec dcaxyAxisQA = {cDCABinsQA, 0.0, 3.0, "DCA_{#it{xy}} (cm)"}; + AxisSpec dcazAxisQA = {cDCABinsQA, 0.0, 3.0, "DCA_{#it{xy}} (cm)"}; + AxisSpec ptAxisQA = {binsPtQA, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec tpcNSigmaPiAxisQA = {cTpcNsigmaPionBinsQA, -7.0, 7.0, "N#sigma_{TPC}"}; + + AxisSpec centAxis = {binsCent, "V0M (%)"}; + AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"}; + AxisSpec etaAxis = {Etabins, "#eta"}; + AxisSpec goodTrackCountAxis = {3, 0., 3., "Passed track = 1, Passed V0 = 2, Passed track and V0 = 3"}; + // register histograms + histos1.add("hVertexZ", "hVertexZ", HistType::kTH1F, {{nBins, -15., 15.}}); + histos1.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); + // Multiplicity and accepted events QA + histos1.add("QAbefore/collMult", "Collision multiplicity", HistType::kTH1F, {centAxis}); + // QA before + histos1.add("QAbefore/pi_Eta", "Primary pion track eta", kTH1F, {etaAxis}); + histos1.add("QAbefore/k0s_Eta", "K0short track eta", kTH1F, {etaAxis}); + histos1.add("QAbefore/chargedkstarpmRapidity", "Reconstructed K*^{#pm} rapidity", kTH1F, {etaAxis}); + + histos1.add("QAbefore/DCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxisQA}); + histos1.add("QAbefore/DCAz_pi", "DCAz distribution of pion track candidates", HistType::kTH1F, {dcazAxisQA}); + histos1.add("QAbefore/pT_pi", "pT distribution of pion track candidates", kTH1F, {ptAxisQA}); + histos1.add("QAbefore/tpcNsigmaPionQA", "NsigmaTPC distribution of primary pion candidates", kTH2F, {ptAxisQA, tpcNSigmaPiAxisQA}); + + // QA after + histos1.add("QAAfter/DCAxy_pi", "DCAxy distribution of pion track candidates", HistType::kTH1F, {dcaxyAxisQA}); + histos1.add("QAAfter/DCAz_pi", "DCAz distribution of pion track candidates", HistType::kTH1F, {dcazAxisQA}); + histos1.add("QAAfter/pT_pi", "pT distribution of pion track candidates", kTH1F, {ptAxisQA}); + histos1.add("QAAfter/tpcNsigmaPionQA", "NsigmaTPC distribution of primary pion candidates", kTH2F, {ptAxisQA, tpcNSigmaPiAxisQA}); + histos1.add("QAAfter/pi_Eta", "Primary pion track eta", kTH1F, {etaAxis}); + + // Good tracks and V0 counts QA + histos1.add("QAafter/hGoodTracksV0s", "Number of good track and V0 passed", kTH1F, {goodTrackCountAxis}); + histos1.add("chargedkstarinvmassUlikeSign", "Invariant mass of charged K*(892)", kTH1F, {invMassAxis}); + histos1.add("chargedkstarinvmassMixedEvent", "Invariant mass of charged K*(892)", kTH1F, {invMassAxis}); + + // Mass vs Pt vs Multiplicity 3-dimensional histogram + // histos1.add("chargekstarMassPtMult", "Charged K*(892) mass vs pT vs V0 multiplicity distribution", kTH3F, {invMassAxis, ptAxis, centAxis}); + + histos1.add("chargekstarMassPtMultPtUnlikeSign", + "Invariant mass of CKS meson Unlike Sign", kTHnSparseF, + {invMassAxis, ptAxis, centAxis}, true); + histos1.add("chargekstarMassPtMultPtMixedEvent", + "Invariant mass of CKS meson MixedEvent Sign", kTHnSparseF, + {invMassAxis, ptAxis, centAxis}, true); + // Axes AxisSpec K0ShortMassAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec vertexZAxis = {nBins, -10., 10., "vrtx_{Z} [cm]"}; - AxisSpec ptAxis = {200, 0.0f, 20.0f, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec multAxis = {100, 0.0f, 100.0f, "Multiplicity"}; // Histograms @@ -459,6 +546,161 @@ struct chargedkstaranalysis { return true; } + double massK0 = o2::constants::physics::MassK0Short; + double massPicharged = o2::constants::physics::MassPionCharged; + double massLambda0 = o2::constants::physics::MassLambda; + double massAntiLambda0 = o2::constants::physics::MassLambda0Bar; + // Fill histograms (main function) + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks, const V0sType& dV0s) + { + // auto multiplicity = collision.cent(); + auto multiplicity = collision.cent(); + histos1.fill(HIST("QAbefore/collMult"), multiplicity); + TLorentzVector lDecayDaughter, lDecayV0, lResonance; + + for (auto track : dTracks) { // loop over all dTracks1 + // if (!trackCut(track1)) + // continue; // track selection and PID selection + // trying to see the information without applying any cut yet //Let's I am trying to reconstruct the charged kstar it is V0s + pion + histos1.fill(HIST("hEta"), track.eta()); + + auto trackId = track.index(); + auto trackptPi = track.pt(); + auto tracketaPi = track.eta(); + + histos1.fill(HIST("QAbefore/pi_Eta"), tracketaPi); + + if (!IsMix) { + // DCA QA (before cuts) + histos1.fill(HIST("QAbefore/DCAxy_pi"), track.dcaXY()); + histos1.fill(HIST("QAbefore/DCAz_pi"), track.dcaZ()); + // Pseudo-rapidity QA (before cuts) + histos1.fill(HIST("QAbefore/pi_Eta"), tracketaPi); + // pT QA (before cuts) + histos1.fill(HIST("QAbefore/pT_pi"), trackptPi); + // TPC PID (before cuts) + histos1.fill(HIST("QAbefore/tpcNsigmaPionQA"), trackptPi, track.tpcNSigmaPi()); + } + + // apply the track cut + if (!trackCutpp(track) || !selectionPIDpp(track)) + continue; + + histos1.fill(HIST("QAafter/hGoodTracksV0s"), 0.5); + + if (!IsMix) { + // DCA QA (before cuts) + histos1.fill(HIST("QAAfter/DCAxy_pi"), track.dcaXY()); + histos1.fill(HIST("QAAfter/DCAz_pi"), track.dcaZ()); + // Pseudo-rapidity QA (before cuts) + histos1.fill(HIST("QAAfter/pi_Eta"), tracketaPi); + // pT QA (before cuts) + histos1.fill(HIST("QAAfter/pT_pi"), trackptPi); + // TPC PID (before cuts) + histos1.fill(HIST("QAAfter/tpcNsigmaPionQA"), trackptPi, track.tpcNSigmaPi()); + } + + for (auto& v0 : dV0s) { + + // Full index policy is needed to consider all possible combinations + if (v0.indices()[0] == trackId || v0.indices()[1] == trackId) + continue; // To avoid combining secondary and primary pions + //// Initialize variables + // trk: Pion, v0: K0s + // apply the track cut + if (!V0Cut(v0)) + continue; + histos1.fill(HIST("QAafter/hGoodTracksV0s"), 1.5); + + lDecayDaughter.SetXYZM(track.px(), track.py(), track.pz(), massPi); + lDecayV0.SetXYZM(v0.px(), v0.py(), v0.pz(), massK0); + lResonance = lDecayDaughter + lDecayV0; + // Counting how many resonances passed + histos1.fill(HIST("QAafter/hGoodTracksV0s"), 2.5); + + // Checking whether the mid-rapidity condition is met + if (abs(lResonance.Rapidity()) > 0.5) + continue; + if constexpr (!IsMix) { + histos1.fill(HIST("chargedkstarinvmassUlikeSign"), lResonance.M()); + // Reconstructed K*(892)pm 3d mass, pt, multiplicity histogram + histos1.fill(HIST("chargekstarMassPtMultPtUnlikeSign"), lResonance.M(), lResonance.Pt(), multiplicity); + + } else { + histos1.fill(HIST("chargedkstarinvmassMixedEvent"), lResonance.M()); + // Reconstructed K*(892)pm 3d mass, pt, multiplicity histogram + histos1.fill(HIST("chargekstarMassPtMultPtMixedEvent"), lResonance.M(), lResonance.Pt(), multiplicity); + } + } + } + } + + template + bool selectionPIDpp(const T& candidate) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + if (std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + tpcPIDPassed = true; + } + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { + tofPIDPassed = true; + } + if ((nsigmaCutCombinedPion > 0) && (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < nsigmaCutCombinedPion * nsigmaCutCombinedPion)) { + tofPIDPassed = true; + } + } else { + tofPIDPassed = true; + } + if (tpcPIDPassed && tofPIDPassed) { + return true; + } + return false; + } + + template + bool trackCutpp(const TrackType track) + { + // basic track cuts + if (std::abs(track.pt()) < cMinPtcut) + return false; + if (std::abs(track.eta()) > ConfDaughEta) + return false; + if (std::abs(track.dcaXY()) > cMaxDCArToPVcut) + return false; + if (std::abs(track.dcaZ()) > cMaxDCAzToPVcut) + return false; + if (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + + return true; + } + template + bool V0Cut(const V0Type v0) + { + // V0 track cuts + if (std::abs(v0.eta()) > ConfDaughEta) + return false; + if (v0.v0CosPA() < cV0MinCosPA) + return false; + if (v0.daughDCA() > cV0MaxDaughDCA) + return false; + + // apply the competing V0 rejection cut (excluding Lambda0 candidates, massLambdaPDG = 1115.683 MeV/c2) + + if (std::abs(v0.mLambda() - massLambda0) < cV0MassWindow) + return false; + if (std::abs(v0.mAntiLambda() - massAntiLambda0) < cV0MassWindow) + return false; + + return true; + } + // Defining filters for events (event selection) // Processed events will be already fulfilling the event selection // requirements @@ -698,7 +940,7 @@ struct chargedkstaranalysis { } } - PROCESS_SWITCH(chargedkstaranalysis, processSE, "Process Same event", true); + PROCESS_SWITCH(chargedkstaranalysis, processSE, "Process Same event", false); void processME(EventCandidates const& /*collisions*/, TrackCandidates const& /*tracks*/, V0TrackCandidate const& /*V0s*/) @@ -803,7 +1045,7 @@ struct chargedkstaranalysis { } } - PROCESS_SWITCH(chargedkstaranalysis, processME, "Process Mixed event", true); + PROCESS_SWITCH(chargedkstaranalysis, processME, "Process Mixed event", false); void processGenMC(aod::McCollision const& mcCollision, aod::McParticles& mcParticles, const soa::SmallGroups& collisions) { @@ -1045,8 +1287,29 @@ struct chargedkstaranalysis { } // track loop ends } - PROCESS_SWITCH(chargedkstaranalysis, processGenMC, "Process Gen event", true); - PROCESS_SWITCH(chargedkstaranalysis, processRecMC, "Process Rec event", true); + PROCESS_SWITCH(chargedkstaranalysis, processGenMC, "Process Gen event", false); + PROCESS_SWITCH(chargedkstaranalysis, processRecMC, "Process Rec event", false); + + void processSEnew(aod::ResoCollision& collision, aod::ResoTracks const& resotracks, aod::ResoV0s const& resov0s) + { + // Fill the event counter + histos1.fill(HIST("hVertexZ"), collision.posZ()); + fillHistograms(collision, resotracks, resov0s); // Fill histograms, no MC, no mixing + } + PROCESS_SWITCH(chargedkstaranalysis, processSEnew, "Process Same event new", true); + + using BinningTypeVtxZT0M = ColumnBinningPolicy; + void processMEnew(aod::ResoCollisions& collisions, aod::ResoTracks const& resotracks, aod::ResoV0s const& resov0s) + { + auto tracksV0sTuple = std::make_tuple(resotracks, resov0s); + auto V0sTuple = std::make_tuple(resov0s); + BinningTypeVtxZT0M colBinning{{CfgVtxBins, CfgMultBins}, true}; + Pair pairs{colBinning, nEvtMixing, -1, collisions, tracksV0sTuple, &cache}; // -1 is the number of the bin to skip + for (auto& [c1, restrk1, c2, resov0s2] : pairs) { + fillHistograms(c1, restrk1, resov0s2); + } + } + PROCESS_SWITCH(chargedkstaranalysis, processMEnew, "Process Mixed events new", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx new file mode 100644 index 00000000000..bb27b5f81c7 --- /dev/null +++ b/PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx @@ -0,0 +1,408 @@ +// 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 "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/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 "CommonConstants/PhysicsConstants.h" + +#include "ReconstructionDataFormats/Track.h" + +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" + +#include "CCDB/CcdbApi.h" +#include "CCDB/BasicCCDBManager.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace o2::soa; +using namespace o2::constants::physics; + +struct f0980pbpbanalysis { + HistogramRegistry histos{ + "histos", + {}, + OutputObjHandlingPolicy::AnalysisObject}; + + Service ccdb; + 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"}; + + Configurable cfgCutVertex{"cfgCutVertex", 10.0, "PV selection"}; + Configurable cfgQvecSel{"cfgQvecSel", true, "Reject events when no QVector"}; + Configurable cfgOccupancySel{"cfgOccupancySe", 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 cfgCentSel{"cfgCentSel", 80., "Centrality selection"}; + Configurable cfgCentEst{"cfgCentEst", 1, "Centrality estimator, 1: FT0C, 2: FT0M"}; + + 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.5, "Maximum transverse DCA"}; + Configurable cfgMaxDCAzToPVcut{"cfgMaxDCAzToPVcut", 2.0, "Maximum longitudinal DCA"}; + Configurable cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"}; + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.8, "TPC Crossed Rows to Findable Clusters"}; + + Configurable cfgMinRap{"cfgMinRap", -0.5, "Minimum rapidity for pair"}; + Configurable cfgMaxRap{"cfgMaxRap", 0.5, "Maximum rapidity for pair"}; + + Configurable cfgPrimaryTrack{"cfgPrimaryTrack", true, "Primary track selection"}; + Configurable cfgGlobalWoDCATrack{"cfgGlobalWoDCATrack", true, "Global track selection without DCA"}; + Configurable cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; + + Configurable cMaxTOFnSigmaPion{"cMaxTOFnSigmaPion", 3.0, "TOF nSigma cut for Pion"}; // TOF + Configurable cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 5.0, "TPC nSigma cut for Pion"}; // TPC + Configurable cMaxTPCnSigmaPionS{"cMaxTPCnSigmaPionS", 3.0, "TPC nSigma cut for Pion as a standalone"}; + Configurable cfgUSETOF{"cfgUSETOF", false, "TPC usage"}; + + 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"}; + + ConfigurableAxis massAxis{"massAxis", {400, 0.2, 2.2}, "Invariant mass axis"}; + ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 13.0, 20.0}, "Transverse momentum Binning"}; + ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"}; + + TF1* fMultPVCutLow = nullptr; + TF1* fMultPVCutHigh = nullptr; + + int DetId; + int RefAId; + int RefBId; + + int QvecDetInd; + int QvecRefAInd; + int QvecRefBInd; + + float centrality; + + double angle; + double relPhi; + + double massPi = o2::constants::physics::MassPionCharged; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgMaxEta && nabs(aod::track::pt) > cfgMinPt); + Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgMaxDCArToPVcut) && (nabs(aod::track::dcaZ) < cfgMaxDCAzToPVcut); + + using EventCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; + + template + int GetDetId(const T& name) + { + 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 0; + } + } + + 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 (cfgQvecSel && (collision.qvecAmp()[DetId] < 1e-4 || collision.qvecAmp()[RefAId] < 1e-4 || collision.qvecAmp()[RefAId] < 1e-4)) { + return 0; + } + if (cfgOccupancySel && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + return 0; + } + if (cfgNCollinTR && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return 0; + } + + return 1; + } // event selection + + template + bool trackSelected(const TrackType track) + { + if (std::abs(track.pt()) < cfgMinPt) { + return 0; + } + if (std::fabs(track.eta()) > cfgMaxEta) { + return 0; + } + if (std::fabs(track.dcaXY()) > cfgMaxDCArToPVcut) { + return 0; + } + if (std::fabs(track.dcaZ()) > cfgMaxDCAzToPVcut) { + return 0; + } + if (track.tpcNClsFound() < cfgTPCcluster) { + return 0; + } + if (cfgPVContributor && !track.isPVContributor()) { + return 0; + } + if (cfgPrimaryTrack && !track.isPrimaryTrack()) { + return 0; + } + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) { + return 0; + } + if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) { + return 0; + } + + return 1; + } + + template + bool PIDSelected(const TrackType track) + { + if (cfgUSETOF) { + if (!track.hasTOF()) { + return 0; + } + if (std::fabs(track.tofNSigmaPi()) > cMaxTOFnSigmaPion) { + return 0; + } + if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPion) { + return 0; + } + } + if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPionS) { + return 0; + } + + return 1; + } + + template + void FillHistograms(const CollisionType& collision, + const TracksType& dTracks, int nmode) + { + 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 eventPlaneDet = TMath::ATan2(collision.qvecIm()[QvecDetInd], collision.qvecRe()[QvecDetInd]) / static_cast(nmode); + double eventPlaneRefA = TMath::ATan2(collision.qvecIm()[QvecRefAInd], collision.qvecRe()[QvecRefAInd]) / static_cast(nmode); + double eventPlaneRefB = TMath::ATan2(collision.qvecIm()[QvecRefBInd], collision.qvecRe()[QvecRefBInd]) / static_cast(nmode); + + histos.fill(HIST("QA/EPhist"), centrality, eventPlaneDet); + histos.fill(HIST("QA/EPResAB"), centrality, TMath::Cos(static_cast(nmode) * (eventPlaneDet - eventPlaneRefA))); + histos.fill(HIST("QA/EPResAC"), centrality, TMath::Cos(static_cast(nmode) * (eventPlaneDet - eventPlaneRefB))); + histos.fill(HIST("QA/EPResBC"), centrality, TMath::Cos(static_cast(nmode) * (eventPlaneRefA - eventPlaneRefB))); + + TLorentzVector Pion1, Pion2, Reco; + for (auto& [trk1, trk2] : + combinations(CombinationsUpperIndexPolicy(dTracks, dTracks))) { + if (trk1.index() == trk2.index()) { + if (!trackSelected(trk1)) + continue; + histos.fill(HIST("QA/Nsigma_TPC"), trk1.pt(), trk1.tpcNSigmaPi()); + histos.fill(HIST("QA/Nsigma_TOF"), trk1.pt(), trk1.tofNSigmaPi()); + histos.fill(HIST("QA/TPC_TOF"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi()); + continue; + } + + if (!trackSelected(trk1) || !trackSelected(trk2)) + continue; + if (!PIDSelected(trk1) || !PIDSelected(trk2)) + continue; + + if (trk1.index() == trk2.index()) { + histos.fill(HIST("QA/Nsigma_TPC_selected"), trk1.pt(), trk1.tpcNSigmaPi()); + histos.fill(HIST("QA/Nsigma_TOF_selected"), trk1.pt(), trk1.tofNSigmaPi()); + histos.fill(HIST("QA/TPC_TOF_selected"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi()); + } + + Pion1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); + Pion2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi); + Reco = Pion1 + Pion2; + + if (Reco.Rapidity() > cfgMaxRap || Reco.Rapidity() < cfgMinRap) + continue; + + relPhi = TVector2::Phi_0_2pi((Reco.Phi() - eventPlaneDet) * static_cast(nmode)); + + if (trk1.sign() * trk2.sign() < 0) { + histos.fill(HIST("hInvMass_f0980_US_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi); + /* + if constexpr (IsMC) { + if (abs(trk1.pdgCode()) != 211 || abs(trk2.pdgCode()) != 211) + continue; + if (trk1.motherId() != trk2.motherId()) + continue; + if (abs(trk1.motherPDG()) != 9010221) + continue; + histos.fill(HIST("MCL/hpT_f0980_REC"), Reco.M(), Reco.Pt(), centrality); + } + */ + } else if (trk1.sign() > 0 && trk2.sign() > 0) { + histos.fill(HIST("hInvMass_f0980_LSpp_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi); + } else if (trk1.sign() < 0 && trk2.sign() < 0) { + histos.fill(HIST("hInvMass_f0980_LSmm_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi); + } + } + } + + void init(o2::framework::InitContext&) + { + AxisSpec epAxis = {6, 0.0, 2.0 * constants::math::PI}; + AxisSpec centQaAxis = {110, 0, 110}; + AxisSpec vzQaAxis = {100, -20, 20}; + AxisSpec PIDqaAxis = {100, -10, 10}; + AxisSpec pTqaAxis = {200, 0, 20}; + AxisSpec epQaAxis = {100, -1.0 * constants::math::PI, constants::math::PI}; + AxisSpec epresAxis = {102, -1.02, 1.02}; + + histos.add("QA/CentDist", "", {HistType::kTH1F, {centQaAxis}}); + histos.add("QA/Vz", "", {HistType::kTH1F, {vzQaAxis}}); + + histos.add("QA/Nsigma_TPC", "", {HistType::kTH2F, {pTqaAxis, PIDqaAxis}}); + histos.add("QA/Nsigma_TOF", "", {HistType::kTH2F, {pTqaAxis, PIDqaAxis}}); + histos.add("QA/TPC_TOF", "", {HistType::kTH2F, {PIDqaAxis, PIDqaAxis}}); + + histos.add("QA/Nsigma_TPC_selected", "", {HistType::kTH2F, {pTqaAxis, PIDqaAxis}}); + histos.add("QA/Nsigma_TOF_selected", "", {HistType::kTH2F, {pTqaAxis, PIDqaAxis}}); + histos.add("QA/TPC_TOF_selected", "", {HistType::kTH2F, {PIDqaAxis, PIDqaAxis}}); + + histos.add("QA/EPhist", "", {HistType::kTH2F, {centQaAxis, epQaAxis}}); + histos.add("QA/EPResAB", "", {HistType::kTH2F, {centQaAxis, epresAxis}}); + histos.add("QA/EPResAC", "", {HistType::kTH2F, {centQaAxis, epresAxis}}); + histos.add("QA/EPResBC", "", {HistType::kTH2F, {centQaAxis, epresAxis}}); + + histos.add("hInvMass_f0980_US_EPA", "unlike invariant mass", + {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, epAxis}}); + histos.add("hInvMass_f0980_LSpp_EPA", "++ invariant mass", + {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, epAxis}}); + histos.add("hInvMass_f0980_LSmm_EPA", "-- invariant mass", + {HistType::kTHnSparseF, {massAxis, ptAxis, centAxis, epAxis}}); + + // if (doprocessMCLight) { + // histos.add("MCL/hpT_f0980_GEN", "generated f0 signals", HistType::kTH1F, {pTqaAxis}); + // histos.add("MCL/hpT_f0980_REC", "reconstructed f0 signals", HistType::kTH3F, {massAxis, pTqaAxis, centAxis}); + // } + + 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"); + DetId = 0; + RefAId = 4; + RefBId = 5; + } + + 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(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()); + } + + void processData(EventCandidates::iterator const& collision, + TrackCandidates const& tracks, 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/Vz"), collision.posZ(), 1.0); + + FillHistograms(collision, tracks, 2); // second order + }; + PROCESS_SWITCH(f0980pbpbanalysis, processData, "Process Event for data", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"lf-f0980pbpbanalysis"})}; +} diff --git a/PWGLF/Tasks/Resonances/highmasslambda.cxx b/PWGLF/Tasks/Resonances/highmasslambda.cxx index c9b59e17180..9ef449cb83b 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{"reject PID", 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,32 +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)) { @@ -668,6 +616,25 @@ 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 +691,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()); } @@ -752,7 +719,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,41 +759,38 @@ 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)) { + if (rejectPID && !rejectPi(track1)) { continue; } - if (!rejectEl(track1)) { + if (rejectPID && !rejectEl(track1)) { continue; } - if (!rejectKa(track1)) { + if (rejectPID && !rejectKa(track1)) { continue; } } diff --git a/PWGLF/Tasks/Resonances/k1analysis.cxx b/PWGLF/Tasks/Resonances/k1analysis.cxx index e3599531046..7d145eff641 100644 --- a/PWGLF/Tasks/Resonances/k1analysis.cxx +++ b/PWGLF/Tasks/Resonances/k1analysis.cxx @@ -27,55 +27,96 @@ #include "Framework/runDataProcessing.h" #include "PWGLF/DataModel/LFResonanceTables.h" #include "DataFormatsParameters/GRPObject.h" +#include "CommonConstants/PhysicsConstants.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; +using namespace o2::constants::physics; struct k1analysis { + enum binAnti : unsigned int { + kNormal = 0, + kAnti, + kNAEnd + }; + enum binType : unsigned int { + kK1P = 0, + kK1N, + kK1P_Mix, + kK1N_Mix, + kK1P_GenINEL10, + kK1N_GenINEL10, + kK1P_GenINELgt10, + kK1N_GenINELgt10, + kK1P_GenTrig10, + kK1N_GenTrig10, + kK1P_GenEvtSel, + kK1N_GenEvtSel, + kK1P_Rec, + kK1N_Rec, + kTYEnd + }; SliceCache cache; Preslice perRCol = aod::resodaughter::resoCollisionId; Preslice perCollision = aod::track::collisionId; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + using ResoMCCols = soa::Join; ///// Configurables + Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; /// 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"}; ConfigurableAxis CfgMultBins{"CfgMultBins", {VARIABLE_WIDTH, 0.0f, 20.0f, 40.0f, 60.0f, 80.0f, 100.0f, 200.0f, 99999.f}, "Mixing bins - multiplicity"}; /// Pre-selection cuts Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; + /// DCA Selections // DCAr to PV Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.1, "Track DCAr cut to PV Maximum"}; // DCAz to PV Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 0.1, "Track DCAz cut to PV Maximum"}; Configurable cMinDCAzToPVcut{"cMinDCAzToPVcut", 0.0, "Track DCAz cut to PV Minimum"}; + /// PID Selections 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 Configurable cUseOnlyTOFTrackPi{"cUseOnlyTOFTrackPi", false, "Use only TOF track for PID selection"}; // Use only TOF track for Pion PID selection - Configurable cUseOnlyTOFTrackKa{"cUseOnlyTOFTrackKa", false, "Use only TOF track for PID selection"}; // Use only TOF track for Kaon PID selection // Kaon - Configurable cMaxTPCnSigmaKaon{"cMaxTPCnSigmaKaon", 3.0, "TPC nSigma cut for Kaon"}; // TPC - Configurable cMaxTOFnSigmaKaon{"cMaxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; // TOF - Configurable nsigmaCutCombinedKaon{"nsigmaCutCombinedKaon", -999, "Combined nSigma cut for Kaon"}; // Combined + Configurable cMaxTPCnSigmaKaon{"cMaxTPCnSigmaKaon", 3.0, "TPC nSigma cut for Kaon"}; // TPC + Configurable cMaxTOFnSigmaKaon{"cMaxTOFnSigmaKaon", 3.0, "TOF nSigma cut for Kaon"}; // TOF + Configurable nsigmaCutCombinedKaon{"nsigmaCutCombinedKaon", -999, "Combined nSigma cut for Kaon"}; // Combined + Configurable cUseOnlyTOFTrackKa{"cUseOnlyTOFTrackKa", false, "Use only TOF track for PID selection"}; // Use only TOF track for Kaon PID selection // 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 cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; // PV Contriuibutor - - // bachelor pion TOF PID? - Configurable cDoTOFPID{"cDoTOFPID", 1, "Do TOF PID"}; - - // K(892)0 selection - Configurable cK892masswindow{"cK892masswindow", 0.1, "K(892)0 inv mass selection window"}; - Configurable cPiPiMin{"cPiPiMin", 0, "Pion pair inv mass selection minimum"}; - Configurable cPiPiMax{"cPiPiMax", 999, "Pion pair inv mass selection maximum"}; - Configurable cPiKaMin{"cPiKaMin", 0, "bPion-Kaon pair inv mass selection minimum"}; - Configurable cPiKaMax{"cPiKaMax", 999, "bPion-Kaon pair inv mass selection maximum"}; + Configurable cfgGlobalTrack{"cfgGlobalTrack", false, "Global track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfgPVContributor{"cfgPVContributor", false, "PV contributor track selection"}; // PV Contriuibutor + Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; + Configurable tof_at_high_pt{"tof_at_high_pt", false, "Use TOF at high pT"}; + Configurable additionalEvsel{"additionalEvsel", true, "Additional event selcection"}; + 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 cfgModeK892orRho{"cfgModeK892orRho", true, "Secondary scenario for K892 (true) or Rho (false)"}; + Configurable cSecondaryMasswindow{"cSecondaryMasswindow", 0.1, "Secondary inv mass selection window"}; + Configurable cMinAnotherSecondaryMassCut{"cMinAnotherSecondaryMassCut", 0, "Min inv. mass selection of another secondary scenario"}; + Configurable cMaxAnotherSecondaryMassCut{"cMaxAnotherSecondaryMassCut", 999, "MAx inv. mass selection of another secondary scenario"}; + Configurable cMinPiKaMassCut{"cMinPiKaMassCut", 0, "bPion-Kaon pair inv mass selection minimum"}; + Configurable cMaxPiKaMassCut{"cMaxPiKaMassCut", 999, "bPion-Kaon pair inv mass selection maximum"}; Configurable cMinAngle{"cMinAngle", 0, "Minimum angle between K(892)0 and bachelor pion"}; Configurable cMaxAngle{"cMaxAngle", 4, "Maximum angle between K(892)0 and bachelor pion"}; Configurable cMinPairAsym{"cMinPairAsym", -1, "Minimum pair asymmetry"}; @@ -92,108 +133,174 @@ struct k1analysis { AxisSpec ptAxis = {150, 0, 15, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec dcaxyAxis = {300, 0, 3, "DCA_{#it{xy}} (cm)"}; AxisSpec dcazAxis = {500, 0, 5, "DCA_{#it{xy}} (cm)"}; - AxisSpec invMassAxis = {900, 0.6, 1.5, "Invariant Mass (GeV/#it{c}^2)"}; // K(892)0 - AxisSpec invMassAxisReso = {1600, 0.9f, 2.5f, "Invariant Mass (GeV/#it{c}^2)"}; // K1 - AxisSpec invMassAxisScan = {250, 0, 2.5, "Invariant Mass (GeV/#it{c}^2)"}; // For selection + AxisSpec invMassAxisK892 = {1400 / cNbinsDiv, 0.6, 2.0, "Invariant Mass (GeV/#it{c}^2)"}; // K(892)0 + AxisSpec invMassAxisRho = {2000 / cNbinsDiv, 0.0, 2.0, "Invariant Mass (GeV/#it{c}^2)"}; // rho + AxisSpec invMassAxisReso = {1600 / cNbinsDiv, 0.9f, 2.5f, "Invariant Mass (GeV/#it{c}^2)"}; // K1 + AxisSpec invMassAxisScan = {250, 0, 2.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"}; - // Mass QA (quick check) - histos.add("k892invmass", "Invariant mass of K(892)0", HistType::kTH1F, {invMassAxis}); - histos.add("k1invmass", "Invariant mass of K1(1270)pm", HistType::kTH1F, {invMassAxisReso}); - histos.add("k1invmass_LS", "Invariant mass of K1(1270)pm", HistType::kTH1F, {invMassAxisReso}); - histos.add("k1invmass_Mix", "Invariant mass of K1(1270)pm", HistType::kTH1F, {invMassAxisReso}); - if (doprocessMC) { - histos.add("k1invmass_MC", "Invariant mass of K1(1270)pm", HistType::kTH1F, {invMassAxisReso}); - } + // THnSparse + AxisSpec axisAnti = {binAnti::kNAEnd, 0, binAnti::kNAEnd, "Type of bin: Normal or Anti"}; + AxisSpec axisType = {binType::kTYEnd, 0, binType::kTYEnd, "Type of bin with charge and mix"}; + AxisSpec mcLabelAxis = {5, -0.5, 4.5, "MC Label"}; + // 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/trkDCAxy_pi_bach", "DCAxy distribution of bachelor pion 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}); - histos.add("QA/trkDCAz_pi_bach", "DCAz distribution of bachelor pion track candidates", HistType::kTH1F, {dcazAxis}); - - // pT QA - histos.add("QA/trkpT_pi", "pT distribution of pion track candidates", HistType::kTH1F, {ptAxis}); - histos.add("QA/trkpT_ka", "pT distribution of kaon track candidates", HistType::kTH1F, {ptAxis}); - histos.add("QA/trkpT_pi_bach", "pT distribution of bachelor pion track candidates", HistType::kTH1F, {ptAxis}); - // PID QA after cuts - histos.add("QA/TOF_TPC_Map_pi", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); - histos.add("QA/TOF_Nsigma_pi", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH2F, {ptAxis, pidQAAxis}}); - histos.add("QA/TPC_Nsigma_pi", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH2F, {ptAxis, pidQAAxis}}); - histos.add("QA/TOF_TPC_Map_ka", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); - histos.add("QA/TOF_Nsigma_ka", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2F, {ptAxis, pidQAAxis}}); - histos.add("QA/TPC_Nsigmaka", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2F, {ptAxis, pidQAAxis}}); - histos.add("QA/TOF_TPC_Map_pi_bach", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{Pion};#sigma_{TPC}^{Pion}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); - histos.add("QA/TOF_Nsigma_pi_bach", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Pion};", {HistType::kTH2F, {ptAxis, pidQAAxis}}); - histos.add("QA/TPC_Nsigma_pi_bach", "TPC NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Pion};", {HistType::kTH2F, {ptAxis, pidQAAxis}}); - histos.add("QA/InvMass_piK_pipi", "Invariant mass of pion + kaon and pion+pion;Invariant Mass (GeV/#it{c}^{2});Invariant Mass (GeV/#it{c}^{2});", {HistType::kTH2F, {invMassAxisScan, invMassAxisScan}}); - histos.add("QA/InvMass_piK_pika", "Invariant mass of pion + kaon and pion+kaon;Invariant Mass (GeV/#it{c}^{2});Invariant Mass (GeV/#it{c}^{2});", {HistType::kTH2F, {invMassAxisScan, invMassAxisScan}}); - histos.add("QA/K1OA", "Opening angle of K1(1270)pm", HistType::kTH1F, {AxisSpec{100, 0, 3.14, "Opening angle of K1(1270)pm"}}); - histos.add("QA/K1PairAsymm", "Pair asymmetry of K1(1270)pm", HistType::kTH1F, {AxisSpec{100, -1, 1, "Pair asymmetry of K1(1270)pm"}}); - - // Invariant mass histograms - histos.add("hK892invmass_PP", "Invariant mass of K(892)0 (Matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("hK892invmass_NP", "Invariant mass of K(892)0 (Matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("hK892invmass_PN", "Invariant mass of K(892)0 (Anti-matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("hK892invmass_NN", "Invariant mass of K(892)0 (Anti-matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxis}); - histos.add("hK1invmass_NPP", "Invariant mass of K(892)0 + pion (Matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_NPN", "Invariant mass of K(892)0 + pion (Matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_PNP", "Invariant mass of K(892)0 + pion (Anti-matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_PNN", "Invariant mass of K(892)0 + pion (Anti-matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - // K892-LS bkg - histos.add("hK1invmass_PPP", "Invariant mass of K(892)0 + pion (Matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_PPN", "Invariant mass of K(892)0 + pion (Anti-matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_NNP", "Invariant mass of K(892)0 + pion (Anti-matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_NNN", "Invariant mass of K(892)0 + pion (Anti-matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - // Mixed event - histos.add("hK1invmass_NPP_Mix", "Invariant mass of K(892)0 + pion (Matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_NPN_Mix", "Invariant mass of K(892)0 + pion (Matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_PNP_Mix", "Invariant mass of K(892)0 + pion (Anti-matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_PNN_Mix", "Invariant mass of K(892)0 + pion (Anti-matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); + // Primary pion + histos.add("QA/trkppionDCAxy", "DCAxy distribution of primary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkppionDCAz", "DCAz distribution of primary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkppionpT", "pT distribution of primary pion candidates", HistType::kTH1F, {ptAxis}); + histos.add("QA/trkppionTPCPID", "TPC PID of primary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QA/trkppionTOFPID", "TOF PID of primary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QA/trkppionTPCTOFPID", "TPC-TOF PID map of primary pion candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + histos.add("QAcut/trkppionDCAxy", "DCAxy distribution of primary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAcut/trkppionDCAz", "DCAz distribution of primary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAcut/trkppionpT", "pT distribution of primary pion candidates", HistType::kTH1F, {ptAxis}); + histos.add("QAcut/trkppionTPCPID", "TPC PID of primary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAcut/trkppionTOFPID", "TOF PID of primary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAcut/trkppionTPCTOFPID", "TPC-TOF PID map of primary pion candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + // Secondary pion + histos.add("QA/trkspionDCAxy", "DCAxy distribution of secondary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkspionDCAz", "DCAz distribution of secondary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkspionpT", "pT distribution of secondary pion candidates", HistType::kTH1F, {ptAxis}); + histos.add("QA/trkspionTPCPID", "TPC PID of secondary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QA/trkspionTOFPID", "TOF PID of secondary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QA/trkspionTPCTOFPID", "TPC-TOF PID map of secondary pion candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + histos.add("QAcut/trkspionDCAxy", "DCAxy distribution of secondary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAcut/trkspionDCAz", "DCAz distribution of secondary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAcut/trkspionpT", "pT distribution of secondary pion candidates", HistType::kTH1F, {ptAxis}); + histos.add("QAcut/trkspionTPCPID", "TPC PID of secondary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAcut/trkspionTOFPID", "TOF PID of secondary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAcut/trkspionTPCTOFPID", "TPC-TOF PID map of secondary pion candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + // Kaon + histos.add("QA/trkkaonDCAxy", "DCAxy distribution of kaon candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkkaonDCAz", "DCAz distribution of kaon candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QA/trkkaonpT", "pT distribution of kaon candidates", HistType::kTH1F, {ptAxis}); + histos.add("QA/trkkaonTPCPID", "TPC PID of kaon candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QA/trkkaonTOFPID", "TOF PID of kaon candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QA/trkkaonTPCTOFPID", "TPC-TOF PID map of kaon candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + histos.add("QAcut/trkkaonDCAxy", "DCAxy distribution of kaon candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAcut/trkkaonDCAz", "DCAz distribution of kaon candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAcut/trkkaonpT", "pT distribution of kaon candidates", HistType::kTH1F, {ptAxis}); + histos.add("QAcut/trkkaonTPCPID", "TPC PID of kaon candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAcut/trkkaonTOFPID", "TOF PID of kaon candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAcut/trkkaonTPCTOFPID", "TPC-TOF PID map of kaon candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + // K1 + histos.add("QA/K1OA", "Opening angle of K1(1270)", HistType::kTH1F, {AxisSpec{100, 0, 3.14, "Opening angle"}}); + histos.add("QA/K1PairAssym", "Pair asymmetry of K1(1270)", HistType::kTH1F, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QA/hInvmassK892_Rho", "Invariant mass of K(892)0 vs Rho(770)", HistType::kTH2F, {invMassAxisK892, invMassAxisRho}); + histos.add("QA/hInvmassSecon_PiKa", "Invariant mass of secondary resonance vs pion-kaon", HistType::kTH2F, {invMassAxisK892, invMassAxisK892}); + histos.add("QA/hInvmassSecon", "Invariant mass of secondary resonance", HistType::kTH1F, {invMassAxisRho}); + histos.add("QA/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1F, {ptAxis}); + + histos.add("QAcut/K1OA", "Opening angle of K1(1270)", HistType::kTH1F, {AxisSpec{100, 0, 3.14, "Opening angle"}}); + histos.add("QAcut/K1PairAssym", "Pair asymmetry of K1(1270)", HistType::kTH1F, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QAcut/hInvmassK892_Rho", "Invariant mass of K(892)0 vs Rho(770)", HistType::kTH2F, {invMassAxisK892, invMassAxisRho}); + histos.add("QAcut/hInvmassSecon_PiKa", "Invariant mass of secondary resonance vs pion-kaon", HistType::kTH2F, {invMassAxisK892, invMassAxisK892}); + histos.add("QAcut/hInvmassSecon", "Invariant mass of secondary resonance", HistType::kTH1F, {invMassAxisRho}); + histos.add("QAcut/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1F, {ptAxis}); + + // Invariant mass + histos.add("hInvmass_K1", "Invariant mass of K1(1270)", HistType::kTHnSparseD, {axisAnti, axisType, centAxis, ptAxis, invMassAxisReso}); + // Mass QA (quick check) + histos.add("k1invmass", "Invariant mass of K1(1270)", HistType::kTH1F, {invMassAxisReso}); + histos.add("k1invmass_Mix", "Invariant mass of K1(1270)", HistType::kTH1F, {invMassAxisReso}); + // MC if (doprocessMC) { - histos.add("QAMC/InvMass_piK_pipi", "Invariant mass of pion + kaon and pion+pion;Invariant Mass (GeV/#it{c}^{2});Invariant Mass (GeV/#it{c}^{2});", {HistType::kTH2F, {invMassAxisScan, invMassAxisScan}}); - histos.add("QAMC/InvMass_piK_pika", "Invariant mass of pion + kaon and pion+kaon;Invariant Mass (GeV/#it{c}^{2});Invariant Mass (GeV/#it{c}^{2});", {HistType::kTH2F, {invMassAxisScan, invMassAxisScan}}); - histos.add("QAMC/K1OA", "Opening angle of K1(1270)pm", HistType::kTH1F, {AxisSpec{100, 0, 3.14, "Opening angle of K1(1270)pm"}}); - histos.add("QAMC/K1PairAsymm", "Pair asymmetry of K1(1270)pm", HistType::kTH1F, {AxisSpec{100, 0, 1, "Pair asymmetry of K1(1270)pm"}}); - - histos.add("hK1invmass_NPP_MC", "Invariant mass of K(892)0 + pion (Matter + Matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - histos.add("hK1invmass_PNN_MC", "Invariant mass of K(892)0 + pion (Anti-matter + Anti-matter)", HistType::kTH3F, {centAxis, ptAxis, invMassAxisReso}); - - histos.add("hReconK892pt", "pT distribution of Reconstructed MC K(892)0", HistType::kTH1F, {ptAxis}); - histos.add("hTrueK1pt", "pT distribution of True MC K1", HistType::kTH1F, {ptAxis}); - histos.add("hReconK1pt", "pT distribution of Reconstructed MC K1", HistType::kTH1F, {ptAxis}); - - histos.add("k1invmass_noK1", "Invariant mass of K1(1270)pm", HistType::kTH1F, {invMassAxisReso}); + histos.add("k1invmass_MC", "Invariant mass of K1(1270)", HistType::kTH1F, {invMassAxisReso}); + histos.add("k1invmass_MC_noK1", "Invariant mass of K1(1270)", HistType::kTH1F, {invMassAxisReso}); + + histos.add("QAMC/trkppionDCAxy", "DCAxy distribution of primary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAMC/trkppionDCAz", "DCAz distribution of primary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAMC/trkppionpT", "pT distribution of primary pion candidates", HistType::kTH1F, {ptAxis}); + histos.add("QAMC/trkppionTPCPID", "TPC PID of primary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkppionTOFPID", "TOF PID of primary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkppionTPCTOFPID", "TPC-TOF PID map of primary pion candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + histos.add("QAMC/trkspionDCAxy", "DCAxy distribution of secondary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAMC/trkspionDCAz", "DCAz distribution of secondary pion candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAMC/trkspionpT", "pT distribution of secondary pion candidates", HistType::kTH1F, {ptAxis}); + histos.add("QAMC/trkspionTPCPID", "TPC PID of secondary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkspionTOFPID", "TOF PID of secondary pion candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkspionTPCTOFPID", "TPC-TOF PID map of secondary pion candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + histos.add("QAMC/trkkaonDCAxy", "DCAxy distribution of kaon candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAMC/trkkaonDCAz", "DCAz distribution of kaon candidates", HistType::kTH1F, {dcaxyAxis}); + histos.add("QAMC/trkkaonpT", "pT distribution of kaon candidates", HistType::kTH1F, {ptAxis}); + histos.add("QAMC/trkkaonTPCPID", "TPC PID of kaon candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkkaonTOFPID", "TOF PID of kaon candidates", HistType::kTH2F, {ptAxis, pidQAAxis}); + histos.add("QAMC/trkkaonTPCTOFPID", "TPC-TOF PID map of kaon candidates", HistType::kTH2F, {pidQAAxis, pidQAAxis}); + + histos.add("QAMC/K1OA", "Opening angle of K1(1270)", HistType::kTH1F, {AxisSpec{100, 0, 3.14, "Opening angle"}}); + histos.add("QAMC/K1PairAssym", "Pair asymmetry of K1(1270)", HistType::kTH1F, {AxisSpec{100, -1, 1, "Pair asymmetry"}}); + histos.add("QAMC/hInvmassK892_Rho", "Invariant mass of K(892)0 vs Rho(770)", HistType::kTH2F, {invMassAxisK892, invMassAxisRho}); + histos.add("QAMC/hInvmassSecon_PiKa", "Invariant mass of secondary resonance vs pion-kaon", HistType::kTH2F, {invMassAxisK892, invMassAxisK892}); + histos.add("QAMC/hInvmassSecon", "Invariant mass of secondary resonance", HistType::kTH1F, {invMassAxisRho}); + histos.add("QAMC/hpT_Secondary", "pT distribution of secondary resonance", HistType::kTH1F, {ptAxis}); } // Print output histograms statistics - LOG(info) << "Size of the histograms in spectraTOF"; + LOG(info) << "Size of the histograms in K1 Analysis Task"; histos.print(); } - double massKa = TDatabasePDG::Instance()->GetParticle(kKPlus)->Mass(); // FIXME: Get from the common header - double massPi = TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass(); // FIXME: Get from the common header - double massK892 = TDatabasePDG::Instance()->GetParticle(313)->Mass(); // FIXME: Get from the common header + double massKa = MassKaonCharged; + double massPi = MassPionCharged; + // double massRho770 = MassRho770; + // double massK892 = MassKStar892; + double massRho770 = 0.77526; + double massK892 = 0.892; + + // PDG code + int kPDGRho770 = 113; + int kK1Plus = 10323; template bool trackCut(const TrackType track) { // basic track cuts - if (track.pt() < cMinPtcut) + 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.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) + return false; + if (track.itsChi2NCl() >= cfgITSChi2NCl) return false; - if (track.dcaXY() > cMaxDCArToPVcut) + if (track.tpcChi2NCl() >= cfgTPCChi2NCl) return false; - if (track.dcaZ() < cMinDCAzToPVcut || track.dcaZ() > cMaxDCAzToPVcut) + 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 (cfgPVContributor && !track.isPVContributor()) + if (cfgGlobalTrack && !track.isGlobalTrack()) return false; + return true; } @@ -204,6 +311,8 @@ struct k1analysis { 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) { @@ -213,6 +322,9 @@ struct k1analysis { tofPIDPassed = true; } } else { + if (!cTOFVeto) { + return false; + } tofPIDPassed = true; } if (tpcPIDPassed && tofPIDPassed) { @@ -226,6 +338,8 @@ struct k1analysis { bool tpcPIDPassed{false}, tofPIDPassed{false}; if (std::abs(candidate.tpcNSigmaKa()) < cMaxTPCnSigmaKaon) { tpcPIDPassed = true; + } else { + return false; } if (candidate.hasTOF()) { if (std::abs(candidate.tofNSigmaKa()) < cMaxTOFnSigmaKaon) { @@ -235,6 +349,9 @@ struct k1analysis { tofPIDPassed = true; } } else { + if (!cTOFVeto) { + return false; + } tofPIDPassed = true; } if (tpcPIDPassed && tofPIDPassed) { @@ -245,6 +362,42 @@ struct k1analysis { template bool isTrueK1(const T& trk1, const T& trk2, const T2& bTrack) + { + if (abs(trk1.pdgCode()) != kPiPlus || abs(trk2.pdgCode()) != kKPlus) + return false; + if (abs(bTrack.pdgCode()) != kPiPlus) + return false; + if (cfgModeK892orRho) { // K892 mode + auto mother1 = trk1.motherId(); + auto mother2 = trk2.motherId(); + if (mother1 != mother2) + return false; + if (abs(trk1.motherPDG()) != kK0Star892) + return false; + if (abs(bTrack.motherPDG()) != kK1Plus) + return false; + auto siblings = bTrack.siblingIds(); + if (siblings[0] != mother1 && siblings[1] != mother1) + return false; + return true; + } else { // Rho mode + auto mother1 = trk1.motherId(); + auto motherb = bTrack.motherId(); + if (mother1 != motherb) + return false; + if (abs(trk1.motherPDG()) != kPDGRho770) + return false; + if (abs(trk2.motherPDG()) != kK1Plus) + return false; + auto siblings = trk2.siblingIds(); + if (siblings[0] != mother1 && siblings[1] != mother1) + return false; + return true; + } + } + + template + bool isTrueK892(const T& trk1, const T& trk2) { if (abs(trk1.pdgCode()) != kPiPlus || abs(trk2.pdgCode()) != kKPlus) return false; @@ -252,29 +405,21 @@ struct k1analysis { auto mother2 = trk2.motherId(); if (mother1 != mother2) return false; - if (abs(trk1.motherPDG()) != 313) - return false; - if (abs(bTrack.pdgCode()) != kPiPlus) - return false; - if (abs(bTrack.motherPDG()) != 10323) + if (abs(trk1.motherPDG()) != kK0Star892) return false; - auto siblings = bTrack.siblingIds(); - if (siblings[0] != mother1 && siblings[1] != mother1) - return false; - return true; } template - bool isTrueK892(const T& trk1, const T& trk2) + bool isTrueRho(const T& trk1, const T& trk2) { - if (abs(trk1.pdgCode()) != kPiPlus || abs(trk2.pdgCode()) != kKPlus) + if (abs(trk1.pdgCode()) != kPiPlus || abs(trk2.pdgCode()) != kPiPlus) return false; auto mother1 = trk1.motherId(); auto mother2 = trk2.motherId(); if (mother1 != mother2) return false; - if (abs(trk1.motherPDG()) != 313) + if (abs(trk1.motherPDG()) != kPDGRho770) return false; return true; } @@ -283,7 +428,7 @@ struct k1analysis { void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2) { auto multiplicity = collision.cent(); - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonanceK892, lDecayDaughter_bach, lResonanceK1; + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonanceSecondary, lDecayDaughter_bach, lResonanceK1; for (auto& [trk1, trk2] : combinations(CombinationsFullIndexPolicy(dTracks2, dTracks2))) { // Full index policy is needed to consider all possible combinations if (trk1.index() == trk2.index()) @@ -295,211 +440,217 @@ struct k1analysis { auto isTrk1hasTOF = trk1.hasTOF(); auto isTrk2hasTOF = trk2.hasTOF(); - auto trk1ptPi = trk1.pt(); + auto trk1pt = trk1.pt(); auto trk1NSigmaPiTPC = trk1.tpcNSigmaPi(); auto trk1NSigmaPiTOF = (isTrk1hasTOF) ? trk1.tofNSigmaPi() : -999.; - auto trk2ptKa = trk2.pt(); + auto trk2pt = trk2.pt(); auto trk2NSigmaKaTPC = trk2.tpcNSigmaKa(); auto trk2NSigmaKaTOF = (isTrk2hasTOF) ? trk2.tofNSigmaKa() : -999.; + // for rho mode + auto trk2NSigmaPiTPC = trk2.tpcNSigmaPi(); + auto trk2NSigmaPiTOF = (isTrk2hasTOF) ? trk2.tofNSigmaPi() : -999.; //// PID selections if (cUseOnlyTOFTrackPi && !isTrk1hasTOF) continue; if (cUseOnlyTOFTrackKa && !isTrk2hasTOF) continue; - if (!selectionPIDPion(trk1) || !selectionPIDKaon(trk2)) - continue; + + if (cfgModeK892orRho) { // K892 mode + if (!selectionPIDPion(trk1) || !selectionPIDKaon(trk2)) + continue; + } else { // Rho mode + if (!selectionPIDPion(trk1) || !selectionPIDPion(trk2)) + continue; + } //// QA plots after the selection - // --- PID QA Pion if constexpr (!IsMix) { - histos.fill(HIST("QA/TPC_Nsigma_pi"), trk1ptPi, trk1NSigmaPiTPC); + // --- PID QA Pion + histos.fill(HIST("QA/trkspionTPCPID"), trk1pt, trk1NSigmaPiTPC); if (isTrk1hasTOF) { - histos.fill(HIST("QA/TOF_Nsigma_pi"), trk1ptPi, trk1NSigmaPiTOF); - histos.fill(HIST("QA/TOF_TPC_Map_pi"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + histos.fill(HIST("QA/trkspionTOFPID"), trk1pt, trk1NSigmaPiTOF); + histos.fill(HIST("QA/trkspionTPCTOFPID"), trk1NSigmaPiTPC, trk1NSigmaPiTOF); } - // --- PID QA Kaon - histos.fill(HIST("QA/TPC_Nsigmaka"), trk2ptKa, trk2NSigmaKaTPC); - if (isTrk1hasTOF) { - histos.fill(HIST("QA/TOF_Nsigma_ka"), trk2ptKa, trk2NSigmaKaTOF); - histos.fill(HIST("QA/TOF_TPC_Map_ka"), trk2NSigmaKaTOF, trk2NSigmaKaTPC); + histos.fill(HIST("QA/trkspionpT"), trk1pt); + histos.fill(HIST("QA/trkspionDCAxy"), trk1.dcaXY()); + histos.fill(HIST("QA/trkspionDCAz"), trk1.dcaZ()); + + if (cfgModeK892orRho) { // K892 mode + // --- PID QA Kaon + histos.fill(HIST("QA/trkkaonTPCPID"), trk2pt, trk2NSigmaKaTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QA/trkkaonTOFPID"), trk2pt, trk2NSigmaKaTOF); + histos.fill(HIST("QA/trkkaonTPCTOFPID"), trk2NSigmaKaTPC, trk2NSigmaKaTOF); + } + histos.fill(HIST("QA/trkkaonpT"), trk2pt); + histos.fill(HIST("QA/trkkaonDCAxy"), trk2.dcaXY()); + histos.fill(HIST("QA/trkkaonDCAz"), trk2.dcaZ()); + } else { // Rho mode + // --- PID QA Pion + histos.fill(HIST("QA/trkppionTPCPID"), trk2pt, trk2NSigmaPiTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QA/trkppionTOFPID"), trk2pt, trk2NSigmaPiTOF); + histos.fill(HIST("QA/trkppionTPCTOFPID"), trk2NSigmaPiTPC, trk2NSigmaPiTOF); + } + histos.fill(HIST("QA/trkppionpT"), trk2pt); + histos.fill(HIST("QA/trkppionDCAxy"), trk2.dcaXY()); + histos.fill(HIST("QA/trkppionDCAz"), trk2.dcaZ()); } - 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()); } //// Resonance reconstruction lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi); - lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); - lResonanceK892 = lDecayDaughter1 + lDecayDaughter2; + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), (cfgModeK892orRho) ? massKa : massPi); + lResonanceSecondary = lDecayDaughter1 + lDecayDaughter2; if constexpr (!IsMix) { - histos.fill(HIST("k892invmass"), lResonanceK892.M()); // quick check - if (trk1.sign() > 0) { // Positive pion - if (trk2.sign() > 0) // Positive kaon - histos.fill(HIST("hK892invmass_PP"), multiplicity, lResonanceK892.Pt(), lResonanceK892.M()); - else // Negative kaon - histos.fill(HIST("hK892invmass_PN"), multiplicity, lResonanceK892.Pt(), lResonanceK892.M()); // Anti-K(892)0 - } else { // Negative pion - if (trk2.sign() > 0) // Positive kaon - histos.fill(HIST("hK892invmass_NP"), multiplicity, lResonanceK892.Pt(), lResonanceK892.M()); // K(892)0 - else // Negative kaon - histos.fill(HIST("hK892invmass_NN"), multiplicity, lResonanceK892.Pt(), lResonanceK892.M()); - } + histos.fill(HIST("QA/hInvmassSecon"), lResonanceSecondary.M()); } - // Like-sign rejection for K(892)0 - disabled for further LS bkg study - // if (trk1.sign() * trk2.sign() > 0) - // continue; - if constexpr (IsMC) { // MC Check of K(892)0 - if (isTrueK892(trk1, trk2)) - histos.fill(HIST("hReconK892pt"), lResonanceK892.Pt()); + if constexpr (IsMC) { // MC Check + if (cfgModeK892orRho) { + if (isTrueK892(trk1, trk2)) + histos.fill(HIST("QAMC/hpT_Secondary"), lResonanceSecondary.Pt()); + } else { + if (isTrueRho(trk1, trk2)) + histos.fill(HIST("QAMC/hpT_Secondary"), lResonanceSecondary.Pt()); + } } // Mass window cut - if (std::abs(lResonanceK892.M() - massK892) > cK892masswindow) + double massCut = cfgModeK892orRho ? massK892 : massRho770; + if (std::abs(lResonanceSecondary.M() - massCut) > cSecondaryMasswindow) continue; - // Add one more track loop for K1 reconstruction + + // bTrack loop for K1 reconstruction for (auto bTrack : dTracks1) { - // ID cut if (bTrack.index() == trk1.index() || bTrack.index() == trk2.index()) continue; - // Track cut if (!trackCut(bTrack)) continue; - auto bTrkPt = bTrack.pt(); - auto bTrkTPCnSigmaPi = bTrack.tpcNSigmaPi(); - auto isbTrkhasTOF = bTrack.hasTOF(); - auto bTrack_TOFnSigma = (isbTrkhasTOF) ? bTrack.tofNSigmaPi() : -999.; - - // PID selection - if (!selectionPIDPion(bTrack)) + // Kaon or Pion + if (cfgModeK892orRho && !selectionPIDPion(bTrack)) + continue; + if (!cfgModeK892orRho && !selectionPIDKaon(bTrack)) continue; - - if constexpr (!IsMix) { - histos.fill(HIST("QA/trkpT_pi_bach"), bTrkPt); - // --- PID QA Pion - histos.fill(HIST("QA/TPC_Nsigma_pi_bach"), bTrkPt, bTrkTPCnSigmaPi); - if (isbTrkhasTOF) { - histos.fill(HIST("QA/TOF_Nsigma_pi_bach"), bTrkPt, bTrack_TOFnSigma); - histos.fill(HIST("QA/TOF_TPC_Map_pi_bach"), bTrack_TOFnSigma, bTrkTPCnSigmaPi); - } - histos.fill(HIST("QA/trkDCAxy_pi_bach"), bTrack.dcaXY()); - histos.fill(HIST("QA/trkDCAz_pi_bach"), bTrack.dcaZ()); - } // K1 reconstruction - lDecayDaughter_bach.SetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), massPi); - lResonanceK1 = lResonanceK892 + lDecayDaughter_bach; + lDecayDaughter_bach.SetXYZM(bTrack.px(), bTrack.py(), bTrack.pz(), cfgModeK892orRho ? massPi : massKa); + lResonanceK1 = lResonanceSecondary + lDecayDaughter_bach; - // Rapidity cut + // Cuts if (lResonanceK1.Rapidity() > cK1MaxRap || lResonanceK1.Rapidity() < cK1MinRap) continue; - // Opening angle cut - auto lK1Angle = lResonanceK892.Angle(lDecayDaughter_bach.Vect()); - // Pair asymmetry cut - auto lPairAsym = (lResonanceK892.E() - lDecayDaughter_bach.E()) / (lResonanceK892.E() + lDecayDaughter_bach.E()); - // PiPi, PiKa mass range cut - TLorentzVector tempPiPi = lDecayDaughter1 + lDecayDaughter_bach; - TLorentzVector tempPiKa = lDecayDaughter2 + lDecayDaughter_bach; + + auto lK1Angle = lResonanceSecondary.Angle(lDecayDaughter_bach.Vect()); + auto lPairAsym = (lResonanceSecondary.E() - lDecayDaughter_bach.E()) / (lResonanceSecondary.E() + lDecayDaughter_bach.E()); + + TLorentzVector temp13 = lDecayDaughter1 + lDecayDaughter_bach; + TLorentzVector temp23 = lDecayDaughter2 + lDecayDaughter_bach; + + // QA histograms if constexpr (!IsMix) { - histos.fill(HIST("QA/InvMass_piK_pipi"), lResonanceK892.M(), tempPiPi.M()); - histos.fill(HIST("QA/InvMass_piK_pika"), lResonanceK892.M(), tempPiKa.M()); histos.fill(HIST("QA/K1OA"), lK1Angle); - histos.fill(HIST("QA/K1PairAsymm"), lPairAsym); + histos.fill(HIST("QA/K1PairAssym"), lPairAsym); + if (cfgModeK892orRho) { + histos.fill(HIST("QA/hInvmassK892_Rho"), lResonanceSecondary.M(), temp13.M()); + } else { + histos.fill(HIST("QA/hInvmassK892_Rho"), temp13.M(), lResonanceSecondary.M()); + } + histos.fill(HIST("QA/hInvmassSecon_PiKa"), lResonanceSecondary.M(), temp23.M()); + histos.fill(HIST("QA/hpT_Secondary"), lResonanceSecondary.Pt()); } - if (tempPiPi.M() < cPiPiMin || tempPiPi.M() > cPiPiMax) + + // Selection cuts + if (temp13.M() < cMinAnotherSecondaryMassCut || temp13.M() > cMaxAnotherSecondaryMassCut) continue; - if (tempPiKa.M() < cPiKaMin || tempPiKa.M() > cPiKaMax) + if (temp23.M() < cMinPiKaMassCut || temp23.M() > cMaxPiKaMassCut) continue; if (lK1Angle < cMinAngle || lK1Angle > cMaxAngle) continue; if (lPairAsym < cMinPairAsym || lPairAsym > cMaxPairAsym) continue; - if constexpr (!IsMix) { // Same event pair - if (trk1.sign() * trk2.sign() < 0) { // K892 - if (bTrack.sign() > 0) { // bachelor pi+ - if (trk2.sign() > 0) { // kaon + means K(892)0 is matter. - histos.fill(HIST("k1invmass"), lResonanceK1.M()); // quick check - histos.fill(HIST("hK1invmass_NPP"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } else { - histos.fill(HIST("k1invmass_LS"), lResonanceK1.M()); // quick check - histos.fill(HIST("hK1invmass_PNP"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } - } else { // bachelor pi- - if (trk2.sign() > 0) { // kaon + means K(892)0 is matter. - histos.fill(HIST("k1invmass_LS"), lResonanceK1.M()); // quick check - histos.fill(HIST("hK1invmass_NPN"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } else { - histos.fill(HIST("k1invmass"), lResonanceK1.M()); // quick check - histos.fill(HIST("hK1invmass_PNN"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } - } - } else { // K892-LS (false) - if (bTrack.sign() > 0) { // bachelor pi+ - if (trk2.sign() > 0) { // Kaon+ - histos.fill(HIST("hK1invmass_PPP"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } else { - histos.fill(HIST("hK1invmass_PPN"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } - } else { // bachelor pi- - if (trk2.sign() > 0) { // Kaon_ - histos.fill(HIST("hK1invmass_NNN"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } else { - histos.fill(HIST("hK1invmass_NNP"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } - } + // QA histograms after the cuts + if constexpr (!IsMix) { + histos.fill(HIST("QAcut/K1OA"), lK1Angle); + histos.fill(HIST("QAcut/K1PairAssym"), lPairAsym); + if (cfgModeK892orRho) { + histos.fill(HIST("QAcut/hInvmassK892_Rho"), lResonanceSecondary.M(), temp13.M()); + } else { + histos.fill(HIST("QAcut/hInvmassK892_Rho"), temp13.M(), lResonanceSecondary.M()); } + histos.fill(HIST("QAcut/hInvmassSecon_PiKa"), lResonanceSecondary.M(), temp23.M()); + histos.fill(HIST("QAcut/hInvmassSecon"), lResonanceSecondary.M()); + histos.fill(HIST("QAcut/hpT_Secondary"), lResonanceSecondary.Pt()); + } + + if constexpr (!IsMix) { + unsigned int typeK1 = bTrack.sign() > 0 ? binType::kK1P : binType::kK1N; + unsigned int typeNormal = cfgModeK892orRho ? (trk1.sign() < 0 ? binAnti::kNormal : binAnti::kAnti) : binAnti::kNormal; + histos.fill(HIST("k1invmass"), lResonanceK1.M()); + histos.fill(HIST("hInvmass_K1"), typeNormal, typeK1, multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); if constexpr (IsMC) { if (isTrueK1(trk1, trk2, bTrack)) { - histos.fill(HIST("hReconK1pt"), lResonanceK1.Pt()); - histos.fill(HIST("QAMC/InvMass_piK_pipi"), lResonanceK892.M(), tempPiPi.M()); - histos.fill(HIST("QAMC/InvMass_piK_pika"), lResonanceK892.M(), tempPiKa.M()); + typeK1 = bTrack.sign() > 0 ? binType::kK1P_Rec : binType::kK1N_Rec; + histos.fill(HIST("hInvmass_K1"), typeNormal, typeK1, multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); + histos.fill(HIST("k1invmass_MC"), lResonanceK1.M()); histos.fill(HIST("QAMC/K1OA"), lK1Angle); - histos.fill(HIST("QAMC/K1PairAsymm"), lPairAsym); - - if ((bTrack.sign() > 0) && (trk2.sign() > 0)) { // Matter - histos.fill(HIST("hK1invmass_NPP_MC"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - histos.fill(HIST("k1invmass_MC"), lResonanceK1.M()); // quick check - } - if ((bTrack.sign() < 0) && (trk2.sign() < 0)) { // Anti-matter - histos.fill(HIST("hK1invmass_PNN_MC"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - histos.fill(HIST("k1invmass_MC"), lResonanceK1.M()); // quick check - } - histos.fill(HIST("hTrueK1pt"), lResonanceK1.Pt()); - } else { - if (((bTrack.sign() > 0) && (trk2.sign() > 0)) || ((bTrack.sign() < 0) && (trk2.sign() < 0))) - histos.fill(HIST("k1invmass_noK1"), lResonanceK1.M()); // quick check - } - } - } else { // Mixed event pair - if (trk1.sign() * trk2.sign() < 0) { // K892 - if (bTrack.sign() > 0) { // bachelor pi+ - if (trk2.sign() > 0) { // kaon + means K(892)0 is matter. - histos.fill(HIST("k1invmass_Mix"), lResonanceK1.M()); // quick check - histos.fill(HIST("hK1invmass_NPP_Mix"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); + histos.fill(HIST("QAMC/K1PairAssym"), lPairAsym); + if (cfgModeK892orRho) { + histos.fill(HIST("QAMC/hInvmassK892_Rho"), lResonanceSecondary.M(), temp13.M()); } else { - histos.fill(HIST("hK1invmass_PNP_Mix"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); + histos.fill(HIST("QAMC/hInvmassK892_Rho"), temp13.M(), lResonanceSecondary.M()); } - } else { // bachelor pi- - if (trk2.sign() > 0) { // kaon + means K(892)0 is matter. - histos.fill(HIST("hK1invmass_NPN_Mix"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); - } else { - histos.fill(HIST("k1invmass_Mix"), lResonanceK1.M()); // quick check - histos.fill(HIST("hK1invmass_PNN_Mix"), multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); + histos.fill(HIST("QAMC/hInvmassSecon_PiKa"), lResonanceSecondary.M(), temp23.M()); + histos.fill(HIST("QAMC/hInvmassSecon"), lResonanceSecondary.M()); + histos.fill(HIST("QAMC/hpT_Secondary"), lResonanceSecondary.Pt()); + + // --- PID QA Pion + histos.fill(HIST("QAMC/trkspionTPCPID"), trk1pt, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAMC/trkspionTOFPID"), trk1pt, trk1NSigmaPiTOF); + histos.fill(HIST("QAMC/trkspionTPCTOFPID"), trk1NSigmaPiTPC, trk1NSigmaPiTOF); + } + histos.fill(HIST("QAMC/trkspionpT"), trk1pt); + histos.fill(HIST("QAMC/trkspionDCAxy"), trk1.dcaXY()); + histos.fill(HIST("QAMC/trkspionDCAz"), trk1.dcaZ()); + + if (cfgModeK892orRho) { // K892 mode + // --- PID QA Kaon + histos.fill(HIST("QAMC/trkkaonTPCPID"), trk2pt, trk2NSigmaKaTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAMC/trkkaonTOFPID"), trk2pt, trk2NSigmaKaTOF); + histos.fill(HIST("QAMC/trkkaonTPCTOFPID"), trk2NSigmaKaTPC, trk2NSigmaKaTOF); + } + histos.fill(HIST("QAMC/trkkaonpT"), trk2pt); + histos.fill(HIST("QAMC/trkkaonDCAxy"), trk2.dcaXY()); + histos.fill(HIST("QAMC/trkkaonDCAz"), trk2.dcaZ()); + } else { // Rho mode + // --- PID QA Pion + histos.fill(HIST("QAMC/trkppionTPCPID"), trk2pt, trk2NSigmaPiTPC); + if (isTrk2hasTOF) { + histos.fill(HIST("QAMC/trkppionTOFPID"), trk2pt, trk2NSigmaPiTOF); + histos.fill(HIST("QAMC/trkppionTPCTOFPID"), trk2NSigmaPiTPC, trk2NSigmaPiTOF); + } + histos.fill(HIST("QAMC/trkppionpT"), trk2pt); + histos.fill(HIST("QAMC/trkppionDCAxy"), trk2.dcaXY()); + histos.fill(HIST("QAMC/trkppionDCAz"), trk2.dcaZ()); } + } else { + histos.fill(HIST("k1invmass_MC_noK1"), lResonanceK1.M()); } - } + } // MC + } else { // Mixed event handling + unsigned int typeK1 = bTrack.sign() > 0 ? binType::kK1P_Mix : binType::kK1N_Mix; + unsigned int typeNormal = cfgModeK892orRho ? (trk1.sign() < 0 ? binAnti::kNormal : binAnti::kAnti) : binAnti::kNormal; + histos.fill(HIST("hInvmass_K1"), typeNormal, typeK1, multiplicity, lResonanceK1.Pt(), lResonanceK1.M()); + histos.fill(HIST("k1invmass_Mix"), lResonanceK1.M()); } - } + } // bTrack } } @@ -517,25 +668,57 @@ struct k1analysis { } PROCESS_SWITCH(k1analysis, processMC, "Process Event for MC", false); - void processMCTrue(aod::ResoMCParents& resoParents) + void processMCTrue(ResoMCCols::iterator const& collision, aod::ResoMCParents& resoParents) { - for (auto& part : resoParents) { // loop over all pre-filtered MC particles - if (abs(part.pdgCode()) != 10323) // K892(0) + auto multiplicity = collision.cent(); + for (auto& part : resoParents) { // loop over all pre-filtered MC particles + if (abs(part.pdgCode()) != kK1Plus) // K892(0) continue; if (abs(part.y()) > 0.5) { // rapidity cut continue; } bool pass1 = false; bool pass2 = false; - if (abs(part.daughterPDG1()) == 313 || abs(part.daughterPDG2()) == 313) { // At least one decay to Kaon - pass2 = true; + if (cfgModeK892orRho) { + if (abs(part.daughterPDG1()) == 313 || abs(part.daughterPDG2()) == 313) { // At least one decay to K892 + pass2 = true; + } + if (abs(part.daughterPDG1()) == kPiPlus || abs(part.daughterPDG2()) == kPiPlus) { // At least one decay to Pion + pass1 = true; + } + if (!pass1 || !pass2) // If we have both decay products + continue; + } else { + if (abs(part.daughterPDG1()) == kPDGRho770 || abs(part.daughterPDG2()) == kPDGRho770) { // At least one decay to Rho + pass2 = true; + } + if (abs(part.daughterPDG1()) == kKPlus || abs(part.daughterPDG2()) == kKPlus) { // At least one decay to Kaon + pass1 = true; + } + if (!pass1 || !pass2) // If we have both decay products + continue; } - if (abs(part.daughterPDG1()) == kPiPlus || abs(part.daughterPDG2()) == kPiPlus) { // At least one decay to Pion - pass1 = true; + auto typeNormal = part.pdgCode() > 0 ? binAnti::kNormal : binAnti::kAnti; + if (collision.isVtxIn10()) // INEL10 + { + auto typeK1 = part.pdgCode() > 0 ? binType::kK1P_GenINEL10 : binType::kK1N_GenINEL10; + histos.fill(HIST("hInvmass_K1"), typeNormal, typeK1, multiplicity, part.pt(), 1); + } + if (collision.isVtxIn10() && collision.isInSel8()) // INEL>10, vtx10 + { + auto typeK1 = part.pdgCode() > 0 ? binType::kK1P_GenINELgt10 : binType::kK1N_GenINELgt10; + histos.fill(HIST("hInvmass_K1"), typeNormal, typeK1, multiplicity, part.pt(), 1); + } + if (collision.isVtxIn10() && collision.isTriggerTVX()) // vtx10, TriggerTVX + { + auto typeK1 = part.pdgCode() > 0 ? binType::kK1P_GenTrig10 : binType::kK1N_GenTrig10; + histos.fill(HIST("hInvmass_K1"), typeNormal, typeK1, multiplicity, part.pt(), 1); + } + if (collision.isInAfterAllCuts()) // after all event selection + { + auto typeK1 = part.pdgCode() > 0 ? binType::kK1P_GenEvtSel : binType::kK1N_GenEvtSel; + histos.fill(HIST("hInvmass_K1"), typeNormal, typeK1, multiplicity, part.pt(), 1); } - if (!pass1 || !pass2) // If we have both decay products - continue; - histos.fill(HIST("hTrueK1pt"), part.pt()); } } PROCESS_SWITCH(k1analysis, processMCTrue, "Process Event for MC", false); diff --git a/PWGLF/Tasks/Resonances/k892analysis.cxx b/PWGLF/Tasks/Resonances/k892analysis.cxx index 7e02c354e89..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"}; @@ -127,6 +131,7 @@ struct k892analysis { 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(); void init(o2::framework::InitContext&) { @@ -138,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 @@ -247,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) { @@ -444,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 @@ -588,7 +600,6 @@ struct k892analysis { lDecayDaughter1.SetPtEtaPhiM(trk1.pt(), trk1.eta(), trk1.phi(), massPi); lDecayDaughter2.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi(), massKa); lResonance = lDecayDaughter1 + lDecayDaughter2; - TRandom* rn = new TRandom(); // Rapidity cut if (abs(lResonance.Rapidity()) >= 0.5) continue; @@ -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..200a3340e6b --- /dev/null +++ b/PWGLF/Tasks/Resonances/k892analysis_PbPb.cxx @@ -0,0 +1,789 @@ +// 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, "Additional evsel2"}; + 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 || doprocessMixedEvent) { + // 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) { + 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) { + 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) { + 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 = collision.centFT0C(); + + 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 TOF High Pt", 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()) { + return; + } + 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))) { + return; + } + 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))) { + return; + } + if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) || !collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + return; + } + + 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 TPC low pt", 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); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"k892analysis_PbPb"})}; +} diff --git a/PWGLF/Tasks/Resonances/k892pmanalysis.cxx b/PWGLF/Tasks/Resonances/k892pmanalysis.cxx index 0f161bfc694..16963b77e6b 100644 --- a/PWGLF/Tasks/Resonances/k892pmanalysis.cxx +++ b/PWGLF/Tasks/Resonances/k892pmanalysis.cxx @@ -352,9 +352,9 @@ struct k892pmanalysis { } // apply the competing V0 rejection cut (excluding Lambda0 candidates, massLambdaPDG = 1115.683 MeV/c2) - if (abs(v0.mLambda() - massLambda0) < cV0MassWindow) + if (std::abs(v0.mLambda() - massLambda0) < cV0MassWindow) continue; - if (abs(v0.mAntiLambda() - massAntiLambda0) < cV0MassWindow) + if (std::abs(v0.mAntiLambda() - massAntiLambda0) < cV0MassWindow) continue; if (!IsMix && !IsV0QAFilled) { @@ -382,7 +382,7 @@ struct k892pmanalysis { } // Checking whether the mid-rapidity condition is met - if (abs(lResonance.Rapidity()) > 0.5) { + if (std::abs(lResonance.Rapidity()) > 0.5) { continue; } @@ -401,7 +401,7 @@ struct k892pmanalysis { histos.fill(HIST("k892pmMassPtMult3d"), lResonance.M(), lResonance.Pt(), multiplicity); if constexpr (IsMC) { // LOG(info) << "track PDG:\t" << trk.pdgCode() << "\tV0 PDG:\t" << v0.pdgCode(); - if (abs(trk.pdgCode()) != 211 || abs(v0.pdgCode()) != 310) // Skip to next iteration if daughters are not charged pion + K0s/AntiK0s + if (std::abs(trk.pdgCode()) != 211 || std::abs(v0.pdgCode()) != 310) // Skip to next iteration if daughters are not charged pion + K0s/AntiK0s continue; if (trk.motherPDG() != v0.motherPDG()) continue; @@ -444,17 +444,17 @@ struct k892pmanalysis { void processMCTrue(aod::ResoMCParents& resoParents) { for (auto& part : resoParents) { // loop over all pre-filtered MC particles - if (abs(part.pdgCode()) != 323) // K*892(pm) + if (std::abs(part.pdgCode()) != 323) // K*892(pm) continue; - if (abs(part.y()) > 0.5) // rapidity cut + if (std::abs(part.y()) > 0.5) // rapidity cut continue; bool pass1 = false; bool pass2 = false; /*// Sanity check: looking for K*0 resonances for sanity check - if (abs(part.pdgCode()) == 323) { + if (std::abs(part.pdgCode()) == 323) { LOG(info) << "Found charged K*: " << part.pdgCode() << ". Daughters' PDG are " << part.daughterPDG1() << " and " << part.daughterPDG2(); } - if (abs(part.pdgCode()) == 313) { + if (std::abs(part.pdgCode()) == 313) { LOG(info) << "Found non-charged K*: " << part.pdgCode() << ". Daughters' PDG are " << part.daughterPDG1() << " and " << part.daughterPDG2(); }*/ @@ -466,11 +466,11 @@ struct k892pmanalysis { pass2 = true; histos.fill(HIST("hK892pmCounter"), 1.5); } - /*if (abs(part.daughterPDG1()) == 211) + /*if (std::abs(part.daughterPDG1()) == 211) histos.fill(HIST("hDaughterCounter"), 0.5); - if (abs(part.daughterPDG2()) == 310) + if (std::abs(part.daughterPDG2()) == 310) histos.fill(HIST("hDaughterCounter"), 1.5); - if (abs(part.daughterPDG1()) == 211 && abs(part.daughterPDG2()) == 310) + if (std::abs(part.daughterPDG1()) == 211 && std::abs(part.daughterPDG2()) == 310) histos.fill(HIST("hDaughterCounter"), 2.5);*/ // if (!pass1 || !pass2) // Go on only if we have both decay products, else skip to next iteration if (!pass1 && !pass2) // Go on only if we have both decay products, else skip to next iteration diff --git a/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx b/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx index f899bf27ed1..81af59575ab 100644 --- a/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx +++ b/PWGLF/Tasks/Resonances/kaonkaonanalysis.cxx @@ -123,6 +123,7 @@ struct kaonkaonAnalysisRun3 { // MC Configurable isMC{"isMC", false, "Run MC"}; Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; + TRandom* rn = new TRandom(); void init(o2::framework::InitContext&) { @@ -312,7 +313,6 @@ struct kaonkaonAnalysisRun3 { template void FillinvMass(const T1& candidate1, const T2& candidate2, const T3& framecalculation, float multiplicity, bool unlike, bool mix, bool likesign, bool rotation, float massd1, float massd2) { - TRandom* rn = new TRandom(); int track1Sign = candidate1.sign(); int track2Sign = candidate2.sign(); TLorentzVector vec1, vec2, vec3, vec4, vec5; @@ -437,8 +437,6 @@ struct kaonkaonAnalysisRun3 { daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); // Kplus daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); // Kminus - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), massKa); // Kaon TLorentzVector lv1, lv2, lv3; lv1.SetPtEtaPhiM(track1.pt(), track1.eta(), track1.phi(), massKa); @@ -485,6 +483,8 @@ struct kaonkaonAnalysisRun3 { FillinvMass(track1, track2, cosThetaStarBeam, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } } 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()); @@ -550,8 +550,6 @@ struct kaonkaonAnalysisRun3 { daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); // Kplus daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massKa); // Kminus - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), massKa); // Kaon TLorentzVector lv1, lv2, lv3; lv1.SetPtEtaPhiM(t1.pt(), t1.eta(), t1.phi(), massKa); @@ -594,6 +592,8 @@ struct kaonkaonAnalysisRun3 { FillinvMass(t1, t2, cosThetaStarBeam, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } } 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()); @@ -647,8 +647,6 @@ struct kaonkaonAnalysisRun3 { daughter1 = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa); // Kplus daughter2 = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massKa); // Kminus - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau = ROOT::Math::PxPyPzMVector(daughter1.Px(), daughter1.Py(), daughter1.Pz(), massKa); // Kaon TLorentzVector lv1, lv2, lv3; lv1.SetPtEtaPhiM(t1.pt(), t1.eta(), t1.phi(), massKa); @@ -691,6 +689,8 @@ struct kaonkaonAnalysisRun3 { FillinvMass(t1, t2, cosThetaStarBeam, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } } 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()); 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 4894d8149d4..9f5e61b2503 100644 --- a/PWGLF/Tasks/Resonances/kstarpbpb.cxx +++ b/PWGLF/Tasks/Resonances/kstarpbpb.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. -// sourav.kundu@cern.ch +// sourav.kundu@cern.ch , sarjeeta.gami@cern.ch #include #include @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include @@ -73,13 +75,17 @@ struct kstarpbpb { // events Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"}; // track Configurable cfgCutCharge{"cfgCutCharge", 0.0, "cut on Charge"}; + Configurable additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"}; + Configurable additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"}; 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 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"}; @@ -89,26 +95,31 @@ struct kstarpbpb { ConfigurableAxis configThnAxisInvMass{"configThnAxisInvMass", {180, 0.6, 1.5}, "#it{M} (GeV/#it{c}^{2})"}; ConfigurableAxis configThnAxisPt{"configThnAxisPt", {100, 0.0, 10.}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0., 80}, "Centrality"}; + Configurable removefaketrak{"removefaketrack", true, "Remove fake track from momentum difference"}; + Configurable ConfFakeKaonCut{"ConfFakeKaonCut", 0.1, "Cut based on track from momentum difference"}; ConfigurableAxis configThnAxisPhiminusPsi{"configThnAxisPhiminusPsi", {6, 0.0, TMath::Pi()}, "#phi - #psi"}; ConfigurableAxis configThnAxisV2{"configThnAxisV2", {200, -1, 1}, "V2"}; Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; + Configurable strategyPID{"strategyPID", 2, "PID strategy"}; + Configurable isGI{"isGI", false, "pT dependent PID"}; Configurable additionalQAplots{"additionalQAplots", 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"}; Configurable fillRotation{"fillRotation", true, "fill rotation"}; + Configurable like{"like", true, "fill rotation"}; + Configurable fillOccupancy{"fillOccupancy", false, "fill Occupancy"}; + Configurable cfgOccupancyCut{"cfgOccupancyCut", 500, "Occupancy cut"}; 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>; - - using EventCandidatesMC = soa::Join; - using TrackCandidatesMC = soa::Filtered>; + using TrackCandidates = soa::Filtered>; SliceCache cache; Partition posTracks = aod::track::signed1Pt > cfgCutCharge; @@ -125,6 +136,7 @@ struct kstarpbpb { void init(o2::framework::InitContext&) { + 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 thnAxisPhiminusPsi{configThnAxisPhiminusPsi, "#phi - #psi"}; @@ -133,21 +145,25 @@ struct kstarpbpb { AxisSpec phiAxis = {500, -6.28, 6.28, "phi"}; AxisSpec resAxis = {400, -2, 2, "Res"}; AxisSpec centAxis = {8, 0, 80, "V0M (%)"}; - AxisSpec occupancyAxis = {1500, 0, 1500, "Occupancy"}; + AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"}; histos.add("hpTvsRapidity", "pT vs Rapidity", kTH2F, {{100, 0.0f, 10.0f}, {300, -1.5f, 1.5f}}); - histos.add("hFTOCvsTPC", "Mult correlation FT0C vs. TPC", 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("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", kTH3F, {centAxis, occupancyAxis, phiAxis}); - histos.add("hPsiFT0A", "PsiFT0A", kTH3F, {centAxis, occupancyAxis, phiAxis}); - histos.add("hPsiTPC", "PsiTPC", kTH3F, {centAxis, occupancyAxis, phiAxis}); + 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}); - histos.add("hMC", "MC Event statistics", kTH1F, {{6, 0.0f, 6.0f}}); // histogram for resolution histos.add("ResFT0CTPC", "ResFT0CTPC", kTH2F, {centAxis, resAxis}); @@ -204,7 +220,7 @@ struct kstarpbpb { double massPi = o2::constants::physics::MassPiMinus; template - bool eventSelected(TCollision collision, const int& /*multTrk*/, const float& centrality) + bool eventSelected(TCollision collision, const float& centrality) { if (collision.alias_bit(kTVXinTRD)) { // TRD triggered @@ -224,7 +240,6 @@ struct kstarpbpb { return 1; } - template bool selectionTrack(const T& candidate) { @@ -238,20 +253,20 @@ struct kstarpbpb { } template - bool selectionPIDpTdependent(const T& candidate, int PID) + bool selectionPIDNew(const T& candidate, int PID) { if (PID == 0) { - if (candidate.p() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (candidate.p() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } } else if (PID == 1) { - if (candidate.p() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (candidate.p() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.pt() >= 0.5 && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } } @@ -262,11 +277,11 @@ struct kstarpbpb { bool selectionPID(const T& candidate, int PID) { if (PID == 0) { - if (candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { return true; } } else if (PID == 1) { - if (candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { return true; } } @@ -274,21 +289,60 @@ struct kstarpbpb { } template - bool selectionPIDNew(const T& candidate, int PID) + bool strategySelectionPID(const T& candidate, int PID, int strategy) { if (PID == 0) { - if (candidate.p() < 0.6 && TMath::Abs(candidate.tpcNSigmaKa()) < 2.0) { - return true; - } - if (candidate.p() >= 0.6 && candidate.p() < 3.0 && candidate.hasTOF() && candidate.tpcNSigmaKa() > -2.0 && candidate.tpcNSigmaKa() < 3.0 && TMath::Abs(candidate.tofNSigmaKa()) < 2.0) { - return true; - } - } else if (PID == 1) { - if (candidate.p() < 1.0 && TMath::Abs(candidate.tpcNSigmaPi()) < 2.0) { - return true; + 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 (candidate.p() >= 1.0 && candidate.p() < 3.0 && candidate.hasTOF() && candidate.tpcNSigmaPi() > -2.0 && candidate.tpcNSigmaPi() < 3.0 && TMath::Abs(candidate.tofNSigmaPi()) < 2.0) { - 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; @@ -305,49 +359,165 @@ struct kstarpbpb { } return result; } - + template + bool isFakeKaon(T const& track, int PID) + { + const auto pglobal = track.p(); + const auto ptpc = track.tpcInnerParam(); + if (TMath::Abs(pglobal - ptpc) > ConfFakeKaonCut) { + return true; + } + return false; + } ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {20, 0, 100}, "multiplicity percentile for bin"}; - ConfigurableAxis axisEPAngle{"axisEPAngle", {6, -TMath::Pi() / 2, TMath::Pi() / 2}, "event plane angle"}; + ConfigurableAxis axisEPAngle{"axisEPAngle", {9, -TMath::Pi() / 2, TMath::Pi() / 2}, "event plane angle"}; 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; + } + 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&) { - histos.fill(HIST("hMC"), 0.5); if (!collision.sel8()) { return; } - histos.fill(HIST("hMC"), 1.5); + auto centrality = collision.centFT0C(); + auto multTPC = collision.multNTracksPV(); if (!collision.triggereventep()) { return; } - histos.fill(HIST("hMC"), 2.5); if (timFrameEvsel && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { return; } - histos.fill(HIST("hMC"), 3.5); + 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(); auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); - auto centrality = collision.centFT0C(); - auto multTPC = collision.multNTracksPV(); auto psiFT0C = collision.psiFT0C(); auto psiFT0A = collision.psiFT0A(); auto psiTPC = collision.psiTPC(); - int occupancy = collision.trackOccupancyInTimeRange(); - if (occupancy >= 1500) // occupancy info is available for this collision (*) + if (fillOccupancy && occupancy >= cfgOccupancyCut) // occupancy info is available for this collision (*) { return; } - histos.fill(HIST("hFTOCvsTPC"), centrality, multTPC); - if (additionalEvsel && !eventSelected(collision, tracks.size(), centrality)) { + if (additionalEvsel && !eventSelected(collision, centrality)) { return; } histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC); - histos.fill(HIST("hPsiFT0C"), centrality, occupancy, psiFT0C); - histos.fill(HIST("hPsiFT0A"), centrality, occupancy, psiFT0A); - histos.fill(HIST("hPsiTPC"), centrality, occupancy, psiTPC); + 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))); @@ -375,6 +545,7 @@ struct kstarpbpb { if (!ispTdepPID && !(selectionPID(track1, 0) || selectionPID(track1, 1))) { continue; } + auto track1ID = track1.globalIndex(); for (auto track2 : negThisColl) { bool track2pion = false; bool track2kaon = false; @@ -394,6 +565,10 @@ struct kstarpbpb { if (!ispTdepPID && !(selectionPID(track2, 0) || selectionPID(track2, 1))) { continue; } + auto track2ID = track2.globalIndex(); + if (isGI && (track2ID <= track1ID)) { + continue; + } if (track1.sign() * track2.sign() > 0) { continue; } @@ -402,20 +577,32 @@ struct kstarpbpb { if (selectionPIDNew(track1, 1) && selectionPIDNew(track2, 0)) { track1pion = true; track2kaon = true; + if (removefaketrak && isFakeKaon(track2, 0)) { + continue; + } } if (selectionPIDNew(track2, 1) && selectionPIDNew(track1, 0)) { track2pion = true; track1kaon = true; + if (removefaketrak && isFakeKaon(track1, 0)) { + continue; + } } } if (!ispTdepPID) { if (selectionPID(track1, 1) && selectionPID(track2, 0)) { track1pion = true; track2kaon = true; + if (removefaketrak && isFakeKaon(track2, 0)) { + continue; + } } if (selectionPID(track2, 1) && selectionPID(track1, 0)) { track2pion = true; track1kaon = true; + if (removefaketrak && isFakeKaon(track1, 0)) { + continue; + } } } @@ -449,7 +636,6 @@ struct kstarpbpb { auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); auto v2 = TMath::Cos(2.0 * phiminuspsi); histos.fill(HIST("hSparseV2SASameEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); - if (fillRotation) { for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { auto anglestart = confMinRot; @@ -471,6 +657,9 @@ struct kstarpbpb { continue; } 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); @@ -479,26 +668,159 @@ struct kstarpbpb { } } } - PROCESS_SWITCH(kstarpbpb, processSameEvent, "Process Same event", true); - void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) + 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(); + 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; + } + int occupancy = collision.trackOccupancyInTimeRange(); + auto psiFT0C = collision.psiFT0C(); + if (fillOccupancy && occupancy >= cfgOccupancyCut) // occupancy info is available for this collision (*) + { + return; + } + + if (additionalEvsel && !eventSelected(collision, centrality)) { + return; + } + for (auto track1 : tracks) { + if (!selectionTrack(track1)) { + continue; + } + bool track1pion = false; + bool track1kaon = false; + if (ispTdepPID && !(selectionPIDNew(track1, 0) || selectionPIDNew(track1, 1))) { + continue; + } + if (!ispTdepPID && !(selectionPID(track1, 0) || selectionPID(track1, 1))) { + continue; + } + for (auto track2 : tracks) { + bool track2pion = false; + bool track2kaon = false; + if (!selectionTrack(track2)) { + continue; + } + if (ispTdepPID && !(selectionPIDNew(track2, 0) || selectionPIDNew(track2, 1))) { + continue; + } + if (!ispTdepPID && !(selectionPID(track2, 0) || selectionPID(track2, 1))) { + continue; + } + if (track1.sign() * track2.sign() < 0) { + continue; + } + + if (ispTdepPID) { + if (selectionPIDNew(track1, 1) && selectionPIDNew(track2, 0)) { + track1pion = true; + track2kaon = true; + if (removefaketrak && isFakeKaon(track2, 0)) { + continue; + } + } + if (selectionPIDNew(track2, 1) && selectionPIDNew(track1, 0)) { + track2pion = true; + track1kaon = true; + if (removefaketrak && isFakeKaon(track1, 0)) { + continue; + } + } + } + if (!ispTdepPID) { + if (selectionPID(track1, 1) && selectionPID(track2, 0)) { + track1pion = true; + track2kaon = true; + if (removefaketrak && isFakeKaon(track2, 0)) { + continue; + } + } + if (selectionPID(track2, 1) && selectionPID(track1, 0)) { + track2pion = true; + track1kaon = true; + if (removefaketrak && isFakeKaon(track1, 0)) { + continue; + } + } + } + if (track1kaon && track2pion) { + if (track1.sign() < 0 && track2.sign() < 0) { + + 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); + histos.fill(HIST("hSparseV2SAlikeEventNN_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } + } else if (track1pion && track2kaon) { + if (track1.sign() > 0 && track2.sign() > 0) { + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massPi); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + KstarMother = daughter1 + daughter2; + if (TMath::Abs(KstarMother.Rapidity()) > confRapidity) { + continue; + } + auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); + auto v2 = TMath::Cos(2.0 * phiminuspsi); + histos.fill(HIST("hSparseV2SAlikeEventPP_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } + } + } + } + } + + PROCESS_SWITCH(kstarpbpb, processlikeEvent, "Process like event", false); + void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& /*tracks*/) { - auto tracksTuple = std::make_tuple(tracks); BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass, axisEPAngle}, true}; - SameKindPair pair{binningOnPositions, cfgNoMixedEvents, -1, collisions, tracksTuple, &cache}; - for (auto& [collision1, tracks1, collision2, tracks2] : pair) { + 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(); - if (occupancy >= 1500) { - return; + if (additionalEvSel3 && (!collision1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + continue; } + if (additionalEvSel3 && (!collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + int occupancy1 = collision1.trackOccupancyInTimeRange(); + int occupancy2 = collision2.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(); @@ -506,19 +828,22 @@ struct kstarpbpb { bool track1kaon = false; bool track2pion = false; bool track2kaon = false; - - if (additionalEvsel && !eventSelected(collision1, tracks.size(), centrality)) { + if (additionalEvsel && !eventSelected(collision1, centrality)) { + // printf("Mix = %d\n", 4); continue; } - if (additionalEvsel && !eventSelected(collision2, tracks.size(), centrality2)) { + if (additionalEvsel && !eventSelected(collision2, centrality2)) { + // printf("Mix = %d\n", 5); continue; } - - for (auto& [track1, track2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { - if (track1.sign() * track2.sign() > 0) { - continue; - } + if (fillOccupancy && occupancy1 >= cfgOccupancyCut && occupancy2 >= cfgOccupancyCut) // occupancy info is available for this collision (*) + { + 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; } if (ispTdepPID && !(selectionPIDNew(track1, 0) || selectionPIDNew(track1, 1))) { @@ -538,20 +863,32 @@ struct kstarpbpb { if (selectionPIDNew(track1, 1) && selectionPIDNew(track2, 0)) { track1pion = true; track2kaon = true; + if (removefaketrak && isFakeKaon(track2, 0)) { + continue; + } } if (selectionPIDNew(track2, 1) && selectionPIDNew(track1, 0)) { track2pion = true; track1kaon = true; + if (removefaketrak && isFakeKaon(track1, 0)) { + continue; + } } } if (!ispTdepPID) { if (selectionPID(track1, 1) && selectionPID(track2, 0)) { track1pion = true; track2kaon = true; + if (removefaketrak && isFakeKaon(track2, 0)) { + continue; + } } if (selectionPID(track2, 1) && selectionPID(track1, 0)) { track2pion = true; track1kaon = true; + if (removefaketrak && isFakeKaon(track1, 0)) { + continue; + } } } if (track1kaon && track2pion) { @@ -573,7 +910,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/kstarqa.cxx b/PWGLF/Tasks/Resonances/kstarqa.cxx index 7bf410a3451..5517a69818e 100644 --- a/PWGLF/Tasks/Resonances/kstarqa.cxx +++ b/PWGLF/Tasks/Resonances/kstarqa.cxx @@ -63,7 +63,6 @@ struct kstarqa { // Confugrable for QA histograms Configurable CalcLikeSign{"CalcLikeSign", true, "Calculate Like Sign"}; Configurable CalcRotational{"CalcRotational", true, "Calculate Rotational"}; - Configurable QA{"QA", false, "QA"}; Configurable QAbefore{"QAbefore", true, "QAbefore"}; Configurable QAafter{"QAafter", true, "QAafter"}; Configurable QAevents{"QAevents", true, "Multiplicity dist, DCAxy, DCAz"}; @@ -125,6 +124,7 @@ struct kstarqa { Configurable activateTHnSparseCosThStarRandom{"activateTHnSparseCosThStarRandom", false, "Activate the THnSparse with cosThStar w.r.t. random axis"}; Configurable c_nof_rotations{"c_nof_rotations", 3, "Number of random rotations in the rotational background"}; ConfigurableAxis configThnAxisPOL{"configThnAxisPOL", {20, -1.0, 1.0}, "Costheta axis"}; + TRandom* rn = new TRandom(); void init(InitContext const&) { @@ -156,12 +156,10 @@ struct kstarqa { } // KStar histograms - histos.add("h3KstarInvMassUnlikeSign", "kstar Unlike Sign", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}, true); - histos.add("h3KstarInvMassMixed", "kstar Mixed", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}, true); - if (CalcLikeSign) - histos.add("h3KstarInvMasslikeSign", "kstar like Sign", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}, true); - if (CalcRotational) - histos.add("h3KstarInvMassRotated", "kstar rotated", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}, true); + histos.add("h3KstarInvMassUnlikeSign", "kstar Unlike Sign", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}); + histos.add("h3KstarInvMasslikeSign", "kstar like Sign", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}); + histos.add("h3KstarInvMassRotated", "kstar rotated", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}); + histos.add("h3KstarInvMassMixed", "kstar Mixed", kTHnSparseF, {binsMultPlot, ptAxis, invmassAxis, thnAxisPOL}); // MC generated histograms histos.add("k892Gen", "pT distribution of True MC K(892)0", kTH1D, {ptAxis}); @@ -182,7 +180,7 @@ struct kstarqa { histos.add("multdist_FT0M", "FT0M Multiplicity distribution", kTH1F, {axisMultdist}); histos.add("multdist_FT0A", "FT0A Multiplicity distribution", kTH1F, {axisMultdist}); histos.add("multdist_FT0C", "FT0C Multiplicity distribution", kTH1F, {axisMultdist}); - histos.add("hNcontributor", "Number of primary vertex contributor", kTH1F, {{2000, 0.0f, 10000.0f}}); + // histos.add("hNcontributor", "Number of primary vertex contributor", kTH1F, {{2000, 0.0f, 10000.0f}}); histos.add("hDcaxy", "Dcaxy distribution", kTH1F, {{200, -1.0f, 1.0f}}); histos.add("hDcaz", "Dcaz distribution", kTH1F, {{200, -1.0f, 1.0f}}); } @@ -379,7 +377,6 @@ struct kstarqa { using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; - using V0TrackCandidate = aod::V0Datas; using EventCandidatesMC = soa::Join; using TrackCandidatesMC = soa::Filtered>; @@ -396,8 +393,6 @@ struct kstarqa { TLorentzVector lv4, lv5; // polarization calculations - auto phiRandom = gRandom->Uniform(0.f, constants::math::TwoPI); - auto thetaRandom = gRandom->Uniform(0.f, constants::math::PI); ROOT::Math::PxPyPzMVector fourVecDau1 = ROOT::Math::PxPyPzMVector(daughter_selected.Px(), daughter_selected.Py(), daughter_selected.Pz(), selected_dau_mass); // Kaon or Pion ROOT::Math::PxPyPzMVector fourVecMother = ROOT::Math::PxPyPzMVector(lv3.Px(), lv3.Py(), lv3.Pz(), lv3.M()); // mass of KshortKshort pair @@ -405,10 +400,7 @@ struct kstarqa { ROOT::Math::PxPyPzMVector fourVecDauCM = boost(fourVecDau1); // boost the frame of daughter same as mother ROOT::Math::XYZVector threeVecDauCM = fourVecDauCM.Vect(); // get the 3 vector of daughter in the frame of mother - TRandom* rn = new TRandom(); - if (TMath::Abs(lv3.Rapidity() < 0.5)) { - 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())); @@ -479,6 +471,9 @@ struct kstarqa { histos.fill(HIST("h3KstarInvMasslikeSign"), multiplicity, lv3.Pt(), lv3.M(), cosThetaStarBeam); } } 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()); @@ -536,7 +531,7 @@ struct kstarqa { histos.fill(HIST("multdist_FT0M"), collision.multFT0M()); histos.fill(HIST("multdist_FT0A"), collision.multFT0A()); histos.fill(HIST("multdist_FT0C"), collision.multFT0C()); - histos.fill(HIST("hNcontributor"), collision.numContrib()); + // histos.fill(HIST("hNcontributor"), collision.numContrib()); } for (auto& [track1, track2] : combinations(CombinationsFullIndexPolicy(tracks, tracks))) { @@ -609,7 +604,7 @@ struct kstarqa { ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {10, 0, 100}, "multiplicity percentile for ME mixing"}; // ConfigurableAxis axisMultiplicity{"axisMultiplicity", {2000, 0, 10000}, "TPC multiplicity for bin for ME mixing"}; - using BinningTypeTPCMultiplicity = ColumnBinningPolicy; + // using BinningTypeTPCMultiplicity = ColumnBinningPolicy; using BinningTypeCentralityM = ColumnBinningPolicy; using BinningTypeVertexContributor = ColumnBinningPolicy; @@ -668,10 +663,8 @@ struct kstarqa { TLorentzVector Kstar = KAON + PION; bool isMix = true; - if (!QA) { - if (TMath::Abs(Kstar.Rapidity()) < 0.5) { - fillInvMass(t1, t2, PION, Kstar, multiplicity, isMix); - } + if (TMath::Abs(Kstar.Rapidity()) < 0.5) { + fillInvMass(t1, t2, PION, Kstar, multiplicity, isMix); } } } @@ -693,7 +686,7 @@ struct kstarqa { return; } - auto multiplicity = c1.centFT0M(); + auto multiplicity = c1.centFT0C(); for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) { @@ -722,10 +715,8 @@ struct kstarqa { TLorentzVector Kstar = KAON + PION; bool isMix = true; - if (!QA) { - if (TMath::Abs(Kstar.Rapidity()) < 0.5) { - fillInvMass(t1, t2, PION, Kstar, multiplicity, isMix); - } + if (TMath::Abs(Kstar.Rapidity()) < 0.5) { + fillInvMass(t1, t2, PION, Kstar, multiplicity, isMix); } } } diff --git a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx index 2a728d33bf4..9537b986a04 100644 --- a/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx +++ b/PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx @@ -79,30 +79,31 @@ struct phianalysisrun3_PbPb { 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"}; Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; Configurable isDeepAngle{"isDeepAngle", false, "Deep Angle cut"}; Configurable cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"}; - Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; + Configurable genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"}; // MC Configurable isMC{"isMC", false, "Run MC"}; Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; void init(o2::framework::InitContext&) { + std::vector occupancyBinning = {0.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 4000.0, 5000.0, 50000.0}; + AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"}; + histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}}); - histos.add("hNcontributor", "Number of primary vertex contributor", kTH1F, {{2000, 0.0f, 10000.0f}}); - histos.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); - histos.add("hDcaxy", "Dcaxy distribution", kTH1F, {{200, -1.0f, 1.0f}}); - histos.add("hDcaz", "Dcaz distribution", kTH1F, {{200, -1.0f, 1.0f}}); - histos.add("hNsigmaKaonTPC", "NsigmaKaon TPC distribution", kTH1F, {{200, -10.0f, 10.0f}}); - histos.add("hNsigmaKaonTOF", "NsigmaKaon TOF distribution", kTH1F, {{200, -10.0f, 10.0f}}); + 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}}); @@ -120,6 +121,7 @@ struct phianalysisrun3_PbPb { } 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("h2PhiRec2", "Phi meson Rec", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}}); @@ -130,21 +132,20 @@ struct phianalysisrun3_PbPb { histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}}); histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}}); } - if (additionalQAplots) { - // DCA QA - histos.add("QAbefore/trkDCAxy", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - histos.add("QAbefore/trkDCAz", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - histos.add("QAafter/trkDCAxy", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - histos.add("QAafter/trkDCAz", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); - // PID QA before cuts - histos.add("QAbefore/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAbefore/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAbefore/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - // PID QA after cuts - histos.add("QAafter/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); - histos.add("QAafter/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - histos.add("QAafter/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); - } + + // DCA QA + histos.add("QAbefore/trkDCAxy", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); + histos.add("QAbefore/trkDCAz", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); + histos.add("QAafter/trkDCAxy", "DCAxy distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); + histos.add("QAafter/trkDCAz", "DCAz distribution of kaon track candidates", HistType::kTH1F, {{150, 0.0f, 1.0f}}); + // PID QA before cuts + histos.add("QAbefore/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); + histos.add("QAbefore/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); + histos.add("QAbefore/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); + // PID QA after cuts + histos.add("QAafter/TOF_TPC_Mapka_all", "TOF + TPC Combined PID for Kaon;#sigma_{TOF}^{Kaon};#sigma_{TPC}^{Kaon}", {HistType::kTH2D, {{100, -6, 6}, {100, -6, 6}}}); + histos.add("QAafter/TOF_Nsigma_all", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); + histos.add("QAafter/TPC_Nsigma_all", "TPC NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{Kaon};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); } double massKa = o2::constants::physics::MassKPlus; @@ -185,7 +186,17 @@ struct phianalysisrun3_PbPb { } return false; } - + template + bool selectionPIDpTdependent(const T& candidate) + { + 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)) { + return true; + } + return false; + } // deep angle cut on pair to remove photon conversion template bool selectionPair(const T1& candidate1, const T2& candidate2) @@ -302,6 +313,12 @@ struct phianalysisrun3_PbPb { if (!collision.sel8()) { 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(); if (fillOccupancy && occupancy < cfgOccupancyCut) // occupancy info is available for this collision (*) { @@ -310,11 +327,9 @@ struct phianalysisrun3_PbPb { float multiplicity; if (cfgMultFT0) multiplicity = collision.centFT0C(); - if (!cfgMultFT0) - multiplicity = collision.numContrib(); histos.fill(HIST("hCentrality"), multiplicity); - histos.fill(HIST("hNcontributor"), collision.numContrib()); histos.fill(HIST("hVtxZ"), collision.posZ()); + histos.fill(HIST("hOccupancy"), occupancy); for (auto track1 : tracks) { if (!selectionTrack(track1)) { continue; @@ -325,11 +340,6 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("QAbefore/trkDCAz"), track1.dcaZ()); histos.fill(HIST("QAbefore/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); - histos.fill(HIST("hEta"), track1.eta()); - histos.fill(HIST("hDcaxy"), track1.dcaXY()); - histos.fill(HIST("hDcaz"), track1.dcaZ()); - histos.fill(HIST("hNsigmaKaonTPC"), track1.tpcNSigmaKa()); - histos.fill(HIST("hNsigmaKaonTOF"), track1.tofNSigmaKa()); auto track1ID = track1.globalIndex(); for (auto track2 : tracks) { if (!selectionTrack(track2)) { @@ -354,7 +364,15 @@ struct phianalysisrun3_PbPb { histos.fill(HIST("QAafter/TOF_TPC_Mapka_all"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); FillinvMass(track1, track2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } - if (!isITSOnlycut && selectionPID(track1) && selectionPID(track2)) { + if (!isITSOnlycut && !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); + } + 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()); @@ -380,8 +398,21 @@ struct phianalysisrun3_PbPb { if (!c2.sel8()) { continue; } - int occupancy = c1.trackOccupancyInTimeRange(); - if (fillOccupancy && occupancy < cfgOccupancyCut) // occupancy info is available for this collision (*) + if (additionalEvSel2 && (!c1.selection_bit(aod::evsel::kNoSameBunchPileup) || !c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + if (additionalEvSel2 && (!c2.selection_bit(aod::evsel::kNoSameBunchPileup) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) { + continue; + } + if (additionalEvSel3 && (!c1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + if (additionalEvSel3 && (!c2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { + continue; + } + int occupancy1 = c1.trackOccupancyInTimeRange(); + int occupancy2 = c2.trackOccupancyInTimeRange(); + if (fillOccupancy && occupancy1 < cfgOccupancyCut && occupancy2 < cfgOccupancyCut) // occupancy info is available for this collision (*) { return; } @@ -408,7 +439,10 @@ struct phianalysisrun3_PbPb { if (isITSOnlycut) { FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } - if (!isITSOnlycut && selectionPID(t1) && selectionPID(t2)) { + if (!isITSOnlycut && !ispTdepPID && selectionPID(t1) && selectionPID(t2)) { + FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); + } + if (!isITSOnlycut && ispTdepPID && selectionPIDpTdependent(t1) && selectionPIDpTdependent(t2)) { FillinvMass(t1, t2, multiplicity, unlike, mix, likesign, rotation, massKa, massKa); } } @@ -452,7 +486,10 @@ struct phianalysisrun3_PbPb { if (!selectionTrack(track1)) { continue; } - if (!selectionPID(track1)) { + if (!ispTdepPID && !selectionPID(track1)) { + continue; + } + if (ispTdepPID && !selectionPIDpTdependent(track1)) { continue; } if (!track1.has_mcParticle()) { @@ -467,7 +504,10 @@ struct phianalysisrun3_PbPb { if (!selectionTrack(track2)) { continue; } - if (!selectionPID(track2)) { + if (!ispTdepPID && !selectionPID(track2)) { + continue; + } + if (ispTdepPID && !selectionPIDpTdependent(track2)) { continue; } if (!track2.has_mcParticle()) { @@ -506,7 +546,10 @@ struct phianalysisrun3_PbPb { if (TMath::Abs(mothertrack1.pdgCode()) != 333) { continue; } - if (!selectionPID(track1) || !selectionPID(track2)) { + if (!ispTdepPID && (!selectionPID(track1) || !selectionPID(track2))) { + continue; + } + if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) { continue; } if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) { diff --git a/PWGLF/Tasks/Resonances/phipbpb.cxx b/PWGLF/Tasks/Resonances/phipbpb.cxx index 79b4e42f6b8..9930f231c25 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,11 @@ 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 phiAxis = {500, -6.28, 6.28, "phi"}; AxisSpec resAxis = {2000, -10, 10, "Res"}; AxisSpec centAxis = {8, 0, 80, "V0M (%)"}; @@ -180,36 +174,19 @@ 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("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 +207,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 +270,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 +281,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 +352,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 +371,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,9 +452,13 @@ 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; + 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) { - continue; + 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); } ROOT::Math::Boost boost{PhiMesonMother.BoostToCM()}; fourVecDauCM = boost(KaonMinus); @@ -525,175 +466,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("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); - } - - 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); - } + 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, 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; - } - 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("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); - } - } - } - } - PROCESS_SWITCH(phipbpb, processMixedEvent, "Process Mixed 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 +540,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 +555,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 +582,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 +678,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 +687,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 +741,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/xi1530Analysisqa.cxx b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx new file mode 100644 index 00000000000..9c60a73042d --- /dev/null +++ b/PWGLF/Tasks/Resonances/xi1530Analysisqa.cxx @@ -0,0 +1,961 @@ +// 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 track-track decay resonance candidates +/// +/// \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 +}; + +struct xi1530analysisqa { + + // Basic set-up // + SliceCache cache; + Preslice perRCol = aod::resodaughter::resoCollisionId; + Preslice perCollision = aod::track::collisionId; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + using ResoMCCols = soa::Join; + + Configurable cMassXiminus{"cMassXiminus", 1.31486, "Mass of Xi baryon"}; + + // 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.2, "Invariant mass start"}; + Configurable cInvMassEnd{"cInvMassEnd", 2.1, "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", 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"}; + + // 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", true, "Global track selection"}; + Configurable cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; + Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; + Configurable additionalQAeventPlots{"additionalQAeventPlots", true, "Additional QA event plots"}; + Configurable additionalMEPlots{"additionalMEPlots", true, "Additional Mixed event plots"}; + + Configurable tof_at_high_pt{"tof_at_high_pt", true, "Use TOF at high pT"}; + + Configurable cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"}; // Minmimum + Configurable cfgTPCcluster{"cfgTPCcluster", 0, "Number of TPC cluster"}; // Minmimum + + Configurable cfgRatioTPCRowsOverFindableCls{"cfgRatioTPCRowsOverFindableCls", 0.0f, "TPC Crossed Rows to Findable Clusters"}; // Minmimum + + Configurable cfgITSChi2NCl{"cfgITSChi2NCl", 999.0, "ITS Chi2/NCl"}; // Maximum + Configurable cfgTPCChi2NCl{"cfgTPCChi2NCl", 999.0, "TPC Chi2/NCl"}; // Maximum + + Configurable cfgUseTPCRefit{"cfgUseTPCRefit", true, "Require TPC Refit"}; + Configurable cfgUseITSRefit{"cfgUseITSRefit", true, "Require ITS Refit"}; + + Configurable cfgHasITS{"cfgHasITS", true, "Require ITS"}; + Configurable cfgHasTPC{"cfgHasTPC", true, "Require TPC"}; + Configurable cfgHasTOF{"cfgHasTOF", true, "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// + + // 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", -999, "Combined nSigma cut for Pion First"}; + + Configurable cUseOnlyTOFTrackPionFirst{"cUseOnlyTOFTrackPionFirst", true, "Use only TOF track for PID selection Pion First"}; + Configurable cByPassTOFPionFirst{"cByPassTOFPionFirst", true, "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", -999, "Combined nSigma cut for Pion Bachelor"}; + + // Configurable cUseOnlyTOFTrackPionBachelor{"cUseOnlyTOFTrackPionBachelor", false, "Use only TOF track for PID selection Pion Bachelor"}; + + // // 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", -999, "Combined nSigma cut for Pion"}; + + // Configurable cUseOnlyTOFTrackPion{"cUseOnlyTOFTrackPion", false, "Use only TOF track for PID selection Pion"}; + + // // 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", -999, "Combined nSigma cut for Proton"}; + + // Configurable cUseOnlyTOFTrackProton{"cUseOnlyTOFTrackProton", false, "Use only TOF track for PID selection Proton"}; + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + // 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", 1.5, "Maximum Minv of mother cut"}; + Configurable cetaphiBins{"cetaphiBins", 400, "number of eta and phi bins"}; + TRandom* rn = new TRandom(); + + //*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*//*// + + 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/TPCnclusterpr", "TPC ncluster distribution", kTH1F, {{160, 0, 160, "TPC nCluster"}}); // can't use TPC info. for cascades!! + histos.add("TPCncluster/TPCnclusterPhipifirst", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); + // histos.add("TPCncluster/TPCnclusterPhipr", "TPC ncluster vs phi", kTH2F, {{160, 0, 160, "TPC nCluster"}, {63, 0, 6.28, "#phi"}}); // can't use TPC info. for cascades!! + + // Multiplicity correlation calibrations + histos.add("MultCalib/centglopi_before", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); + histos.add("MultCalib/GloPVpi_before", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); + + histos.add("MultCalib/centglopi_after", "Centrality vs Global-Tracks", kTH2F, {{110, 0, 110, "Centrality"}, {500, 0, 5000, "Global Tracks"}}); + histos.add("MultCalib/GloPVpi_after", "Global tracks vs PV tracks", kTH2F, {{500, 0, 5000, "Global tracks"}, {500, 0, 5000, "PV tracks"}}); + } + + // 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}); + + // Can't use PID for cascades !! + if (PIDplots) { + 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_pr_all", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{proton};#sigma_{TPC}^{proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + // histos.add("QAbefore/TOF_Nsigma_pr_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{proton};", {HistType::kTH3F, {centAxis, ptAxisQA, 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}}); + + // PID QA after cuts + 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_pr_all", "TOF + TPC Combined PID for Pion;#sigma_{TOF}^{proton};#sigma_{TPC}^{proton}", {HistType::kTH2F, {pidQAAxis, pidQAAxis}}); + // histos.add("QAafter/TOF_Nsigma_pr_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{proton};", {HistType::kTH3F, {centAxis, ptAxisQA, 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}}); + } + + // 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}); + + // Can't use PID for cascades !! + if (PIDplots) { + 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_pr_all", "TOF NSigma for Pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Proton};", {HistType::kTH3F, {centAxis, ptAxisQA, 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("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 trackCut(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.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; + } + + // Primary track selection for cascades (Need to more informations for cascades!) // + template + bool casctrackCut(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 // + //(Not added yet!-> Need to more informations for cascades!) + + // 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 (track.sign() > 0) { + 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() - pdgDB->Mass(3312)) > cMasswindowCasccut) // codes are not operated when using pdgDB->Mass() !! + // return false; + if (std::abs(track.mXi() - cMassXiminus) > cMasswindowCasccut) + return false; + + return true; + } + + // PID selection for the First Pion // + template + bool selectionPIDPionFirst(const T& candidate) + { + if (tof_at_high_pt) { + if (candidate.hasTOF() && (std::abs(candidate.tofNSigmaPi()) < cMaxTOFnSigmaPionFirst)) { + return true; + } + if (!candidate.hasTOF() && (std::abs(candidate.tpcNSigmaPi()) < cMaxTPCnSigmaPionFirst)) { + return true; + } + } else { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + if (std::abs(candidate.tpcNSigmaPi()) < cMaxTPCnSigmaPionFirst) { + tpcPIDPassed = true; + } + if (cByPassTOFPionFirst && tpcPIDPassed) { + return true; + } + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaPi()) < cMaxTOFnSigmaPionFirst) { + tofPIDPassed = true; + } + if ((nsigmaCutCombinedPionFirst > 0) && (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi() < nsigmaCutCombinedPionFirst * nsigmaCutCombinedPionFirst)) { + tofPIDPassed = true; + } + } else { + tofPIDPassed = true; + } + if (tpcPIDPassed && tofPIDPassed) { + return true; + } + } + return true; + } + + // PID selection for the Cascades // -> Does not use yet! + // template + // bool selectionPIDCascade(const TCascade& candidate) + // { + // auto bachTrack = candidate.template bachelor_as(); + // auto posTrack = candidate.template posTrack_as(); + // auto negTrack = candidate.template negTrack_as(); + + // bool lConsistentWithLambdaPos = false; + // bool lConsistentWithLambdaNeg = false; + // bool lConsistentWithLambda = false; + // bool lConsistentWithXi = false; + + // if (tof_at_high_pt) { + // if (bachTrack.hasTOF() && (std::abs(bachTrack.tofNSigmaPi()) < cMaxTOFnSigmaPionBachelor)) { + // lConsistentWithXi = true; + // } + // if (!bachTrack.hasTOF() && (std::abs(bachTrack.tpcNSigmaPi()) < cMaxTPCnSigmaPionBachelor)) { + // lConsistentWithXi = true; + // } + // } else { + // bool tpcPIDPassed{false}, tofPIDPassed{false}; + // if (std::abs(bachTrack.tpcNSigmaPi()) < cMaxTPCnSigmaPionBachelor) { + // tpcPIDPassed = true; + // } + // if (cByPassTOF && tpcPIDPassed) { + // lConsistentWithXi = true; + // } + // if (bachTrack.hasTOF()) { + // if (std::abs(bachTrack.tofNSigmaPi()) < cMaxTPCnSigmaPionBachelor) { + // tofPIDPassed = true; + // } + // if ((nsigmaCutCombinedPionBachelor > 0) && (bachTrack.tpcNSigmaPi() * bachTrack.tpcNSigmaPi() + bachTrack.tofNSigmaPi() * bachTrack.tofNSigmaPi() < nsigmaCutCombinedPionBachelor * nsigmaCutCombinedPionBachelor)) { + // tofPIDPassed = true; + // } + // } else { + // tofPIDPassed = true; + // } + // if (tpcPIDPassed && tofPIDPassed) { + // lConsistentWithXi = true; + // } + + // } + + // if(candidate.sign() > 0) { + // bool lConsistentWithPion = false; + // bool lConsistentWithProton = false; + + // if (tof_at_high_pt) { + // if (posTrack.hasTOF() && (std::abs(posTrack.tofNSigmaPi()) < cMaxTOFnSigmaPion)) { + // lConsistentWithPion = true; + // } + // if (!posTrack.hasTOF() && (std::abs(posTrack.tpcNSigmaPi()) < cMaxTPCnSigmaPion)) { + // lConsistentWithPion = true; + // } + // } else { + // bool tpcPIDPassed{false}, tofPIDPassed{false}; + // if (std::abs(posTrack.tpcNSigmaPi()) < cMaxTPCnSigmaPion) { + // tpcPIDPassed = true; + // } + // if (cByPassTOF && tpcPIDPassed) { + // lConsistentWithPion = true; + // } + // if (posTrack.hasTOF()) { + // if (std::abs(posTrack.tofNSigmaPi()) < cMaxTPCnSigmaPion) { + // tofPIDPassed = true; + // } + // if ((nsigmaCutCombinedPion > 0) && (posTrack.tpcNSigmaPi() * posTrack.tpcNSigmaPi() + posTrack.tofNSigmaPi() * posTrack.tofNSigmaPi() < nsigmaCutCombinedPion * nsigmaCutCombinedPion)) { + // tofPIDPassed = true; + // } + // } else { + // tofPIDPassed = true; + // } + // if (tpcPIDPassed && tofPIDPassed) { + // lConsistentWithPion = true; + // } + // } + + // if (tof_at_high_pt) { + // if (posTrack.hasTOF() && (std::abs(posTrack.tofNSigmaPr()) < cMaxTOFnSigmaProton)) { + // lConsistentWithProton = true; + // } + // if (!posTrack.hasTOF() && (std::abs(posTrack.tpcNSigmaPr()) < cMaxTPCnSigmaProton)) { + // lConsistentWithProton = true; + // } + // } else { + // bool tpcPIDPassed{false}, tofPIDPassed{false}; + // if (std::abs(posTrack.tpcNSigmaPr()) < cMaxTPCnSigmaProton) { + // tpcPIDPassed = true; + // } + // if (cByPassTOF && tpcPIDPassed) { + // lConsistentWithProton = true; + // } + // if (posTrack.hasTOF()) { + // if (std::abs(posTrack.tofNSigmaPr()) < cMaxTPCnSigmaProton) { + // tofPIDPassed = true; + // } + // if ((nsigmaCutCombinedProton > 0) && (posTrack.tpcNSigmaPr() * posTrack.tpcNSigmaPr() + posTrack.tofNSigmaPr() * posTrack.tofNSigmaPr() < nsigmaCutCombinedProton * nsigmaCutCombinedProton)) { + // tofPIDPassed = true; + // } + // } else { + // tofPIDPassed = true; + // } + // if (tpcPIDPassed && tofPIDPassed) { + // lConsistentWithProton = true; + // } + // } + // lConsistentWithLambdaPos = lConsistentWithProton*lConsistentWithPion; + // } + + // if(candidate.sign() < 0) { + // bool lConsistentWithPion = false; + // bool lConsistentWithProton = false; + + // if (tof_at_high_pt) { + // if (negTrack.hasTOF() && (std::abs(negTrack.tofNSigmaPi()) < cMaxTOFnSigmaPion)) { + // lConsistentWithPion = true; + // } + // if (!negTrack.hasTOF() && (std::abs(negTrack.tpcNSigmaPi()) < cMaxTPCnSigmaPion)) { + // lConsistentWithPion = true; + // } + // } else { + // bool tpcPIDPassed{false}, tofPIDPassed{false}; + // if (std::abs(negTrack.tpcNSigmaPi()) < cMaxTPCnSigmaPion) { + // tpcPIDPassed = true; + // } + // if (cByPassTOF && tpcPIDPassed) { + // lConsistentWithPion = true; + // } + // if (negTrack.hasTOF()) { + // if (std::abs(negTrack.tofNSigmaPi()) < cMaxTPCnSigmaPion) { + // tofPIDPassed = true; + // } + // if ((nsigmaCutCombinedPion > 0) && (negTrack.tpcNSigmaPi() * negTrack.tpcNSigmaPi() + negTrack.tofNSigmaPi() * negTrack.tofNSigmaPi() < nsigmaCutCombinedPion * nsigmaCutCombinedPion)) { + // tofPIDPassed = true; + // } + // } else { + // tofPIDPassed = true; + // } + // if (tpcPIDPassed && tofPIDPassed) { + // lConsistentWithPion = true; + // } + // } + + // if (tof_at_high_pt) { + // if (negTrack.hasTOF() && (std::abs(negTrack.tofNSigmaPr()) < cMaxTOFnSigmaProton)) { + // lConsistentWithProton = true; + // } + // if (!negTrack.hasTOF() && (std::abs(negTrack.tpcNSigmaPr()) < cMaxTPCnSigmaProton)) { + // lConsistentWithProton = true; + // } + // } else { + // bool tpcPIDPassed{false}, tofPIDPassed{false}; + // if (std::abs(negTrack.tpcNSigmaPr()) < cMaxTPCnSigmaProton) { + // tpcPIDPassed = true; + // } + // if (cByPassTOF && tpcPIDPassed) { + // lConsistentWithProton = true; + // } + // if (negTrack.hasTOF()) { + // if (std::abs(negTrack.tofNSigmaPr()) < cMaxTPCnSigmaProton) { + // tofPIDPassed = true; + // } + // if ((nsigmaCutCombinedProton > 0) && (negTrack.tpcNSigmaPr() * negTrack.tpcNSigmaPr() + negTrack.tofNSigmaPr() * negTrack.tofNSigmaPr() < nsigmaCutCombinedProton * nsigmaCutCombinedProton)) { + // tofPIDPassed = true; + // } + // } else { + // tofPIDPassed = true; + // } + // if (tpcPIDPassed && tofPIDPassed) { + // lConsistentWithProton = true; + // } + // } + // lConsistentWithLambdaNeg = lConsistentWithProton*lConsistentWithPion; + // } + + // lConsistentWithLambda = lConsistentWithLambdaPos * lConsistentWithLambdaNeg; + + // return lConsistentWithXi * lConsistentWithLambda; + // } + + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksTypeCasc& dTracks2) // Order: ResoColl, ResoTrack, ResoCascTrack + { + auto multiplicity = collision.cent(); + + if (additionalQAplots) { + histos.fill(HIST("MultCalib/centglopi_before"), multiplicity, dTracks1.size()); // centrality vs global tracks before the multiplicity calibration cuts + histos.fill(HIST("MultCalib/GloPVpi_before"), dTracks1.size(), collision.multNTracksPV()); // global tracks vs PV tracks before the multiplicity calibration cuts + } + + 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()); + } + } + + if (additionalQAplots) { + histos.fill(HIST("MultCalib/centglopi_after"), multiplicity, dTracks1.size()); // centrality vs global tracks after the multiplicity calibration cuts + histos.fill(HIST("MultCalib/GloPVpi_after"), dTracks1.size(), collision.multNTracksPV()); // global tracks vs PV tracks after the multiplicity calibration cuts + } + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + 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 (!trackCut(trk1) || !casctrackCut(trk2)) + continue; + + auto isTrk1hasTOF = trk1.hasTOF(); + // auto isTrk2hasTOF = trk2.hasTOF(); // Can't use TPC, TOF info. for cascades yet!! + + auto trk1ptPi = trk1.pt(); + auto trk1NSigmaPiTPC = trk1.tpcNSigmaPi(); + auto trk1NSigmaPiTOF = (isTrk1hasTOF) ? trk1.tofNSigmaPi() : -999.; + + auto trk2ptXi = trk2.pt(); + + if constexpr (!IsMix) { + //// QA plots before the selection + // --- PID QA Pion + if (PIDplots) { + histos.fill(HIST("QAbefore/TPC_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAbefore/TOF_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + histos.fill(HIST("QAbefore/TOF_TPC_Map_pi_first_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + } + } + + 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()); + } + + if (cUseOnlyTOFTrackPionFirst && !isTrk1hasTOF) + continue; + + // if (cUseOnlyTOFTrackPr && !isTrk2hasTOF) // Can't use TPC, TOF info. for cascades yet!! + // continue; + if (!selectionPIDPionFirst(trk1)) + continue; + + // if (!selectionPIDCascades(trk2)) // Can't use TPC, TOF info. for cascades yet!! + // 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 Pion + if (PIDplots) { + histos.fill(HIST("QAafter/TPC_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAafter/TOF_Nsigma_pi_first_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + histos.fill(HIST("QAafter/TOF_TPC_Map_pi_first_all"), trk1NSigmaPiTOF, trk1NSigmaPiTPC); + } + } + + 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(trk1.pt(), trk1.eta(), trk1.phi(), massPi); + lDecayDaughter2.SetPtEtaPhiM(trk2.pt(), trk2.eta(), trk2.phi(), trk2.mXi()); + lResonance = lDecayDaughter1 + lDecayDaughter2; + + 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; + } + + if (trk1.sign() * trk2.sign() < 0) { + + if constexpr (!IsMix) { + if (study_antiparticle) { + if (trk1.sign() > 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassDS"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassDS"), multiplicity, lResonance.Pt(), lResonance.M(), kData); + } else if (trk1.sign() < 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassDSAnti"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassDSAnti"), multiplicity, lResonance.Pt(), lResonance.M(), kData); + } + } else { + if (invmass1D) + histos.fill(HIST("Xi1530invmassDS"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassDS"), multiplicity, lResonance.Pt(), lResonance.M(), kData); + } + } else { + if (invmass1D) + histos.fill(HIST("Xi1530invmassME"), lResonance.M()); + if (trk1.sign() > 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassME_DS"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassME_DS"), multiplicity, lResonance.Pt(), lResonance.M(), kMixing); + } else if (trk1.sign() < 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassME_DSAnti"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassME_DSAnti"), multiplicity, lResonance.Pt(), lResonance.M(), kMixing); + } + histos.fill(HIST("h3Xi1530invmassME"), multiplicity, lResonance.Pt(), lResonance.M(), kMixing); + } + + if constexpr (IsMC) { + if (abs(trk1.pdgCode()) != 211 || abs(trk2.pdgCode()) != 3312) + continue; + if (trk1.motherId() != trk2.motherId()) + continue; + if (abs(trk2.motherPDG()) != 3324) + 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_all"), multiplicity, trk1ptPi, trk1NSigmaPiTPC); + if (isTrk1hasTOF) { + histos.fill(HIST("QAMCTrue/TOF_Nsigma_pi_all"), multiplicity, trk1ptPi, trk1NSigmaPiTOF); + } + + // MC histograms + if (trk2.motherPDG() > 0) { + histos.fill(HIST("Xi1530Rec"), lResonance.Pt(), multiplicity); + histos.fill(HIST("Xi1530Recinvmass"), lResonance.M()); + histos.fill(HIST("h3RecXi1530invmass"), multiplicity, lResonance.Pt(), lResonance.M(), kMCReco); + } else { + histos.fill(HIST("Xi1530RecAnti"), lResonance.Pt(), multiplicity); + histos.fill(HIST("Xi1530Recinvmass"), lResonance.M()); + histos.fill(HIST("h3RecXi1530invmassAnti"), multiplicity, lResonance.Pt(), lResonance.M(), kMCReco); + } + } + + } else { + if constexpr (!IsMix) { + if (study_antiparticle) { + if (trk1.sign() < 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassLS"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassLS"), multiplicity, lResonance.Pt(), lResonance.M(), kLS); + } else if (trk1.sign() > 0) { + if (invmass1D) + histos.fill(HIST("Xi1530invmassLSAnti"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassLSAnti"), multiplicity, lResonance.Pt(), lResonance.M(), kLS); + } + } else { + if (invmass1D) + histos.fill(HIST("Xi1530invmassLS"), lResonance.M()); + histos.fill(HIST("h3Xi1530invmassLS"), multiplicity, lResonance.Pt(), lResonance.M(), 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() || (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 (abs(part.pdgCode()) != 3324 || abs(part.y()) >= 0.5) + continue; + bool pass1 = abs(part.daughterPDG1()) == 211 || abs(part.daughterPDG2()) == 211; + bool pass2 = abs(part.daughterPDG1()) == 3312 || abs(part.daughterPDG2()) == 3312; + + 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 4873d3e6b1b..660c7ce8610 100644 --- a/PWGLF/Tasks/Strangeness/CMakeLists.txt +++ b/PWGLF/Tasks/Strangeness/CMakeLists.txt @@ -16,7 +16,7 @@ o2physics_add_dpl_workflow(hyperon-reco-test o2physics_add_dpl_workflow(derivedlambdakzeroanalysis SOURCES derivedlambdakzeroanalysis.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(lambdakzeroanalysis-mc @@ -94,6 +94,11 @@ o2physics_add_dpl_workflow(lambdapolarization PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(lambdapolsp + SOURCES lambdapolsp.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(strangeness-in-jets SOURCES strangeness_in_jets.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore @@ -102,4 +107,19 @@ o2physics_add_dpl_workflow(strangeness-in-jets o2physics_add_dpl_workflow(v0topologicalcuts SOURCES v0topologicalcuts.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME Analysis) \ No newline at end of file + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(v0ptinvmassplots + SOURCES v0ptinvmassplots.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(strange-yield-pbpb + SOURCES strange-yield-pbpb.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(lambdak0sflattenicity + SOURCES lambdak0sflattenicity.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx index 2d02d8c2111..c9ff1f74f88 100644 --- a/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx +++ b/PWGLF/Tasks/Strangeness/cascadecorrelations.cxx @@ -281,6 +281,7 @@ struct cascadeCorrelations { 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"}; // initialize efficiency maps TH1D* hEffXiMin; @@ -318,6 +319,9 @@ struct cascadeCorrelations { {"hMassXiPlus", "hMassXiPlus", {HistType::kTH2F, {invMassAxis, ptAxis}}}, {"hMassOmegaMinus", "hMassOmegaMinus", {HistType::kTH2F, {invMassAxis, ptAxis}}}, {"hMassOmegaPlus", "hMassOmegaPlus", {HistType::kTH2F, {invMassAxis, ptAxis}}}, + // efficiency corrected inv mass + {"hMassXiEffCorrected", "hMassXiEffCorrected", {HistType::kTHnSparseF, {invMassAxis, ptAxis, rapidityAxis, vertexAxis, multiplicityAxis}}, true}, + {"hMassOmegaEffCorrected", "hMassOmegaEffCorrected", {HistType::kTHnSparseF, {invMassAxis, ptAxis, rapidityAxis, vertexAxis, multiplicityAxis}}, true}, // basic selection variables {"hV0Radius", "hV0Radius", {HistType::kTH1F, {{1000, 0.0f, 100.0f, "cm"}}}}, @@ -337,21 +341,21 @@ struct cascadeCorrelations { {"hAutoCorrelationOS", "hAutoCorrelationOS", {HistType::kTH1I, {{2, -1.f, 1.f, "Charge of OS autocorrelated track"}}}}, {"hPhi", "hPhi", {HistType::kTH1F, {{100, 0, 2 * PI, "#varphi"}}}}, {"hEta", "hEta", {HistType::kTH1F, {{100, -2, 2, "#eta"}}}}, - {"hRapidityXi", "hRapidityXi", {HistType::kTH1F, {{100, -2, 2, "y"}}}}, - {"hRapidityOmega", "hRapidityOmega", {HistType::kTH1F, {{100, -2, 2, "y"}}}}, + {"hRapidityXi", "hRapidityXi", {HistType::kTH1F, {rapidityAxis}}}, + {"hRapidityOmega", "hRapidityOmega", {HistType::kTH1F, {rapidityAxis}}}, // correlation histos {"hDeltaPhiSS", "hDeltaPhiSS", {HistType::kTH1F, {deltaPhiAxis}}}, {"hDeltaPhiOS", "hDeltaPhiOS", {HistType::kTH1F, {deltaPhiAxis}}}, - {"hXiXiOS", "hXiXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"hXiXiSS", "hXiXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"hXiOmOS", "hXiOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"hXiOmSS", "hXiOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"hOmXiOS", "hOmXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"hOmXiSS", "hOmXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"hOmOmOS", "hOmOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"hOmOmSS", "hOmOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, + {"hXiXiOS", "hXiXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"hXiXiSS", "hXiXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"hXiOmOS", "hXiOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"hXiOmSS", "hXiOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"hOmXiOS", "hOmXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"hOmXiSS", "hOmXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"hOmOmOS", "hOmOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"hOmOmSS", "hOmOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, // Mixed events {"MixedEvents/hMEVz1", "hMEVz1", {HistType::kTH1F, {vertexAxis}}}, @@ -360,14 +364,14 @@ struct cascadeCorrelations { {"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/hMEXiXiOS", "hMEXiXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"MixedEvents/hMEXiXiSS", "hMEXiXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"MixedEvents/hMEXiOmOS", "hMEXiOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"MixedEvents/hMEXiOmSS", "hMEXiOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"MixedEvents/hMEOmXiOS", "hMEOmXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"MixedEvents/hMEOmXiSS", "hMEOmXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"MixedEvents/hMEOmOmOS", "hMEOmOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, - {"MixedEvents/hMEOmOmSS", "hMEOmOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}}, + {"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}, + {"MixedEvents/hMEXiOmOS", "hMEXiOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"MixedEvents/hMEXiOmSS", "hMEXiOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"MixedEvents/hMEOmXiOS", "hMEOmXiOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"MixedEvents/hMEOmXiSS", "hMEOmXiSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"MixedEvents/hMEOmOmOS", "hMEOmOmOS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, + {"MixedEvents/hMEOmOmSS", "hMEOmOmSS", {HistType::kTHnSparseF, {deltaPhiAxis, deltaYAxis, ptAxis, ptAxis, invMassAxis, invMassAxis, vertexAxis, multiplicityAxis}}, true}, }, }; @@ -392,22 +396,29 @@ struct cascadeCorrelations { return; } + double weight; // Some QA on the cascades for (auto& 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()); + weight = 1. / getEfficiency(hEffXiMin, casc.pt()); } else { registry.fill(HIST("hMassXiPlus"), casc.mXi(), casc.pt()); + weight = 1. / getEfficiency(hEffXiPlus, casc.pt()); } + registry.fill(HIST("hMassXiEffCorrected"), casc.mXi(), casc.pt(), casc.yXi(), collision.posZ(), collision.multFT0M(), weight); registry.fill(HIST("hRapidityXi"), casc.yXi()); } if (casc.isSelected() >= 2) { // consistent with Omega or both if (casc.sign() < 0) { registry.fill(HIST("hMassOmegaMinus"), casc.mOmega(), casc.pt()); + weight = 1. / getEfficiency(hEffOmegaMin, casc.pt()); } else { registry.fill(HIST("hMassOmegaPlus"), casc.mOmega(), casc.pt()); + weight = 1. / getEfficiency(hEffOmegaPlus, casc.pt()); } + registry.fill(HIST("hMassOmegaEffCorrected"), casc.mOmega(), casc.pt(), casc.yOmega(), collision.posZ(), collision.multFT0M(), weight); registry.fill(HIST("hRapidityOmega"), casc.yOmega()); } registry.fill(HIST("hV0Radius"), casc.v0radius()); diff --git a/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedcascadeanalysis.cxx index 861f820e157..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 @@ -45,151 +58,179 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; +using dauTracks = soa::Join; +using cascMCCandidates = soa::Join; + struct derivedCascadeAnalysis { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - Configurable 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 axisXiMass{"axisXiMass", {200, 1.222f, 1.422f}, ""}; - ConfigurableAxis axisOmegaMass{"axisOmegaMass", {200, 1.572f, 1.772f}, ""}; + 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 isMC{"isMC", false, "MC data are processed"}; - Configurable doBefSelCheck{"doBefSelCheck", false, "Fill mass histograms of all candidates before selections"}; - Configurable doPtDepCutStudy{"doPtDepCutStudy", false, "Fill histogram with a cutting paramer"}; - 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 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"}; + 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; static constexpr std::string_view Index[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; static constexpr float centralityIntervals[11] = {0., 5., 10., 20., 30., 40., 50., 60., 70., 80., 90.}; + static constexpr std::string_view charge[] = {"Positive", "Negative"}; + static constexpr std::string_view selectionNames[] = {"BachelorBaryonDCA", "DCAV0ToPV", "V0Radius", "CascadeRadius", "DCAV0Daughters", "DCACascDaughters", "V0pa", "CascPA", "DCABachelorToPV", "DCAMesonToPV", "DCABaryonToPV", "CascadeProperLifeTime"}; + + // For manual sliceBy + // Preslice> perMcCollision = aod::v0data::straMCCollisionId; + PresliceUnsorted> perMcCollision = aod::v0data::straMCCollisionId; void init(InitContext const&) { histos.add("hEventVertexZ", "hEventVertexZ", kTH1F, {vertexZ}); histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{101, 0, 101}}); - histos.add("hEventSelection", "hEventSelection", kTH1F, {{13, 0, 13}}); - 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 @@ -202,12 +243,16 @@ struct derivedCascadeAnalysis { histos.get(HIST("hCutValue"))->GetXaxis()->SetBinLabel(i, CutLabel[i - 1]); } - histos.add("InvMassAfterSel/hNegativeCascade", "hNegativeCascade", HistType::kTH3F, {axisPt, axisXiMass, {101, 0, 101}}); - histos.add("InvMassAfterSel/hPositiveCascade", "hPositiveCascade", {HistType::kTH3F, {axisPt, axisXiMass, {101, 0, 101}}}); + 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) { - histos.add("InvMassAfterSelCent1/hNegativeCascade", "hNegativeCascade", HistType::kTH3F, {axisPt, axisXiMass, axisOccupancy}); - histos.add("InvMassAfterSelCent1/hPositiveCascade", "hPositiveCascade", HistType::kTH3F, {axisPt, axisXiMass, axisOccupancy}); + 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/"); @@ -219,118 +264,88 @@ struct derivedCascadeAnalysis { histos.addClone("InvMassAfterSelCent1/", "InvMassAfterSelCent10/"); } - if (!isXi) { - histos.get(HIST("InvMassAfterSel/hNegativeCascade"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("InvMassAfterSel/hPositiveCascade"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } - - if (doBefSelCheck) + if (qaFlags.doBefSelCheck) histos.addClone("InvMassAfterSel/", "InvMassBefSel/"); - if (isMC) + if (doprocessCascadesMCrec) histos.addClone("InvMassAfterSel/", "InvMassAfterSelMCrecTruth/"); - if (doPtDepCutStudy && !doProperLifeTimeCut) { - histos.add("PtDepCutStudy/hNegativeCascadeProperLifeTime", "hNegativeCascadeProperLifeTime", HistType::kTH3F, {axisPt, axisXiMass, {100, 0, 10}}); - histos.add("PtDepCutStudy/hPositiveCascadeProperLifeTime", "hPositiveCascadeProperLifeTime", {HistType::kTH3F, {axisPt, axisXiMass, {100, 0, 10}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeCascadeProperLifeTime"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveCascadeProperLifeTime"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeBachelorBaryonDCA", "hNegativeBachelorBaryonDCA", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}); - histos.add("PtDepCutStudy/hPositiveBachelorBaryonDCA", "hPositiveBachelorBaryonDCA", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeBachelorBaryonDCA"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveBachelorBaryonDCA"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeDCAV0ToPV", "hNegativeDCAV0ToPV", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}); - histos.add("PtDepCutStudy/hPositiveDCAV0ToPV", "hPositiveDCAV0ToPV", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 1}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeDCAV0ToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveDCAV0ToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeV0Radius", "hNegativeV0Radius", HistType::kTH3F, {axisPt, axisXiMass, {20, 0, 10}}); - histos.add("PtDepCutStudy/hPositiveV0Radius", "hPositiveV0Radius", {HistType::kTH3F, {axisPt, axisXiMass, {20, 0, 10}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeV0Radius"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveV0Radius"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeCascadeRadius", "hNegativeCascadeRadius", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}); - histos.add("PtDepCutStudy/hPositiveCascadeRadius", "hPositiveCascadeRadius", {HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeCascadeRadius"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveCascadeRadius"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeDCAV0Daughters", "hNegativeDCAV0Daughters", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}); - histos.add("PtDepCutStudy/hPositiveDCAV0Daughters", "hPositiveDCAV0Daughters", {HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 5}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeDCAV0Daughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveDCAV0Daughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeDCACascDaughters", "hNegativeDCACascDaughters", {HistType::kTH3F, {axisPt, axisXiMass, {20, 0, 1}}}); - histos.add("PtDepCutStudy/hPositiveDCACascDaughters", "hPositiveDCACascDaughters", {HistType::kTH3F, {axisPt, axisXiMass, {20, 0, 1}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hPositiveDCACascDaughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hNegativeDCACascDaughters"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeV0pa", "hNegativeV0pa", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}); - histos.add("PtDepCutStudy/hPositiveV0pa", "hPositiveV0pa", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeV0pa"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveV0pa"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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) { - histos.add("PtDepCutStudy/hNegativeDCABachelorToPV", "hNegativeDCABachelorToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); - histos.add("PtDepCutStudy/hNegativeDCABaryonToPV", "hNegativeDCABaryonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); - histos.add("PtDepCutStudy/hNegativeDCAMesonToPV", "hNegativeDCAMesonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); - histos.add("PtDepCutStudy/hPositiveDCABachelorToPV", "hPositiveDCABachelorToPV", {HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}}); - histos.add("PtDepCutStudy/hPositiveDCABaryonToPV", "hPositiveDCABaryonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); - histos.add("PtDepCutStudy/hPositiveDCAMesonToPV", "hPositiveDCAMesonToPV", HistType::kTH3F, {axisPt, axisXiMass, {50, 0, 0.5}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeDCABachelorToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hNegativeDCABaryonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hNegativeDCAMesonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveDCABachelorToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveDCABaryonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveDCAMesonToPV"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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}}); + histos.add("PtDepCutStudy/hPositiveDCABachelorToPV", "hPositiveDCABachelorToPV", {HistType::kTH3F, {axisPt, axisMass, {50, 0, 0.5}}}); + histos.add("PtDepCutStudy/hPositiveDCABaryonToPV", "hPositiveDCABaryonToPV", HistType::kTH3F, {axisPt, axisMass, {50, 0, 0.5}}); + histos.add("PtDepCutStudy/hPositiveDCAMesonToPV", "hPositiveDCAMesonToPV", HistType::kTH3F, {axisPt, axisMass, {50, 0, 0.5}}); } - if (doPtDepCutStudy && !doCascadeCosPaCut) { - histos.add("PtDepCutStudy/hNegativeCascPA", "hNegativeCascPA", HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}); - histos.add("PtDepCutStudy/hPositiveCascPA", "hPositiveCascPA", {HistType::kTH3F, {axisPt, axisXiMass, {40, 0, 0.4}}}); - if (!isXi) { - histos.get(HIST("PtDepCutStudy/hNegativeCascPA"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("PtDepCutStudy/hPositiveCascPA"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + 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}}}); } - if (isMC) { + if (doprocessCascadesMCrec) { histos.addClone("PtDepCutStudy/", "PtDepCutStudyMCTruth/"); - histos.add("hNegativeCascadePtForEfficiency", "hNegativeCascadePtForEfficiency", HistType::kTH3F, {axisPt, axisXiMass, {101, 0, 101}}); - histos.add("hPositiveCascadePtForEfficiency", "hPositiveCascadePtForEfficiency", {HistType::kTH3F, {axisPt, axisXiMass, {101, 0, 101}}}); - if (!isXi) { - histos.get(HIST("hNegativeCascadePtForEfficiency"))->GetYaxis()->Set(200, 1.572f, 1.772f); - histos.get(HIST("hPositiveCascadePtForEfficiency"))->GetYaxis()->Set(200, 1.572f, 1.772f); - } + histos.add("hNegativeCascadePtForEfficiency", "hNegativeCascadePtForEfficiency", HistType::kTH3F, {axisPt, axisMass, {101, 0, 101}}); + histos.add("hPositiveCascadePtForEfficiency", "hPositiveCascadePtForEfficiency", {HistType::kTH3F, {axisPt, axisMass, {101, 0, 101}}}); + } + + if (doprocessCascadesMCforEff) { + histos.add("hGenEvents", "", HistType::kTH2F, {{axisNch}, {2, 0, 2}}); + histos.add("hCentralityVsMultMC", "", kTH2F, {{101, 0.0f, 101.0f}, axisNch}); + + histos.add("hCentralityVsNcoll_beforeEvSel", "", kTH2F, {{101, 0.0f, 101.0f}, {50, 0.f, 50.f}}); + histos.add("hCentralityVsNcoll_afterEvSel", "", kTH2F, {{101, 0.0f, 101.0f}, {50, 0.f, 50.f}}); + + histos.add("h2dGenXiMinus", "h2dGenXiMinus", kTH2D, {{101, 0.0f, 101.0f}, axisPt}); + histos.add("h2dGenXiPlus", "h2dGenXiPlus", kTH2D, {{101, 0.0f, 101.0f}, axisPt}); + 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}); + histos.add("h2dGenOmegaPlusVsMultMC", "h2dGenOmegaPlusVsMultMC", kTH2D, {axisNch, axisPt}); } } template @@ -340,183 +355,228 @@ 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; } return true; } + template - bool IsEventAccepted(TCollision coll, bool sel) + bool IsEventAccepted(TCollision coll, bool fillHists) { - histos.fill(HIST("hEventSelection"), 0.5 /* all collisions */); + 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 (isMC) { - if (!coll.selection_bit(aod::evsel::kIsTriggerTVX)) { - return false; - } - histos.fill(HIST("hEventSelection"), 1.5 /* MB trigger*/); - if (TMath::Abs(coll.posZ()) > zVertexCut) { - return false; - } + if (eventSelectionFlags.doTriggerTVXEventCut && !coll.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 1.5 /* collisions after sel*/); - histos.fill(HIST("hEventSelection"), 2.5 /* collisions after sel pvz sel*/); + if (eventSelectionFlags.doTriggerSel8EventCut && !coll.sel8()) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 2.5 /* collisions after sel*/); - if (doTFeventCut && !coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - return false; - } - histos.fill(HIST("hEventSelection"), 3.5 /* Not at TF border */); - if (doITSFrameBorderCut && !coll.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - return false; - } - histos.fill(HIST("hEventSelection"), 4.5 /* Not at ITS ROF border */); - } else { - if (!sel) { - return false; - } - histos.fill(HIST("hEventSelection"), 1.5 /* collisions after sel*/); - if (TMath::Abs(coll.posZ()) > zVertexCut) { - return false; - } + if (TMath::Abs(coll.posZ()) > eventSelectionFlags.zVertexCut) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 3.5 /* collisions after sel pvz sel*/); - histos.fill(HIST("hEventSelection"), 2.5 /* collisions after sel pvz sel*/); + if (coll.centFT0C() > centMax || coll.centFT0C() < centMin) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 4.5 /* collisions after centrality sel*/); - if (coll.centFT0C() > centMax || coll.centFT0C() < centMin) { - return false; - } + 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 */); - histos.fill(HIST("hEventSelection"), 3.5 /* collisions after centrality sel*/); + 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 (doSameBunchPileUpEventCut && !coll.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return false; - } - histos.fill(HIST("hEventSelection"), 4.5 /* Not same Bunch pile up */); + 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 (doGoodPVFT0EventCut && !coll.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return false; - } - histos.fill(HIST("hEventSelection"), 5.5 /* No large vertexZ difference from tracks and FT0*/); + 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 (doITSTPCvertexEventCut && !coll.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return false; - } - histos.fill(HIST("hEventSelection"), 6.5 /* At least one ITS-TPC track in the event*/); + 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 (doVertexTOFmatch && !coll.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { - return false; - } - histos.fill(HIST("hEventSelection"), 7.5 /* At least one of vertex contributors is matched to TOF*/); + 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 (doVertexTRDmatch && !coll.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { - return false; - } - histos.fill(HIST("hEventSelection"), 8.5 /* At least one of vertex contributors is matched to TRD*/); + 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 (doITSFrameBorderCut && !coll.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + 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; - } - histos.fill(HIST("hEventSelection"), 9.5 /* Not at ITS ROF border */); - - if (doTFeventCut && !coll.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + if (coll.multNTracksPVeta1() < (3703 * TMath::Exp(-0.0455483 * coll.centFT0C()) - 150) || coll.multNTracksPVeta1() > (4937.33 * TMath::Exp(-0.0372668 * coll.centFT0C()) + 20)) return false; - } - histos.fill(HIST("hEventSelection"), 10.5 /* Not at TF border */); - - if (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)) - return false; - } - histos.fill(HIST("hEventSelection"), 11.5 /* Remove outlyers */); } + 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, dtime +/- 10 μs */); - histos.fill(HIST("hEventSelection"), 12.5 /* Rejection of events too close in time */); + if (eventSelectionFlags.doTimeRangeStandardCut && !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + if (fillHists) + 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(); - histos.fill(HIST("hOccupancyVsCentrality"), occupancy, coll.centFT0C()); - histos.fill(HIST("hEventCentrality"), coll.centFT0C()); - histos.fill(HIST("hEventVertexZ"), coll.posZ()); - histos.fill(HIST("hEventNchCorrelationAfCuts"), coll.multNTracksPVeta1(), coll.multNTracksGlobal()); - histos.fill(HIST("hEventPVcontributorsVsCentrality"), coll.centFT0C(), coll.multNTracksPVeta1()); - histos.fill(HIST("hEventGlobalTracksVsCentrality"), coll.centFT0C(), coll.multNTracksGlobal()); + if (minOccupancy > 0 && occupancy < minOccupancy) { + return false; + } + if (fillHists) + histos.fill(HIST("hEventSelection"), 15.5 /* Below min occupancy */); + if (maxOccupancy > 0 && occupancy > maxOccupancy) { + return false; + } + 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("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()); + histos.fill(HIST("hEventPVcontributorsVsCentrality"), coll.centFT0C(), coll.multNTracksPVeta1()); + histos.fill(HIST("hEventGlobalTracksVsCentrality"), coll.centFT0C(), coll.multNTracksGlobal()); + } + return true; } 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); @@ -524,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); @@ -592,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 { @@ -636,7 +696,7 @@ struct derivedCascadeAnalysis { void processCascades(soa::Join::iterator const& coll, soa::Join const& Cascades, soa::Join const&) { - if (!IsEventAccepted(coll, coll.sel8())) + if (!IsEventAccepted(coll, true)) return; for (auto& casc : Cascades) { @@ -644,17 +704,27 @@ struct derivedCascadeAnalysis { int counter = -1; histos.fill(HIST("hCandidate"), ++counter); + bool isNegative = false; + bool isPositive = false; + if (casc.sign() > 0) + isPositive = true; + if (casc.sign() < 0) + isNegative = true; + if (!isNegative && !isPositive) + continue; + double invmass; if (isXi) invmass = casc.mXi(); else invmass = casc.mOmega(); // To have trace of how it was before selections - if (casc.sign() < 0 && doBefSelCheck) { - histos.fill(HIST("InvMassBefSel/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); - } - if (casc.sign() > 0 && doBefSelCheck) { - histos.fill(HIST("InvMassBefSel/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); + + if (qaFlags.doBefSelCheck) { + if (isPositive) + histos.fill(HIST("InvMassBefSel/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), invmass, coll.centFT0C()); + if (isNegative) + histos.fill(HIST("InvMassBefSel/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), invmass, coll.centFT0C()); } if (!IsCascadeCandidateAccepted(casc, counter, coll.centFT0C())) @@ -673,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 { @@ -698,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 { @@ -736,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 { @@ -759,178 +829,200 @@ 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 { ++counter; } } + if (isPositive) + histos.fill(HIST("InvMassAfterSel/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), invmass, coll.centFT0C()); + if (isNegative) + histos.fill(HIST("InvMassAfterSel/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), invmass, coll.centFT0C()); + + 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, occupancy); + if (isNegative) + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), invmass, occupancy); + } + }); + } - if (casc.sign() < 0) { - histos.fill(HIST("InvMassAfterSel/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); - if (doOccupancyCheck) { - static_for<0, 9>([&](auto i) { - constexpr int index = i.value; - if (coll.centFT0C() < centralityIntervals[index + 1] && coll.centFT0C() > centralityIntervals[index]) { - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/hNegativeCascade"), casc.pt(), invmass, coll.trackOccupancyInTimeRange()); - } - }); - } - if (!doBachelorBaryonCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); - if (!doDCAV0ToPVCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); - if (!doV0RadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeV0Radius"), casc.pt(), invmass, casc.v0radius()); - if (!doCascadeRadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeCascadeRadius"), casc.pt(), invmass, casc.cascradius()); - if (!doDCAV0DauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); - if (!doDCACascadeDauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); - if (!doV0CosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeV0pa"), casc.pt(), invmass, TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z()))); - if (!doCascadeCosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); - if (!doDCAdauToPVCut && doPtDepCutStudy) { - histos.fill(HIST("PtDepCutStudy/hNegativeDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); - histos.fill(HIST("PtDepCutStudy/hNegativeDCAMesonToPV"), casc.pt(), invmass, casc.dcanegtopv()); - histos.fill(HIST("PtDepCutStudy/hNegativeDCABaryonToPV"), casc.pt(), invmass, casc.dcapostopv()); - } - if (!doProperLifeTimeCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeCascadeProperLifeTime"), casc.pt(), invmass, ctau); - } else { - histos.fill(HIST("InvMassAfterSel/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); - if (doOccupancyCheck) { - static_for<0, 9>([&](auto i) { - constexpr int index = i.value; - if (coll.centFT0C() < centralityIntervals[index + 1] && coll.centFT0C() > centralityIntervals[index]) { - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/hPositiveCascade"), casc.pt(), invmass, coll.trackOccupancyInTimeRange()); - } - }); - } - if (!doBachelorBaryonCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); - if (!doDCAV0ToPVCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); - if (!doV0RadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveV0Radius"), casc.pt(), invmass, casc.v0radius()); - if (!doCascadeRadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveCascadeRadius"), casc.pt(), invmass, casc.cascradius()); - if (!doDCAV0DauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); - if (!doDCACascadeDauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); - if (!doV0CosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveV0pa"), casc.pt(), invmass, TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z()))); - if (!doCascadeCosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); - if (!doDCAdauToPVCut && doPtDepCutStudy) { - histos.fill(HIST("PtDepCutStudy/hPositiveDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); - histos.fill(HIST("PtDepCutStudy/hPositiveDCAMesonToPV"), casc.pt(), invmass, casc.dcapostopv()); - histos.fill(HIST("PtDepCutStudy/hPositiveDCABaryonToPV"), casc.pt(), invmass, casc.dcanegtopv()); - } - if (!doProperLifeTimeCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveCascadeProperLifeTime"), casc.pt(), invmass, ctau); + float dcaMesonToPV = -10; + float dcaBaryonToPV = -10; + if (isPositive) { + dcaMesonToPV = casc.dcanegtopv(); + dcaBaryonToPV = casc.dcapostopv(); + } + if (isNegative) { + dcaBaryonToPV = casc.dcanegtopv(); + dcaMesonToPV = casc.dcapostopv(); + } + double selections[] = {casc.bachBaryonDCAxyToPV(), + TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z())), + casc.v0radius(), + casc.cascradius(), + casc.dcaV0daughters(), + casc.dcacascdaughters(), + TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), + casc.dcabachtopv(), + dcaMesonToPV, + dcaBaryonToPV, + ctau}; + 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]) { + if (isPositive) + histos.fill(HIST("PtDepCutStudy/h") + HIST(charge[0]) + HIST(selectionNames[index]), casc.pt(), invmass, selections[index]); + if (isNegative) + histos.fill(HIST("PtDepCutStudy/h") + HIST(charge[1]) + HIST(selectionNames[index]), casc.pt(), invmass, selections[index]); + } + }); } } } - void processCascadesMCrec(soa::Join::iterator const& coll, soa::Join const& Cascades, soa::Join const&) + void processCascadesMCrec(soa::Join::iterator const& coll, cascMCCandidates const& Cascades, dauTracks const&, soa::Join const&) //, , , soa::Join const& /*mccollisions*/, soa::Join const&) + // soa::Join const& Cascades, soa::Join const&) { - if (!IsEventAccepted(coll, coll.sel8())) + if (!IsEventAccepted(coll, true)) return; for (auto& casc : Cascades) { + float mass = -1; + if (isXi) + mass = casc.mXi(); + else + mass = casc.mOmega(); int counter = -1; histos.fill(HIST("hCandidate"), ++counter); + bool isNegative = false; + bool isPositive = false; + if (casc.sign() > 0) + isPositive = true; + if (casc.sign() < 0) + isNegative = true; + if (!isNegative && !isPositive) + continue; // To have trace of how it was before selections - if (casc.sign() < 0 && doBefSelCheck) { - if (isXi) - histos.fill(HIST("InvMassBefSel/hNegativeCascade"), casc.pt(), casc.mXi(), coll.centFT0C()); - else - histos.fill(HIST("InvMassBefSel/hNegativeCascade"), casc.pt(), casc.mOmega(), coll.centFT0C()); - } - if (casc.sign() > 0 && doBefSelCheck) { - if (isXi) - histos.fill(HIST("InvMassBefSel/hPositiveCascade"), casc.pt(), casc.mXi(), coll.centFT0C()); - else - histos.fill(HIST("InvMassBefSel/hPositiveCascade"), casc.pt(), casc.mOmega(), coll.centFT0C()); + if (qaFlags.doBefSelCheck) { + if (isPositive) + histos.fill(HIST("InvMassBefSel/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), mass, coll.centFT0C()); + if (isNegative) + histos.fill(HIST("InvMassBefSel/h") + HIST(charge[1]) + HIST("Cascade"), casc.pt(), mass, coll.centFT0C()); } + if (!casc.has_cascMCCore()) + continue; + auto cascMC = casc.cascMCCore_as>(); + + bool isTrueMCCascade = false; + bool isTrueMCCascadeDecay = false; + bool isCorrectLambdaDecay = false; + if (cascMC.isPhysicalPrimary() && ((isXi && std::abs(cascMC.pdgCode()) == 3312) || (!isXi && std::abs(cascMC.pdgCode()) == 3334))) + isTrueMCCascade = true; + if (isTrueMCCascade && ((isPositive && cascMC.pdgCodePositive() == 211 && cascMC.pdgCodeNegative() == -2212) || (isNegative && cascMC.pdgCodePositive() == 2212 && cascMC.pdgCodeNegative() == -211))) + isCorrectLambdaDecay = true; + if (isTrueMCCascade && isCorrectLambdaDecay && ((isXi && std::abs(cascMC.pdgCodeBachelor()) == 211) || (!isXi && std::abs(cascMC.pdgCodeBachelor()) == 321))) + isTrueMCCascadeDecay = true; + float ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); + if (!IsCascadeCandidateAccepted(casc, counter, coll.centFT0C())) continue; counter += 13; @@ -947,59 +1039,56 @@ 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 { ++counter; } - if (casc.sign() < 0) { - if (doFillNsigmaTPCHistProton) + if (isNegative) { + 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) - histos.fill(HIST("hNsigmaKaon"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - - } else if (casc.sign() > 0) { - if (doFillNsigmaTPCHistV0Pion) - histos.fill(HIST("hNsigmaPionPos"), posExtra.tpcNSigmaPi(), fullMomentumPosDaugh, coll.centFT0C()); - if (doFillNsigmaTPCHistProton) - histos.fill(HIST("hNsigmaProtonNeg"), negExtra.tpcNSigmaPr(), fullmomentumNegDaugh, coll.centFT0C()); - if (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; } + } + if (isPositive) { + if (qaFlags.doFillNsigmaTPCHistV0Pion) + histos.fill(HIST("hNsigmaPionPos"), posExtra.tpcNSigmaPi(), fullMomentumPosDaugh, coll.centFT0C()); + if (qaFlags.doFillNsigmaTPCHistProton) + histos.fill(HIST("hNsigmaProtonNeg"), negExtra.tpcNSigmaPr(), fullmomentumNegDaugh, coll.centFT0C()); + if (qaFlags.doFillNsigmaTPCHistPionBach && isXi) + histos.fill(HIST("hNsigmaPionPosBach"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); + if (qaFlags.doFillNsigmaTPCHistPionBach && !isXi) + histos.fill(HIST("hNsigmaKaon"), bachExtra.tpcNSigmaPi(), fullmomentumBachelor, coll.centFT0C()); - } 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 { @@ -1007,237 +1096,290 @@ 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 { ++counter; } - double invmass; float cascpos = std::hypot(casc.x() - coll.posX(), casc.y() - coll.posY(), casc.z() - coll.posZ()); float cascptotmom = std::hypot(casc.px(), casc.py(), casc.pz()); float ctau = -10; if (posExtra.hasTOF()) { - if (doNTOFSigmaProtonCut && casc.sign() < 0) { + 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 && casc.sign() > 0) { + 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 && casc.sign() > 0) { + 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 && casc.sign() < 0) { + 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); - if (doProperLifeTimeCut) { - if (ctau > proplifetime) - continue; - histos.fill(HIST("hCandidate"), ++counter); - } else { - ++counter; - } - - invmass = casc.mXi(); } 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) - continue; - histos.fill(HIST("hCandidate"), ++counter); - } else { - ++counter; - } - invmass = casc.mOmega(); } - if (casc.sign() < 0) { - histos.fill(HIST("InvMassAfterSel/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); - if (doOccupancyCheck) { - static_for<0, 9>([&](auto i) { - constexpr int index = i.value; - if (coll.centFT0C() < centralityIntervals[index + 1] && coll.centFT0C() > centralityIntervals[index]) { - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/hNegativeCascade"), casc.pt(), invmass, coll.trackOccupancyInTimeRange()); + if (candidateSelectionFlags.doProperLifeTimeCut) { + if (ctau > candidateSelectionValues.proplifetime) + continue; + histos.fill(HIST("hCandidate"), ++counter); + } else { + ++counter; + } + + if (isPositive) { + histos.fill(HIST("InvMassAfterSel/h") + HIST(charge[0]) + HIST("Cascade"), casc.pt(), mass, coll.centFT0C()); + if (isTrueMCCascadeDecay) + 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("hNegativeCascadePtForEfficiency"), ptmc, mass, coll.centFT0C()); + } + if (isTrueMCCascade) { + if (isPositive) + histos.fill(HIST("InvMassAfterSelMCrecTruth/h") + HIST(charge[0]) + HIST("Cascade"), ptmc, mass, coll.centFT0C()); + if (isNegative) + histos.fill(HIST("InvMassAfterSelMCrecTruth/h") + HIST(charge[1]) + HIST("Cascade"), ptmc, mass, coll.centFT0C()); + } + 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, occupancy); + if (isTrueMCCascadeDecay) + histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/h") + HIST(charge[0]) + HIST("CascadeMCTruth"), casc.pt(), mass, occupancy); } - }); - } - if (!doBachelorBaryonCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); - if (!doDCAV0ToPVCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); - if (!doV0RadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeV0Radius"), casc.pt(), invmass, casc.v0radius()); - if (!doCascadeRadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeCascadeRadius"), casc.pt(), invmass, casc.cascradius()); - if (!doDCAV0DauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); - if (!doDCACascadeDauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); - if (!doV0CosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeV0pa"), casc.pt(), invmass, TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z()))); - if (!doCascadeCosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); - if (!doDCAdauToPVCut && doPtDepCutStudy) { - histos.fill(HIST("PtDepCutStudy/hNegativeDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); - histos.fill(HIST("PtDepCutStudy/hNegativeDCAMesonToPV"), casc.pt(), invmass, casc.dcanegtopv()); - histos.fill(HIST("PtDepCutStudy/hNegativeDCABaryonToPV"), casc.pt(), invmass, casc.dcapostopv()); - } - if (!doProperLifeTimeCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hNegativeCascadeProperLifeTime"), casc.pt(), invmass, ctau); - if (casc.isPhysicalPrimary()) { - if ((isXi && casc.pdgCode() == 3312) || (!isXi && casc.pdgCode() == 3334)) { - histos.fill(HIST("InvMassAfterSelMCrecTruth/hNegativeCascade"), casc.pt(), invmass, coll.centFT0C()); - if (!doBachelorBaryonCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); - if (!doDCAV0ToPVCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); - if (!doV0RadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeV0Radius"), casc.pt(), invmass, casc.v0radius()); - if (!doCascadeRadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeCascadeRadius"), casc.pt(), invmass, casc.cascradius()); - if (!doDCAV0DauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); - if (!doDCACascadeDauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); - if (!doV0CosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeV0pa"), casc.pt(), invmass, TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z()))); - if (!doCascadeCosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); - if (!doDCAdauToPVCut && doPtDepCutStudy) { - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCAMesonToPV"), casc.pt(), invmass, casc.dcanegtopv()); - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeDCABaryonToPV"), casc.pt(), invmass, casc.dcapostopv()); + 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); } - if (!doProperLifeTimeCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hNegativeCascadeProperLifeTime"), casc.pt(), invmass, ctau); - if ((isXi && casc.pdgCodeV0() == 3122 && casc.pdgCodePositive() == 2212 && casc.pdgCodeNegative() == -211 && casc.pdgCodeBachelor() == -211) || (!isXi && casc.pdgCodeV0() == 3122 && casc.pdgCodePositive() == 2212 && casc.pdgCodeNegative() == -211 && casc.pdgCodeBachelor() == -321)) - histos.fill(HIST("hNegativeCascadePtForEfficiency"), casc.pt(), invmass, coll.centFT0C()); } - } - } else { - histos.fill(HIST("InvMassAfterSel/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); - if (doOccupancyCheck) { - static_for<0, 9>([&](auto i) { - constexpr int index = i.value; - if (coll.centFT0C() < centralityIntervals[index + 1] && coll.centFT0C() > centralityIntervals[index]) { - histos.fill(HIST("InvMassAfterSelCent") + HIST(Index[index]) + HIST("/hPositiveCascade"), casc.pt(), invmass, coll.trackOccupancyInTimeRange()); - } - }); - } - if (!doBachelorBaryonCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); - if (!doDCAV0ToPVCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); - if (!doV0RadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveV0Radius"), casc.pt(), invmass, casc.v0radius()); - if (!doCascadeRadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveCascadeRadius"), casc.pt(), invmass, casc.cascradius()); - if (!doDCAV0DauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); - if (!doDCACascadeDauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); - if (!doV0CosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveV0pa"), casc.pt(), invmass, TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z()))); - if (!doCascadeCosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); - if (!doDCAdauToPVCut && doPtDepCutStudy) { - histos.fill(HIST("PtDepCutStudy/hPositiveDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); - histos.fill(HIST("PtDepCutStudy/hPositiveDCAMesonToPV"), casc.pt(), invmass, casc.dcapostopv()); - histos.fill(HIST("PtDepCutStudy/hPositiveDCABaryonToPV"), casc.pt(), invmass, casc.dcanegtopv()); - } - if (!doProperLifeTimeCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudy/hPositiveCascadeProperLifeTime"), casc.pt(), invmass, ctau); - if (casc.isPhysicalPrimary()) { - if ((isXi && casc.pdgCode() == -3312) || (!isXi && casc.pdgCode() == -3334)) { - histos.fill(HIST("InvMassAfterSelMCrecTruth/hPositiveCascade"), casc.pt(), invmass, coll.centFT0C()); - if (!doBachelorBaryonCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveBachelorBaryonDCA"), casc.pt(), invmass, casc.bachBaryonDCAxyToPV()); - if (!doDCAV0ToPVCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCAV0ToPV"), casc.pt(), invmass, TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z()))); - if (!doV0RadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveV0Radius"), casc.pt(), invmass, casc.v0radius()); - if (!doCascadeRadiusCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveCascadeRadius"), casc.pt(), invmass, casc.cascradius()); - if (!doDCAV0DauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCAV0Daughters"), casc.pt(), invmass, casc.dcaV0daughters()); - if (!doDCACascadeDauCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCACascDaughters"), casc.pt(), invmass, casc.dcacascdaughters()); - if (!doV0CosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveV0pa"), casc.pt(), invmass, TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z()))); - if (!doCascadeCosPaCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveCascPA"), casc.pt(), invmass, TMath::ACos(casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()))); - if (!doDCAdauToPVCut && doPtDepCutStudy) { - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCABachelorToPV"), casc.pt(), invmass, casc.dcabachtopv()); - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCAMesonToPV"), casc.pt(), invmass, casc.dcapostopv()); - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveDCABaryonToPV"), casc.pt(), invmass, casc.dcanegtopv()); + }); + } + float dcaMesonToPV = -10; + float dcaBaryonToPV = -10; + if (isPositive) { + dcaMesonToPV = casc.dcanegtopv(); + dcaBaryonToPV = casc.dcapostopv(); + } + if (isNegative) { + dcaBaryonToPV = casc.dcanegtopv(); + dcaMesonToPV = casc.dcapostopv(); + } + double selections[] = {casc.bachBaryonDCAxyToPV(), + TMath::Abs(casc.dcav0topv(casc.x(), casc.y(), casc.z())), + casc.v0radius(), + casc.cascradius(), + casc.dcaV0daughters(), + casc.dcacascdaughters(), + TMath::ACos(casc.v0cosPA(casc.x(), casc.y(), casc.z())), + casc.dcabachtopv(), + dcaMesonToPV, + dcaBaryonToPV, + ctau}; + 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]) { + if (isPositive) + histos.fill(HIST("PtDepCutStudy/h") + HIST(charge[0]) + HIST(selectionNames[index]), casc.pt(), mass, selections[index]); + if (isNegative) + histos.fill(HIST("PtDepCutStudy/h") + HIST(charge[1]) + HIST(selectionNames[index]), casc.pt(), mass, selections[index]); + if (isTrueMCCascade) { + if (isPositive) + histos.fill(HIST("PtDepCutStudyMCTruth/h") + HIST(charge[0]) + HIST(selectionNames[index]), ptmc, mass, selections[index]); + if (isNegative) + histos.fill(HIST("PtDepCutStudyMCTruth/h") + HIST(charge[1]) + HIST(selectionNames[index]), ptmc, mass, selections[index]); } - if (!doProperLifeTimeCut && doPtDepCutStudy) - histos.fill(HIST("PtDepCutStudyMCTruth/hPositiveCascadeProperLifeTime"), casc.pt(), invmass, ctau); - if ((isXi && casc.pdgCodeV0() == -3122 && casc.pdgCodePositive() == 211 && casc.pdgCodeNegative() == -2212 && casc.pdgCodeBachelor() == 211) || (!isXi && casc.pdgCodeV0() == -3122 && casc.pdgCodePositive() == 211 && casc.pdgCodeNegative() == -2212 && casc.pdgCodeBachelor() == 321)) - histos.fill(HIST("hPositiveCascadePtForEfficiency"), casc.pt(), invmass, coll.centFT0C()); } + }); + } + } + } + void processCascadesMCforEff(soa::Join const& mcCollisions, soa::Join const& Cascades, soa::Join const& collisions) + { + + std::vector listBestCollisionIdx = fillGenEventHist(mcCollisions, collisions); + + for (auto const& cascMC : Cascades) { + if (!cascMC.has_straMCCollision()) + continue; + + if (!cascMC.isPhysicalPrimary()) + continue; + + float ptmc = RecoDecay::sqrtSumOfSquares(cascMC.pxMC(), cascMC.pyMC()); + float ymc = 1e3; + if (TMath::Abs(cascMC.pdgCode()) == 3312) + ymc = RecoDecay::y(std::array{cascMC.pxMC(), cascMC.pyMC(), cascMC.pzMC()}, o2::constants::physics::MassXiMinus); + 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) > 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); + } + } + } + // ______________________________________________________ + // 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.5 /* 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 (!IsEventAccepted(collision, false)) { + 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() + 0.5); + histos.fill(HIST("hCentralityVsNcoll_afterEvSel"), centrality, nCollisions + 0.5); + + histos.fill(HIST("hCentralityVsMultMC"), centrality, mcCollision.multMCNParticlesEta05()); + + if (atLeastOne) { + histos.fill(HIST("hGenEvents"), mcCollision.multMCNParticlesEta05(), 1.5 /* at least 1 rec. event*/); } } + return listBestCollisionIdx; } PROCESS_SWITCH(derivedCascadeAnalysis, processCascades, "cascade analysis, run3 data ", true); PROCESS_SWITCH(derivedCascadeAnalysis, processCascadesMCrec, "cascade analysis, run3 rec MC", false); + PROCESS_SWITCH(derivedCascadeAnalysis, processCascadesMCforEff, "cascade analysis, run3 rec MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx index 606fca84348..d287bd0f7aa 100644 --- a/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/derivedlambdakzeroanalysis.cxx @@ -39,9 +39,11 @@ #include "Framework/AnalysisDataModel.h" #include "Framework/ASoAHelpers.h" #include "ReconstructionDataFormats/Track.h" +#include "CommonConstants/MathConstants.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" @@ -50,6 +52,8 @@ #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" using namespace o2; using namespace o2::framework; @@ -58,9 +62,9 @@ using std::array; using dauTracks = soa::Join; using dauMCTracks = soa::Join; -using v0Candidates = soa::Join; +using v0Candidates = soa::Join; // using v0MCCandidates = soa::Join; -using v0MCCandidates = soa::Join; +using v0MCCandidates = soa::Join; // simple checkers, but ensure 64 bit integers #define bitset(var, nbit) ((var) |= (static_cast(1) << static_cast(nbit))) @@ -74,47 +78,63 @@ struct derivedlambdakzeroanalysis { Configurable analyseLambda{"analyseLambda", true, "process Lambda-like candidates"}; Configurable analyseAntiLambda{"analyseAntiLambda", true, "process AntiLambda-like candidates"}; Configurable calculateFeeddownMatrix{"calculateFeeddownMatrix", true, "fill feeddown matrix if MC"}; + + 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 v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; - - // Selection criteria: acceptance - Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; - Configurable daughterEtaCut{"daughterEtaCut", 0.8, "max eta for daughters"}; - - // Standard 5 topological criteria - Configurable v0cospa{"v0cospa", 0.97, "min V0 CosPA"}; - Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; - Configurable dcanegtopv{"dcanegtopv", .05, "min DCA Neg To PV (cm)"}; - Configurable dcapostopv{"dcapostopv", .05, "min DCA Pos To PV (cm)"}; - Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; - Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; - - // Additional selection on the AP plot (exclusive for K0Short) - // original equation: lArmPt*5>TMath::Abs(lArmAlpha) - Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; - - // Track quality - Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; - Configurable minITSclusters{"minITSclusters", -1, "minimum ITS clusters"}; - Configurable skipTPConly{"skipTPConly", false, "skip V0s comprised of at least one TPC only prong"}; - Configurable requirePosITSonly{"requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; - Configurable requireNegITSonly{"requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; - - // PID (TPC/TOF) - Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; - Configurable TofPidNsigmaCutLaPr{"TofPidNsigmaCutLaPr", 1e+6, "TofPidNsigmaCutLaPr"}; - Configurable TofPidNsigmaCutLaPi{"TofPidNsigmaCutLaPi", 1e+6, "TofPidNsigmaCutLaPi"}; - Configurable TofPidNsigmaCutK0Pi{"TofPidNsigmaCutK0Pi", 1e+6, "TofPidNsigmaCutK0Pi"}; + Configurable requireNoCollInTimeRangeStd{"requireNoCollInTimeRangeStd", false, "reject collisions corrupted by the cannibalism, with other collisions within +/- 2 microseconds or mult above a certain threshold in -4 - -2 microseconds"}; + Configurable requireNoCollInTimeRangeStrict{"requireNoCollInTimeRangeStrict", 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 +/- 2 microseconds"}; + Configurable requireNoCollInTimeRangeVzDep{"requireNoCollInTimeRangeVzDep", false, "reject collisions corrupted by the cannibalism, with other collisions with pvZ of drifting TPC tracks from past/future collisions within 2.5 cm the current pvZ"}; + 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 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"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + + struct : ConfigurableGroup { + Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + + // Selection criteria: acceptance + Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; + Configurable daughterEtaCut{"daughterEtaCut", 0.8, "max eta for daughters"}; + + // Standard 5 topological criteria + Configurable v0cospa{"v0cospa", 0.97, "min V0 CosPA"}; + Configurable dcav0dau{"dcav0dau", 1.0, "max DCA V0 Daughters (cm)"}; + Configurable dcanegtopv{"dcanegtopv", .05, "min DCA Neg To PV (cm)"}; + Configurable dcapostopv{"dcapostopv", .05, "min DCA Pos To PV (cm)"}; + Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + + // Additional selection on the AP plot (exclusive for K0Short) + // original equation: lArmPt*5>TMath::Abs(lArmAlpha) + Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + + // Track quality + Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; + Configurable minITSclusters{"minITSclusters", -1, "minimum ITS clusters"}; + Configurable skipTPConly{"skipTPConly", false, "skip V0s comprised of at least one TPC only prong"}; + Configurable requirePosITSonly{"requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; + Configurable requireNegITSonly{"requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; + + // PID (TPC/TOF) + Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 5, "TpcPidNsigmaCut"}; + Configurable TofPidNsigmaCutLaPr{"TofPidNsigmaCutLaPr", 1e+6, "TofPidNsigmaCutLaPr"}; + Configurable TofPidNsigmaCutLaPi{"TofPidNsigmaCutLaPi", 1e+6, "TofPidNsigmaCutLaPi"}; + Configurable TofPidNsigmaCutK0Pi{"TofPidNsigmaCutK0Pi", 1e+6, "TofPidNsigmaCutK0Pi"}; + + // PID (TOF) + Configurable maxDeltaTimeProton{"maxDeltaTimeProton", 1e+9, "check maximum allowed time"}; + Configurable maxDeltaTimePion{"maxDeltaTimePion", 1e+9, "check maximum allowed time"}; + } v0Selections; Configurable doCompleteTopoQA{"doCompleteTopoQA", false, "do topological variable QA histograms"}; Configurable doTPCQA{"doTPCQA", false, "do TPC QA histograms"}; @@ -126,17 +146,56 @@ struct derivedlambdakzeroanalysis { Configurable qaMaxPt{"qaMaxPt", 1000.0f, "maximum pT for QA plots"}; Configurable qaCentrality{"qaCentrality", false, "qa centrality flag: check base raw values"}; - // PID (TOF) - Configurable maxDeltaTimeProton{"maxDeltaTimeProton", 1e+9, "check maximum allowed time"}; - Configurable maxDeltaTimePion{"maxDeltaTimePion", 1e+9, "check maximum allowed time"}; - // for MC Configurable doMCAssociation{"doMCAssociation", true, "if MC, do MC association"}; Configurable doCollisionAssociationQA{"doCollisionAssociationQA", true, "check collision association"}; - // fast check on occupancy - Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; - Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + // 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; + + o2::ccdb::CcdbApi ccdbApi; + int mRunNumber; + std::map metadata; static constexpr float defaultLifetimeCuts[1][2] = {{30., 20.}}; Configurable> lifetimecut{"lifetimecut", {defaultLifetimeCuts[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecut"}; @@ -161,6 +220,8 @@ struct derivedlambdakzeroanalysis { ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; ConfigurableAxis axisTPCsignal{"axisTPCsignal", {200, 0.0f, 200.0f}, "TPC signal"}; ConfigurableAxis axisTOFdeltaT{"axisTOFdeltaT", {200, -5000.0f, 5000.0f}, "TOF Delta T (ps)"}; + ConfigurableAxis axisPhi{"axisPhi", {18, 0.0f, constants::math::TwoPI}, "Azimuth angle (rad)"}; + ConfigurableAxis axisEta{"axisEta", {10, -1.0f, 1.0f}, "#eta"}; // UPC axes ConfigurableAxis axisSelGap{"axisSelGap", {4, -1.5, 2.5}, "Gap side"}; @@ -168,11 +229,11 @@ struct derivedlambdakzeroanalysis { // UPC selections SGSelector sgSelector; struct : ConfigurableGroup { - Configurable FV0cut{"FV0cut", 100., "FV0A threshold"}; - Configurable FT0Acut{"FT0Acut", 200., "FT0A threshold"}; - Configurable FT0Ccut{"FT0Ccut", 100., "FT0C threshold"}; - Configurable ZDCcut{"ZDCcut", 10., "ZDC threshold"}; - // Configurable gapSel{"gapSel", 2, "Gap selection"}; + 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; // AP plot axes @@ -272,44 +333,44 @@ struct derivedlambdakzeroanalysis { // ask for specific TPC/TOF PID selections maskTrackProperties = 0; - if (requirePosITSonly) { + 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 (TpcPidNsigmaCut < 1e+5) { // safeguard for no cut + 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 (TofPidNsigmaCutK0Pi < 1e+5) // safeguard for no cut + if (v0Selections.TofPidNsigmaCutK0Pi < 1e+5) // safeguard for no cut maskK0ShortSpecific = maskK0ShortSpecific | (uint64_t(1) << selTOFNSigmaPositivePionK0Short) | (uint64_t(1) << selTOFDeltaTPositivePionK0Short); - if (TofPidNsigmaCutLaPr < 1e+5) // safeguard for no cut + if (v0Selections.TofPidNsigmaCutLaPr < 1e+5) // safeguard for no cut maskLambdaSpecific = maskLambdaSpecific | (uint64_t(1) << selTOFNSigmaPositiveProtonLambda) | (uint64_t(1) << selTOFDeltaTPositiveProtonLambda); - if (TofPidNsigmaCutLaPi < 1e+5) // safeguard for no cut + if (v0Selections.TofPidNsigmaCutLaPi < 1e+5) // safeguard for no cut maskAntiLambdaSpecific = maskAntiLambdaSpecific | (uint64_t(1) << selTOFNSigmaPositivePionLambda) | (uint64_t(1) << selTOFDeltaTPositivePionLambda); } - if (requireNegITSonly) { + 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 (TpcPidNsigmaCut < 1e+5) { // safeguard for no cut + 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 (TofPidNsigmaCutK0Pi < 1e+5) // safeguard for no cut + if (v0Selections.TofPidNsigmaCutK0Pi < 1e+5) // safeguard for no cut maskK0ShortSpecific = maskK0ShortSpecific | (uint64_t(1) << selTOFNSigmaNegativePionK0Short) | (uint64_t(1) << selTOFDeltaTNegativePionK0Short); - if (TofPidNsigmaCutLaPi < 1e+5) // safeguard for no cut + if (v0Selections.TofPidNsigmaCutLaPi < 1e+5) // safeguard for no cut maskLambdaSpecific = maskLambdaSpecific | (uint64_t(1) << selTOFNSigmaNegativePionLambda) | (uint64_t(1) << selTOFDeltaTNegativePionLambda); - if (TofPidNsigmaCutLaPr < 1e+5) // safeguard for no cut + if (v0Selections.TofPidNsigmaCutLaPr < 1e+5) // safeguard for no cut maskAntiLambdaSpecific = maskAntiLambdaSpecific | (uint64_t(1) << selTOFNSigmaNegativeProtonLambda) | (uint64_t(1) << selTOFDeltaTNegativeProtonLambda); } - if (skipTPConly) { + 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); @@ -337,9 +398,13 @@ struct derivedlambdakzeroanalysis { 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.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.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}}); histos.add("hCentralityVsNch", "hCentralityVsNch", kTH2F, {axisCentrality, axisNch}); @@ -349,6 +414,7 @@ struct derivedlambdakzeroanalysis { 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}); @@ -360,6 +426,7 @@ struct derivedlambdakzeroanalysis { // histograms versus mass if (analyseK0Short) { + histos.add("h2dNbrOfK0ShortVsCentrality", "h2dNbrOfK0ShortVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); histos.add("h3dMassK0Short", "h3dMassK0Short", kTH3F, {axisCentrality, axisPt, axisK0Mass}); // Non-UPC info histos.add("h3dMassK0ShortHadronic", "h3dMassK0ShortHadronic", kTH3F, {axisCentrality, axisPt, axisK0Mass}); @@ -405,6 +472,7 @@ struct derivedlambdakzeroanalysis { } } if (analyseLambda) { + histos.add("h2dNbrOfLambdaVsCentrality", "h2dNbrOfLambdaVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); histos.add("h3dMassLambda", "h3dMassLambda", kTH3F, {axisCentrality, axisPt, axisLambdaMass}); // Non-UPC info histos.add("h3dMassLambdaHadronic", "h3dMassLambdaHadronic", kTH3F, {axisCentrality, axisPt, axisLambdaMass}); @@ -450,6 +518,7 @@ struct derivedlambdakzeroanalysis { } } if (analyseAntiLambda) { + histos.add("h2dNbrOfAntiLambdaVsCentrality", "h2dNbrOfAntiLambdaVsCentrality", kTH2F, {axisCentrality, {10, -0.5f, 9.5f}}); histos.add("h3dMassAntiLambda", "h3dMassAntiLambda", kTH3F, {axisCentrality, axisPt, axisLambdaMass}); // Non-UPC info histos.add("h3dMassAntiLambdaHadronic", "h3dMassAntiLambdaHadronic", kTH3F, {axisCentrality, axisPt, axisLambdaMass}); @@ -512,6 +581,7 @@ struct derivedlambdakzeroanalysis { histos.add("K0Short/h4dDCADaughters", "h4dDCADaughters", kTHnF, {axisCentrality, axisPtCoarse, axisK0Mass, axisDCAdau}); histos.add("K0Short/h4dPointingAngle", "h4dPointingAngle", kTHnF, {axisCentrality, axisPtCoarse, axisK0Mass, axisPointingAngle}); histos.add("K0Short/h4dV0Radius", "h4dV0Radius", kTHnF, {axisCentrality, axisPtCoarse, axisK0Mass, axisV0Radius}); + histos.add("K0Short/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnF, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } if (analyseLambda) { histos.add("Lambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); @@ -519,6 +589,7 @@ struct derivedlambdakzeroanalysis { histos.add("Lambda/h4dDCADaughters", "h4dDCADaughters", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); histos.add("Lambda/h4dPointingAngle", "h4dPointingAngle", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); histos.add("Lambda/h4dV0Radius", "h4dV0Radius", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); + histos.add("Lambda/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnF, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } if (analyseAntiLambda) { histos.add("AntiLambda/h4dPosDCAToPV", "h4dPosDCAToPV", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAtoPV}); @@ -526,6 +597,7 @@ struct derivedlambdakzeroanalysis { histos.add("AntiLambda/h4dDCADaughters", "h4dDCADaughters", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisDCAdau}); histos.add("AntiLambda/h4dPointingAngle", "h4dPointingAngle", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisPointingAngle}); histos.add("AntiLambda/h4dV0Radius", "h4dV0Radius", kTHnF, {axisCentrality, axisPtCoarse, axisLambdaMass, axisV0Radius}); + histos.add("AntiLambda/h4dV0PhiVsEta", "h4dV0PhiVsEta", kTHnF, {axisPtCoarse, axisK0Mass, axisPhi, axisEta}); } } @@ -613,86 +685,105 @@ struct derivedlambdakzeroanalysis { histos.print(); } + void initCCDB(soa::Join::iterator const& collision) + { + if (mRunNumber == collision.runNumber()) { + return; + } + + mRunNumber = 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); + } + } + 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 - if (v0.v0radius() > v0radius) + if (v0.v0radius() > v0Selections.v0radius) bitset(bitMap, selRadius); - if (v0.v0radius() < v0radiusMax) + if (v0.v0radius() < v0Selections.v0radiusMax) bitset(bitMap, selRadiusMax); - if (TMath::Abs(v0.dcapostopv()) > dcapostopv) + if (TMath::Abs(v0.dcapostopv()) > v0Selections.dcapostopv) bitset(bitMap, selDCAPosToPV); - if (TMath::Abs(v0.dcanegtopv()) > dcanegtopv) + if (TMath::Abs(v0.dcanegtopv()) > v0Selections.dcanegtopv) bitset(bitMap, selDCANegToPV); - if (v0.v0cosPA() > v0cospa) + if (v0.v0cosPA() > v0Selections.v0cospa) bitset(bitMap, selCosPA); - if (v0.dcaV0daughters() < dcav0dau) + if (v0.dcaV0daughters() < v0Selections.dcav0dau) bitset(bitMap, selDCAV0Dau); // rapidity - if (TMath::Abs(rapidityLambda) < rapidityCut) + if (TMath::Abs(rapidityLambda) < v0Selections.rapidityCut) bitset(bitMap, selLambdaRapidity); - if (TMath::Abs(rapidityK0Short) < rapidityCut) + if (TMath::Abs(rapidityK0Short) < v0Selections.rapidityCut) bitset(bitMap, selK0ShortRapidity); auto posTrackExtra = v0.template posTrackExtra_as(); auto negTrackExtra = v0.template negTrackExtra_as(); // ITS quality flags - if (posTrackExtra.itsNCls() >= minITSclusters) + if (posTrackExtra.itsNCls() >= v0Selections.minITSclusters) bitset(bitMap, selPosGoodITSTrack); - if (negTrackExtra.itsNCls() >= minITSclusters) + if (negTrackExtra.itsNCls() >= v0Selections.minITSclusters) bitset(bitMap, selNegGoodITSTrack); // TPC quality flags - if (posTrackExtra.tpcCrossedRows() >= minTPCrows) + if (posTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows) bitset(bitMap, selPosGoodTPCTrack); - if (negTrackExtra.tpcCrossedRows() >= minTPCrows) + if (negTrackExtra.tpcCrossedRows() >= v0Selections.minTPCrows) bitset(bitMap, selNegGoodTPCTrack); // TPC PID - if (fabs(posTrackExtra.tpcNSigmaPi()) < TpcPidNsigmaCut) + if (fabs(posTrackExtra.tpcNSigmaPi()) < v0Selections.TpcPidNsigmaCut) bitset(bitMap, selTPCPIDPositivePion); - if (fabs(posTrackExtra.tpcNSigmaPr()) < TpcPidNsigmaCut) + if (fabs(posTrackExtra.tpcNSigmaPr()) < v0Selections.TpcPidNsigmaCut) bitset(bitMap, selTPCPIDPositiveProton); - if (fabs(negTrackExtra.tpcNSigmaPi()) < TpcPidNsigmaCut) + if (fabs(negTrackExtra.tpcNSigmaPi()) < v0Selections.TpcPidNsigmaCut) bitset(bitMap, selTPCPIDNegativePion); - if (fabs(negTrackExtra.tpcNSigmaPr()) < TpcPidNsigmaCut) + if (fabs(negTrackExtra.tpcNSigmaPr()) < v0Selections.TpcPidNsigmaCut) bitset(bitMap, selTPCPIDNegativeProton); // TOF PID in DeltaT // Positive track - if (fabs(v0.posTOFDeltaTLaPr()) < maxDeltaTimeProton) + if (fabs(v0.posTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) bitset(bitMap, selTOFDeltaTPositiveProtonLambda); - if (fabs(v0.posTOFDeltaTLaPi()) < maxDeltaTimePion) + if (fabs(v0.posTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) bitset(bitMap, selTOFDeltaTPositivePionLambda); - if (fabs(v0.posTOFDeltaTK0Pi()) < maxDeltaTimePion) + if (fabs(v0.posTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) bitset(bitMap, selTOFDeltaTPositivePionK0Short); // Negative track - if (fabs(v0.negTOFDeltaTLaPr()) < maxDeltaTimeProton) + if (fabs(v0.negTOFDeltaTLaPr()) < v0Selections.maxDeltaTimeProton) bitset(bitMap, selTOFDeltaTNegativeProtonLambda); - if (fabs(v0.negTOFDeltaTLaPi()) < maxDeltaTimePion) + if (fabs(v0.negTOFDeltaTLaPi()) < v0Selections.maxDeltaTimePion) bitset(bitMap, selTOFDeltaTNegativePionLambda); - if (fabs(v0.negTOFDeltaTK0Pi()) < maxDeltaTimePion) + if (fabs(v0.negTOFDeltaTK0Pi()) < v0Selections.maxDeltaTimePion) bitset(bitMap, selTOFDeltaTNegativePionK0Short); // TOF PID in NSigma // Positive track - if (fabs(v0.tofNSigmaLaPr()) < TofPidNsigmaCutLaPr) + if (fabs(v0.tofNSigmaLaPr()) < v0Selections.TofPidNsigmaCutLaPr) bitset(bitMap, selTOFNSigmaPositiveProtonLambda); - if (fabs(v0.tofNSigmaALaPi()) < TofPidNsigmaCutLaPi) + if (fabs(v0.tofNSigmaALaPi()) < v0Selections.TofPidNsigmaCutLaPi) bitset(bitMap, selTOFNSigmaPositivePionLambda); - if (fabs(v0.tofNSigmaK0PiPlus()) < TofPidNsigmaCutK0Pi) + if (fabs(v0.tofNSigmaK0PiPlus()) < v0Selections.TofPidNsigmaCutK0Pi) bitset(bitMap, selTOFNSigmaPositivePionK0Short); // Negative track - if (fabs(v0.tofNSigmaALaPr()) < TofPidNsigmaCutLaPr) + if (fabs(v0.tofNSigmaALaPr()) < v0Selections.TofPidNsigmaCutLaPr) bitset(bitMap, selTOFNSigmaNegativeProtonLambda); - if (fabs(v0.tofNSigmaLaPi()) < TofPidNsigmaCutLaPi) + if (fabs(v0.tofNSigmaLaPi()) < v0Selections.TofPidNsigmaCutLaPi) bitset(bitMap, selTOFNSigmaNegativePionLambda); - if (fabs(v0.tofNSigmaK0PiMinus()) < TofPidNsigmaCutK0Pi) + if (fabs(v0.tofNSigmaK0PiMinus()) < v0Selections.TofPidNsigmaCutK0Pi) bitset(bitMap, selTOFNSigmaNegativePionK0Short); // ITS only tag @@ -714,7 +805,7 @@ struct derivedlambdakzeroanalysis { bitset(bitMap, selK0ShortCTau); // armenteros - if (v0.qtarm() * armPodCut > TMath::Abs(v0.alpha()) || armPodCut < 1e-4) + if (v0.qtarm() * v0Selections.armPodCut > TMath::Abs(v0.alpha()) || v0Selections.armPodCut < 1e-4) bitset(bitMap, selK0ShortArmenteros); return bitMap; @@ -856,10 +947,108 @@ struct derivedlambdakzeroanalysis { return bitMap; } + // 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 - void analyseCandidate(TV0 v0, float pt, float centrality, uint64_t selMap, uint8_t gapSide) + void analyseCandidate(TV0 v0, float pt, float centrality, uint64_t selMap, uint8_t gapSide, int& nK0Shorts, int& nLambdas, int& nAntiLambdas) // 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); + } + auto posTrackExtra = v0.template posTrackExtra_as(); auto negTrackExtra = v0.template negTrackExtra_as(); @@ -885,16 +1074,16 @@ struct derivedlambdakzeroanalysis { // __________________________________________ // main analysis - if (verifyMask(selMap, maskSelectionK0Short) && analyseK0Short) { + if (passK0ShortSelections && analyseK0Short) { histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), v0.alpha(), v0.qtarm()); // cross-check histos.fill(HIST("h3dMassK0Short"), centrality, pt, v0.mK0Short()); if (gapSide == 0) histos.fill(HIST("h3dMassK0ShortSGA"), centrality, pt, v0.mK0Short()); - if (gapSide == 1) + else if (gapSide == 1) histos.fill(HIST("h3dMassK0ShortSGC"), centrality, pt, v0.mK0Short()); - if (gapSide == 2) + else if (gapSide == 2) histos.fill(HIST("h3dMassK0ShortDG"), centrality, pt, v0.mK0Short()); - if (gapSide > 2) + else histos.fill(HIST("h3dMassK0ShortHadronic"), centrality, pt, v0.mK0Short()); histos.fill(HIST("hMassK0Short"), v0.mK0Short()); if (doPlainTopoQA) { @@ -938,16 +1127,17 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTK0Pi()); histos.fill(HIST("K0Short/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTK0Pi()); } + nK0Shorts++; } - if (verifyMask(selMap, maskSelectionLambda) && analyseLambda) { + if (passLambdaSelections && analyseLambda) { histos.fill(HIST("h3dMassLambda"), centrality, pt, v0.mLambda()); if (gapSide == 0) histos.fill(HIST("h3dMassLambdaSGA"), centrality, pt, v0.mLambda()); - if (gapSide == 1) + else if (gapSide == 1) histos.fill(HIST("h3dMassLambdaSGC"), centrality, pt, v0.mLambda()); - if (gapSide == 2) + else if (gapSide == 2) histos.fill(HIST("h3dMassLambdaDG"), centrality, pt, v0.mLambda()); - if (gapSide > 2) + else histos.fill(HIST("h3dMassLambdaHadronic"), centrality, pt, v0.mLambda()); if (doPlainTopoQA) { histos.fill(HIST("Lambda/hPosDCAToPV"), v0.dcapostopv()); @@ -990,16 +1180,17 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("Lambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPr()); histos.fill(HIST("Lambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPi()); } + nLambdas++; } - if (verifyMask(selMap, maskSelectionAntiLambda) && analyseAntiLambda) { + if (passAntiLambdaSelections && analyseAntiLambda) { histos.fill(HIST("h3dMassAntiLambda"), centrality, pt, v0.mAntiLambda()); if (gapSide == 0) histos.fill(HIST("h3dMassAntiLambdaSGA"), centrality, pt, v0.mAntiLambda()); - if (gapSide == 1) + else if (gapSide == 1) histos.fill(HIST("h3dMassAntiLambdaSGC"), centrality, pt, v0.mAntiLambda()); - if (gapSide == 2) + else if (gapSide == 2) histos.fill(HIST("h3dMassAntiLambdaDG"), centrality, pt, v0.mAntiLambda()); - if (gapSide > 2) + else histos.fill(HIST("h3dMassAntiLambdaHadronic"), centrality, pt, v0.mAntiLambda()); if (doPlainTopoQA) { histos.fill(HIST("AntiLambda/hPosDCAToPV"), v0.dcapostopv()); @@ -1042,6 +1233,7 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("AntiLambda/h3dPosTOFdeltaTvsTrackPt"), centrality, v0.positivept(), v0.posTOFDeltaTLaPi()); histos.fill(HIST("AntiLambda/h3dNegTOFdeltaTvsTrackPt"), centrality, v0.negativept(), v0.negTOFDeltaTLaPr()); } + nAntiLambdas++; } // __________________________________________ @@ -1058,6 +1250,9 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("K0Short/h4dPointingAngle"), centrality, pt, v0.mK0Short(), TMath::ACos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskK0ShortSpecific)) histos.fill(HIST("K0Short/h4dDCADaughters"), centrality, pt, v0.mK0Short(), v0.dcaV0daughters()); + + if (passK0ShortSelections) + histos.fill(HIST("K0Short/h4dV0PhiVsEta"), pt, v0.mK0Short(), v0.phi(), v0.eta()); } if (analyseLambda) { @@ -1071,6 +1266,9 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("Lambda/h4dPointingAngle"), centrality, pt, v0.mLambda(), TMath::ACos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskLambdaSpecific)) histos.fill(HIST("Lambda/h4dDCADaughters"), centrality, pt, v0.mLambda(), v0.dcaV0daughters()); + + if (passLambdaSelections) + histos.fill(HIST("Lambda/h4dV0PhiVsEta"), pt, v0.mLambda(), v0.phi(), v0.eta()); } if (analyseAntiLambda) { if (verifyMask(selMap, maskTopoNoV0Radius | maskAntiLambdaSpecific)) @@ -1083,6 +1281,9 @@ struct derivedlambdakzeroanalysis { histos.fill(HIST("AntiLambda/h4dPointingAngle"), centrality, pt, v0.mAntiLambda(), TMath::ACos(v0.v0cosPA())); if (verifyMask(selMap, maskTopoNoDCAV0Dau | maskAntiLambdaSpecific)) histos.fill(HIST("AntiLambda/h4dDCADaughters"), centrality, pt, v0.mAntiLambda(), v0.dcaV0daughters()); + + if (passAntiLambdaSelections) + histos.fill(HIST("AntiLambda/h4dV0PhiVsEta"), pt, v0.mAntiLambda(), v0.phi(), v0.eta()); } } // end systematics / qa } @@ -1136,10 +1337,17 @@ struct derivedlambdakzeroanalysis { // ______________________________________________________ // Real data processing - no MC subscription - void processRealData(soa::Join::iterator const& collision, v0Candidates const& fullV0s, dauTracks const&) + 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); + } + histos.fill(HIST("hEventSelection"), 0. /* all collisions */); - if (!collision.sel8()) { + if (requireSel8 && !collision.sel8()) { return; } histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); @@ -1187,21 +1395,42 @@ struct derivedlambdakzeroanalysis { if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; } - histos.fill(HIST("hEventSelection"), 10 /* No other collision within +/- 10 microseconds */); + 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"), 11 /* No other collision within +/- 4 microseconds */); + 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; + } + histos.fill(HIST("hEventSelection"), 15 /* No other collision within the same ITS ROF */); - if (minOccupancy > 0 && collision.trackOccupancyInTimeRange() < minOccupancy) { + float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (minOccupancy > 0 && collisionOccupancy < minOccupancy) { return; } - histos.fill(HIST("hEventSelection"), 12 /* Below min occupancy */); - if (maxOccupancy > 0 && collision.trackOccupancyInTimeRange() > maxOccupancy) { + histos.fill(HIST("hEventSelection"), 16 /* Below min occupancy */); + if (maxOccupancy > 0 && collisionOccupancy > maxOccupancy) { return; } - histos.fill(HIST("hEventSelection"), 13 /* Above max occupancy */); + histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); float centrality = collision.centFT0C(); if (qaCentrality) { @@ -1219,21 +1448,25 @@ struct derivedlambdakzeroanalysis { 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()); + histos.fill(HIST("hEventOccupancy"), collisionOccupancy); + histos.fill(HIST("hCentralityVsOccupancy"), centrality, collisionOccupancy); // __________________________________________ // perform main analysis + int nK0Shorts = 0; + int nLambdas = 0; + int nAntiLambdas = 0; for (auto& v0 : fullV0s) { - if (std::abs(v0.negativeeta()) > daughterEtaCut || std::abs(v0.positiveeta()) > daughterEtaCut) + 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() != v0TypeSelection && v0TypeSelection > -1) + if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1) continue; // skip V0s that are not standard // fill AP plot for all V0s @@ -1245,8 +1478,19 @@ struct derivedlambdakzeroanalysis { 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); - analyseCandidate(v0, v0.pt(), centrality, selMap, selGapSide); + analyseCandidate(v0, v0.pt(), centrality, selMap, selGapSide, nK0Shorts, nLambdas, nAntiLambdas); } // end v0 loop + + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + if (analyseK0Short) { + histos.fill(HIST("h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); + } + if (analyseLambda) { + histos.fill(HIST("h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); + } + if (analyseAntiLambda) { + histos.fill(HIST("h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); + } } // ______________________________________________________ @@ -1254,7 +1498,7 @@ struct derivedlambdakzeroanalysis { 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 (!collision.sel8()) { + if (requireSel8 && !collision.sel8()) { return; } histos.fill(HIST("hEventSelection"), 1 /* sel8 collisions */); @@ -1302,21 +1546,42 @@ struct derivedlambdakzeroanalysis { if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; } - histos.fill(HIST("hEventSelection"), 10 /* No other collision within +/- 10 microseconds */); + 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"), 11 /* No other collision within +/- 4 microseconds */); + histos.fill(HIST("hEventSelection"), 12 /* No other collision within +/- 2 microseconds */); - if (minOccupancy > 0 && collision.trackOccupancyInTimeRange() < minOccupancy) { + if (requireNoCollInTimeRangeVzDep && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeVzDependent)) { return; } - histos.fill(HIST("hEventSelection"), 12 /* Below min occupancy */); - if (maxOccupancy > 0 && collision.trackOccupancyInTimeRange() > maxOccupancy) { + 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"), 13 /* Above max occupancy */); + 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; + } + 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) { + return; + } + histos.fill(HIST("hEventSelection"), 17 /* Above max occupancy */); float centrality = collision.centFT0C(); if (qaCentrality) { @@ -1334,18 +1599,22 @@ struct derivedlambdakzeroanalysis { 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()); + histos.fill(HIST("hEventOccupancy"), collisionOccupancy); + histos.fill(HIST("hCentralityVsOccupancy"), centrality, collisionOccupancy); // __________________________________________ // perform main analysis + int nK0Shorts = 0; + int nLambdas = 0; + int nAntiLambdas = 0; for (auto& v0 : fullV0s) { - if (std::abs(v0.negativeeta()) > daughterEtaCut || std::abs(v0.positiveeta()) > daughterEtaCut) + 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()) @@ -1376,7 +1645,7 @@ struct derivedlambdakzeroanalysis { selMap = selMap | (uint64_t(1) << selPhysPrimK0Short) | (uint64_t(1) << selPhysPrimLambda) | (uint64_t(1) << selPhysPrimAntiLambda); } - analyseCandidate(v0, ptmc, centrality, selMap, selGapSide); + analyseCandidate(v0, ptmc, centrality, selMap, selGapSide, nK0Shorts, nLambdas, nAntiLambdas); if (doCollisionAssociationQA) { // check collision association explicitly @@ -1391,6 +1660,17 @@ struct derivedlambdakzeroanalysis { } } // end v0 loop + + // fill the histograms with the number of reconstructed K0s/Lambda/antiLambda per collision + if (analyseK0Short) { + histos.fill(HIST("h2dNbrOfK0ShortVsCentrality"), centrality, nK0Shorts); + } + if (analyseLambda) { + histos.fill(HIST("h2dNbrOfLambdaVsCentrality"), centrality, nLambdas); + } + if (analyseAntiLambda) { + histos.fill(HIST("h2dNbrOfAntiLambdaVsCentrality"), centrality, nAntiLambdas); + } } // ______________________________________________________ @@ -1412,7 +1692,7 @@ struct derivedlambdakzeroanalysis { 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); - if (TMath::Abs(ymc) > rapidityCut) + if (TMath::Abs(ymc) > v0Selections.rapidityCut) continue; auto mcCollision = v0MC.straMCCollision_as>(); @@ -1450,7 +1730,7 @@ struct derivedlambdakzeroanalysis { 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) > rapidityCut) + if (TMath::Abs(ymc) > v0Selections.rapidityCut) continue; auto mcCollision = cascMC.straMCCollision_as>(); @@ -1497,7 +1777,7 @@ struct derivedlambdakzeroanalysis { float centrality = 100.5f; int nCollisions = 0; for (auto const& collision : groupedCollisions) { - if (!collision.sel8()) { + if (requireSel8 && !collision.sel8()) { continue; } if (std::abs(collision.posZ()) > 10.f) { @@ -1527,14 +1807,27 @@ struct derivedlambdakzeroanalysis { 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; + } - if (minOccupancy > 0 && collision.trackOccupancyInTimeRange() < minOccupancy) { + float collisionOccupancy = useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + if (minOccupancy > 0 && collisionOccupancy < minOccupancy) { continue; } - if (maxOccupancy > 0 && collision.trackOccupancyInTimeRange() > maxOccupancy) { + if (maxOccupancy > 0 && collisionOccupancy > maxOccupancy) { continue; } diff --git a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx index fca804b8a13..9e7e4da9953 100644 --- a/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/hStrangeCorrelation.cxx @@ -33,6 +33,8 @@ #include "Common/DataModel/Centrality.h" #include "Framework/StaticFor.h" #include "CCDB/BasicCCDBManager.h" +#include +#include using namespace o2; using namespace o2::constants::math; @@ -73,6 +75,9 @@ struct correlateStrangeness { Configurable doLambdaPrimary{"doLambdaPrimary", false, "do primary selection for lambda"}; 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"}; 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"}; @@ -159,7 +164,8 @@ struct correlateStrangeness { 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[] = {"Pion", "K0Short", "Lambda", "AntiLambda", "XiMinus", "XiPlus", "OmegaMinus", "OmegaPlus"}; + static constexpr std::string_view particlenames[] = {"K0Short", "Lambda", "AntiLambda", "XiMinus", "XiPlus", "OmegaMinus", "OmegaPlus", "Pion"}; + static constexpr int pdgCodes[] = {310, 3122, -3122, 3312, -3312, 3334, -3334, 211}; uint8_t doCorrelation; int mRunNumber; @@ -230,6 +236,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) @@ -308,8 +320,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) @@ -657,78 +678,12 @@ struct correlateStrangeness { const AxisSpec axisVtxZNDim{edgesVtxZ, "vertex Z (cm)"}; const AxisSpec axisMultNDim{edgesMult, "mult percentile"}; - if (bitcheck(doCorrelation, 0)) { - histos.add("h3dK0ShortSpectrum", "h3dK0ShortSpectrum", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("h3dK0ShortSpectrumY", "h3dK0ShortSpectrumY", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("sameEvent/Signal/K0Short", "K0Short", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - if (bitcheck(doCorrelation, 1)) { - histos.add("h3dLambdaSpectrum", "h3dLambdaSpectrum", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("h3dLambdaSpectrumY", "h3dLambdaSpectrumY", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("sameEvent/Signal/Lambda", "Lambda", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - if (bitcheck(doCorrelation, 2)) { - histos.add("h3dAntiLambdaSpectrum", "h3dAntiLambdaSpectrum", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("h3dAntiLambdaSpectrumY", "h3dAntiLambdaSpectrumY", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("sameEvent/Signal/AntiLambda", "AntiLambda", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - if (bitcheck(doCorrelation, 3)) { - histos.add("h3dXiMinusSpectrum", "h3dXiMinusSpectrum", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("h3dXiMinusSpectrumY", "h3dXiMinusSpectrumY", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("sameEvent/Signal/XiMinus", "XiMinus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - if (bitcheck(doCorrelation, 4)) { - histos.add("h3dXiPlusSpectrum", "h3dXiPlusSpectrum", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("h3dXiPlusSpectrumY", "h3dXiPlusSpectrumY", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("sameEvent/Signal/XiPlus", "XiPlus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - if (bitcheck(doCorrelation, 5)) { - histos.add("h3dOmegaMinusSpectrum", "h3dOmegaMinusSpectrum", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("h3dOmegaMinusSpectrumY", "h3dOmegaMinusSpectrumY", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("sameEvent/Signal/OmegaMinus", "OmegaMinus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - if (bitcheck(doCorrelation, 6)) { - histos.add("h3dOmegaPlusSpectrum", "h3dOmegaPlusSpectrum", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("h3dOmegaPlusSpectrumY", "h3dOmegaPlusSpectrumY", kTH3F, {axisPtQA, axisMult, axisMassNSigma}); - histos.add("sameEvent/Signal/OmegaPlus", "OmegaPlus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - if (bitcheck(doCorrelation, 7)) { - histos.add("sameEvent/Pion", "Pion", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - } - LOGF(info, "Init THnFs done"); - if (doCorrelationK0Short || doCorrelationLambda || doCorrelationAntiLambda || doCorrelationXiMinus || doCorrelationXiPlus || doCorrelationOmegaMinus || doCorrelationOmegaPlus) { - histos.addClone("sameEvent/Signal/", "sameEvent/LeftBg/"); - histos.addClone("sameEvent/Signal/", "sameEvent/RightBg/"); - } - - // mixed-event correlation functions - if (doprocessMixedEventHV0s || doprocessMixedEventHCascades || doprocessMixedEventHPions) { - histos.addClone("sameEvent/", "mixedEvent/"); - } - // Some QA plots histos.add("hGeneratedQAPtTrigger", "hGeneratedQAPtTrigger", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); histos.add("hGeneratedQAPtAssociatedK0", "hGeneratedQAPtAssociatedK0", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); histos.add("hClosureQAPtTrigger", "hClosureQAPtTrigger", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); histos.add("hClosureQAPtAssociatedK0", "hClosureQAPtAssociatedK0", kTH2F, {axisPtQA, {5, -0.5f, 4.5f}}); - histos.add("hTrackEtaVsPtVsPhi", "hTrackEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hK0ShortEtaVsPtVsPhi", "hK0ShortEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hK0ShortEtaVsPtVsPhiBg", "hK0ShortEtaVsPtVsPhiBg", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hLambdaEtaVsPtVsPhi", "hLambdaEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hLambdaEtaVsPtVsPhiBg", "hLambdaEtaVsPtVsPhiBg", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hAntiLambdaEtaVsPtVsPhi", "hAntiLambdaEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hAntiLambdaEtaVsPtVsPhiBg", "hAntiLambdaEtaVsPtVsPhiBg", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hXiMinusEtaVsPtVsPhi", "hXiMinusEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hXiMinusEtaVsPtVsPhiBg", "hXiMinusEtaVsPtVsPhiBg", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hXiPlusEtaVsPtVsPhi", "hXiPlusEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hXiPlusEtaVsPtVsPhiBg", "hXiPlusEtaVsPtVsPhiBg", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hOmegaMinusEtaVsPtVsPhi", "hOmegaMinusEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hOmegaMinusEtaVsPtVsPhiBg", "hOmegaMinusEtaVsPtVsPhiBg", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hOmegaPlusEtaVsPtVsPhi", "hOmegaPlusEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hOmegaPlusEtaVsPtVsPhiBg", "hOmegaPlusEtaVsPtVsPhiBg", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hPionEtaVsPtVsPhi", "hPionEtaVsPtVsPhi", kTH3F, {axisPtQA, axisEta, axisPhi}); - histos.add("hTriggerPrimaryEtaVsPt", "hTriggerPrimaryEtaVsPt", kTH3F, {axisPtQA, axisEta, axisMult}); histos.add("hTriggerAllSelectedEtaVsPt", "hTriggerAllSelectedEtaVsPt", kTH3F, {axisPtQA, axisEta, axisMult}); histos.add("hClosureTestEventCounter", "hClosureTestEventCounter", kTH1F, {{10, 0, 10}}); @@ -753,71 +708,60 @@ struct correlateStrangeness { histos.add("EventQA/hPvz", ";pvz;Entries", kTH1F, {{30, -15, 15}}); histos.add("EventQA/hMultFT0vsTPC", ";centFT0M;multNTracksPVeta1", kTH2F, {{100, 0, 100}, {300, 0, 300}}); + // QA and THn Histograms + 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}); + + bool hStrange = false; + for (int i = 0; i < 8; i++) { + if ((doprocessSameEventHV0s && i < 3) || (doprocessSameEventHCascades && i > 2 && i < 7) || (doprocessSameEventHPions && i == 7)) + histos.add(fmt::format("h{}EtaVsPtVsPhi", particlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); + if ((doprocessSameEventHV0s && i < 3) || (doprocessSameEventHCascades && i > 2 && i < 7)) + histos.add(fmt::format("h{}EtaVsPtVsPhiBg", particlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); + if (bitcheck(doCorrelation, i)) { + 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}}); + 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) + hStrange = true; + } + } + if (hStrange) { + histos.addClone("sameEvent/Signal/", "sameEvent/LeftBg/"); + histos.addClone("sameEvent/Signal/", "sameEvent/RightBg/"); + } + + LOGF(info, "Init THnFs done"); + // mixed-event correlation functions + if (doprocessMixedEventHV0s || doprocessMixedEventHCascades || doprocessMixedEventHPions) { + histos.addClone("sameEvent/", "mixedEvent/"); + } + // MC generated plots if (doprocessMCGenerated) { histos.add("Generated/hTrigger", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hPion", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hK0Short", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hLambda", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hAntiLambda", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hXiMinus", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hXiPlus", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hOmegaMinus", "", kTH2F, {axisPtQA, axisEta}); - histos.add("Generated/hOmegaPlus", "", kTH2F, {axisPtQA, axisEta}); - + for (int i = 0; i < 8; i++) { + histos.add(fmt::format("Generated/h{}", particlenames[i]).c_str(), "", kTH2F, {axisPtQA, axisEta}); + } histos.addClone("Generated/", "GeneratedWithPV/"); // histograms within |y|<0.5, vs multiplicity - histos.add("GeneratedWithPV/hPion_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hK0Short_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hLambda_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hAntiLambda_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hXiMinus_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hXiPlus_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hOmegaMinus_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hOmegaPlus_MidYVsMult", "", kTH2F, {axisPtQA, axisMult}); - - histos.add("GeneratedWithPV/hPion_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hK0Short_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hLambda_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hAntiLambda_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hXiMinus_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hXiPlus_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hOmegaMinus_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); - histos.add("GeneratedWithPV/hOmegaPlus_MidYVsMult_TwoPVsOrMore", "", kTH2F, {axisPtQA, axisMult}); + for (int i = 0; i < 8; i++) { + histos.add(fmt::format("GeneratedWithPV/h{}_MidYVsMult", particlenames[i]).c_str(), "", kTH2F, {axisPtQA, axisMult}); + histos.add(fmt::format("GeneratedWithPV/h{}_MidYVsMult_TwoPVsOrMore", particlenames[i]).c_str(), "", kTH2F, {axisPtQA, axisMult}); + } } if (doprocessClosureTest) { - if (doCorrelationPion) { - histos.add("ClosureTest/sameEvent/Pion", "Pion", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/hPion", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - } - if (doCorrelationK0Short) { - histos.add("ClosureTest/sameEvent/K0Short", "K0Short", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/hK0Short", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - } - if (doCorrelationLambda) { - histos.add("ClosureTest/sameEvent/Lambda", "Lambda", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/hLambda", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - } - if (doCorrelationAntiLambda) { - histos.add("ClosureTest/sameEvent/AntiLambda", "AntiLambda", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/hAntiLambda", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - } - if (doCorrelationXiMinus) { - histos.add("ClosureTest/sameEvent/XiMinus", "XiMinus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/hXiMinus", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - } - if (doCorrelationXiPlus) { - histos.add("ClosureTest/sameEvent/XiPlus", "XiPlus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/XiPlus", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - } - if (doCorrelationOmegaMinus) { - histos.add("ClosureTest/sameEvent/OmegaMinus", "OmegaMinus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/hOmegaMinus", "", kTH3F, {axisPtQA, axisEta, axisPhi}); - } - if (doCorrelationOmegaPlus) { - histos.add("ClosureTest/sameEvent/OmegaPlus", "OmegaPlus", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); - histos.add("ClosureTest/hOmegaPlus", "", kTH3F, {axisPtQA, axisEta, axisPhi}); + for (int i = 0; i < 8; i++) { + if (bitcheck(doCorrelation, i)) + histos.add(fmt::format("ClosureTest/sameEvent/{}", particlenames[i]).c_str(), "", kTHnF, {axisDeltaPhiNDim, axisDeltaEtaNDim, axisPtAssocNDim, axisPtTriggerNDim, axisVtxZNDim, axisMultNDim}); + if (bitcheck(doCorrelation, i)) + histos.add(fmt::format("ClosureTest/h{}", particlenames[i]).c_str(), "", kTH3F, {axisPtQA, axisEta, axisPhi}); } histos.add("ClosureTest/hTrigger", "Trigger Tracks", kTH3F, {axisPtQA, axisEta, axisMult}); } @@ -835,10 +779,60 @@ struct correlateStrangeness { } } + // if this process function is enabled, it will be such that only events with trigger particles within a given + // trigger pt bin are taken for the entire processing. This allows for the calculation of e.g. efficiencies + // within an event class that has a trigger (which may differ with respect to other cases, to be checked) + + // for map determining which trigger bins are present and which aren't + std::vector triggerPresenceMap; + + void processSelectEventWithTrigger(soa::Join const& collisions, + aod::TriggerTracks const& triggerTracks, TracksComplete const&, aod::BCsWithTimestamps const&) + { + // setup + triggerPresenceMap.clear(); + triggerPresenceMap.resize(collisions.size(), 0); + + for (auto const& collision : collisions) { + // ________________________________________________ + // Perform basic event selection + if (!collision.sel8()) { + continue; + } + if (TMath::Abs(collision.posZ()) > zVertexCut) { + continue; + } + if (collision.centFT0M() > axisRanges[5][1] || collision.centFT0M() < axisRanges[5][0]) { + continue; + } + if (!collision.isInelGt0() && selectINELgtZERO) { + continue; + } + + // do not forget to re-group ... + auto slicedTriggerTracks = triggerTracks.sliceBy(collisionSliceTracks, collision.globalIndex()); + + for (auto const& triggerTrack : slicedTriggerTracks) { + auto track = triggerTrack.track_as(); + if (!isValidTrigger(track)) { + continue; + } + auto binNumber = histos.get(HIST("axes/hPtTriggerAxis"))->FindFixBin(track.pt()) - 1; + bitset(triggerPresenceMap[collision.globalIndex()], binNumber); + } + } + } + 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&) { + // ________________________________________________ + // skip if desired trigger not found + if (triggerPresenceMap.size() > 0 && !bitcheck(triggerPresenceMap[collision.globalIndex()], triggerBinToSelect)) { + return; + } + // ________________________________________________ // Perform basic event selection if (!collision.sel8()) { @@ -894,16 +888,17 @@ struct correlateStrangeness { } float weight = applyEfficiencyCorrection ? 1. / efficiency : 1.0f; if (v0.compatible(index, systCuts.dEdxCompatibility) && (!doMCassociation || v0.mcTrue(index)) && (!doAssocPhysicalPrimary || v0.mcPhysicalPrimary()) && (!applyEfficiencyCorrection || efficiency != 0)) { - if (-massWindowConfigurations.maxPeakNSigma < v0.invMassNSigma(index) && v0.invMassNSigma(index) < +massWindowConfigurations.maxPeakNSigma) - histos.fill(HIST("h") + HIST(v0names[index]) + HIST("EtaVsPtVsPhi"), v0Data.pt(), v0Data.eta(), v0Data.phi(), weight); - if ((-massWindowConfigurations.maxBgNSigma < v0.invMassNSigma(index) && v0.invMassNSigma(index) < -massWindowConfigurations.minBgNSigma) || (+massWindowConfigurations.minBgNSigma < v0.invMassNSigma(index) && v0.invMassNSigma(index) < +massWindowConfigurations.maxBgNSigma)) - histos.fill(HIST("h") + HIST(v0names[index]) + HIST("EtaVsPtVsPhiBg"), v0Data.pt(), v0Data.eta(), v0Data.phi(), weight); if (bitcheck(doCorrelation, index)) { histos.fill(HIST("h3d") + HIST(v0names[index]) + HIST("Spectrum"), v0Data.pt(), collision.centFT0M(), v0.invMassNSigma(index), weight); if (std::abs(v0Data.rapidity(index)) < 0.5) { histos.fill(HIST("h3d") + HIST(v0names[index]) + HIST("SpectrumY"), v0Data.pt(), collision.centFT0M(), v0.invMassNSigma(index), weight); } } + if ((-massWindowConfigurations.maxBgNSigma < v0.invMassNSigma(index) && v0.invMassNSigma(index) < -massWindowConfigurations.minBgNSigma) || (+massWindowConfigurations.minBgNSigma < v0.invMassNSigma(index) && v0.invMassNSigma(index) < +massWindowConfigurations.maxBgNSigma)) + histos.fill(HIST("h") + HIST(v0names[index]) + HIST("EtaVsPtVsPhiBg"), v0Data.pt(), v0Data.eta(), v0Data.phi(), weight); + if (-massWindowConfigurations.maxPeakNSigma < v0.invMassNSigma(index) && v0.invMassNSigma(index) < +massWindowConfigurations.maxPeakNSigma) { + histos.fill(HIST("h") + HIST(v0names[index]) + HIST("EtaVsPtVsPhi"), v0Data.pt(), v0Data.eta(), v0Data.phi(), weight); + } } }); } @@ -913,6 +908,7 @@ struct correlateStrangeness { 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()); @@ -929,6 +925,12 @@ struct correlateStrangeness { aod::AssocV0s const&, aod::AssocCascades const& associatedCascades, aod::TriggerTracks const& triggerTracks, V0DatasWithoutTrackX const&, aod::V0sLinked const&, aod::CascDatas const&, 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()) { @@ -995,8 +997,10 @@ struct correlateStrangeness { histos.fill(HIST("h3d") + HIST(cascadenames[index]) + HIST("SpectrumY"), cascData.pt(), collision.centFT0M(), casc.invMassNSigma(index), weight); } } - if (-massWindowConfigurations.maxPeakNSigma < casc.invMassNSigma(index) && casc.invMassNSigma(index) < +massWindowConfigurations.maxPeakNSigma) + if (-massWindowConfigurations.maxPeakNSigma < casc.invMassNSigma(index) && casc.invMassNSigma(index) < +massWindowConfigurations.maxPeakNSigma) { histos.fill(HIST("h") + HIST(cascadenames[index]) + HIST("EtaVsPtVsPhi"), cascData.pt(), cascData.eta(), cascData.phi(), weight); + } + if ((-massWindowConfigurations.maxBgNSigma < casc.invMassNSigma(index) && casc.invMassNSigma(index) < -massWindowConfigurations.minBgNSigma) || (+massWindowConfigurations.minBgNSigma < casc.invMassNSigma(index) && casc.invMassNSigma(index) < +massWindowConfigurations.maxBgNSigma)) histos.fill(HIST("h") + HIST(cascadenames[index]) + HIST("EtaVsPtVsPhiBg"), cascData.pt(), cascData.eta(), cascData.phi(), weight); } @@ -1007,6 +1011,7 @@ struct correlateStrangeness { 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()); @@ -1021,6 +1026,12 @@ struct correlateStrangeness { aod::AssocPions const& associatedPions, 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()) { @@ -1052,6 +1063,7 @@ struct correlateStrangeness { 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()); @@ -1073,6 +1085,12 @@ struct correlateStrangeness { auto bc = collision1.bc_as(); initEfficiencyFromCCDB(bc); } + // ________________________________________________ + // 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; @@ -1112,6 +1130,12 @@ struct correlateStrangeness { auto bc = collision1.bc_as(); initEfficiencyFromCCDB(bc); } + // ________________________________________________ + // 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; @@ -1145,6 +1169,13 @@ struct correlateStrangeness { 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()) @@ -1201,22 +1232,16 @@ struct correlateStrangeness { for (auto const& mcParticle : mcParticles) { if (!mcParticle.isPhysicalPrimary()) continue; - if (abs(mcParticle.pdgCode()) == 211) - histos.fill(HIST("Generated/hPion"), mcParticle.pt(), mcParticle.eta()); - if (abs(mcParticle.pdgCode()) == 310) - histos.fill(HIST("Generated/hK0Short"), mcParticle.pt(), mcParticle.eta()); - if (mcParticle.pdgCode() == 3122) - histos.fill(HIST("Generated/hLambda"), mcParticle.pt(), mcParticle.eta()); - if (mcParticle.pdgCode() == -3122) - histos.fill(HIST("Generated/hAntiLambda"), mcParticle.pt(), mcParticle.eta()); - if (mcParticle.pdgCode() == 3312) - histos.fill(HIST("Generated/hXiMinus"), mcParticle.pt(), mcParticle.eta()); - if (mcParticle.pdgCode() == -3312) - histos.fill(HIST("Generated/hXiPlus"), mcParticle.pt(), mcParticle.eta()); - if (mcParticle.pdgCode() == 3334) - histos.fill(HIST("Generated/hOmegaMinus"), mcParticle.pt(), mcParticle.eta()); - if (mcParticle.pdgCode() == -3334) - histos.fill(HIST("Generated/hOmegaPlus"), mcParticle.pt(), mcParticle.eta()); + static_for<0, 7>([&](auto i) { + constexpr int index = i.value; + if (i == 0 || i == 7) { + if (abs(mcParticle.pdgCode()) == pdgCodes[i]) + histos.fill(HIST("Generated/h") + HIST(particlenames[index]), mcParticle.pt(), mcParticle.eta()); + } else { + if (mcParticle.pdgCode() == pdgCodes[i]) + histos.fill(HIST("Generated/h") + HIST(particlenames[index]), mcParticle.pt(), mcParticle.eta()); + } + }); } if (collisions.size() < 1) return; @@ -1227,6 +1252,8 @@ struct correlateStrangeness { float bestCollisionVtxZ = 0.0f; bool bestCollisionSel8 = false; bool bestCollisionINELgtZERO = false; + uint32_t bestCollisionTriggerPresenceMap = 0; + for (auto& collision : collisions) { if (biggestNContribs < collision.numContrib()) { biggestNContribs = collision.numContrib(); @@ -1234,6 +1261,8 @@ struct correlateStrangeness { bestCollisionSel8 = collision.sel8(); bestCollisionVtxZ = collision.posZ(); bestCollisionINELgtZERO = collision.isInelGt0(); + if (triggerPresenceMap.size() > 0) + bestCollisionTriggerPresenceMap = triggerPresenceMap[collision.globalIndex()]; } } @@ -1241,30 +1270,30 @@ struct correlateStrangeness { for (auto const& mcParticle : mcParticles) { if (!mcParticle.isPhysicalPrimary()) continue; - if (abs(mcParticle.y()) < 0.5) { - if (abs(mcParticle.pdgCode()) == 211) - histos.fill(HIST("GeneratedWithPV/hPion_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - if (abs(mcParticle.pdgCode()) == 310) - histos.fill(HIST("GeneratedWithPV/hK0Short_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == 3122) - histos.fill(HIST("GeneratedWithPV/hLambda_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == -3122) - histos.fill(HIST("GeneratedWithPV/hAntiLambda_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == 3312) - histos.fill(HIST("GeneratedWithPV/hXiMinus_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == -3312) - histos.fill(HIST("GeneratedWithPV/hXiPlus_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == 3334) - histos.fill(HIST("GeneratedWithPV/hOmegaMinus_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == -3334) - histos.fill(HIST("GeneratedWithPV/hOmegaPlus_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); - } + if (abs(mcParticle.y()) > 0.5) + continue; + static_for<0, 7>([&](auto i) { + constexpr int index = i.value; + if (i == 0 || i == 7) { + if (abs(mcParticle.pdgCode()) == pdgCodes[i]) + histos.fill(HIST("GeneratedWithPV/h") + HIST(particlenames[index]) + HIST("_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); + } else { + if (mcParticle.pdgCode() == pdgCodes[i]) + histos.fill(HIST("GeneratedWithPV/h") + HIST(particlenames[index]) + HIST("_MidYVsMult_TwoPVsOrMore"), mcParticle.pt(), bestCollisionFT0Mpercentile); + } + }); } } // do selections on best collision // WARNING: if 2 PV case large, this will not necessarily be fine! // caution advised! + + // ________________________________________________ + // skip if desired trigger not found + if (triggerPresenceMap.size() > 0 && !bitcheck(bestCollisionTriggerPresenceMap, triggerBinToSelect)) { + return; + } if (!bestCollisionSel8) return; if (std::abs(bestCollisionVtxZ) > 10.0f) @@ -1301,41 +1330,23 @@ struct correlateStrangeness { Double_t gpt = mcParticle.pt(); if (abs(mcParticle.pdgCode()) == 211 || abs(mcParticle.pdgCode()) == 321 || abs(mcParticle.pdgCode()) == 2212 || abs(mcParticle.pdgCode()) == 11 || abs(mcParticle.pdgCode()) == 13) histos.fill(HIST("GeneratedWithPV/hTrigger"), gpt, geta); - if (abs(mcParticle.pdgCode()) == 211) - histos.fill(HIST("GeneratedWithPV/hPion"), gpt, geta); - if (abs(mcParticle.pdgCode()) == 310) - histos.fill(HIST("GeneratedWithPV/hK0Short"), gpt, geta); - if (mcParticle.pdgCode() == 3122) - histos.fill(HIST("GeneratedWithPV/hLambda"), gpt, geta); - if (mcParticle.pdgCode() == -3122) - histos.fill(HIST("GeneratedWithPV/hAntiLambda"), gpt, geta); - if (mcParticle.pdgCode() == 3312) - histos.fill(HIST("GeneratedWithPV/hXiMinus"), gpt, geta); - if (mcParticle.pdgCode() == -3312) - histos.fill(HIST("GeneratedWithPV/hXiPlus"), gpt, geta); - if (mcParticle.pdgCode() == 3334) - histos.fill(HIST("GeneratedWithPV/hOmegaMinus"), gpt, geta); - if (mcParticle.pdgCode() == -3334) - histos.fill(HIST("GeneratedWithPV/hOmegaPlus"), gpt, geta); - - if (abs(mcParticle.y()) < 0.5) { - if (abs(mcParticle.pdgCode()) == 211) - histos.fill(HIST("GeneratedWithPV/hPion_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - if (abs(mcParticle.pdgCode()) == 310) - histos.fill(HIST("GeneratedWithPV/hK0Short_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == 3122) - histos.fill(HIST("GeneratedWithPV/hLambda_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == -3122) - histos.fill(HIST("GeneratedWithPV/hAntiLambda_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == 3312) - histos.fill(HIST("GeneratedWithPV/hXiMinus_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == -3312) - histos.fill(HIST("GeneratedWithPV/hXiPlus_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == 3334) - histos.fill(HIST("GeneratedWithPV/hOmegaMinus_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - if (mcParticle.pdgCode() == -3334) - histos.fill(HIST("GeneratedWithPV/hOmegaPlus_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); - } + static_for<0, 7>([&](auto i) { + constexpr int index = i.value; + if (i == 0 || i == 7) { + if (abs(mcParticle.pdgCode()) == pdgCodes[i]) { + histos.fill(HIST("GeneratedWithPV/h") + HIST(particlenames[index]), gpt, geta); + if (abs(mcParticle.y()) < 0.5) + histos.fill(HIST("GeneratedWithPV/h") + HIST(particlenames[index]) + HIST("_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); + } + + } else { + if (mcParticle.pdgCode() == pdgCodes[i]) { + histos.fill(HIST("GeneratedWithPV/h") + HIST(particlenames[index]), gpt, geta); + if (abs(mcParticle.y()) < 0.5) + histos.fill(HIST("GeneratedWithPV/h") + HIST(particlenames[index]) + HIST("_MidYVsMult"), gpt, bestCollisionFT0Mpercentile); + } + } + }); } } void processClosureTest(aod::McCollision const& mcCollision, soa::SmallGroups> const& recCollisions, aod::McParticles const& mcParticles) @@ -1378,6 +1389,8 @@ struct correlateStrangeness { bool bestCollisionSel8 = false; bool bestCollisionINELgtZERO = false; int biggestNContribs = -1; + uint32_t bestCollisionTriggerPresenceMap = 0; + for (auto& recCollision : recCollisions) { if (biggestNContribs < recCollision.numContrib()) { biggestNContribs = recCollision.numContrib(); @@ -1385,8 +1398,16 @@ struct correlateStrangeness { bestCollisionSel8 = recCollision.sel8(); bestCollisionVtxZ = recCollision.posZ(); bestCollisionINELgtZERO = recCollision.isInelGt0(); + if (triggerPresenceMap.size() > 0) + bestCollisionTriggerPresenceMap = triggerPresenceMap[recCollision.globalIndex()]; } } + // ________________________________________________ + // skip if desired trigger not found + if (triggerPresenceMap.size() > 0 && !bitcheck(bestCollisionTriggerPresenceMap, triggerBinToSelect)) { + return; + } + if (doGenEventSelection) { if (!bestCollisionSel8) return; @@ -1470,7 +1491,7 @@ struct correlateStrangeness { } } } - associatedIndices.emplace_back(piIndices); + associatedIndices.emplace_back(k0ShortIndices); associatedIndices.emplace_back(lambdaIndices); associatedIndices.emplace_back(antiLambdaIndices); @@ -1478,6 +1499,7 @@ struct correlateStrangeness { associatedIndices.emplace_back(xiPlusIndices); associatedIndices.emplace_back(omegaMinusIndices); associatedIndices.emplace_back(omegaPlusIndices); + associatedIndices.emplace_back(piIndices); for (Int_t iTrigger = 0; iTrigger < triggerIndices.size(); iTrigger++) { auto triggerParticle = mcParticles.iteratorAt(triggerIndices[iTrigger]); @@ -1498,21 +1520,25 @@ struct correlateStrangeness { Double_t getaassoc = assocParticle.eta(); Double_t gphiassoc = assocParticle.phi(); Double_t ptassoc = assocParticle.pt(); + Double_t deltaphi = ComputeDeltaPhi(gphitrigger, gphiassoc); + Double_t deltaeta = getatrigger - getaassoc; // skip if basic ranges not met - if (gphiassoc < axisRanges[0][0] || gphiassoc > axisRanges[0][1]) + if (deltaphi < axisRanges[0][0] || deltaphi > axisRanges[0][1]) continue; - if (getaassoc < axisRanges[1][0] || getaassoc > axisRanges[1][1]) + if (deltaeta < axisRanges[1][0] || deltaeta > axisRanges[1][1]) continue; if (ptassoc < axisRanges[2][0] || ptassoc > axisRanges[2][1]) continue; - histos.fill(HIST("ClosureTest/sameEvent/") + HIST(particlenames[index]), ComputeDeltaPhi(gphitrigger, gphiassoc), getatrigger - getaassoc, ptassoc, pttrigger, bestCollisionVtxZ, bestCollisionFT0Mpercentile); + if (bitcheck(doCorrelation, i)) + histos.fill(HIST("ClosureTest/sameEvent/") + HIST(particlenames[index]), ComputeDeltaPhi(gphitrigger, gphiassoc), deltaeta, ptassoc, pttrigger, bestCollisionVtxZ, bestCollisionFT0Mpercentile); } } }); } } + PROCESS_SWITCH(correlateStrangeness, processSelectEventWithTrigger, "Select events with trigger only", false); 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); diff --git a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx index d43be490657..b76fbee0fa8 100644 --- a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx +++ b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx @@ -299,10 +299,10 @@ struct K0MixedEvents { registry.fill(HIST("Trks"), 1); const float& vtxZ = track.singleCollSel_as().posZ(); registry.fill(HIST("VTX"), vtxZ); - if (abs(vtxZ) > _vertexZ) + if (std::abs(vtxZ) > _vertexZ) continue; registry.fill(HIST("eta"), track.pt(), track.eta()); - if (abs(track.rapidity(particle_mass(_particlePDG_1))) > _maxy) { + if (std::abs(track.rapidity(particle_mass(_particlePDG_1))) > _maxy) { continue; } registry.fill(HIST("rapidity_first"), track.pt(), track.rapidity(particle_mass(_particlePDG_1))); diff --git a/PWGLF/Tasks/Strangeness/lambdak0sflattenicity.cxx b/PWGLF/Tasks/Strangeness/lambdak0sflattenicity.cxx new file mode 100755 index 00000000000..b0636238735 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/lambdak0sflattenicity.cxx @@ -0,0 +1,1691 @@ +// 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. +/// +/// 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) + +#include +// #include +#include + +// #include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +// #include "Framework/StaticFor.h" +#include "Framework/runDataProcessing.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 "Common/DataModel/PIDResponse.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/Utils/inelGt.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct lambdak0sflattenicity { + // Histograms are defined with HistogramRegistry + 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"}; + static constexpr std::string_view tEst[8] = { + "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"}; + + // 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 nBinspT{"nBinspT", 250, "N bins in pT"}; + Configurable nBinsFlattenicity{"nBinsFlattenicity", 100, "N bins in Flattenicity"}; + + // Configurable for event selection + + 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 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_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_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_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 v0_etacut{"v0EtaCut", 0.8, "v0EtaCut"}; + + // acceptance cuts for Flattenicity correlation + 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 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}; + float upEdgeEst[8] = {99.5, 49999.5, 1.01, 499.5, 1.01, 499.5, 1.01, 150.0}; + + // Histograms + // Event selection + rEventSelection.add("hVertexZ", "hVertexZ", + {HistType::kTH1F, {vertexZAxis}}); + rEventSelection.add("hEventsSelected", "hEventsSelected", + {HistType::kTH1I, {{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::kTH1F, {flatAxis}}); + if (doprocessRecMC) { + rEventSelection.add("hFlattenicityDistributionMCGen_Rec", "hFlattenicityDistributionMCGen_Rec", + {HistType::kTH1F, {flatAxis}}); + rEventSelection.add("hFlattenicity_Corr_Gen_vs_Rec", "hFlattenicity_Corr_Gen_vs_Rec", + {HistType::kTH2F, {flatAxis, flatAxis}}); + } + if (doprocessGenMC) { + rEventSelection.add("hVertexZGen", "hVertexZGen", + {HistType::kTH1F, {vertexZAxis}}); + + rEventSelection.add("hFlattenicityDistributionMCGen", "hFlattenicityDistributionMCGen", + {HistType::kTH1F, {flatAxis}}); + + rEventSelection.add("hFlat_RecoColl_MC", "hFlat_RecoColl_MC", {HistType::kTH1F, {flatAxis}}); + rEventSelection.add("hFlat_RecoColl_MC_INELgt0", "hFlat_RecoColl_MC_INELgt0", {HistType::kTH1F, {flatAxis}}); + rEventSelection.add("hFlat_GenRecoColl_MC", "hFlat_GenRecoColl_MC", {HistType::kTH1F, {flatAxis}}); + rEventSelection.add("hFlat_GenRecoColl_MC_INELgt0", "hFlat_GenRecoColl_MC_INELgt0", {HistType::kTH1F, {flatAxis}}); + rEventSelection.add("hFlat_GenColl_MC", "hFlat_GenColl_MC", {HistType::kTH1F, {flatAxis}}); + rEventSelection.add("hFlat_GenColl_MC_INELgt0", "hFlat_GenColl_MC_INELgt0", {HistType::kTH1F, {flatAxis}}); + rEventSelection.add("hNEventsMCGen", "hNEventsMCGen", {HistType::kTH1I, {{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::kTH1I, {{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::kTH1I, {{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}}); + + // 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("hMassK0spTFlat", "hMassK0spTFlat", + {HistType::kTH3F, {{K0sMassAxis}, {ptAxis}, {flatAxis}}}); + if (doprocessRecMC) { + rKzeroShort.add("Generated_MCRecoCollCheck_INEL_K0Short", "Generated_MCRecoCollCheck_INEL_K0Short", + {HistType::kTH2F, {{ptAxis}, {flatAxis}}}); + } + + if (doprocessGenMC) { + rKzeroShort.add("pGen_MCGenRecoColl_INEL_K0Short", "pGen_MCGenRecoColl_INEL_K0Short", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rKzeroShort.add("Generated_MCRecoColl_INEL_K0Short", "Generated_MCRecoColl_INEL_K0Short", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rKzeroShort.add("pGen_MCGenColl_INEL_K0Short", "pGen_MCGenColl_INEL_K0Short", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rKzeroShort.add("pGen_MCGenRecoColl_INELgt0_K0Short", "pGen_MCGenRecoColl_INELgt0_K0Short", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rKzeroShort.add("Generated_MCRecoColl_INELgt0_K0Short", "Generated_MCRecoColl_INELgt0_K0Short", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rKzeroShort.add("Generated_MCRecoCollCheck_INELgt0_K0Short", "Generated_MCRecoCollCheck_INELgt0_K0Short", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rKzeroShort.add("pGen_MCGenColl_INELgt0_K0Short", "pGen_MCGenColl_INELgt0_K0Short", + {HistType::kTH2F, {ptAxis, flatAxis}}); + } + // Lambda reconstruction Mass + rLambda.add("hMassLambda", "hMassLambda", + {HistType::kTH1F, {LambdaMassAxis}}); + rLambda.add("hMassLambdaSelected", "hMassLambdaSelected", + {HistType::kTH1F, {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("hMassLambdapTFlat", "hMassLambdapTFlat", + {HistType::kTH3F, {{LambdaMassAxis}, {ptAxis}, {flatAxis}}}); + if (doprocessRecMC) { + rLambda.add("Generated_MCRecoCollCheck_INEL_Lambda", "Generated_MCRecoCollCheck_INEL_Lambda", + {HistType::kTH2F, {{ptAxis}, {flatAxis}}}); + } + + if (doprocessGenMC) { + rLambda.add("pGen_MCGenRecoColl_INEL_Lambda", "pGen_MCGenRecoColl_INEL_Lambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rLambda.add("Generated_MCRecoColl_INEL_Lambda", "Generated_MCRecoColl_INEL_Lambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rLambda.add("pGen_MCGenColl_INEL_Lambda", "pGen_MCGenColl_INEL_Lambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rLambda.add("pGen_MCGenRecoColl_INELgt0_Lambda", "pGen_MCGenRecoColl_INELgt0_Lambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rLambda.add("Generated_MCRecoColl_INELgt0_Lambda", "Generated_MCRecoColl_INELgt0_Lambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rLambda.add("Generated_MCRecoCollCheck_INELgt0_Lambda", "Generated_MCRecoCollCheck_INELgt0_Lambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rLambda.add("pGen_MCGenColl_INELgt0_Lambda", "pGen_MCGenColl_INELgt0_Lambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + } + // AntiLambda reconstruction + // Mass + rAntiLambda.add("hMassAntiLambda", "hMassAntiLambda", + {HistType::kTH1F, {AntiLambdaMassAxis}}); + rAntiLambda.add("hMassAntiLambdaSelected", "hMassAntiLambdaSelected", + {HistType::kTH1F, {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}}}); + rAntiLambda.add("hMassAntiLambdapTFlat", "hMassAntiLambdapTFlat", + {HistType::kTH3F, {{AntiLambdaMassAxis}, {ptAxis}, {flatAxis}}}); + if (doprocessRecMC) { + rAntiLambda.add("Generated_MCRecoCollCheck_INEL_AntiLambda", "Generated_MCRecoCollCheck_INEL_AntiLambda", + {HistType::kTH2F, {{ptAxis}, {flatAxis}}}); + } + + if (doprocessGenMC) { + rAntiLambda.add("pGen_MCGenRecoColl_INEL_AntiLambda", "pGen_MCGenRecoColl_INEL_AntiLambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rAntiLambda.add("Generated_MCRecoColl_INEL_AntiLambda", "Generated_MCRecoColl_INEL_AntiLambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rAntiLambda.add("pGen_MCGenColl_INEL_AntiLambda", "pGen_MCGenColl_INEL_AntiLambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rAntiLambda.add("pGen_MCGenRecoColl_INELgt0_AntiLambda", "pGen_MCGenRecoColl_INELgt0_AntiLambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rAntiLambda.add("Generated_MCRecoColl_INELgt0_AntiLambda", "Generated_MCRecoColl_INELgt0_AntiLambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rAntiLambda.add("Generated_MCRecoCollCheck_INELgt0_AntiLambda", "Generated_MCRecoCollCheck_INELgt0_AntiLambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + rAntiLambda.add("pGen_MCGenColl_INELgt0_AntiLambda", "pGen_MCGenColl_INELgt0_AntiLambda", + {HistType::kTH2F, {ptAxis, flatAxis}}); + } + + if (flattenicityQA) { + 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"}}); + } + + // 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("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"}}); + + 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( + "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("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("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("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"}}); + } + 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"); + } + if (!doprocessDataRun3 && !(doprocessRecMC || doprocessGenMC)) { + 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"); + } + } + + int getT0ASector(int i_ch) + { + int i_sec_t0a = -1; + for (int i_sec = 0; i_sec < 24; ++i_sec) { + if (i_ch >= 4 * i_sec && i_ch <= 3 + 4 * i_sec) { + i_sec_t0a = i_sec; + break; + } + } + return i_sec_t0a; + } + + int getT0CSector(int i_ch) + { + int i_sec_t0c = -1; + for (int i_sec = 0; i_sec < 28; ++i_sec) { + if (i_ch >= 4 * i_sec && i_ch <= 3 + 4 * i_sec) { + i_sec_t0c = i_sec; + break; + } + } + return i_sec_t0c; + } + + int getFV0Ring(int i_ch) + { + int i_ring = -1; + if (i_ch < 8) { + i_ring = 0; + } else if (i_ch >= 8 && i_ch < 16) { + i_ring = 1; + } else if (i_ch >= 16 && i_ch < 24) { + i_ring = 2; + } else if (i_ch >= 24 && i_ch < 32) { + i_ring = 3; + } else { + i_ring = 4; + } + return i_ring; + } + + int getFV0IndexPhi(int i_ch) + { + int i_ring = -1; + + if (i_ch >= 0 && i_ch < 8) { + if (i_ch < 4) { + i_ring = i_ch; + } else { + if (i_ch == 7) { + i_ring = 4; + } else if (i_ch == 6) { + i_ring = 5; + } else if (i_ch == 5) { + i_ring = 6; + } else if (i_ch == 4) { + i_ring = 7; + } + } + } else if (i_ch >= 8 && i_ch < 16) { + if (i_ch < 12) { + i_ring = i_ch; + } else { + if (i_ch == 15) { + i_ring = 12; + } else if (i_ch == 14) { + i_ring = 13; + } else if (i_ch == 13) { + i_ring = 14; + } else if (i_ch == 12) { + i_ring = 15; + } + } + } else if (i_ch >= 16 && i_ch < 24) { + if (i_ch < 20) { + i_ring = i_ch; + } else { + if (i_ch == 23) { + i_ring = 20; + } else if (i_ch == 22) { + i_ring = 21; + } else if (i_ch == 21) { + i_ring = 22; + } else if (i_ch == 20) { + i_ring = 23; + } + } + } else if (i_ch >= 24 && i_ch < 32) { + if (i_ch < 28) { + i_ring = i_ch; + } else { + if (i_ch == 31) { + i_ring = 28; + } else if (i_ch == 30) { + i_ring = 29; + } else if (i_ch == 29) { + i_ring = 30; + } else if (i_ch == 28) { + i_ring = 31; + } + } + } else if (i_ch == 32) { + i_ring = 32; + } else if (i_ch == 40) { + i_ring = 33; + } else if (i_ch == 33) { + i_ring = 34; + } else if (i_ch == 41) { + i_ring = 35; + } else if (i_ch == 34) { + i_ring = 36; + } else if (i_ch == 42) { + i_ring = 37; + } else if (i_ch == 35) { + i_ring = 38; + } else if (i_ch == 43) { + i_ring = 39; + } else if (i_ch == 47) { + i_ring = 40; + } else if (i_ch == 39) { + i_ring = 41; + } else if (i_ch == 46) { + i_ring = 42; + } else if (i_ch == 38) { + i_ring = 43; + } else if (i_ch == 45) { + i_ring = 44; + } else if (i_ch == 37) { + i_ring = 45; + } else if (i_ch == 44) { + i_ring = 46; + } else if (i_ch == 36) { + i_ring = 47; + } + return i_ring; + } + + float GetFlatenicity(std::span signals) + { + int entries = signals.size(); + float flat = 9999; + float mRho = 0; + for (int iCell = 0; iCell < entries; ++iCell) { + mRho += 1.0 * signals[iCell]; + } + // average activity per cell + mRho /= (1.0 * entries); + // get sigma + float sRho_tmp = 0; + for (int iCell = 0; iCell < entries; ++iCell) { + sRho_tmp += TMath::Power(1.0 * signals[iCell] - mRho, 2); + } + sRho_tmp /= (1.0 * entries * entries); + float sRho = TMath::Sqrt(sRho_tmp); + if (mRho > 0) { + flat = sRho / mRho; + } + return flat; + } + 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}; + // 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}; + // 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}; + // 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}; + + // 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}; + // 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}; + // 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 int nEta5 = 2; // FT0C + FT0A + static constexpr float weigthsEta5[nEta5] = {0.0490638, 0.010958415}; + static constexpr float deltaEeta5[nEta5] = {1.1, 1.2}; + + static constexpr int nEta6 = 2; // FT0C + FV0 + static constexpr float weigthsEta6[nEta6] = {0.0490638, 0.00353962}; + static constexpr float deltaEeta6[nEta6] = {1.1, 2.9}; + + static constexpr int innerFV0 = 32; + static constexpr float maxEtaFV0 = 5.1; + static constexpr float minEtaFV0 = 2.2; + static constexpr float detaFV0 = (maxEtaFV0 - minEtaFV0) / 5.0; + + 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; + std::array RhoLatticeT0A; + static constexpr int nCellsT0C = 28; + std::array RhoLatticeT0C; + + std::array estimator; + + template + bool isEventSelected(TCollision const& collision) + { + 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 (IsNoTimeFrameBorder && + !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + rEventSelection.fill(HIST("hEventsSelected"), 3.5); + + if (IsNoITSROFrameBorder && + !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + rEventSelection.fill(HIST("hEventsSelected"), 4.5); + + if (IsVertexITSTPC && + !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + rEventSelection.fill(HIST("hEventsSelected"), 5.5); + + if (IsNoSameBunchPileup && + !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + rEventSelection.fill(HIST("hEventsSelected"), 6.5); + + if (IsGoodZvtxFT0vsPV && + !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + rEventSelection.fill(HIST("hEventsSelected"), 7.5); + + if (IsTriggerTVX && + !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) { + return false; + } + 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 + float EstimateFlattenicity(TCollision const& collision, Tracks const& tracks) + { + const int nDetVtx = 3; + TGraph* gVtx[nDetVtx]; + const char* nameDet[nDetVtx] = {"AmpV0", "AmpT0A", "AmpT0C"}; + + float ampl5[nEta5] = {0, 0}; + float ampl6[nEta6] = {0, 0}; + + for (int i_d = 0; i_d < nDetVtx; ++i_d) { + gVtx[i_d] = 0; + gVtx[i_d] = new TGraph(); + } + for (int i_v = 0; i_v < 30; ++i_v) { + gVtx[0]->SetPoint(i_v, biningVtxt[i_v], calibFV0vtx[i_v]); + } + for (int i_v = 0; i_v < 30; ++i_v) { + gVtx[1]->SetPoint(i_v, biningVtxt[i_v], calibFT0Avtx[i_v]); + } + for (int i_v = 0; i_v < 30; ++i_v) { + gVtx[2]->SetPoint(i_v, biningVtxt[i_v], calibFT0Cvtx[i_v]); + } + + for (int i_d = 0; i_d < nDetVtx; ++i_d) { + gVtx[i_d]->SetName(Form("g%s", nameDet[i_d])); + } + auto vtxZ = collision.posZ(); + + float sumAmpFV0 = 0; + float sumAmpFV01to4Ch = 0; + + ampchannel.fill(0.0); + ampchannelBefore.fill(0.0); + RhoLattice.fill(0); + + if ((isflattenicitywithFV0 || isflattenicitywithFV0FT0C) && + collision.has_foundFV0()) { + + auto fv0 = collision.foundFV0(); + for (std::size_t ich = 0; ich < fv0.amplitude().size(); ich++) { + float phiv0 = -999.0; + float etav0 = -999.0; + int channelv0 = fv0.channel()[ich]; + float ampl_ch = fv0.amplitude()[ich]; + int ringindex = getFV0Ring(channelv0); + int channelv0phi = getFV0IndexPhi(channelv0); + etav0 = maxEtaFV0 - (detaFV0 / 2.0) * (2.0 * ringindex + 1); + if (channelv0 < innerFV0) { + phiv0 = (2.0 * (channelv0phi - 8 * ringindex) + 1) * M_PI / (8.0); + } else { + phiv0 = ((2.0 * channelv0phi) + 1 - 64.0) * 2.0 * M_PI / (32.0); + } + ampchannelBefore[channelv0phi] = ampl_ch; + if (applyCalibCh) { + ampl_ch *= calib[channelv0phi]; + } + sumAmpFV0 += ampl_ch; + + if (channelv0 >= 8) { // exclude the 1st ch, eta 2.2,4.52 + sumAmpFV01to4Ch += ampl_ch; + } + if (flattenicityQA) { + rFlattenicity.fill(HIST("fEtaPhiFv0"), phiv0, etav0, ampl_ch); + } + ampchannel[channelv0phi] = ampl_ch; + if (channelv0 < innerFV0) { + RhoLattice[channelv0phi] = ampl_ch; + } else { + RhoLattice[channelv0phi] = ampl_ch / 2.0; // two channels per bin + } + } + + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpV0vsVtxBeforeCalibration"), vtxZ, sumAmpFV0); + } + if (applyCalibVtx) { + sumAmpFV0 *= gVtx[0]->Eval(vtxZ); + sumAmpFV01to4Ch *= gVtx[0]->Eval(vtxZ); + } + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpV0vsVtx"), vtxZ, sumAmpFV0); + } + } + + float flattenicityfv0 = 9999; + if (isflattenicitywithFV0 || isflattenicitywithFV0FT0C) { + flattenicityfv0 = GetFlatenicity({RhoLattice.data(), RhoLattice.size()}); + } + + // global tracks + float ptT = 0.; + int multGlob = 0; + for (auto& track : tracks) { + if (!track.isGlobalTrack()) { + continue; + } + if (track.pt() > ptT) { + ptT = track.pt(); + } + multGlob++; + } + + // FT0 + float sumAmpFT0A = 0.f; + float sumAmpFT0C = 0.f; + + RhoLatticeT0A.fill(0); + RhoLatticeT0C.fill(0); + + if ((isflattenicitywithFT0 || isflattenicitywithFV0FT0C) && + collision.has_foundFT0()) { + auto ft0 = collision.foundFT0(); + 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); + } + } + } + + for (std::size_t i_c = 0; i_c < ft0.amplitudeC().size(); i_c++) { + float amplitude = ft0.amplitudeC()[i_c]; + sumAmpFT0C += amplitude; + uint8_t channel = ft0.channelC()[i_c]; + int sector = getT0CSector(channel); + if (sector >= 0 && sector < 28) { + RhoLatticeT0C[sector] += amplitude; + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0CVsChBeforeCalibration"), sector, + amplitude); + } + if (applyCalibCh) { + amplitude *= calibT0C[sector]; + } + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0CVsCh"), sector, amplitude); + } + } + if (flattenicityQA) { + rFlattenicity.fill(HIST("hFT0C"), amplitude); + } + } + 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); + } + if (flattenicityQA) { + rFlattenicity.fill(HIST("hAmpT0AvsVtx"), vtxZ, sumAmpFT0A); + rFlattenicity.fill(HIST("hAmpT0CvsVtx"), vtxZ, sumAmpFT0C); + } + } + float flatenicity_t0a = 9999; + if (isflattenicitywithFT0) { + flatenicity_t0a = + GetFlatenicity({RhoLatticeT0A.data(), RhoLatticeT0A.size()}); + } + float flatenicity_t0c = 9999; + if (isflattenicitywithFT0 || isflattenicitywithFV0FT0C) { + flatenicity_t0c = + GetFlatenicity({RhoLatticeT0C.data(), RhoLatticeT0C.size()}); + } + + bool isOK_estimator5 = false; + bool isOK_estimator6 = false; + float combined_estimator5 = 0; + float combined_estimator6 = 0; + + for (int i_e = 0; i_e < 8; ++i_e) { + estimator[i_e] = 0; + } + + if (collision.has_foundFV0() && collision.has_foundFT0()) { + float all_weights = 0; + // option 5 + ampl5[0] = sumAmpFT0C; + ampl5[1] = sumAmpFT0A; + if (sumAmpFT0C > 0 && sumAmpFT0A > 0) { + isOK_estimator5 = true; + } + if (isOK_estimator5) { + if (applyNorm) { + all_weights = 0; + for (int i_5 = 0; i_5 < nEta5; ++i_5) { + combined_estimator5 += + ampl5[i_5] * weigthsEta5[i_5] / deltaEeta5[i_5]; + all_weights += weigthsEta5[i_5]; + } + combined_estimator5 /= all_weights; + } else { + for (int i_5 = 0; i_5 < nEta5; ++i_5) { + combined_estimator5 += ampl5[i_5] * weigthsEta5[i_5]; + } + } + } + // option 6: FT0C + FV0 + ampl6[0] = sumAmpFT0C; + ampl6[1] = sumAmpFV0; + if (sumAmpFT0C > 0 && sumAmpFV0 > 0) { + isOK_estimator6 = true; + } + if (isOK_estimator6) { + if (applyNorm) { + all_weights = 0; + for (int i_6 = 0; i_6 < nEta6; ++i_6) { + combined_estimator6 += + ampl6[i_6] * weigthsEta6[i_6] / deltaEeta6[i_6]; + all_weights += weigthsEta6[i_6]; + } + combined_estimator6 /= all_weights; + } else { + for (int i_6 = 0; i_6 < nEta6; ++i_6) { + combined_estimator6 += ampl6[i_6] * weigthsEta6[i_6]; + } + } + } + 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; + estimator[3] = combined_estimator5; + float flatenicity_ft0 = (flatenicity_t0a + flatenicity_t0c) / 2.0; + estimator[4] = 1.0 - flatenicity_ft0; + estimator[5] = combined_estimator6; + 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); + } + + if (isflattenicitywithFV0) { + for (int iCh = 0; iCh < 48; ++iCh) { + rFlattenicity.fill(HIST("hAmpV0VsCh"), iCh, ampchannel[iCh]); + rFlattenicity.fill(HIST("hAmpV0VsChBeforeCalibration"), iCh, + ampchannelBefore[iCh]); + } + } + + 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; + } + + 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++; + } + } + } + + flattenicity = + 1.0 - GetFlatenicity({RhoLatticeFV0AMC.data(), RhoLatticeFV0AMC.size()}); + return flattenicity; + } + // ====================== Flattenicity estimation ends ===================== + + // Filters on V0s + // 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 && aod::track::pt > cfgTrkLowPtCut); + + using TrackCandidates = soa::Filtered< + soa::Join>; + + 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 (applyEvSel && + !(isEventSelected(collision))) { // Checking if the event passes the + // selection criteria + return; + } + + auto vtxZ = collision.posZ(); + auto vtxY = collision.posY(); + auto vtxX = collision.posX(); + + 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()) > cfgTrkEtaCut || + TMath::Abs(negDaughterTrack.eta()) > cfgTrkEtaCut || + negDaughterTrack.pt() < cfgTrkLowPtCut || + posDaughterTrack.pt() < cfgTrkLowPtCut) { + continue; + } + 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; + + // 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)) <= 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()); + } + } + + // 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)) <= 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()); + } + } + + // 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)) <= 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()); + } + } + } + } + + 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) + { + for (const auto& collision : collisions) { + if (applyEvSel && + !(isEventSelected(collision))) { // Checking if the event passes the + // selection criteria + continue; + } + + auto vtxZ = collision.posZ(); + auto vtxY = collision.posY(); + auto vtxX = collision.posX(); + + float flattenicity = EstimateFlattenicity(collision, tracks); + + rEventSelection.fill(HIST("hVertexZ"), vtxZ); + rEventSelection.fill(HIST("hFlattenicityDistribution"), flattenicity); + + auto v0sThisCollision = V0s.sliceBy(perCol, collision.globalIndex()); + const auto& mcCollision = collision.mcCollision_as(); + + for (const auto& v0 : v0sThisCollision) { + + const auto& posDaughterTrack = v0.posTrack_as(); + const auto& negDaughterTrack = v0.negTrack_as(); + + if (TMath::Abs(posDaughterTrack.eta()) > cfgTrkEtaCut || + TMath::Abs(negDaughterTrack.eta()) > cfgTrkEtaCut || + negDaughterTrack.pt() < cfgTrkLowPtCut || + posDaughterTrack.pt() < cfgTrkLowPtCut) { + continue; + } + + if (!v0.has_mcParticle()) { + continue; + } + + 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()); + } + } + + // 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()); + } + } + + // 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()); + } + } + } + + 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& mcParticle : particlesInCollision) { + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + + if (std::abs(mcParticle.y()) > 0.5f) { + continue; + } + + 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) + { + float flattenicity = EstimateFlattenicityFV0MC(mcParticles); + rEventSelection.fill(HIST("hFlattenicityDistributionMCGen"), flattenicity); + //==================================== + //===== Event Loss Denominator ======= + //==================================== + + 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; + } + + 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 + } + } + } + + int recoCollIndex_INEL = 0; + int recoCollIndex_INELgt0 = 0; + for (auto& collision : collisions) { // loop on reconstructed collisions + + //===================================== + //====== Event Split Numerator ======== + //===================================== + + 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); + + recoCollIndex_INEL++; + + if (collision.isInelGt0() && isINELgt0true) { + rEventSelection.fill(HIST("hNEventsMCReco"), 2.5); + rEventSelection.fill(HIST("hFlat_RecoColl_MC_INELgt0"), flattenicity); + + recoCollIndex_INELgt0++; + } + + //===================================== + //======== Sgn Split Numerator ======== + //===================================== + + for (auto& mcParticle : mcParticles) { + + if (!mcParticle.isPhysicalPrimary()) { + continue; + } + + if (std::abs(mcParticle.y()) > 0.5f) { + continue; + } + + if (mcParticle.pdgCode() == 310) { + 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("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("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); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Strangeness/lambdapolarization.cxx b/PWGLF/Tasks/Strangeness/lambdapolarization.cxx index ac133f93e83..6fc88bf79dd 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" @@ -87,6 +88,12 @@ struct lambdapolarization { Configurable cfgCentSel{"cfgCentSel", 80., "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"}; @@ -115,10 +122,20 @@ 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"}; + TF1* fMultPVCutLow = nullptr; TF1* fMultPVCutHigh = nullptr; @@ -138,6 +155,7 @@ struct lambdapolarization { int currentRunNumber = -999; int lastRunNumber = -999; std::vector shiftprofile{}; + TProfile2D* EffMap = nullptr; std::string fullCCDBShiftCorrPath; @@ -156,6 +174,8 @@ struct lambdapolarization { return 4; } else if (name.value == "TPCneg") { return 5; + } else if (name.value == "TPCall") { + return 6; } else { return 0; } @@ -163,11 +183,9 @@ struct lambdapolarization { void init(o2::framework::InitContext&) { - AxisSpec massAxis = {100, 1.065, 1.165}; - AxisSpec ptAxis = {100, 0.0, 10.0}; AxisSpec cosAxis = {110, -1.05, 1.05}; - AxisSpec centAxis = {8, 0.0, 80.0}; 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}; @@ -184,10 +202,20 @@ struct lambdapolarization { histos.add(Form("psi%d/h_lambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); histos.add(Form("psi%d/h_alambda_cossin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + + histos.add(Form("psi%d/h_lambda_vncos", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + histos.add(Form("psi%d/h_lambda_vnsin", i), "", {HistType::kTHnSparseF, {massAxis, ptAxis, cosAxis, centAxis}}); + 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}}); @@ -273,6 +301,15 @@ struct lambdapolarization { 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 @@ -526,38 +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_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_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.mLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi2/h_alambda_vnsin"), v0.mLambda(), 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_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_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.mLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi3/h_alambda_vnsin"), v0.mLambda(), 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_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_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.mLambda(), v0.pt(), TMath::Cos(relphi), centrality, weight); + histos.fill(HIST("psi4/h_alambda_vnsin"), v0.mLambda(), v0.pt(), TMath::Sin(relphi), centrality, weight); } } ////////// FIXME: not possible to get histograms using nmode } @@ -576,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(); @@ -591,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 new file mode 100644 index 00000000000..1081f0b872a --- /dev/null +++ b/PWGLF/Tasks/Strangeness/lambdapolsp.cxx @@ -0,0 +1,596 @@ +// 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. +// Lambda polarisation task +// prottay.das@cern.ch + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 "ReconstructionDataFormats/Track.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; +using namespace o2::framework::expressions; +using std::array; + +struct lambdapolsp { + + 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 correction{"correction", false, "fill histograms including corrections"}; + 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 isPVContributor{"isPVContributor", true, "is PV contributor"}; + Configurable checkwithpub{"checkwithpub", true, "checking results with published"}; + // Configs for V0 + Configurable ConfV0PtMin{"ConfV0PtMin", 0.f, "Minimum transverse momentum of V0"}; + Configurable ConfV0Rap{"ConfV0Rap", 0.8f, "Rapidity range of V0"}; + Configurable ConfV0DCADaughMax{"ConfV0DCADaughMax", 0.2f, "Maximum DCA between the V0 daughters"}; + 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 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 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 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"}; + + 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, 0.4, 0.8}, "Eta"}; + + SliceCache cache; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + void init(o2::framework::InitContext&) + { + AxisSpec thnAxispT{ptNbins, lbinpt, hbinpt, "#it{p}_{T} (GeV/#it{c})"}; + 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"}; + + if (checkwithpub) { + 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("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); + } 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("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); + } 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("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("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}}); + + if (!checkwithpub) { + // histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{20, -10.0, 10.0}}); + histos.add("hpRes", "hpRes", HistType::kTHnSparseF, {centAxis, thnAxisres}); + if (QA) { + histos.add("hpResSin", "hpResSin", HistType::kTHnSparseF, {centAxis, thnAxisres}); + histos.add("hpCosPsiA", "hpCosPsiA", HistType::kTHnSparseF, {centAxis, thnAxisres}); + histos.add("hpCosPsiC", "hpCosPsiC", HistType::kTHnSparseF, {centAxis, thnAxisres}); + histos.add("hpSinPsiA", "hpSinPsiA", HistType::kTHnSparseF, {centAxis, thnAxisres}); + histos.add("hpSinPsiC", "hpSinPsiC", HistType::kTHnSparseF, {centAxis, 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}}); + } + if (!correction) { + 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); + } + } + } + + 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; + } + } + return true; + } + + template + bool SelectionV0(Collision const& collision, V0 const& candidate) + { + + const float pT = candidate.pt(); + // const std::vector decVtx = {candidate.x(), candidate.y(), candidate.z()}; + const float tranRad = candidate.v0radius(); + const float dcaDaughv0 = TMath::Abs(candidate.dcaV0daughters()); + const float cpav0 = candidate.v0cosPA(); + + float CtauLambda = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda; + // float lowmasscutlambda = cMinLambdaMass; + // float highmasscutlambda = cMaxLambdaMass; + + if (pT < ConfV0PtMin) { + return false; + } + if (TMath::Abs(candidate.dcapostopv()) < cMinV0DCA) { + return false; + } + if (TMath::Abs(candidate.dcanegtopv()) < cMinV0DCA) { + return false; + } + if (dcaDaughv0 > ConfV0DCADaughMax) { + return false; + } + if (cpav0 < ConfV0CPAMin) { + return false; + } + if (tranRad < ConfV0TranRadV0Min) { + return false; + } + if (tranRad > ConfV0TranRadV0Max) { + return false; + } + if (TMath::Abs(CtauLambda) > cMaxV0LifeTime) { + return false; + } + if (TMath::Abs(candidate.yLambda()) > ConfV0Rap) { + return false; + } + return true; + } + template + bool isSelectedV0Daughter(T const& track, int pid) + { + const auto eta = track.eta(); + const auto pt = track.pt(); + const auto tpcNClsF = track.tpcNClsFound(); + // const auto dcaXY = track.dcaXY(); + // const auto sign = track.sign(); + /* + if (charge < 0 && sign > 0) { + return false; + } + if (charge > 0 && sign < 0) { + return false; + }*/ + if (TMath::Abs(eta) > ConfDaughEta) { + return false; + } + if (pt < ConfDaughPt) { + return false; + } + if (tpcNClsF < ConfDaughTPCnclsMin) { + return false; + } + /* + if (track.tpcCrossedRowsOverFindableCls() < 0.8) { + return false; + } + if (TMath::Abs(dcaXY) < ConfDaughDCAMin) { + return false; + }*/ + if (pid == 0 && TMath::Abs(track.tpcNSigmaPr()) > ConfDaughPIDCuts) { + return false; + } + if (pid == 1 && TMath::Abs(track.tpcNSigmaPi()) > ConfDaughPIDCuts) { + return false; + } + + return true; + } + + double GetPhiInRange(double phi) + { + double result = phi; + while (result < 0) { + result = result + 2. * TMath::Pi(); + } + while (result > 2. * TMath::Pi()) { + result = result - 2. * TMath::Pi(); + } + return result; + } + + ROOT::Math::PxPyPzMVector Lambda, Proton, Pion, fourVecDauCM; + // ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector; + ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY; + float phiangle = 0.0; + // double massPi = TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass(); + // double massPr = TDatabasePDG::Instance()->GetParticle(kProton)->Mass(); + // double massLambda = TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass(); + double massLambda = o2::constants::physics::MassLambda; + double massPr = o2::constants::physics::MassProton; + double massPi = o2::constants::physics::MassPionCharged; + + 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; + } + auto centrality = collision.centFT0C(); + + // histos.fill(HIST("hCentrality0"), centrality); + if (!collision.triggerevent()) { + return; + } + // 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))) { + if (additionalEvSel2 && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) { + return; + } + // histos.fill(HIST("hCentrality3"), centrality); + if (additionalEvSel3 && (!collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder))) { + return; + } + + 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); + if (!checkwithpub) { + // 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); + } + } + + ///////////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); + + for (auto track : tracks) { + if (!selectionTrack(track)) { + continue; + } + + float sign = track.sign(); + if (sign == 0.0) // removing neutral particles + continue; + + 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 (tofhit) { + if (track.hasTOF()) { + 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); + + 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("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); + + 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("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 { + for (auto v0 : V0s) { + + auto postrack = v0.template posTrack_as(); + auto negtrack = v0.template negTrack_as(); + + int LambdaTag = 0; + int aLambdaTag = 0; + + if (isSelectedV0Daughter(postrack, 0) && isSelectedV0Daughter(negtrack, 1)) { + LambdaTag = 1; + } + if (isSelectedV0Daughter(negtrack, 0) && isSelectedV0Daughter(postrack, 1)) { + aLambdaTag = 1; + } + + if (LambdaTag == aLambdaTag) + continue; + + if (!SelectionV0(collision, v0)) { + continue; + } + + if (LambdaTag) { + Proton = ROOT::Math::PxPyPzMVector(postrack.px(), postrack.py(), postrack.pz(), massPr); + Pion = ROOT::Math::PxPyPzMVector(negtrack.px(), negtrack.py(), negtrack.pz(), massPi); + } + if (aLambdaTag) { + Proton = ROOT::Math::PxPyPzMVector(negtrack.px(), negtrack.py(), negtrack.pz(), massPr); + Pion = ROOT::Math::PxPyPzMVector(postrack.px(), postrack.py(), postrack.pz(), massPi); + } + Lambda = Proton + Pion; + Lambda.SetM(massLambda); + + ROOT::Math::Boost boost{Lambda.BoostToCM()}; + fourVecDauCM = boost(Proton); + threeVecDauCM = fourVecDauCM.Vect(); + // beamvector = ROOT::Math::XYZVector(0, 0, 1); + // 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()); + + auto phiminuspsiC = GetPhiInRange(phiangle - psiZDCC); + auto phiminuspsiA = GetPhiInRange(phiangle - psiZDCA); + // auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); + auto cosThetaStar = fourVecDauCM.Pz() / fourVecDauCM.P(); // A0 correction + 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 + + 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); + } else { + histos.fill(HIST("hSparseLambdaPolA"), v0.mLambda(), v0.pt(), PolA, centrality); + histos.fill(HIST("hSparseLambdaPolC"), v0.mLambda(), v0.pt(), PolC, 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); + } else { + histos.fill(HIST("hSparseAntiLambdaPolA"), v0.mAntiLambda(), v0.pt(), PolA, centrality); + histos.fill(HIST("hSparseAntiLambdaPolC"), v0.mAntiLambda(), v0.pt(), PolC, centrality); + } + } + } + } + } + PROCESS_SWITCH(lambdapolsp, processData, "Process data", true); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"lambdapolsp"})}; +} diff --git a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx b/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx index c7bd8bd13c2..44e3ded502a 100644 --- a/PWGLF/Tasks/Strangeness/nonPromptCascade.cxx +++ b/PWGLF/Tasks/Strangeness/nonPromptCascade.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 "CCDB/BasicCCDBManager.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" @@ -45,7 +50,9 @@ struct NPCascCandidate { float itsClusSize; bool isGoodMatch; bool isGoodCascade; - int pdgCodePrimary; + int pdgCodeMom; + bool isFromBeauty; + bool isFromCharm; float pvX; float pvY; float pvZ; @@ -143,6 +150,7 @@ struct NonPromptCascadeTask { Produces NPCTable; Produces NPCTableMC; + Produces NPCTableGen; using TracksExtData = soa::Join; using TracksExtMC = soa::Join; @@ -369,6 +377,26 @@ struct NonPromptCascadeTask { candidates.clear(); std::vector mcParticleId; + + auto isFromHF = [&](auto particle) -> std::tuple { + bool fromBeauty = false; + bool fromCharm = false; + if (particle.has_mothers()) { + auto mom = particle.template mothers_as()[0]; + int pdgCodeMom = mom.pdgCode(); + fromBeauty = std::abs(pdgCodeMom) / 5000 == 1 || std::abs(pdgCodeMom) / 500 == 1 || std::abs(pdgCodeMom) == 5; + fromCharm = std::abs(pdgCodeMom) / 4000 == 1 || std::abs(pdgCodeMom) / 400 == 1 || std::abs(pdgCodeMom) == 4; + while (mom.has_mothers()) { + const auto grandma = mom.template mothers_as()[0]; + int pdgCodeGrandma = std::abs(grandma.pdgCode()); + fromBeauty = fromBeauty || (pdgCodeGrandma / 5000 == 1 || pdgCodeGrandma / 500 == 1 || pdgCodeGrandma == 5); + fromCharm = fromCharm || (pdgCodeGrandma / 4000 == 1 || pdgCodeGrandma / 400 == 1 || pdgCodeGrandma == 4); + mom = grandma; + } + } + return {fromBeauty, fromCharm}; + }; + for (const auto& trackedCascade : trackedCascades) { auto collision = trackedCascade.collision_as(); @@ -563,15 +591,14 @@ struct NonPromptCascadeTask { bool isGoodMatch = ((motherParticleID == ITStrack.mcParticleId())) ? true : false; - int pdgCodePrimary = 0; + int pdgCodeMom = 0; + std::tuple fromHF{false, false}; if (isGoodCascade && isGoodMatch) { - if (track.mcParticle().has_mothers()) { - const auto primary = track.mcParticle().mothers_as()[0]; - pdgCodePrimary = primary.pdgCode(); - } + 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, pdgCodePrimary, + 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), primaryVertex.getX(), primaryVertex.getY(), primaryVertex.getZ(), track.pt(), track.eta(), track.phi(), protonTrack.pt(), protonTrack.eta(), pionTrack.pt(), pionTrack.eta(), bachelor.pt(), bachelor.eta(), @@ -600,7 +627,7 @@ struct NonPromptCascadeTask { auto mcCollision = particle.mcCollision_as(); auto label = collisions.iteratorAt(c.collisionID); - NPCTableMC(c.matchingChi2, c.itsClusSize, c.isGoodMatch, c.isGoodCascade, c.pdgCodePrimary, + NPCTableMC(c.matchingChi2, c.itsClusSize, c.isGoodMatch, c.isGoodCascade, c.pdgCodeMom, 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, @@ -614,6 +641,18 @@ struct NonPromptCascadeTask { c.protonTOFNSigma, c.pionTOFNSigma, c.bachKaonTOFNSigma, c.bachPionTOFNSigma, particle.pt(), particle.eta(), particle.phi(), particle.pdgCode(), mcCollision.posX() - particle.vx(), mcCollision.posY() - particle.vy(), mcCollision.posZ() - particle.vz(), mcCollision.globalIndex() == label.mcCollisionId()); } + + for (auto& p : mcParticles) { + auto absCode = std::abs(p.pdgCode()); + if (absCode != 3312 && absCode != 3334) { + continue; + } + auto fromHF = isFromHF(p); + int pdgCodeMom = p.has_mothers() ? p.mothers_as()[0].pdgCode() : 0; + auto mcCollision = p.mcCollision_as(); + + NPCTableGen(p.pt(), p.eta(), p.phi(), p.pdgCode(), pdgCodeMom, mcCollision.posX() - p.vx(), mcCollision.posY() - p.vy(), mcCollision.posZ() - p.vz(), std::get<0>(fromHF), std::get<1>(fromHF)); + } } PROCESS_SWITCH(NonPromptCascadeTask, processTrackedCascadesMC, "process cascades from strangeness tracking: MC analysis", true); @@ -808,7 +847,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, -1, + candidates.emplace_back(NPCascCandidate{track.globalIndex(), ITStrack.globalIndex(), trackedCascade.collisionId(), trackedCascade.matchingChi2(), trackedCascade.itsClsSize(), 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(), diff --git a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx index 343c5ba4287..687c444bb71 100644 --- a/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx +++ b/PWGLF/Tasks/Strangeness/sigmaanalysis.cxx @@ -9,8 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. // -// This is a task that employs the standard V0 tables and attempts to combine -// two V0s into a Sigma0 -> Lambda + gamma candidate. +// This is a task that reads sigma0 tables (from sigma0builder) to perform analysis. // *+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* // Sigma0 analysis task // *+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+* @@ -54,11 +53,9 @@ 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; +using V0MCSigmas = soa::Join; +using V0Sigmas = soa::Join; struct sigmaanalysis { HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -68,7 +65,7 @@ struct sigmaanalysis { // Configurable analyseAntiSigma{"analyseAntiSigma", false, "process AntiSigma-like candidates"}; // Analysis strategy: - Configurable fUseMLSel{"fUseMLSel", true, "Flag to use ML selection. If False, the standard selection is applied."}; + 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."}; // For ML Selection @@ -81,46 +78,48 @@ 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 LambdaWindow{"LambdaWindow", 0.015, "Mass window around expected (in GeV/c2)"}; + Configurable LambdaMaxRap{"LambdaMaxRap", 0.8, "Max lambda rapidity"}; //// 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 PhotonMaxDauPseudoRap{"PhotonMaxDauPseudoRap", 0.9, "Max pseudorapidity of daughter tracks"}; + 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 PhotonMaxPseudoRap{"PhotonMaxPseudoRap", 0.9, "Max photon pseudorapidity"}; - Configurable PhotonMinRadius{"PhotonMinRadius", 0.5, "Min photon conversion radius (cm)"}; - Configurable PhotonMaxRadius{"PhotonMaxRadius", 180, "Max photon conversion radius (cm)"}; + Configurable PhotonMaxRap{"PhotonMaxRap", 0.5, "Max photon rapidity"}; + 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"}; + // 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"}; @@ -128,13 +127,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", {25, 0.5f, +25.5f}, "Candidate Selection"}; // ML ConfigurableAxis MLProb{"MLOutput", {100, 0.0f, 1.0f}, ""}; @@ -144,26 +143,15 @@ struct sigmaanalysis { // Event counter histos.add("hEventCentrality", "hEventCentrality", kTH1F, {axisCentrality}); - // For Signal Extraction - histos.add("h3dMassSigma0", "h3dMassSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - histos.add("h3dMassAntiSigma0", "h3dMassAntiSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - // All candidates received - // histos.add("GeneralQA/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); - // histos.add("GeneralQA/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); - // histos.add("GeneralQA/hDCADaughters", "hDCADaughters", kTH1F, {axisDCAdau}); - // histos.add("GeneralQA/hPointingAngle", "hPointingAngle", kTH1F, {axisPointingAngle}); - // histos.add("GeneralQA/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - // histos.add("GeneralQA/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); - // histos.add("GeneralQA/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); 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}); // Candidates Counters - histos.add("GeneralQA/hCandidateAnalysisSelection", "hCandidateAnalysisSelection", kTH1F, {{22, -0.5f, +21.5f}}); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(1, "Photon Mass Cut"); - histos.get(HIST("GeneralQA/hCandidateAnalysisSelection"))->GetXaxis()->SetBinLabel(2, "Photon DauEta 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"); @@ -171,7 +159,7 @@ struct sigmaanalysis { 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 Eta 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"); @@ -184,71 +172,73 @@ struct sigmaanalysis { 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"); + + // 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/hPhotonMassSelected", "hPhotonMassSelected", kTH1F, {axisPhotonMass}); + histos.add("GeneralQA/hLambdaMassSelected", "hLambdaMassSelected", kTH1F, {axisLambdaMass}); + histos.add("GeneralQA/hAntiLambdaMassSelected", "hAntiLambdaMassSelected", kTH1F, {axisLambdaMass}); + // For Signal Extraction - // Sigma0 QA + // Sigma0 + histos.add("Sigma0/h3dMassSigma0", "h3dMassSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); histos.add("Sigma0/hMassSigma0", "hMassSigma0", kTH1F, {axisSigmaMass}); histos.add("Sigma0/hPtSigma0", "hPtSigma0", kTH1F, {axisPt}); histos.add("Sigma0/hRapiditySigma0", "hRapiditySigma0", kTH1F, {axisRapidity}); - // Sigma0 QA - histos.add("AntiSigma0/hMassSigma0", "hMassSigma0", kTH1F, {axisSigmaMass}); - histos.add("AntiSigma0/hPtSigma0", "hPtSigma0", kTH1F, {axisPt}); - histos.add("AntiSigma0/hRapiditySigma0", "hRapiditySigma0", kTH1F, {axisRapidity}); - - // Gamma QA - histos.add("Gamma/hMassGamma", "hMassGamma", kTH1F, {axisSigmaMass}); - histos.add("Gamma/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); - histos.add("Gamma/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); - histos.add("Gamma/hDCADaughters", "hDCADaughters", kTH1F, {axisDCAdau}); - histos.add("Gamma/hPointingAngle", "hPointingAngle", kTH1F, {axisPointingAngle}); - histos.add("Gamma/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("Gamma/hMLOutputGamma", "hMLOutputGamma", kTH1F, {MLProb}); - histos.add("Gamma/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); - histos.add("Gamma/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); - histos.add("Gamma/h2dPhotonRadiusVsPt", "hPhotonRadiusVsPt", {HistType::kTH2F, {axisPt, axisRadius}}); - histos.add("Gamma/h2dPhotonMassVsMLScore", "h2dPhotonMassVsMLScore", {HistType::kTH2F, {MLProb, axisSigmaMass}}); - - // Lambda QA - histos.add("Lambda/hMassLambda", "hMassLambda", kTH1F, {axisLambdaMass}); - histos.add("Lambda/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); - histos.add("Lambda/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); - histos.add("Lambda/hDCADaughters", "hDCADaughters", kTH1F, {axisDCAdau}); - histos.add("Lambda/hPointingAngle", "hPointingAngle", kTH1F, {axisPointingAngle}); - histos.add("Lambda/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("Lambda/hMLOutputLambda", "hMLOutputLambda", kTH1F, {MLProb}); - histos.add("Lambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); - histos.add("Lambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); - histos.add("Lambda/h2dLambdaRadiusVsPt", "hLambdaRadiusVsPt", {HistType::kTH2F, {axisPt, axisRadius}}); - histos.add("Lambda/h2dLambdaMassVsMLScore", "h2dLambdaMassVsMLScore", {HistType::kTH2F, {MLProb, axisLambdaMass}}); - - // AntiLambda QA - histos.add("AntiLambda/hMassAntiLambda", "hMassAntiLambda", kTH1F, {axisLambdaMass}); - histos.add("AntiLambda/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); - histos.add("AntiLambda/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); - histos.add("AntiLambda/hDCADaughters", "hDCADaughters", kTH1F, {axisDCAdau}); - histos.add("AntiLambda/hPointingAngle", "hPointingAngle", kTH1F, {axisPointingAngle}); - histos.add("AntiLambda/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); - histos.add("AntiLambda/hMLOutputAntiLambda", "hMLOutputAntiLambda", kTH1F, {MLProb}); - histos.add("AntiLambda/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); - histos.add("AntiLambda/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); - histos.add("AntiLambda/h2dAntiLambdaRadiusVsPt", "h2dAntiLambdaRadiusVsPt", {HistType::kTH2F, {axisPt, axisRadius}}); - histos.add("AntiLambda/h2dAntiLambdaMassVsMLScore", "h2dAntiLambdaMassVsMLScore", {HistType::kTH2F, {MLProb, axisLambdaMass}}); + // AntiSigma0 + histos.add("AntiSigma0/h3dMassAntiSigma0", "h3dMassAntiSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); + histos.add("AntiSigma0/hMassAntiSigma0", "hMassAntiSigma0", kTH1F, {axisSigmaMass}); + histos.add("AntiSigma0/hPtAntiSigma0", "hPtAntiSigma0", kTH1F, {axisPt}); + histos.add("AntiSigma0/hRapidityAntiSigma0", "hRapidityAntiSigma0", kTH1F, {axisRapidity}); if (fProcessMonteCarlo) { // Event counter histos.add("hMCEventCentrality", "hMCEventCentrality", kTH1F, {axisCentrality}); - // For Signal Extraction - histos.add("h3dMCMassSigma0", "h3dMCMassSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); + // Kinematic + histos.add("MC/h3dMassSigma0", "h3dMassSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); + histos.add("MC/h3dMassAntiSigma0", "h3dMassSigma0", kTH3F, {axisCentrality, axisPt, axisSigmaMass}); - histos.add("GeneralQA/h2dMCArmenterosAll", "h2dMCArmenterosAll", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); - histos.add("GeneralQA/h2dMCArmenterosSelected", "h2dMCArmenterosSelected", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("MC/h2dArmenterosAll", "h2dArmenterosAll", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); + histos.add("MC/h2dArmenterosSelected", "h2dArmenterosSelected", {HistType::kTH2F, {axisAPAlpha, axisAPQt}}); // Sigma0 QA - histos.add("GeneralQA/hMCMassSigma0All", "hMCMassSigma0All", kTH1F, {axisSigmaMass}); - histos.add("GeneralQA/hMCPtSigma0All", "hMCPtSigma0All", kTH1F, {axisPt}); - histos.add("Sigma0/hMCMassSigma0", "hMCMassSigma0", kTH1F, {axisSigmaMass}); - histos.add("Sigma0/hMCPtSigma0", "hMCPtSigma0", kTH1F, {axisPt}); + histos.add("MC/hMassSigma0All", "hMassSigma0All", kTH1F, {axisSigmaMass}); + histos.add("MC/hPtSigma0All", "hPtSigma0All", 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}); } } @@ -272,74 +262,108 @@ struct sigmaanalysis { if (cand.antilambdaBDTScore() <= AntiLambda_MLThreshold) return false; } else { - if (TMath::Abs(cand.photonMass()) > PhotonMaxMass) - return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 0.); - if ((TMath::Abs(cand.photonPosEta()) > PhotonMaxDauPseudoRap) || (TMath::Abs(cand.photonNegEta()) > PhotonMaxDauPseudoRap)) - return false; + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 1.); - if ((cand.photonPosPt() < PhotonDauMinPt) || (cand.photonNegPt() < PhotonDauMinPt)) + histos.fill(HIST("GeneralQA/hPhotonMass"), cand.photonMass()); + if (TMath::Abs(cand.photonMass()) > PhotonMaxMass) return false; + histos.fill(HIST("GeneralQA/hPhotonNegpT"), cand.photonNegPt()); + histos.fill(HIST("GeneralQA/hPhotonPospT"), cand.photonPosPt()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 2.); - if ((TMath::Abs(cand.photonDCAPosPV()) < PhotonMinDCADauToPv) || (TMath::Abs(cand.photonDCANegPV()) < PhotonMinDCADauToPv)) + if ((cand.photonPosPt() < PhotonDauMinPt) || (cand.photonNegPt() < PhotonDauMinPt)) return false; + histos.fill(HIST("GeneralQA/hPhotonDCANegToPV"), cand.photonDCANegPV()); + histos.fill(HIST("GeneralQA/hPhotonDCAPosToPV"), cand.photonDCAPosPV()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 3.); - if (cand.photonDCADau() > PhotonMaxDCAV0Dau) + if ((TMath::Abs(cand.photonDCAPosPV()) < PhotonMinDCADauToPv) || (TMath::Abs(cand.photonDCANegPV()) < PhotonMinDCADauToPv)) return false; histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 4.); - if ((cand.photonPosTPCCrossedRows() < PhotonMinTPCCrossedRows) || (cand.photonNegTPCCrossedRows() < PhotonMinTPCCrossedRows)) + histos.fill(HIST("GeneralQA/hPhotonDCADau"), cand.photonDCADau()); + if (TMath::Abs(cand.photonDCADau()) > PhotonMaxDCAV0Dau) return false; + histos.fill(HIST("GeneralQA/hPhotonPosTPCCR"), cand.photonPosTPCCrossedRows()); + histos.fill(HIST("GeneralQA/hPhotonNegTPCCR"), cand.photonNegTPCCrossedRows()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 5.); - if ((cand.photonPosTPCNSigma() < PhotonMinTPCNSigmas) || (cand.photonPosTPCNSigma() > PhotonMaxTPCNSigmas)) + if ((cand.photonPosTPCCrossedRows() < PhotonMinTPCCrossedRows) || (cand.photonNegTPCCrossedRows() < PhotonMinTPCCrossedRows)) return false; + histos.fill(HIST("GeneralQA/hPhotonPosTPCNSigma"), cand.photonPosTPCNSigma()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 6.); - if ((cand.photonNegTPCNSigma() < PhotonMinTPCNSigmas) || (cand.photonNegTPCNSigma() > PhotonMaxTPCNSigmas)) + if ((cand.photonPosTPCNSigma() < PhotonMinTPCNSigmas) || (cand.photonPosTPCNSigma() > PhotonMaxTPCNSigmas)) return false; + histos.fill(HIST("GeneralQA/hPhotonNegTPCNSigma"), cand.photonNegTPCNSigma()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 7.); - if ((cand.photonPt() < PhotonMinPt) || (cand.photonPt() > PhotonMaxPt)) + if ((cand.photonNegTPCNSigma() < PhotonMinTPCNSigmas) || (cand.photonNegTPCNSigma() > PhotonMaxTPCNSigmas)) return false; + histos.fill(HIST("GeneralQA/hPhotonpT"), cand.photonPt()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 8.); - if (TMath::Abs(cand.photonEta()) > PhotonMaxPseudoRap) + if ((cand.photonPt() < PhotonMinPt) || (cand.photonPt() > PhotonMaxPt)) return false; + histos.fill(HIST("GeneralQA/hPhotonY"), cand.photonY()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 9.); - if ((cand.photonRadius() < PhotonMinRadius) || (cand.photonRadius() > PhotonMaxRadius)) + if ((TMath::Abs(cand.photonY()) > PhotonMaxRap)) return false; + histos.fill(HIST("GeneralQA/hPhotonRadius"), cand.photonRadius()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 10.); - if (TMath::Abs(cand.photonZconv()) > PhotonMaxZ) + if ((cand.photonRadius() < PhotonMinRadius) || (cand.photonRadius() > PhotonMaxRadius)) return false; + histos.fill(HIST("GeneralQA/hPhotonZ"), cand.photonZconv()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 11.); - if (cand.photonQt() > PhotonMaxQt) + if (TMath::Abs(cand.photonZconv()) > PhotonMaxZ) return false; + histos.fill(HIST("GeneralQA/h2dPhotonArmenteros"), cand.photonAlpha(), cand.photonQt()); histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 12.); - if (TMath::Abs(cand.photonAlpha()) > PhotonMaxAlpha) + if (cand.photonQt() > PhotonMaxQt) return false; histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 13.); - if (cand.photonCosPA() < PhotonMinV0cospa) + if (TMath::Abs(cand.photonAlpha()) > PhotonMaxAlpha) return false; histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 14.); + histos.fill(HIST("GeneralQA/hPhotonCosPA"), cand.photonCosPA()); + if (cand.photonCosPA() < PhotonMinV0cospa) + return false; + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 15.); // Lambda selection - if (TMath::Abs(cand.lambdaMass() - 1.115683) > LambdaWindow) + 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"), 15.); + 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"), 16.); + 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"), 17.); + 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"), 18.); + 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"), 19.); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 20.); if ((TMath::Abs(cand.lambdaAlpha()) < LambdaMinAlpha) || (TMath::Abs(cand.lambdaAlpha()) > LambdaMaxAlpha)) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 20.); + histos.fill(HIST("GeneralQA/hLambdaCosPA"), cand.lambdaCosPA()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 21.); if (cand.lambdaCosPA() < LambdaMinv0cospa) return false; - histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 21.); + 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/hSigmaY"), cand.sigmaRapidity()); + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 23.); + if (TMath::Abs(cand.sigmaRapidity()) > SigmaMaxRap) + return false; + histos.fill(HIST("GeneralQA/hCandidateAnalysisSelection"), 24.); + histos.fill(HIST("GeneralQA/hPhotonMassSelected"), cand.photonMass()); + histos.fill(HIST("GeneralQA/hLambdaMassSelected"), cand.lambdaMass()); + histos.fill(HIST("GeneralQA/hAntiLambdaMassSelected"), cand.antilambdaMass()); } return true; @@ -359,22 +383,27 @@ struct sigmaanalysis { { histos.fill(HIST("hMCEventCentrality"), coll.centFT0C()); for (auto& sigma : v0s) { // selecting Sigma0-like candidates - if (sigma.isSigma()) { - histos.fill(HIST("GeneralQA/h2dMCArmenterosAll"), sigma.photonAlpha(), sigma.photonQt()); - histos.fill(HIST("GeneralQA/h2dMCArmenterosAll"), sigma.lambdaAlpha(), sigma.lambdaQt()); - histos.fill(HIST("GeneralQA/hMCMassSigma0All"), sigma.sigmaMass()); - histos.fill(HIST("GeneralQA/hMCPtSigma0All"), sigma.sigmapT()); + 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()); if (!processSigmaCandidate(sigma)) continue; - histos.fill(HIST("GeneralQA/h2dMCArmenterosSelected"), sigma.photonAlpha(), sigma.photonQt()); - histos.fill(HIST("GeneralQA/h2dMCArmenterosSelected"), sigma.lambdaAlpha(), sigma.lambdaQt()); - - histos.fill(HIST("Sigma0/hMCMassSigma0"), sigma.sigmaMass()); - histos.fill(HIST("Sigma0/hMCPtSigma0"), sigma.sigmapT()); - - histos.fill(HIST("h3dMCMassSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); + histos.fill(HIST("MC/h2dArmenterosSelected"), sigma.photonAlpha(), sigma.photonQt()); + histos.fill(HIST("MC/h2dArmenterosSelected"), sigma.lambdaAlpha(), sigma.lambdaQt()); + + 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()); + } 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()); + } } } } @@ -397,13 +426,17 @@ struct sigmaanalysis { histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), sigma.photonAlpha(), sigma.photonQt()); histos.fill(HIST("GeneralQA/h2dArmenterosSelected"), sigma.lambdaAlpha(), sigma.lambdaQt()); - histos.fill(HIST("Sigma0/hMassSigma0"), sigma.sigmaMass()); - histos.fill(HIST("Sigma0/hPtSigma0"), sigma.sigmapT()); - histos.fill(HIST("Sigma0/hRapiditySigma0"), sigma.sigmaRapidity()); - histos.fill(HIST("h3dMassSigma0"), coll.centFT0C(), sigma.sigmapT(), sigma.sigmaMass()); - - histos.fill(HIST("Gamma/hMassGamma"), sigma.lambdaMass()); - histos.fill(HIST("Lambda/hMassLambda"), 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()); + } 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()); + } } } diff --git a/PWGLF/Tasks/Strangeness/strange-yield-pbpb.cxx b/PWGLF/Tasks/Strangeness/strange-yield-pbpb.cxx new file mode 100644 index 00000000000..777554a5916 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/strange-yield-pbpb.cxx @@ -0,0 +1,1553 @@ +// 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. +// +// Strangeness in UPC analysis task +// ================ +// This code is meant to be run over derived data. +// +// Comments, questions, complaints, suggestions? +// Please write to: +// roman.nepeivoda@cern.ch +// + +#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 "Common/Core/RecoDecay.h" +#include "Common/Core/trackUtilities.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.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" +#include "Framework/StaticFor.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGLF/Utils/strangenessMasks.h" + +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 cascadeCandidates = soa::Join; + +using straCollisonFull = soa::Join::iterator; + +struct strangeYieldPbPb { + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // master analysis switches + Configurable analyseK0Short{"analyseK0Short", true, "process K0Short-like candidates"}; + Configurable analyseLambda{"analyseLambda", true, "process Lambda-like candidates"}; + Configurable analyseAntiLambda{"analyseAntiLambda", true, "process AntiLambda-like candidates"}; + Configurable analyseXi{"analyseXi", true, "process Xi-like candidates"}; + Configurable analyseAntiXi{"analyseAntiXi", true, "process AntiXi-like candidates"}; + Configurable analyseOmega{"analyseOmega", true, "process Omega-like candidates"}; + Configurable analyseAntiOmega{"analyseAntiOmega", true, "process AntiOmega-like candidates"}; + + // Event selections + Configurable rejectITSROFBorder{"rejectITSROFBorder", true, "reject events at ITS ROF border"}; + Configurable rejectTFBorder{"rejectTFBorder", true, "reject events at TF border"}; + Configurable rejectSameBunchPileup{"rejectSameBunchPileup", true, "reject collisions in case of pileup with another collision in the same foundBC"}; + Configurable requireIsTriggerTVX{"requireIsTriggerTVX", true, "require coincidence in FT0A and FT0C"}; + 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 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 studyUPConly{"studyUPConly", false, "is UPC-only analysis"}; + + Configurable verbose{"verbose", false, "additional printouts"}; + + // Acceptance selections + Configurable rapidityCut{"rapidityCut", 0.5, "rapidity"}; + Configurable daughterEtaCut{"daughterEtaCut", 0.8, "max eta for daughters"}; + + // Standard V0 topological criteria + struct : ConfigurableGroup { + Configurable v0cospa{"v0cospa", 0.97, "min V0 CosPA"}; + Configurable dcav0dau{"dcav0dau", 1.5, "max DCA V0 Daughters (cm)"}; + Configurable dcanegtopv{"dcanegtopv", .05, "min DCA Neg To PV (cm)"}; + Configurable dcapostopv{"dcapostopv", .05, "min DCA Pos To PV (cm)"}; + Configurable v0radius{"v0radius", 1.2, "minimum V0 radius (cm)"}; + Configurable v0radiusMax{"v0radiusMax", 1E5, "maximum V0 radius (cm)"}; + // Additional selection on the AP plot (exclusive for K0Short) + // original equation: lArmPt*5>fabs(lArmAlpha) + Configurable armPodCut{"armPodCut", 5.0f, "pT * (cut) > |alpha|, AP cut. Negative: no cut"}; + Configurable v0TypeSelection{"v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"}; + } v0cuts; + static constexpr float lifetimeCutsV0[1][2] = {{30., 20.}}; + Configurable> lifetimecutV0{"lifetimecutV0", {lifetimeCutsV0[0], 2, {"lifetimecutLambda", "lifetimecutK0S"}}, "lifetimecutV0"}; + + // Standard cascade topological criteria + struct : ConfigurableGroup { + Configurable casccospa{"casccospa", 0.97, "Casc CosPA"}; + Configurable dcacascdau{"dcacascdau", 1.2, "DCA Casc Daughters"}; + Configurable cascradius{"cascradius", 0.6, "minimum cascade radius (cm)"}; + Configurable cascradiusMax{"cascradiusMax", 1E5, "maximum cascade radius (cm)"}; + Configurable bachbaryoncospa{"bachbaryoncospa", 2, "Bachelor baryon CosPA"}; + Configurable bachbaryondcaxytopv{"bachbaryondcaxytopv", -1, "DCA bachelor baryon to PV"}; + Configurable dcamesontopv{"dcamesontopv", 0.1, "DCA of meson doughter track To PV"}; + Configurable dcabaryontopv{"dcabaryontopv", 0.05, "DCA of baryon doughter track To PV"}; + Configurable dcabachtopv{"dcabachtopv", 0.04, "DCA Bach To PV"}; + Configurable dcav0topv{"dcav0topv", 0.06, "DCA V0 To PV"}; + // Cascade specific selections + Configurable masswin{"masswin", 0.05, "mass window limit"}; + Configurable lambdamasswin{"lambdamasswin", 0.005, "V0 Mass window limit"}; + Configurable rejcomp{"rejcomp", 0.008, "competing Cascade rejection"}; + } casccuts; + Configurable doBachelorBaryonCut{"doBachelorBaryonCut", false, "Enable Bachelor-Baryon cut "}; + static constexpr float nCtauCutsCasc[1][2] = {{6., 6.}}; + Configurable> nCtauCutCasc{"nCtauCutCasc", {nCtauCutsCasc[0], 2, {"lifetimecutXi", "lifetimecutOmega"}}, "nCtauCutCasc"}; + + // UPC selections + SGSelector sgSelector; + struct : ConfigurableGroup { + Configurable FV0cut{"FV0cut", 100., "FV0A threshold"}; + Configurable FT0Acut{"FT0Acut", 200., "FT0A threshold"}; + Configurable FT0Ccut{"FT0Ccut", 100., "FT0C threshold"}; + Configurable ZDCcut{"ZDCcut", 10., "ZDC threshold"}; + // Configurable gapSel{"gapSel", 2, "Gap selection"}; + } upcCuts; + + // Track quality + struct : ConfigurableGroup { + Configurable minTPCrows{"minTPCrows", 70, "minimum TPC crossed rows"}; + Configurable minITSclusters{"minITSclusters", -1, "minimum ITS clusters"}; + Configurable skipTPConly{"skipTPConly", false, "skip V0s comprised of at least one TPC only prong"}; + Configurable requireBachITSonly{"requireBachITSonly", false, "require that bachelor track is ITSonly (overrides TPC quality)"}; + Configurable requirePosITSonly{"requirePosITSonly", false, "require that positive track is ITSonly (overrides TPC quality)"}; + Configurable requireNegITSonly{"requireNegITSonly", false, "require that negative track is ITSonly (overrides TPC quality)"}; + } TrackConfigurations; + + // PID (TPC/TOF) + struct : ConfigurableGroup { + Configurable TpcPidNsigmaCut{"TpcPidNsigmaCut", 1e+6, "TpcPidNsigmaCut"}; + Configurable TofPidNsigmaCutLaPr{"TofPidNsigmaCutLaPr", 1e+6, "TofPidNsigmaCutLaPr"}; + Configurable TofPidNsigmaCutLaPi{"TofPidNsigmaCutLaPi", 1e+6, "TofPidNsigmaCutLaPi"}; + Configurable TofPidNsigmaCutK0Pi{"TofPidNsigmaCutK0Pi", 1e+6, "TofPidNsigmaCutK0Pi"}; + + Configurable TofPidNsigmaCutXiPi{"TofPidNsigmaCutXiPi", 1e+6, "TofPidNsigmaCutXiPi"}; + Configurable TofPidNsigmaCutOmegaKaon{"TofPidNsigmaCutOmegaKaon", 1e+6, "TofPidNsigmaCutOmegaKaon"}; + + Configurable doTPCQA{"doTPCQA", false, "do TPC QA histograms"}; + Configurable doTOFQA{"doTOFQA", false, "do TOF QA histograms"}; + + // PID (TOF) + Configurable maxDeltaTimeProton{"maxDeltaTimeProton", 1e+9, "check maximum allowed time"}; + Configurable maxDeltaTimePion{"maxDeltaTimePion", 1e+9, "check maximum allowed time"}; + Configurable maxDeltaTimeKaon{"maxDeltaTimeKaon", 1e+9, "check maximum allowed time"}; + } PIDConfigurations; + + Configurable doKienmaticQA{"doKienmaticQA", true, "do Kinematic QA histograms"}; + Configurable doDetectPropQA{"doDetectPropQA", 0, "do Detector/ITS map QA: 0: no, 1: 4D, 2: 5D with mass"}; + 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"}; + } axisDetectors; + + // for MC + Configurable doMCAssociation{"doMCAssociation", false, "if MC, do MC association"}; + Configurable doCollisionAssociationQA{"doCollisionAssociationQA", false, "check collision association"}; + + // fast check on occupancy + Configurable minOccupancy{"minOccupancy", -1, "minimum occupancy from neighbouring collisions"}; + Configurable maxOccupancy{"maxOccupancy", -1, "maximum occupancy from neighbouring collisions"}; + + // Kinematic axes + 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 axisRap{"axisRap", {100, -2.0f, 2.0f}, "y"}; + + // Invariant mass axes + ConfigurableAxis axisK0Mass{"axisK0Mass", {200, 0.4f, 0.6f}, ""}; + ConfigurableAxis axisLambdaMass{"axisLambdaMass", {200, 1.101f, 1.131f}, ""}; + ConfigurableAxis axisXiMass{"axisXiMass", {200, 1.28f, 1.36f}, ""}; + ConfigurableAxis axisOmegaMass{"axisOmegaMass", {200, 1.59f, 1.75f}, ""}; + std::vector axisInvMass = {axisK0Mass, + axisLambdaMass, + axisLambdaMass, + axisXiMass, + axisXiMass, + axisOmegaMass, + axisOmegaMass}; + + ConfigurableAxis axisNch{"axisNch", {2000, -0.5f, 1999.5f}, "Number of charged particles"}; + ConfigurableAxis axisFT0C{"FT0C", + {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 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"}; + + // UPC axes + ConfigurableAxis axisSelGap{"axisSelGap", {4, -1.5, 2.5}, "Gap side"}; + + // 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"}; + + // MC coll assoc QA axis + ConfigurableAxis axisMonteCarloNch{"axisMonteCarloNch", {300, 0.0f, 3000.0f}, "N_{ch} MC"}; + + // Track quality axes + ConfigurableAxis axisTPCrows{"axisTPCrows", {160, -0.5f, 159.5f}, "N TPC rows"}; + ConfigurableAxis axisITSclus{"axisITSclus", {7, -0.5f, 6.5f}, "N ITS Clusters"}; + ConfigurableAxis axisITScluMap{"axisITSMap", {128, -0.5f, 127.5f}, "ITS Cluster map"}; + ConfigurableAxis axisDetMap{"axisDetMap", {16, -0.5f, 15.5f}, "Detector use map"}; + ConfigurableAxis axisITScluMapCoarse{"axisITScluMapCoarse", {16, -3.5f, 12.5f}, "ITS Coarse cluster map"}; + ConfigurableAxis axisDetMapCoarse{"axisDetMapCoarse", {5, -0.5f, 4.5f}, "Detector Coarse user map"}; + + // Topological variable QA axes + ConfigurableAxis axisDCAtoPV{"axisDCAtoPV", {80, -4.0f, 4.0f}, "DCA (cm)"}; + ConfigurableAxis axisDCAdau{"axisDCAdau", {24, 0.0f, 1.2f}, "DCA (cm)"}; + ConfigurableAxis axisPointingAngle{"axisPointingAngle", {100, 0.0f, 0.5f}, "pointing angle (rad)"}; + ConfigurableAxis axisV0Radius{"axisV0Radius", {60, 0.0f, 60.0f}, "V0 2D radius (cm)"}; + ConfigurableAxis axisNsigmaTPC{"axisNsigmaTPC", {200, -10.0f, 10.0f}, "N sigma TPC"}; + ConfigurableAxis axisTPCsignal{"axisTPCsignal", {200, 0.0f, 200.0f}, "TPC signal"}; + ConfigurableAxis axisTOFdeltaT{"axisTOFdeltaT", {200, -5000.0f, 5000.0f}, "TOF Delta T (ps)"}; + ConfigurableAxis axisNctau{"axisNctau", {100, 0.0f, 10.0f}, "n c x tau"}; + + // PDG database + Service pdgDB; + + static constexpr std::string_view particlenames[] = {"K0Short", "Lambda", "AntiLambda", "Xi", "AntiXi", "Omega", "AntiOmega"}; + + void setBits(std::bitset& mask, std::initializer_list selections) + { + for (int sel : selections) { + mask.set(sel); + } + } + + template + void addTopoHistograms(HistogramRegistry& histos) + { + const bool isCascade = (partID > 2.5) ? true : false; + if (isCascade) { + histos.add(Form("%s/hCascCosPA", particlenames[partID].data()), "hCascCosPA", kTH2F, {axisPtCoarse, {100, 0.9f, 1.0f}}); + histos.add(Form("%s/hDCACascDaughters", particlenames[partID].data()), "hDCACascDaughters", kTH2F, {axisPtCoarse, {44, 0.0f, 2.2f}}); + histos.add(Form("%s/hCascRadius", particlenames[partID].data()), "hCascRadius", kTH2D, {axisPtCoarse, {500, 0.0f, 50.0f}}); + histos.add(Form("%s/hMesonDCAToPV", particlenames[partID].data()), "hMesonDCAToPV", kTH2F, {axisPtCoarse, axisDCAtoPV}); + histos.add(Form("%s/hBaryonDCAToPV", particlenames[partID].data()), "hBaryonDCAToPV", kTH2F, {axisPtCoarse, axisDCAtoPV}); + histos.add(Form("%s/hBachDCAToPV", particlenames[partID].data()), "hBachDCAToPV", kTH2F, {axisPtCoarse, {200, -1.0f, 1.0f}}); + histos.add(Form("%s/hV0CosPA", particlenames[partID].data()), "hV0CosPA", kTH2F, {axisPtCoarse, {100, 0.9f, 1.0f}}); + histos.add(Form("%s/hV0Radius", particlenames[partID].data()), "hV0Radius", kTH2D, {axisPtCoarse, axisV0Radius}); + histos.add(Form("%s/hDCAV0Daughters", particlenames[partID].data()), "hDCAV0Daughters", kTH2F, {axisPtCoarse, axisDCAdau}); + histos.add(Form("%s/hDCAV0ToPV", particlenames[partID].data()), "hDCAV0ToPV", kTH2F, {axisPtCoarse, {44, 0.0f, 2.2f}}); + histos.add(Form("%s/hMassLambdaDau", particlenames[partID].data()), "hMassLambdaDau", kTH2F, {axisPtCoarse, axisLambdaMass}); + histos.add(Form("%s/hNctau", particlenames[partID].data()), "hNctau", kTH2F, {axisPtCoarse, axisNctau}); + if (doBachelorBaryonCut) { + histos.add(Form("%s/hBachBaryonCosPA", particlenames[partID].data()), "hBachBaryonCosPA", kTH2F, {axisPtCoarse, {100, 0.0f, 1.0f}}); + histos.add(Form("%s/hBachBaryonDCAxyToPV", particlenames[partID].data()), "hBachBaryonDCAxyToPV", kTH2F, {axisPtCoarse, {300, -3.0f, 3.0f}}); + } + } else { + histos.add(Form("%s/hPosDCAToPV", particlenames[partID].data()), "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add(Form("%s/hNegDCAToPV", particlenames[partID].data()), "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add(Form("%s/hDCADaughters", particlenames[partID].data()), "hDCADaughters", kTH1F, {axisDCAdau}); + histos.add(Form("%s/hPointingAngle", particlenames[partID].data()), "hPointingAngle", kTH1F, {axisPointingAngle}); + histos.add(Form("%s/hV0Radius", particlenames[partID].data()), "hV0Radius", kTH1F, {axisV0Radius}); + histos.add(Form("%s/h2dPositiveITSvsTPCpts", particlenames[partID].data()), "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add(Form("%s/h2dNegativeITSvsTPCpts", particlenames[partID].data()), "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + } + } + + template + void addTPCQAHistograms(HistogramRegistry& histos) + { + const bool isCascade = (partID > 2.5) ? true : false; + histos.add(Form("%s/h3dPosNsigmaTPC", particlenames[partID].data()), "h3dPosNsigmaTPC", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + histos.add(Form("%s/h3dNegNsigmaTPC", particlenames[partID].data()), "h3dNegNsigmaTPC", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + histos.add(Form("%s/h3dPosTPCsignal", particlenames[partID].data()), "h3dPosTPCsignal", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + histos.add(Form("%s/h3dNegTPCsignal", particlenames[partID].data()), "h3dNegTPCsignal", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + + histos.add(Form("%s/h3dPosNsigmaTPCvsTrackPtot", particlenames[partID].data()), "h3dPosNsigmaTPCvsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + histos.add(Form("%s/h3dNegNsigmaTPCvsTrackPtot", particlenames[partID].data()), "h3dNegNsigmaTPCvsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + + histos.add(Form("%s/h3dPosTPCsignalVsTrackPtot", particlenames[partID].data()), "h3dPosTPCsignalVsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + histos.add(Form("%s/h3dNegTPCsignalVsTrackPtot", particlenames[partID].data()), "h3dNegTPCsignalVsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + + histos.add(Form("%s/h3dPosNsigmaTPCvsTrackPt", particlenames[partID].data()), "h3dPosNsigmaTPCvsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + histos.add(Form("%s/h3dNegNsigmaTPCvsTrackPt", particlenames[partID].data()), "h3dNegNsigmaTPCvsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + + histos.add(Form("%s/h3dPosTPCsignalVsTrackPt", particlenames[partID].data()), "h3dPosTPCsignalVsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + histos.add(Form("%s/h3dNegTPCsignalVsTrackPt", particlenames[partID].data()), "h3dNegTPCsignalVsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + + if (isCascade) { + histos.add(Form("%s/h3dBachTPCsignal", particlenames[partID].data()), "h3dBachTPCsignal", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + histos.add(Form("%s/h3dBachNsigmaTPC", particlenames[partID].data()), "h3dBachNsigmaTPC", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + histos.add(Form("%s/h3dBachNsigmaTPCvsTrackPtot", particlenames[partID].data()), "h3dBachNsigmaTPCvsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + histos.add(Form("%s/h3dBachTPCsignalVsTrackPtot", particlenames[partID].data()), "h3dBachTPCsignalVsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + histos.add(Form("%s/h3dBachNsigmaTPCvsTrackPt", particlenames[partID].data()), "h3dBachNsigmaTPCvsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisNsigmaTPC}); + histos.add(Form("%s/h3dBachTPCsignalVsTrackPt", particlenames[partID].data()), "h3dBachTPCsignalVsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisTPCsignal}); + } + } + + template + void addTOFQAHistograms(HistogramRegistry& histos) + { + const bool isCascade = (partID > 2.5) ? true : false; + histos.add(Form("%s/h3dPosTOFdeltaT", particlenames[partID].data()), "h3dPosTOFdeltaT", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + histos.add(Form("%s/h3dNegTOFdeltaT", particlenames[partID].data()), "h3dNegTOFdeltaT", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + histos.add(Form("%s/h3dPosTOFdeltaTvsTrackPtot", particlenames[partID].data()), "h3dPosTOFdeltaTvsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + histos.add(Form("%s/h3dNegTOFdeltaTvsTrackPtot", particlenames[partID].data()), "h3dNegTOFdeltaTvsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + histos.add(Form("%s/h3dPosTOFdeltaTvsTrackPt", particlenames[partID].data()), "h3dPosTOFdeltaTvsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + histos.add(Form("%s/h3dNegTOFdeltaTvsTrackPt", particlenames[partID].data()), "h3dNegTOFdeltaTvsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + if (isCascade) { + histos.add(Form("%s/h3dBachTOFdeltaT", particlenames[partID].data()), "h3dBachTOFdeltaT", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + histos.add(Form("%s/h3dBachTOFdeltaTvsTrackPtot", particlenames[partID].data()), "h3dBachTOFdeltaTvsTrackPtot", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + histos.add(Form("%s/h3dBachTOFdeltaTvsTrackPt", particlenames[partID].data()), "h3dBachTOFdeltaTvsTrackPt", kTH3F, {axisFT0C, axisPtCoarse, axisTOFdeltaT}); + } + } + + template + 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}); + if (isCascade) { + histos.add(Form("%s/h2dBachEtaPt", particlenames[partID].data()), "h2dBachEtaPt", kTH3F, {axisPtCoarse, axisEta, axisSelGap}); + } + } + + template + void addDetectorPropHistograms(HistogramRegistry& histos) + { + 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}); + } else { + histos.add(Form("%s/h6dDetectPropVsCentrality", particlenames[partID].data()), "h6dDetectPropVsCentrality", kTHnF, {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}); + } + 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)}); + } else { + histos.add(Form("%s/h7dDetectPropVsCentrality", particlenames[partID].data()), "h7dDetectPropVsCentrality", kTHnF, {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)}); + } + } + + 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/h2dMass", particlenames[partID].data()), "h2dMass", kTH2F, {axisInvMass.at(partID), axisSelGap}); + if (doPlainTopoQA) { + addTopoHistograms(histos); + } + if (PIDConfigurations.doTPCQA) { + addTPCQAHistograms(histos); + } + if (PIDConfigurations.doTOFQA) { + addTOFQAHistograms(histos); + } + if (doKienmaticQA) { + addKinematicQAHistograms(histos); + } + addDetectorPropHistograms(histos); + } + + template + void addCollisionAssocHistograms(HistogramRegistry& histos) + { + histos.add(Form("%s/h2dPtVsNch", particlenames[partID].data()), "h2dPtVsNch", kTH2F, {axisMonteCarloNch, axisPt}); + histos.add(Form("%s/h2dPtVsNch_BadCollAssig", particlenames[partID].data()), "h2dPtVsNch_BadCollAssig", kTH2F, {axisMonteCarloNch, axisPt}); + } + + template + void fillHistogramsV0(TCand cand, TCollision coll, int gap) + { + float invMass = 0; + float centrality = coll.centFT0C(); + float pT = cand.pt(); + float rapidity = 1e6; + + float tpcNsigmaPos = 0; + float tpcNsigmaNeg = 0; + float tofDeltaTPos = 0; + float tofDeltaTNeg = 0; + + auto posTrackExtra = cand.template posTrackExtra_as(); + auto negTrackExtra = cand.template negTrackExtra_as(); + + bool posIsFromAfterburner = posTrackExtra.itsChi2PerNcl() < 0; + bool negIsFromAfterburner = negTrackExtra.itsChi2PerNcl() < 0; + + uint posDetMap = computeDetBitmap(posTrackExtra.detectorMap()); + int posITSclusMap = computeITSclusBitmap(posTrackExtra.itsClusterMap(), posIsFromAfterburner); + uint negDetMap = computeDetBitmap(negTrackExtra.detectorMap()); + int negITSclusMap = computeITSclusBitmap(negTrackExtra.itsClusterMap(), negIsFromAfterburner); + + if (partID == 0) { + histos.fill(HIST("generalQA/h2dArmenterosSelected"), cand.alpha(), cand.qtarm()); + invMass = cand.mK0Short(); + rapidity = cand.yK0Short(); + if (PIDConfigurations.doTOFQA) { + tofDeltaTPos = cand.posTOFDeltaTK0Pi(); + tofDeltaTNeg = cand.negTOFDeltaTK0Pi(); + } + if (PIDConfigurations.doTPCQA) { + tpcNsigmaPos = posTrackExtra.tpcNSigmaPi(); + tpcNsigmaNeg = negTrackExtra.tpcNSigmaPi(); + } + } else if (partID == 1) { + invMass = cand.mLambda(); + rapidity = cand.yLambda(); + if (PIDConfigurations.doTOFQA) { + tofDeltaTPos = cand.posTOFDeltaTLaPr(); + tofDeltaTNeg = cand.negTOFDeltaTLaPi(); + } + if (PIDConfigurations.doTPCQA) { + tpcNsigmaPos = posTrackExtra.tpcNSigmaPr(); + tpcNsigmaNeg = negTrackExtra.tpcNSigmaPi(); + } + } else if (partID == 2) { + invMass = cand.mAntiLambda(); + rapidity = cand.yLambda(); + if (PIDConfigurations.doTOFQA) { + tofDeltaTPos = cand.posTOFDeltaTLaPi(); + tofDeltaTNeg = cand.negTOFDeltaTLaPr(); + } + if (PIDConfigurations.doTPCQA) { + tpcNsigmaPos = posTrackExtra.tpcNSigmaPi(); + tpcNsigmaNeg = negTrackExtra.tpcNSigmaPr(); + } + } else { + LOG(fatal) << "Particle is unknown!"; + } + + histos.fill(HIST(particlenames[partID]) + HIST("/h2dMass"), invMass, gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h5dMass"), centrality, pT, invMass, gap, coll.multNTracksGlobal()); + 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); + } + if (doPlainTopoQA) { + histos.fill(HIST(particlenames[partID]) + HIST("/hPosDCAToPV"), cand.dcapostopv()); + histos.fill(HIST(particlenames[partID]) + HIST("/hNegDCAToPV"), cand.dcanegtopv()); + histos.fill(HIST(particlenames[partID]) + HIST("/hDCADaughters"), cand.dcaV0daughters()); + histos.fill(HIST(particlenames[partID]) + HIST("/hPointingAngle"), TMath::ACos(cand.v0cosPA())); + histos.fill(HIST(particlenames[partID]) + HIST("/hV0Radius"), cand.v0radius()); + histos.fill(HIST(particlenames[partID]) + HIST("/h2dPositiveITSvsTPCpts"), posTrackExtra.tpcCrossedRows(), posTrackExtra.itsNCls()); + histos.fill(HIST(particlenames[partID]) + HIST("/h2dNegativeITSvsTPCpts"), negTrackExtra.tpcCrossedRows(), negTrackExtra.itsNCls()); + } + if (doDetectPropQA == 1) { + histos.fill(HIST(particlenames[partID]) + HIST("/h6dDetectPropVsCentrality"), centrality, posDetMap, posITSclusMap, negDetMap, negITSclusMap, pT); + histos.fill(HIST(particlenames[partID]) + HIST("/h4dPosDetectPropVsCentrality"), centrality, posTrackExtra.detectorMap(), posTrackExtra.itsClusterMap(), pT); + histos.fill(HIST(particlenames[partID]) + HIST("/h4dNegDetectPropVsCentrality"), centrality, negTrackExtra.detectorMap(), negTrackExtra.itsClusterMap(), pT); + } + if (doDetectPropQA == 2) { + histos.fill(HIST(particlenames[partID]) + HIST("/h7dPosDetectPropVsCentrality"), centrality, posDetMap, posITSclusMap, negDetMap, negITSclusMap, pT, invMass); + histos.fill(HIST(particlenames[partID]) + HIST("/h5dPosDetectPropVsCentrality"), centrality, posTrackExtra.detectorMap(), posTrackExtra.itsClusterMap(), pT, invMass); + histos.fill(HIST(particlenames[partID]) + HIST("/h5dNegDetectPropVsCentrality"), centrality, negTrackExtra.detectorMap(), negTrackExtra.itsClusterMap(), pT, invMass); + } + if (PIDConfigurations.doTPCQA) { + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTPCsignal"), centrality, pT, posTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTPCsignal"), centrality, pT, negTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTPCsignalVsTrackPtot"), centrality, cand.positivept() * TMath::CosH(cand.positiveeta()), posTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTPCsignalVsTrackPtot"), centrality, cand.negativept() * TMath::CosH(cand.negativeeta()), negTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTPCsignalVsTrackPt"), centrality, cand.positivept(), posTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTPCsignalVsTrackPt"), centrality, cand.negativept(), negTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosNsigmaTPCvsTrackPt"), centrality, cand.positivept(), posTrackExtra.tpcNSigmaPi()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegNsigmaTPCvsTrackPt"), centrality, cand.negativept(), negTrackExtra.tpcNSigmaPi()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosNsigmaTPCvsTrackPtot"), centrality, cand.positivept() * TMath::CosH(cand.positiveeta()), tpcNsigmaPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegNsigmaTPCvsTrackPtot"), centrality, cand.negativept() * TMath::CosH(cand.negativeeta()), tpcNsigmaNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosNsigmaTPC"), centrality, pT, tpcNsigmaPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegNsigmaTPC"), centrality, pT, tpcNsigmaNeg); + } + if (PIDConfigurations.doTOFQA) { + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTOFdeltaTvsTrackPt"), centrality, cand.positivept(), tofDeltaTPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTOFdeltaTvsTrackPt"), centrality, cand.negativept(), tofDeltaTNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTOFdeltaT"), centrality, pT, tofDeltaTPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTOFdeltaT"), centrality, pT, tofDeltaTNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTOFdeltaTvsTrackPtot"), centrality, cand.positivept() * TMath::CosH(cand.positiveeta()), tofDeltaTPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTOFdeltaTvsTrackPtot"), centrality, cand.negativept() * TMath::CosH(cand.negativeeta()), tofDeltaTNeg); + } + } + + template + void fillHistogramsCasc(TCand cand, TCollision coll, int gap) + { + float invMass = 0; + float centrality = coll.centFT0C(); + float pT = cand.pt(); + float rapidity = 1e6; + + // Access daughter tracks + auto posTrackExtra = cand.template posTrackExtra_as(); + auto negTrackExtra = cand.template negTrackExtra_as(); + auto bachTrackExtra = cand.template bachTrackExtra_as(); + + bool posIsFromAfterburner = posTrackExtra.itsChi2PerNcl() < 0; + bool negIsFromAfterburner = negTrackExtra.itsChi2PerNcl() < 0; + bool bachIsFromAfterburner = bachTrackExtra.itsChi2PerNcl() < 0; + + uint posDetMap = computeDetBitmap(posTrackExtra.detectorMap()); + int posITSclusMap = computeITSclusBitmap(posTrackExtra.itsClusterMap(), posIsFromAfterburner); + uint negDetMap = computeDetBitmap(negTrackExtra.detectorMap()); + int negITSclusMap = computeITSclusBitmap(negTrackExtra.itsClusterMap(), negIsFromAfterburner); + uint bachDetMap = computeDetBitmap(bachTrackExtra.detectorMap()); + int bachITSclusMap = computeITSclusBitmap(bachTrackExtra.itsClusterMap(), bachIsFromAfterburner); + + // c x tau + float decayPos = std::hypot(cand.x() - coll.posX(), cand.y() - coll.posY(), cand.z() - coll.posZ()); + float totalMom = std::hypot(cand.px(), cand.py(), cand.pz()); + + float ctau = 0; + + float tpcNsigmaPos = 0; + float tpcNsigmaNeg = 0; + float tpcNsigmaBach = 0; + float tofDeltaTPos = 0; + float tofDeltaTNeg = 0; + float tofDeltaTBach = 0; + + if (partID == 3) { + invMass = cand.mXi(); + ctau = totalMom != 0 ? pdgDB->Mass(3312) * decayPos / (totalMom * ctauxiPDG) : 1e6; + rapidity = cand.yXi(); + + if (PIDConfigurations.doTPCQA) { + tpcNsigmaPos = posTrackExtra.tpcNSigmaPr(); + tpcNsigmaNeg = negTrackExtra.tpcNSigmaPi(); + tpcNsigmaBach = bachTrackExtra.tpcNSigmaPi(); + } + if (PIDConfigurations.doTOFQA) { + tofDeltaTPos = cand.posTOFDeltaTXiPr(); + tofDeltaTNeg = cand.negTOFDeltaTXiPi(); + tofDeltaTBach = cand.bachTOFDeltaTXiPi(); + } + } else if (partID == 4) { + invMass = cand.mXi(); + ctau = totalMom != 0 ? pdgDB->Mass(3312) * decayPos / (totalMom * ctauxiPDG) : 1e6; + rapidity = cand.yXi(); + + if (PIDConfigurations.doTPCQA) { + tpcNsigmaPos = posTrackExtra.tpcNSigmaPi(); + tpcNsigmaNeg = negTrackExtra.tpcNSigmaPr(); + tpcNsigmaBach = bachTrackExtra.tpcNSigmaPi(); + } + if (PIDConfigurations.doTOFQA) { + tofDeltaTPos = cand.posTOFDeltaTXiPi(); + tofDeltaTNeg = cand.negTOFDeltaTXiPr(); + tofDeltaTBach = cand.bachTOFDeltaTXiPi(); + } + + } else if (partID == 5) { + invMass = cand.mOmega(); + ctau = totalMom != 0 ? pdgDB->Mass(3334) * decayPos / (totalMom * ctauomegaPDG) : 1e6; + rapidity = cand.yOmega(); + + if (PIDConfigurations.doTPCQA) { + tpcNsigmaPos = posTrackExtra.tpcNSigmaPr(); + tpcNsigmaNeg = negTrackExtra.tpcNSigmaPi(); + tpcNsigmaBach = bachTrackExtra.tpcNSigmaKa(); + } + if (PIDConfigurations.doTOFQA) { + tofDeltaTPos = cand.posTOFDeltaTOmPi(); + tofDeltaTNeg = cand.posTOFDeltaTOmPr(); + tofDeltaTBach = cand.bachTOFDeltaTOmKa(); + } + + } else if (partID == 6) { + invMass = cand.mOmega(); + ctau = totalMom != 0 ? pdgDB->Mass(3334) * decayPos / (totalMom * ctauomegaPDG) : 1e6; + rapidity = cand.yOmega(); + + if (PIDConfigurations.doTPCQA) { + tpcNsigmaPos = posTrackExtra.tpcNSigmaPi(); + tpcNsigmaNeg = negTrackExtra.tpcNSigmaPr(); + tpcNsigmaBach = bachTrackExtra.tpcNSigmaKa(); + } + if (PIDConfigurations.doTOFQA) { + tofDeltaTPos = cand.posTOFDeltaTOmPr(); + tofDeltaTNeg = cand.posTOFDeltaTOmPi(); + tofDeltaTBach = cand.bachTOFDeltaTOmKa(); + } + } + histos.fill(HIST(particlenames[partID]) + HIST("/h2dMass"), invMass, gap); + histos.fill(HIST(particlenames[partID]) + HIST("/h5dMass"), centrality, pT, invMass, gap, coll.multNTracksGlobal()); + 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); + } + if (doPlainTopoQA) { + histos.fill(HIST(particlenames[partID]) + HIST("/hCascCosPA"), pT, cand.casccosPA(coll.posX(), coll.posY(), coll.posZ())); + histos.fill(HIST(particlenames[partID]) + HIST("/hDCACascDaughters"), pT, cand.dcacascdaughters()); + histos.fill(HIST(particlenames[partID]) + HIST("/hCascRadius"), pT, cand.cascradius()); + histos.fill(HIST(particlenames[partID]) + HIST("/hMesonDCAToPV"), pT, cand.dcanegtopv()); + histos.fill(HIST(particlenames[partID]) + HIST("/hBaryonDCAToPV"), pT, cand.dcapostopv()); + histos.fill(HIST(particlenames[partID]) + HIST("/hBachDCAToPV"), pT, cand.dcabachtopv()); + histos.fill(HIST(particlenames[partID]) + HIST("/hV0CosPA"), pT, cand.v0cosPA(coll.posX(), coll.posY(), coll.posZ())); + histos.fill(HIST(particlenames[partID]) + HIST("/hV0Radius"), pT, cand.v0radius()); + histos.fill(HIST(particlenames[partID]) + HIST("/hDCAV0Daughters"), pT, cand.dcaV0daughters()); + histos.fill(HIST(particlenames[partID]) + HIST("/hDCAV0ToPV"), pT, fabs(cand.dcav0topv(coll.posX(), coll.posY(), coll.posZ()))); + histos.fill(HIST(particlenames[partID]) + HIST("/hMassLambdaDau"), pT, cand.mLambda()); + histos.fill(HIST(particlenames[partID]) + HIST("/hNctau"), pT, ctau); + } + if (PIDConfigurations.doTPCQA) { + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosNsigmaTPC"), centrality, pT, tpcNsigmaPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegNsigmaTPC"), centrality, pT, tpcNsigmaNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachNsigmaTPC"), centrality, pT, tpcNsigmaBach); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTPCsignal"), centrality, pT, posTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTPCsignal"), centrality, pT, negTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachTPCsignal"), centrality, pT, bachTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosNsigmaTPCvsTrackPtot"), centrality, cand.positivept() * TMath::CosH(cand.positiveeta()), tpcNsigmaPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegNsigmaTPCvsTrackPtot"), centrality, cand.negativept() * TMath::CosH(cand.negativeeta()), tpcNsigmaNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachNsigmaTPCvsTrackPtot"), centrality, cand.bachelorpt() * TMath::CosH(cand.bacheloreta()), tpcNsigmaBach); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTPCsignalVsTrackPtot"), centrality, cand.positivept() * TMath::CosH(cand.positiveeta()), posTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTPCsignalVsTrackPtot"), centrality, cand.negativept() * TMath::CosH(cand.negativeeta()), negTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachTPCsignalVsTrackPtot"), centrality, cand.bachelorpt() * TMath::CosH(cand.bacheloreta()), bachTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosNsigmaTPCvsTrackPt"), centrality, cand.positivept(), tpcNsigmaPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegNsigmaTPCvsTrackPt"), centrality, cand.negativept(), tpcNsigmaNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachNsigmaTPCvsTrackPt"), centrality, cand.bachelorpt(), tpcNsigmaBach); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTPCsignalVsTrackPt"), centrality, cand.positivept(), posTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTPCsignalVsTrackPt"), centrality, cand.negativept(), negTrackExtra.tpcSignal()); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachTPCsignalVsTrackPt"), centrality, cand.bachelorpt(), bachTrackExtra.tpcSignal()); + } + if (PIDConfigurations.doTOFQA) { + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTOFdeltaT"), centrality, pT, tofDeltaTPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTOFdeltaT"), centrality, pT, tofDeltaTNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachTOFdeltaT"), centrality, pT, tofDeltaTBach); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTOFdeltaTvsTrackPtot"), centrality, cand.positivept() * TMath::CosH(cand.positiveeta()), tofDeltaTPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTOFdeltaTvsTrackPtot"), centrality, cand.negativept() * TMath::CosH(cand.negativeeta()), tofDeltaTNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachTOFdeltaTvsTrackPtot"), centrality, cand.bachelorpt() * TMath::CosH(cand.bacheloreta()), tofDeltaTBach); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dPosTOFdeltaTvsTrackPt"), centrality, cand.positivept(), tofDeltaTPos); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dNegTOFdeltaTvsTrackPt"), centrality, cand.negativept(), tofDeltaTNeg); + histos.fill(HIST(particlenames[partID]) + HIST("/h3dBachTOFdeltaTvsTrackPt"), centrality, cand.bachelorpt(), tofDeltaTBach); + } + if (doDetectPropQA == 1) { + histos.fill(HIST(particlenames[partID]) + HIST("/h8dDetectPropVsCentrality"), centrality, posDetMap, posITSclusMap, negDetMap, negITSclusMap, bachDetMap, bachITSclusMap, pT); + histos.fill(HIST(particlenames[partID]) + HIST("/h4dPosDetectPropVsCentrality"), centrality, posTrackExtra.detectorMap(), posTrackExtra.itsClusterMap(), pT); + histos.fill(HIST(particlenames[partID]) + HIST("/h4dNegDetectPropVsCentrality"), centrality, negTrackExtra.detectorMap(), negTrackExtra.itsClusterMap(), pT); + histos.fill(HIST(particlenames[partID]) + HIST("/h4dBachDetectPropVsCentrality"), centrality, bachTrackExtra.detectorMap(), bachTrackExtra.itsClusterMap(), pT); + } + if (doDetectPropQA == 2) { + histos.fill(HIST(particlenames[partID]) + HIST("/h9dDetectPropVsCentrality"), centrality, posDetMap, posITSclusMap, negDetMap, negITSclusMap, bachDetMap, bachITSclusMap, pT, invMass); + histos.fill(HIST(particlenames[partID]) + HIST("/h5dPosDetectPropVsCentrality"), centrality, posTrackExtra.detectorMap(), posTrackExtra.itsClusterMap(), pT, invMass); + histos.fill(HIST(particlenames[partID]) + HIST("/h5dNegDetectPropVsCentrality"), centrality, negTrackExtra.detectorMap(), negTrackExtra.itsClusterMap(), pT, invMass); + histos.fill(HIST(particlenames[partID]) + HIST("/h5dBachDetectPropVsCentrality"), centrality, bachTrackExtra.detectorMap(), bachTrackExtra.itsClusterMap(), pT, invMass); + } + } + + void init(InitContext const&) + { + if ((doprocessV0s == true) && (doprocessCascades == true)) { + LOG(fatal) << "Unable to analyze both v0s and cascades simultaneously. Please enable only one process at a time"; + } + + // initialise bit masks + setBits(maskTopologicalV0, {selV0CosPA, selDCANegToPV, selDCAPosToPV, selDCAV0Dau, selV0Radius, selV0RadiusMax}); + setBits(maskTopologicalCasc, {selCascCosPA, selDCACascDau, selCascRadius, selCascRadiusMax, selBachToPV, selMesonToPV, selBaryonToPV, + selDCAV0ToPV, selV0CosPA, selDCAV0Dau, selV0Radius, selV0RadiusMax, selLambdaMassWin}); + + if (doBachelorBaryonCut) + maskTopologicalCasc.set(selBachBaryon); + + setBits(maskKinematicV0, {selPosEta, selNegEta}); + setBits(maskKinematicCasc, {selPosEta, selNegEta, selBachEta}); + + // Specific masks + setBits(maskK0ShortSpecific, {selK0ShortRapidity, selK0ShortCTau, selK0ShortArmenteros, selConsiderK0Short}); + setBits(maskLambdaSpecific, {selLambdaRapidity, selLambdaCTau, selConsiderLambda}); + setBits(maskAntiLambdaSpecific, {selLambdaRapidity, selLambdaCTau, selConsiderAntiLambda}); + setBits(maskXiSpecific, {selXiRapidity, selXiCTau, selRejCompXi, selMassWinXi, selConsiderXi}); + setBits(maskAntiXiSpecific, {selXiRapidity, selXiCTau, selRejCompXi, selMassWinXi, selConsiderAntiXi}); + setBits(maskOmegaSpecific, {selOmegaRapidity, selOmegaCTau, selRejCompOmega, selMassWinOmega, selConsiderOmega}); + setBits(maskAntiOmegaSpecific, {selOmegaRapidity, selOmegaCTau, selRejCompOmega, selMassWinOmega, selConsiderAntiOmega}); + + // ask for specific TPC/TOF PID selections + // positive track + if (TrackConfigurations.requirePosITSonly) { + setBits(maskTrackPropertiesV0, {selPosItsOnly, selPosGoodITSTrack}); + } else { + setBits(maskTrackPropertiesV0, {selPosGoodTPCTrack, selPosGoodITSTrack}); + // TPC signal is available: ask for positive track PID + if (PIDConfigurations.TpcPidNsigmaCut < 1e+5) { // safeguard for no cut + maskK0ShortSpecific.set(selTPCPIDPositivePion); + maskLambdaSpecific.set(selTPCPIDPositiveProton); + maskAntiLambdaSpecific.set(selTPCPIDPositivePion); + + maskXiSpecific.set(selTPCPIDPositiveProton); + maskAntiXiSpecific.set(selTPCPIDPositivePion); + maskOmegaSpecific.set(selTPCPIDPositiveProton); + maskAntiOmegaSpecific.set(selTPCPIDPositivePion); + } + // TOF PID + if (PIDConfigurations.TofPidNsigmaCutK0Pi < 1e+5) { // safeguard for no cut + setBits(maskK0ShortSpecific, {selTOFNSigmaPositivePionK0Short, selTOFDeltaTPositivePionK0Short}); + } + if (PIDConfigurations.TofPidNsigmaCutLaPr < 1e+5) { // safeguard for no cut + setBits(maskLambdaSpecific, {selTOFNSigmaPositiveProtonLambda, selTOFDeltaTPositiveProtonLambda}); + setBits(maskXiSpecific, {selTOFNSigmaPositiveProtonLambdaXi, selTOFDeltaTPositiveProtonLambdaXi}); + setBits(maskOmegaSpecific, {selTOFNSigmaPositiveProtonLambdaOmega, selTOFDeltaTPositiveProtonLambdaOmega}); + } + if (PIDConfigurations.TofPidNsigmaCutLaPi < 1e+5) { // safeguard for no cut + setBits(maskAntiLambdaSpecific, {selTOFNSigmaPositivePionLambda, selTOFDeltaTPositivePionLambda}); + setBits(maskAntiXiSpecific, {selTOFNSigmaPositivePionLambdaXi, selTOFDeltaTPositivePionLambdaXi}); + setBits(maskAntiOmegaSpecific, {selTOFNSigmaPositivePionLambdaOmega, selTOFDeltaTPositivePionLambdaOmega}); + } + } + // negative track + if (TrackConfigurations.requireNegITSonly) { + setBits(maskTrackPropertiesV0, {selNegItsOnly, selNegGoodITSTrack}); + } else { + setBits(maskTrackPropertiesV0, {selNegGoodTPCTrack, selNegGoodITSTrack}); + // TPC signal is available: ask for negative track PID + if (PIDConfigurations.TpcPidNsigmaCut < 1e+5) { // safeguard for no cut + maskK0ShortSpecific.set(selTPCPIDNegativePion); + maskLambdaSpecific.set(selTPCPIDNegativePion); + maskAntiLambdaSpecific.set(selTPCPIDNegativeProton); + + maskXiSpecific.set(selTPCPIDNegativePion); + maskAntiXiSpecific.set(selTPCPIDPositiveProton); + maskOmegaSpecific.set(selTPCPIDNegativePion); + maskAntiOmegaSpecific.set(selTPCPIDPositiveProton); + } + // TOF PID + if (PIDConfigurations.TofPidNsigmaCutK0Pi < 1e+5) { // safeguard for no cut + setBits(maskK0ShortSpecific, {selTOFNSigmaNegativePionK0Short, selTOFDeltaTNegativePionK0Short}); + } + if (PIDConfigurations.TofPidNsigmaCutLaPr < 1e+5) { // safeguard for no cut + setBits(maskAntiLambdaSpecific, {selTOFNSigmaNegativeProtonLambda, selTOFDeltaTNegativeProtonLambda}); + setBits(maskAntiXiSpecific, {selTOFNSigmaNegativeProtonLambdaXi, selTOFDeltaTNegativeProtonLambdaXi}); + setBits(maskAntiOmegaSpecific, {selTOFNSigmaNegativeProtonLambdaOmega, selTOFDeltaTNegativeProtonLambdaOmega}); + } + if (PIDConfigurations.TofPidNsigmaCutLaPi < 1e+5) { // safeguard for no cut + setBits(maskLambdaSpecific, {selTOFNSigmaNegativePionLambda, selTOFDeltaTNegativePionLambda}); + setBits(maskXiSpecific, {selTOFNSigmaNegativePionLambdaXi, selTOFDeltaTNegativePionLambdaXi}); + setBits(maskOmegaSpecific, {selTOFNSigmaNegativePionLambdaOmega, selTOFDeltaTNegativePionLambdaOmega}); + } + } + // bachelor track + maskTrackPropertiesCasc = maskTrackPropertiesV0; + if (TrackConfigurations.requireBachITSonly) { + setBits(maskTrackPropertiesCasc, {selBachItsOnly, selBachGoodITSTrack}); + } else { + setBits(maskTrackPropertiesCasc, {selBachGoodTPCTrack, selBachGoodITSTrack}); + // TPC signal is available: ask for positive track PID + if (PIDConfigurations.TpcPidNsigmaCut < 1e+5) { // safeguard for no cut + maskXiSpecific.set(selTPCPIDBachPion); + maskAntiXiSpecific.set(selTPCPIDBachPion); + maskOmegaSpecific.set(selTPCPIDBachKaon); + maskAntiOmegaSpecific.set(selTPCPIDBachKaon); + } + // TOF PID + if (PIDConfigurations.TofPidNsigmaCutXiPi < 1e+5) { // safeguard for no cut + setBits(maskXiSpecific, {selTOFNSigmaBachPionXi, selTOFDeltaTBachPionXi}); + setBits(maskAntiXiSpecific, {selTOFNSigmaBachPionXi, selTOFDeltaTBachPionXi}); + } + if (PIDConfigurations.TofPidNsigmaCutOmegaKaon < 1e+5) { // safeguard for no cut + setBits(maskOmegaSpecific, {selTOFNSigmaBachKaonOmega, selTOFDeltaTBachKaonOmega}); + setBits(maskAntiOmegaSpecific, {selTOFNSigmaBachKaonOmega, selTOFDeltaTBachKaonOmega}); + } + } + + if (TrackConfigurations.skipTPConly) { + setBits(maskK0ShortSpecific, {selPosNotTPCOnly, selNegNotTPCOnly}); + setBits(maskLambdaSpecific, {selPosNotTPCOnly, selNegNotTPCOnly}); + setBits(maskAntiLambdaSpecific, {selPosNotTPCOnly, selNegNotTPCOnly}); + setBits(maskXiSpecific, {selPosNotTPCOnly, selNegNotTPCOnly, selBachNotTPCOnly}); + setBits(maskOmegaSpecific, {selPosNotTPCOnly, selNegNotTPCOnly, selBachNotTPCOnly}); + setBits(maskAntiXiSpecific, {selPosNotTPCOnly, selNegNotTPCOnly, selBachNotTPCOnly}); + setBits(maskAntiOmegaSpecific, {selPosNotTPCOnly, selNegNotTPCOnly, selBachNotTPCOnly}); + } + + // Primary particle selection, central to analysis + maskSelectionK0Short = maskTopologicalV0 | maskKinematicV0 | maskTrackPropertiesV0 | maskK0ShortSpecific | (std::bitset(1) << selPhysPrimK0Short); + maskSelectionLambda = maskTopologicalV0 | maskKinematicV0 | maskTrackPropertiesV0 | maskLambdaSpecific | (std::bitset(1) << selPhysPrimLambda); + maskSelectionAntiLambda = maskTopologicalV0 | maskKinematicV0 | maskTrackPropertiesV0 | maskAntiLambdaSpecific | (std::bitset(1) << selPhysPrimAntiLambda); + maskSelectionXi = maskTopologicalCasc | maskKinematicCasc | maskTrackPropertiesCasc | maskXiSpecific | (std::bitset(1) << selPhysPrimXi); + maskSelectionAntiXi = maskTopologicalCasc | maskKinematicCasc | maskTrackPropertiesCasc | maskAntiXiSpecific | (std::bitset(1) << selPhysPrimAntiXi); + maskSelectionOmega = maskTopologicalCasc | maskKinematicCasc | maskTrackPropertiesCasc | maskOmegaSpecific | (std::bitset(1) << selPhysPrimOmega); + maskSelectionAntiOmega = maskTopologicalCasc | maskKinematicCasc | maskTrackPropertiesCasc | maskAntiOmegaSpecific | (std::bitset(1) << selPhysPrimAntiOmega); + + // Event Counters + histos.add("hEventSelection", "hEventSelection", kTH1F, {{15, -0.5f, +14.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"); + 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.get(HIST("hEventSelection"))->GetXaxis()->SetBinLabel(15, "isUPC"); + + // 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/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/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}); + + if (doprocessV0s) { + // For all candidates + if (doPlainTopoQA) { + histos.add("generalQA/hPt", "hPt", kTH1F, {axisPtCoarse}); + histos.add("generalQA/hPosDCAToPV", "hPosDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("generalQA/hNegDCAToPV", "hNegDCAToPV", kTH1F, {axisDCAtoPV}); + histos.add("generalQA/hDCADaughters", "hDCADaughters", kTH1F, {axisDCAdau}); + histos.add("generalQA/hPointingAngle", "hPointingAngle", kTH1F, {axisPointingAngle}); + histos.add("generalQA/hV0Radius", "hV0Radius", kTH1F, {axisV0Radius}); + histos.add("generalQA/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("generalQA/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("generalQA/h2dArmenterosAll", "h2dArmenterosAll", kTH2F, {axisAPAlpha, axisAPQt}); + histos.add("generalQA/h2dArmenterosSelected", "h2dArmenterosSelected", kTH2F, {axisAPAlpha, axisAPQt}); + } + + // K0s + if (analyseK0Short) { + addHistograms<0>(histos); + } + + // Lambda + if (analyseLambda) { + addHistograms<1>(histos); + if (doCollisionAssociationQA) { + addCollisionAssocHistograms<1>(histos); + } + } + + // Anti-Lambda + if (analyseAntiLambda) { + addHistograms<2>(histos); + if (doCollisionAssociationQA) { + addCollisionAssocHistograms<2>(histos); + } + } + } + + if (doprocessCascades) { + // For all candidates + if (doPlainTopoQA) { + histos.add("generalQA/hPt", "hPt", kTH1F, {axisPtCoarse}); + histos.add("generalQA/hCascCosPA", "hCascCosPA", kTH2F, {axisPtCoarse, {100, 0.9f, 1.0f}}); + histos.add("generalQA/hDCACascDaughters", "hDCACascDaughters", kTH2F, {axisPtCoarse, {44, 0.0f, 2.2f}}); + histos.add("generalQA/hCascRadius", "hCascRadius", kTH2D, {axisPtCoarse, {500, 0.0f, 50.0f}}); + histos.add("generalQA/hMesonDCAToPV", "hMesonDCAToPV", kTH2F, {axisPtCoarse, axisDCAtoPV}); + histos.add("generalQA/hBaryonDCAToPV", "hBaryonDCAToPV", kTH2F, {axisPtCoarse, axisDCAtoPV}); + histos.add("generalQA/hBachDCAToPV", "hBachDCAToPV", kTH2F, {axisPtCoarse, {200, -1.0f, 1.0f}}); + histos.add("generalQA/hV0CosPA", "hV0CosPA", kTH2F, {axisPtCoarse, {100, 0.9f, 1.0f}}); + histos.add("generalQA/hV0Radius", "hV0Radius", kTH2D, {axisPtCoarse, axisV0Radius}); + histos.add("generalQA/hDCAV0Daughters", "hDCAV0Daughters", kTH2F, {axisPtCoarse, axisDCAdau}); + histos.add("generalQA/hDCAV0ToPV", "hDCAV0ToPV", kTH2F, {axisPtCoarse, {44, 0.0f, 2.2f}}); + histos.add("generalQA/hMassLambdaDau", "hMassLambdaDau", kTH2F, {axisPtCoarse, axisLambdaMass}); + histos.add("generalQA/h2dPositiveITSvsTPCpts", "h2dPositiveITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("generalQA/h2dNegativeITSvsTPCpts", "h2dNegativeITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + histos.add("generalQA/h2dBachITSvsTPCpts", "h2dBachITSvsTPCpts", kTH2F, {axisTPCrows, axisITSclus}); + } + + // Xi + if (analyseXi) { + addHistograms<3>(histos); + } + + // Anti-Xi + if (analyseAntiXi) { + addHistograms<4>(histos); + } + + // Omega + if (analyseOmega) { + addHistograms<5>(histos); + } + + // Anti-Omega + if (analyseAntiOmega) { + addHistograms<6>(histos); + } + } + + if (verbose) { + histos.print(); + } + } + + template + int getGapSide(TCollision const& collision) + { + int selGapSide = sgSelector.trueGap(collision, upcCuts.FV0cut, upcCuts.FT0Acut, upcCuts.FT0Ccut, upcCuts.ZDCcut); + histos.fill(HIST("eventQA/hGapSide"), collision.gapSide()); + histos.fill(HIST("eventQA/hSelGapSide"), selGapSide); + histos.fill(HIST("eventQA/hFT0"), collision.totalFT0AmplitudeA(), collision.totalFT0AmplitudeC(), selGapSide); + histos.fill(HIST("eventQA/hFDD"), collision.totalFDDAmplitudeA(), collision.totalFDDAmplitudeC(), selGapSide); + histos.fill(HIST("eventQA/hZN"), collision.energyCommonZNA(), collision.energyCommonZNC(), selGapSide); + return selGapSide; + } + + template + void fillHistogramsQA(TCollision const& collision) + { + // 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()); + } + + template + bool acceptEvent(TCollision const& collision) + { + histos.fill(HIST("hEventSelection"), 0. /* all collisions */); + + if (requireIsTriggerTVX && !collision.selection_bit(aod::evsel::kIsTriggerTVX)) { + return false; + } + histos.fill(HIST("hEventSelection"), 1 /* triggered by FT0M */); + + if (fabs(collision.posZ()) > 10.f) { + return false; + } + histos.fill(HIST("hEventSelection"), 2 /* vertex-Z selected */); + + if (rejectITSROFBorder && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { + return false; + } + histos.fill(HIST("hEventSelection"), 3 /* Not at ITS ROF border */); + + if (rejectTFBorder && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + histos.fill(HIST("hEventSelection"), 4 /* Not at TF border */); + + if (requireIsVertexITSTPC && !collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + histos.fill(HIST("hEventSelection"), 5 /* Contains at least one ITS-TPC track */); + + if (requireIsGoodZvtxFT0VsPV && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + histos.fill(HIST("hEventSelection"), 6 /* PV position consistency check */); + + if (requireIsVertexTOFmatched && !collision.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return false; + } + 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; + } + 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; + } + histos.fill(HIST("hEventSelection"), 9 /* Not at same bunch pile-up */); + + if (requireNoCollInTimeRangeStd && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + histos.fill(HIST("hEventSelection"), 10 /* No other collision within +/- 10 microseconds */); + + if (requireNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) { + return false; + } + histos.fill(HIST("hEventSelection"), 11 /* No other collision within +/- 4 microseconds */); + + if (minOccupancy > 0 && collision.trackOccupancyInTimeRange() < minOccupancy) { + return false; + } + histos.fill(HIST("hEventSelection"), 12 /* Above min occupancy */); + + if (maxOccupancy > 0 && collision.trackOccupancyInTimeRange() > maxOccupancy) { + return false; + } + histos.fill(HIST("hEventSelection"), 13 /* Below max occupancy */); + + if (studyUPConly && !collision.isUPC()) { + return false; + } else if (collision.isUPC()) { + histos.fill(HIST("hEventSelection"), 14 /* is UPC compatible */); + } + + return true; + } + + bool verifyMask(std::bitset bitmap, std::bitset mask) + { + return (bitmap & mask) == mask; + } + + int computeITSclusBitmap(uint8_t itsClusMap, bool fromAfterburner) + { + int bitMap = 0; + + struct MaskBitmapPair { + uint8_t mask; + int bitmap; + int afterburnerBitmap; + }; + + constexpr MaskBitmapPair configs[] = { + // L6 <-- L0 + {0x7F, 12, 12}, // 01111 111 (L0 to L6) + {0x7E, 11, 11}, // 01111 110 (L1 to L6) + {0x7C, 10, 10}, // 01111 100 (L2 to L6) + {0x78, 9, -3}, // 01111 000 (L3 to L6) + {0x70, 8, -2}, // 01110 000 (L4 to L6) + {0x60, 7, -1}, // 01100 000 (L5 to L6) + {0x3F, 6, 6}, // 00111 111 (L0 to L5) + {0x3E, 5, 5}, // 00111 110 (L1 to L5) + {0x3C, 4, 4}, // 00111 100 (L2 to L5) + {0x1F, 3, 3}, // 00011 111 (L0 to L4) + {0x1E, 2, 2}, // 00011 110 (L1 to L4) + {0x0F, 1, 1}, // 00001 111 (L0 to L3) + }; + + for (const auto& config : configs) { + if (verifyMask(itsClusMap, config.mask)) { + bitMap = fromAfterburner ? config.afterburnerBitmap : config.bitmap; + break; + } + } + + return bitMap; + } + + uint computeDetBitmap(uint8_t detMap) + { + uint bitMap = 0; + + struct MaskBitmapPair { + uint8_t mask; + int bitmap; + }; + + constexpr MaskBitmapPair configs[] = { + {o2::aod::track::ITS | o2::aod::track::TPC | o2::aod::track::TRD | o2::aod::track::TOF, 4}, // ITS-TPC-TRD-TOF + {o2::aod::track::ITS | o2::aod::track::TPC | o2::aod::track::TOF, 3}, // ITS-TPC-TOF + {o2::aod::track::ITS | o2::aod::track::TPC | o2::aod::track::TRD, 2}, // ITS-TPC-TRD + {o2::aod::track::ITS | o2::aod::track::TPC, 1} // ITS-TPC + }; + + for (const auto& config : configs) { + if (verifyMask(detMap, config.mask)) { + bitMap = config.bitmap; + break; + } + } + + return bitMap; + } + + template + std::bitset computeBitmapCascade(TCasc const& casc, TCollision const& coll) + { + float rapidityXi = casc.yXi(); + float rapidityOmega = casc.yOmega(); + + // Access daughter tracks + auto posTrackExtra = casc.template posTrackExtra_as(); + auto negTrackExtra = casc.template negTrackExtra_as(); + auto bachTrackExtra = casc.template bachTrackExtra_as(); + + // c x tau + float decayPos = std::hypot(casc.x() - coll.posX(), casc.y() - coll.posY(), casc.z() - coll.posZ()); + float totalMom = std::hypot(casc.px(), casc.py(), casc.pz()); + float ctauXi = totalMom != 0 ? pdgDB->Mass(3312) * decayPos / totalMom : 1e6; + float ctauOmega = totalMom != 0 ? pdgDB->Mass(3334) * decayPos / totalMom : 1e6; + + std::bitset bitMap = 0; + + if (casc.casccosPA(coll.posX(), coll.posY(), coll.posZ()) > casccuts.casccospa) + bitMap.set(selCascCosPA); + if (casc.dcacascdaughters() < casccuts.dcacascdau) + bitMap.set(selDCACascDau); + if (casc.cascradius() > casccuts.cascradius) + bitMap.set(selCascRadius); + if (casc.cascradius() < casccuts.cascradiusMax) + bitMap.set(selCascRadiusMax); + if (doBachelorBaryonCut && (casc.bachBaryonCosPA() < casccuts.bachbaryoncospa) && (fabs(casc.bachBaryonDCAxyToPV()) > casccuts.bachbaryondcaxytopv)) + bitMap.set(selBachBaryon); + if (fabs(casc.dcabachtopv()) > casccuts.dcabachtopv) + bitMap.set(selBachToPV); + + if (casc.sign() > 0) { + if (fabs(casc.dcanegtopv()) > casccuts.dcabaryontopv) + bitMap.set(selBaryonToPV); + if (fabs(casc.dcapostopv()) > casccuts.dcamesontopv) + bitMap.set(selMesonToPV); + } else { // no sign == 0, in principle + if (fabs(casc.dcapostopv()) > casccuts.dcabaryontopv) + bitMap.set(selBaryonToPV); + if (fabs(casc.dcanegtopv()) > casccuts.dcamesontopv) + bitMap.set(selMesonToPV); + } + + if (fabs(casc.mXi() - pdgDB->Mass(3312)) < casccuts.masswin) + bitMap.set(selMassWinXi); + if (fabs(casc.mOmega() - pdgDB->Mass(3334)) < casccuts.masswin) + bitMap.set(selMassWinOmega); + if (fabs(casc.mLambda() - pdgDB->Mass(3122)) < casccuts.lambdamasswin) + bitMap.set(selLambdaMassWin); + + if (fabs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ())) > casccuts.dcav0topv) + bitMap.set(selDCAV0ToPV); + if (casc.v0radius() > v0cuts.v0radius) + bitMap.set(selV0Radius); + if (casc.v0radius() < v0cuts.v0radiusMax) + bitMap.set(selV0RadiusMax); + if (casc.v0cosPA(coll.posX(), coll.posY(), coll.posZ()) > v0cuts.v0cospa) + bitMap.set(selV0CosPA); + if (casc.dcaV0daughters() < v0cuts.dcav0dau) + bitMap.set(selDCAV0Dau); + + // proper lifetime + if (ctauXi < nCtauCutCasc->get("lifetimecutXi") * ctauxiPDG) + bitMap.set(selXiCTau); + if (ctauOmega < nCtauCutCasc->get("lifetimecutOmega") * ctauomegaPDG) + bitMap.set(selOmegaCTau); + + auto poseta = RecoDecay::eta(std::array{casc.pxpos(), casc.pypos(), casc.pzpos()}); + auto negeta = RecoDecay::eta(std::array{casc.pxneg(), casc.pyneg(), casc.pzneg()}); + auto bacheta = RecoDecay::eta(std::array{casc.pxbach(), casc.pybach(), casc.pzbach()}); + + // kinematic + if (fabs(rapidityXi) < rapidityCut) + bitMap.set(selXiRapidity); + if (fabs(rapidityOmega) < rapidityCut) + bitMap.set(selOmegaRapidity); + if (fabs(poseta) < daughterEtaCut) + bitMap.set(selNegEta); + if (fabs(negeta) < daughterEtaCut) + bitMap.set(selPosEta); + if (fabs(bacheta) < daughterEtaCut) + bitMap.set(selBachEta); + + // ITS quality flags + if (posTrackExtra.itsNCls() >= TrackConfigurations.minITSclusters) + bitMap.set(selPosGoodITSTrack); + if (negTrackExtra.itsNCls() >= TrackConfigurations.minITSclusters) + bitMap.set(selNegGoodITSTrack); + if (bachTrackExtra.itsNCls() >= TrackConfigurations.minITSclusters) + bitMap.set(selBachGoodITSTrack); + + // TPC quality flags + if (posTrackExtra.tpcCrossedRows() >= TrackConfigurations.minTPCrows) + bitMap.set(selPosGoodTPCTrack); + if (negTrackExtra.tpcCrossedRows() >= TrackConfigurations.minTPCrows) + bitMap.set(selNegGoodTPCTrack); + if (bachTrackExtra.tpcCrossedRows() >= TrackConfigurations.minTPCrows) + bitMap.set(selBachGoodTPCTrack); + + // TPC PID + // positive track + if (fabs(posTrackExtra.tpcNSigmaPi()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDPositivePion); + if (fabs(posTrackExtra.tpcNSigmaPr()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDPositiveProton); + // negative track + if (fabs(negTrackExtra.tpcNSigmaPi()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDNegativePion); + if (fabs(negTrackExtra.tpcNSigmaPr()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDNegativeProton); + // bachelor track + if (fabs(bachTrackExtra.tpcNSigmaPi()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDBachPion); + if (fabs(bachTrackExtra.tpcNSigmaKa()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDBachKaon); + + // TOF PID in DeltaT + // positive track + if (fabs(casc.posTOFDeltaTXiPr()) < PIDConfigurations.maxDeltaTimeProton) + bitMap.set(selTOFDeltaTPositiveProtonLambdaXi); + if (fabs(casc.posTOFDeltaTXiPi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTPositivePionLambdaXi); + if (fabs(casc.posTOFDeltaTOmPr()) < PIDConfigurations.maxDeltaTimeProton) + bitMap.set(selTOFDeltaTPositiveProtonLambdaOmega); + if (fabs(casc.posTOFDeltaTOmPi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTPositivePionLambdaOmega); + // negative track + if (fabs(casc.negTOFDeltaTXiPr()) < PIDConfigurations.maxDeltaTimeProton) + bitMap.set(selTOFDeltaTNegativeProtonLambdaXi); + if (fabs(casc.negTOFDeltaTXiPi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTNegativePionLambdaXi); + if (fabs(casc.negTOFDeltaTOmPr()) < PIDConfigurations.maxDeltaTimeProton) + bitMap.set(selTOFDeltaTNegativeProtonLambdaOmega); + if (fabs(casc.negTOFDeltaTOmPi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTNegativePionLambdaOmega); + // bachelor track + if (fabs(casc.bachTOFDeltaTOmKa()) < PIDConfigurations.maxDeltaTimeKaon) + bitMap.set(selTOFDeltaTBachKaonOmega); + if (fabs(casc.bachTOFDeltaTXiPi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTBachPionXi); + + // TOF PID in NSigma + // meson track + if (fabs(casc.tofNSigmaXiLaPi()) < PIDConfigurations.TofPidNsigmaCutLaPi) { + bitMap.set(selTOFNSigmaPositivePionLambdaXi); + bitMap.set(selTOFNSigmaNegativePionLambdaXi); + } + if (fabs(casc.tofNSigmaOmLaPi()) < PIDConfigurations.TofPidNsigmaCutLaPi) { + bitMap.set(selTOFNSigmaPositivePionLambdaOmega); + bitMap.set(selTOFNSigmaNegativePionLambdaOmega); + } + // baryon track + if (fabs(casc.tofNSigmaXiLaPr()) < PIDConfigurations.TofPidNsigmaCutLaPr) { + bitMap.set(selTOFNSigmaNegativeProtonLambdaXi); + bitMap.set(selTOFNSigmaPositiveProtonLambdaXi); + } + if (fabs(casc.tofNSigmaOmLaPr()) < PIDConfigurations.TofPidNsigmaCutLaPr) { + bitMap.set(selTOFNSigmaNegativePionLambdaOmega); + bitMap.set(selTOFNSigmaPositivePionLambdaOmega); + } + // bachelor track + if (fabs(casc.tofNSigmaXiPi()) < PIDConfigurations.TofPidNsigmaCutXiPi) { + bitMap.set(selTOFNSigmaBachPionXi); + } + if (fabs(casc.tofNSigmaOmKa()) < PIDConfigurations.TofPidNsigmaCutOmegaKaon) { + bitMap.set(selTOFNSigmaBachKaonOmega); + } + + // ITS only tag + if (posTrackExtra.tpcCrossedRows() < 1) + bitMap.set(selPosItsOnly); + if (negTrackExtra.tpcCrossedRows() < 1) + bitMap.set(selNegItsOnly); + if (bachTrackExtra.tpcCrossedRows() < 1) + bitMap.set(selBachItsOnly); + + // rej. comp. + if (fabs(casc.mOmega() - pdgDB->Mass(3334)) > casccuts.rejcomp) + bitMap.set(selRejCompXi); + if (fabs(casc.mXi() - pdgDB->Mass(3312)) > casccuts.rejcomp) + bitMap.set(selRejCompOmega); + + // TPC only tag + if (posTrackExtra.detectorMap() != o2::aod::track::TPC) + bitMap.set(selPosNotTPCOnly); + if (negTrackExtra.detectorMap() != o2::aod::track::TPC) + bitMap.set(selNegNotTPCOnly); + if (bachTrackExtra.detectorMap() != o2::aod::track::TPC) + bitMap.set(selBachNotTPCOnly); + + return bitMap; + } + + template + std::bitset computeBitmapV0(TV0 const& v0, TCollision const& collision) + { + float rapidityLambda = v0.yLambda(); + float rapidityK0Short = v0.yK0Short(); + + std::bitset bitMap = 0; + + // base topological variables + if (v0.v0radius() > v0cuts.v0radius) + bitMap.set(selV0Radius); + if (v0.v0radius() < v0cuts.v0radiusMax) + bitMap.set(selV0RadiusMax); + if (fabs(v0.dcapostopv()) > v0cuts.dcapostopv) + bitMap.set(selDCAPosToPV); + if (fabs(v0.dcanegtopv()) > v0cuts.dcanegtopv) + bitMap.set(selDCANegToPV); + if (v0.v0cosPA() > v0cuts.v0cospa) + bitMap.set(selV0CosPA); + if (v0.dcaV0daughters() < v0cuts.dcav0dau) + bitMap.set(selDCAV0Dau); + + // kinematic + if (fabs(rapidityLambda) < rapidityCut) + bitMap.set(selLambdaRapidity); + if (fabs(rapidityK0Short) < rapidityCut) + bitMap.set(selK0ShortRapidity); + if (fabs(v0.negativeeta()) < daughterEtaCut) + bitMap.set(selNegEta); + if (fabs(v0.positiveeta()) < daughterEtaCut) + bitMap.set(selPosEta); + + auto posTrackExtra = v0.template posTrackExtra_as(); + auto negTrackExtra = v0.template negTrackExtra_as(); + + // ITS quality flags + if (posTrackExtra.itsNCls() >= TrackConfigurations.minITSclusters) + bitMap.set(selPosGoodITSTrack); + if (negTrackExtra.itsNCls() >= TrackConfigurations.minITSclusters) + bitMap.set(selNegGoodITSTrack); + + // TPC quality flags + if (posTrackExtra.tpcCrossedRows() >= TrackConfigurations.minTPCrows) + bitMap.set(selPosGoodTPCTrack); + if (negTrackExtra.tpcCrossedRows() >= TrackConfigurations.minTPCrows) + bitMap.set(selNegGoodTPCTrack); + + // TPC PID + if (fabs(posTrackExtra.tpcNSigmaPi()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDPositivePion); + if (fabs(posTrackExtra.tpcNSigmaPr()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDPositiveProton); + if (fabs(negTrackExtra.tpcNSigmaPi()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDNegativePion); + if (fabs(negTrackExtra.tpcNSigmaPr()) < PIDConfigurations.TpcPidNsigmaCut) + bitMap.set(selTPCPIDNegativeProton); + + // TOF PID in DeltaT + // positive track + if (fabs(v0.posTOFDeltaTLaPr()) < PIDConfigurations.maxDeltaTimeProton) + bitMap.set(selTOFDeltaTPositiveProtonLambda); + if (fabs(v0.posTOFDeltaTLaPi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTPositivePionLambda); + if (fabs(v0.posTOFDeltaTK0Pi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTPositivePionK0Short); + // negative track + if (fabs(v0.negTOFDeltaTLaPr()) < PIDConfigurations.maxDeltaTimeProton) + bitMap.set(selTOFDeltaTNegativeProtonLambda); + if (fabs(v0.negTOFDeltaTLaPi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTNegativePionLambda); + if (fabs(v0.negTOFDeltaTK0Pi()) < PIDConfigurations.maxDeltaTimePion) + bitMap.set(selTOFDeltaTNegativePionK0Short); + + // TOF PID in NSigma + // positive track + if (fabs(v0.tofNSigmaLaPr()) < PIDConfigurations.TofPidNsigmaCutLaPr) + bitMap.set(selTOFNSigmaPositiveProtonLambda); + if (fabs(v0.tofNSigmaALaPi()) < PIDConfigurations.TofPidNsigmaCutLaPi) + bitMap.set(selTOFNSigmaPositivePionLambda); + if (fabs(v0.tofNSigmaK0PiPlus()) < PIDConfigurations.TofPidNsigmaCutK0Pi) + bitMap.set(selTOFNSigmaPositivePionK0Short); + // negative track + if (fabs(v0.tofNSigmaALaPr()) < PIDConfigurations.TofPidNsigmaCutLaPr) + bitMap.set(selTOFNSigmaNegativeProtonLambda); + if (fabs(v0.tofNSigmaLaPi()) < PIDConfigurations.TofPidNsigmaCutLaPi) + bitMap.set(selTOFNSigmaNegativePionLambda); + if (fabs(v0.tofNSigmaK0PiMinus()) < PIDConfigurations.TofPidNsigmaCutK0Pi) + bitMap.set(selTOFNSigmaNegativePionK0Short); + + // ITS only tag + if (posTrackExtra.tpcCrossedRows() < 1) + bitMap.set(selPosItsOnly); + if (negTrackExtra.tpcCrossedRows() < 1) + bitMap.set(selNegItsOnly); + + // TPC only tag + if (posTrackExtra.detectorMap() != o2::aod::track::TPC) + bitMap.set(selPosNotTPCOnly); + if (negTrackExtra.detectorMap() != o2::aod::track::TPC) + bitMap.set(selNegNotTPCOnly); + + // proper lifetime + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassLambda0 < lifetimecutV0->get("lifetimecutLambda")) + bitMap.set(selLambdaCTau); + if (v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * o2::constants::physics::MassK0Short < lifetimecutV0->get("lifetimecutK0S")) + bitMap.set(selK0ShortCTau); + + // armenteros + if (v0.qtarm() * v0cuts.armPodCut > fabs(v0.alpha()) || v0cuts.armPodCut < 1e-4) + bitMap.set(selK0ShortArmenteros); + + return bitMap; + } + + template + void analyseCascCandidate(TCasc const& casc, TCollision const& coll, int const& gap, std::bitset const& selMap) + { + // Access daughter tracks + auto posTrackExtra = casc.template posTrackExtra_as(); + auto negTrackExtra = casc.template negTrackExtra_as(); + auto bachTrackExtra = casc.template bachTrackExtra_as(); + + if (doPlainTopoQA) { + histos.fill(HIST("generalQA/hPt"), casc.pt()); + histos.fill(HIST("generalQA/hCascCosPA"), casc.pt(), casc.casccosPA(coll.posX(), coll.posY(), coll.posZ())); + histos.fill(HIST("generalQA/hDCACascDaughters"), casc.pt(), casc.dcacascdaughters()); + histos.fill(HIST("generalQA/hCascRadius"), casc.pt(), casc.cascradius()); + histos.fill(HIST("generalQA/hMesonDCAToPV"), casc.pt(), casc.dcanegtopv()); + histos.fill(HIST("generalQA/hBaryonDCAToPV"), casc.pt(), casc.dcapostopv()); + histos.fill(HIST("generalQA/hBachDCAToPV"), casc.pt(), casc.dcabachtopv()); + histos.fill(HIST("generalQA/hV0CosPA"), casc.pt(), casc.v0cosPA(coll.posX(), coll.posY(), coll.posZ())); + histos.fill(HIST("generalQA/hV0Radius"), casc.pt(), casc.v0radius()); + histos.fill(HIST("generalQA/hDCAV0Daughters"), casc.pt(), casc.dcaV0daughters()); + histos.fill(HIST("generalQA/hDCAV0ToPV"), casc.pt(), fabs(casc.dcav0topv(coll.posX(), coll.posY(), coll.posZ()))); + histos.fill(HIST("generalQA/hMassLambdaDau"), casc.pt(), casc.mLambda()); + histos.fill(HIST("generalQA/h2dPositiveITSvsTPCpts"), posTrackExtra.tpcCrossedRows(), posTrackExtra.itsNCls()); + histos.fill(HIST("generalQA/h2dNegativeITSvsTPCpts"), negTrackExtra.tpcCrossedRows(), negTrackExtra.itsNCls()); + histos.fill(HIST("generalQA/h2dBachITSvsTPCpts"), bachTrackExtra.tpcCrossedRows(), bachTrackExtra.itsNCls()); + } + + // Xi + if (verifyMask(selMap, maskSelectionXi) && analyseXi) { + fillHistogramsCasc<3>(casc, coll, gap); + } + + // Anti-Xi + if (verifyMask(selMap, maskSelectionAntiXi) && analyseAntiXi) { + fillHistogramsCasc<4>(casc, coll, gap); + } + + // Omega + if (verifyMask(selMap, maskSelectionOmega) && analyseOmega) { + fillHistogramsCasc<5>(casc, coll, gap); + } + + // Anti-Omega + if (verifyMask(selMap, maskSelectionAntiOmega) && analyseAntiOmega) { + fillHistogramsCasc<6>(casc, coll, gap); + } + } + + template + void analyseV0Candidate(TV0 const& v0, TCollision const& coll, int const& gap, std::bitset const& selMap) + { + auto posTrackExtra = v0.template posTrackExtra_as(); + auto negTrackExtra = v0.template negTrackExtra_as(); + + // QA plots + if (doPlainTopoQA) { + histos.fill(HIST("generalQA/hPt"), v0.pt()); + histos.fill(HIST("generalQA/hPosDCAToPV"), v0.dcapostopv()); + histos.fill(HIST("generalQA/hNegDCAToPV"), v0.dcanegtopv()); + histos.fill(HIST("generalQA/hDCADaughters"), v0.dcaV0daughters()); + histos.fill(HIST("generalQA/hPointingAngle"), TMath::ACos(v0.v0cosPA())); + histos.fill(HIST("generalQA/hV0Radius"), v0.v0radius()); + histos.fill(HIST("generalQA/h2dPositiveITSvsTPCpts"), posTrackExtra.tpcCrossedRows(), posTrackExtra.itsNCls()); + histos.fill(HIST("generalQA/h2dNegativeITSvsTPCpts"), negTrackExtra.tpcCrossedRows(), negTrackExtra.itsNCls()); + } + + histos.fill(HIST("generalQA/h2dArmenterosAll"), v0.alpha(), v0.qtarm()); + + // K0s + if (verifyMask(selMap, maskSelectionK0Short) && analyseK0Short) { + fillHistogramsV0<0>(v0, coll, gap); + } + + // Lambda + if (verifyMask(selMap, maskSelectionLambda) && analyseLambda) { + fillHistogramsV0<1>(v0, coll, gap); + } + + // Anti-Lambda + if (verifyMask(selMap, maskSelectionAntiLambda) && analyseAntiLambda) { + fillHistogramsV0<2>(v0, coll, gap); + } + } + + void processV0s(straCollisonFull const& collision, v0Candidates const& fullV0s, dauTracks const&) + { + if (!acceptEvent(collision)) { + return; + } // event is accepted + + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + if (studyUPConly && (selGapSide < -0.5)) + return; + + fillHistogramsQA(collision); + + for (auto& v0 : fullV0s) { + if ((v0.v0Type() != v0cuts.v0TypeSelection) && (v0cuts.v0TypeSelection > 0)) + continue; // skip V0s that are not standard + + std::bitset selMap = computeBitmapV0(v0, collision); + + // consider for histograms for all species + setBits(selMap, {selConsiderK0Short, selConsiderLambda, selConsiderAntiLambda, + selPhysPrimK0Short, selPhysPrimLambda, selPhysPrimAntiLambda}); + + analyseV0Candidate(v0, collision, selGapSide, selMap); + } // end v0 loop + } + + void processCascades(straCollisonFull const& collision, cascadeCandidates const& fullCascades, dauTracks const&) + { + if (!acceptEvent(collision)) { + return; + } // event is accepted + + int selGapSide = collision.isUPC() ? getGapSide(collision) : -1; + if (studyUPConly && (selGapSide < -0.5)) + return; + + fillHistogramsQA(collision); + + for (auto& casc : fullCascades) { + std::bitset selMap = computeBitmapCascade(casc, collision); + // consider for histograms for all species + setBits(selMap, {selConsiderXi, selConsiderAntiXi, selConsiderOmega, selConsiderAntiOmega, + selPhysPrimXi, selPhysPrimAntiXi, selPhysPrimOmega, selPhysPrimAntiOmega}); + + analyseCascCandidate(casc, collision, selGapSide, selMap); + } // end casc loop + } + + PROCESS_SWITCH(strangeYieldPbPb, processV0s, "Process V0s", true); + PROCESS_SWITCH(strangeYieldPbPb, processCascades, "Process Cascades", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx b/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx index c214dc8d75a..6499e3575fc 100644 --- a/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx +++ b/PWGLF/Tasks/Strangeness/strangeness_in_jets.cxx @@ -25,8 +25,8 @@ #include "Common/Core/RecoDecay.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Framework/ASoAHelpers.h" #include "Framework/AnalysisDataModel.h" @@ -44,45 +44,25 @@ using std::array; using SelCollisions = soa::Join; using SimCollisions = soa::Join; - -using FullTracks = soa::Join; - -using MCTracks = soa::Join; +using StrHadronDaughterTracks = soa::Join; +using MCTracks = soa::Join; struct strangeness_in_jets { - // Analysis Histograms: Data - HistogramRegistry registryData{ - "registryData", - {}, - OutputObjHandlingPolicy::AnalysisObject, - true, - true}; - - // MC Histograms - HistogramRegistry registryMC{ - "registryMC", - {}, - OutputObjHandlingPolicy::AnalysisObject, - true, - true}; - - // QC Histograms - HistogramRegistry registryQC{ - "registryQC", - {}, - OutputObjHandlingPolicy::AnalysisObject, - true, - true}; + HistogramRegistry registryData{"registryData", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry registryMC{"registryMC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry registryQC{"registryQC", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; // Global Parameters Configurable particle_of_interest{"particle_of_interest", 0, "0=v0, 1=cascade, 2=pions"}; - Configurable ptLeadingMin{"ptLeadingMin", 5.0f, "pt leading min"}; - Configurable ptJetMin{"ptJetMin", 5.0f, "Minimum pt of the jet"}; - Configurable nPartInJetMin{"nPartInJetMin", 2, "Minimum number of particles inside jet"}; - Configurable Rjet{"Rjet", 0.3f, "jet resolution parameter R"}; - Configurable Rmax{"Rmax", 0.3f, "radius of the jet and UE cones"}; - Configurable zVtx{"zVtx", 10.0f, "z vertex cut"}; + Configurable min_jet_pt{"min_jet_pt", 10.0, "Minimum pt of the jet"}; + Configurable Rjet{"Rjet", 0.3, "Jet resolution parameter R"}; + Configurable zVtx{"zVtx", 10.0, "Maximum zVertex"}; + Configurable min_nPartInJet{"min_nPartInJet", 2, "Minimum number of particles inside jet"}; + Configurable n_jets_per_event_max{"n_jets_per_event_max", 1000, "Maximum number of jets per event"}; + Configurable requireNoOverlap{"requireNoOverlap", false, "require no overlap between jets and UE cones"}; + Configurable par0{"par0", 0.004f, "par 0"}; + Configurable par1{"par1", 0.013f, "par 1"}; // Track Parameters Configurable minITSnCls{"minITSnCls", 4.0f, "min number of ITS clusters"}; @@ -104,8 +84,6 @@ struct strangeness_in_jets { Configurable nsigmaTOFmax{"nsigmaTOFmax", +3.0f, "Maximum nsigma TOF"}; Configurable dcaxyMax{"dcaxyMax", 0.1f, "Maximum DCAxy to primary vertex"}; Configurable dcazMax{"dcazMax", 0.1f, "Maximum DCAz to primary vertex"}; - Configurable yMin{"yMin", -0.5f, "minimum y"}; - Configurable yMax{"yMax", +0.5f, "maximum y"}; Configurable requireITS{"requireITS", false, "require ITS hit"}; Configurable requireTOF{"requireTOF", false, "require TOF hit"}; @@ -133,9 +111,25 @@ struct strangeness_in_jets { void init(InitContext const&) { // Event Counters - registryData.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{10, 0, 10, "Event Cuts"}}); - registryMC.add("number_of_events_mc", "number of events in mc", HistType::kTH1F, {{10, 0, 10, "Event Cuts"}}); - registryQC.add("deltaPt_leading", "deltaPt leading part", HistType::kTH1F, {{1000, -0.1, 0.1, "#Delta p_{T}"}}); + 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"}}); + registryQC.add("deltaEtadeltaPhi_ue", "deltaEtadeltaPhi_ue", HistType::kTH2F, {{200, -0.5, 0.5, "#Delta#eta"}, {200, 0, 0.5 * TMath::Pi(), "#Delta#phi"}}); + registryQC.add("NchJetPlusUE", "NchJetPlusUE", HistType::kTH1F, {{100, 0, 100, "#it{N}_{ch}"}}); + registryQC.add("NchJet", "NchJet", HistType::kTH1F, {{100, 0, 100, "#it{N}_{ch}"}}); + registryQC.add("NchUE", "NchUE", HistType::kTH1F, {{100, 0, 100, "#it{N}_{ch}"}}); + registryQC.add("sumPtJetPlusUE", "sumPtJetPlusUE", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); + registryQC.add("sumPtJet", "sumPtJet", HistType::kTH1F, {{500, 0, 50, "#it{p}_{T} (GeV/#it{c})"}}); + 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("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}"}}); + registryQC.add("survivedK0", "survivedK0", HistType::kTH1F, {{20, 0, 20, "step"}}); // Multiplicity Binning std::vector multBinning = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; @@ -200,6 +194,11 @@ struct strangeness_in_jets { registryMC.add("Lambda_reconstructed_incl", "Lambda_reconstructed_incl", HistType::kTH2F, {multBinning, {100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}}); registryMC.add("AntiLambda_reconstructed_incl", "AntiLambda_reconstructed_incl", HistType::kTH2F, {multBinning, {100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}}); + // Histograms for 2d reweighting (pion) + registryMC.add("Pion_eta_pt_jet", "Pion_eta_pt_jet", HistType::kTH2F, {{100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {18, -0.9, 0.9, "#eta"}}); + registryMC.add("Pion_eta_pt_ue", "Pion_eta_pt_ue", HistType::kTH2F, {{100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {18, -0.9, 0.9, "#eta"}}); + registryMC.add("Pion_eta_pt_pythia", "Pion_eta_pt_pythia", HistType::kTH2F, {{100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {18, -0.9, 0.9, "#eta"}}); + // Histograms for 2d reweighting (K0s) registryMC.add("K0s_eta_pt_jet", "K0s_eta_pt_jet", HistType::kTH2F, {{100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {18, -0.9, 0.9, "#eta"}}); registryMC.add("K0s_eta_pt_ue", "K0s_eta_pt_ue", HistType::kTH2F, {{100, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {18, -0.9, 0.9, "#eta"}}); @@ -236,7 +235,7 @@ struct strangeness_in_jets { } template - bool passedTrackSelectionForJets(const chargedTrack& track) + bool passedTrackSelectionForJetReconstruction(const chargedTrack& track) { if (!track.hasITS()) return false; @@ -252,11 +251,11 @@ struct strangeness_in_jets { return false; if (track.eta() < -0.8 || track.eta() > 0.8) return false; - if (track.pt() < 0.1) + if (track.pt() < 0.15) return false; - if (TMath::Abs(track.dcaXY()) > (0.0105 * 0.035 / TMath::Power(track.pt(), 1.1))) + if (TMath::Abs(track.dcaXY()) > (par0 + par1 / track.pt())) return false; - if (TMath::Abs(track.dcaZ()) > 2.0) + if (TMath::Abs(track.dcaZ()) > (par0 + par1 / track.pt())) return false; return true; } @@ -282,13 +281,6 @@ struct strangeness_in_jets { return false; if (TMath::Abs(track.dcaZ()) > dcazMax) return false; - - // Rapidity Selection - TLorentzVector lorentzVect; - lorentzVect.SetXYZM(track.px(), track.py(), track.pz(), 0.13957021); - if (lorentzVect.Rapidity() < yMin || lorentzVect.Rapidity() > yMax) - return false; - return true; } @@ -322,9 +314,9 @@ struct strangeness_in_jets { return false; if (v0.dcaV0daughters() > dcaV0DaughtersMax) return false; - if (v0.dcapostopv() < dcapostoPVmin) + if (TMath::Abs(v0.dcapostopv()) < dcapostoPVmin) return false; - if (v0.dcanegtopv() < dcanegtoPVmin) + if (TMath::Abs(v0.dcanegtopv()) < dcanegtoPVmin) return false; // PID Selections (TPC) @@ -340,12 +332,6 @@ struct strangeness_in_jets { if (ntrack.tofNSigmaPi() < nsigmaTOFmin || ntrack.tofNSigmaPi() > nsigmaTOFmax) return false; } - - // Rapidity Selection - TLorentzVector lorentzVect; - lorentzVect.SetXYZM(v0.px(), v0.py(), v0.pz(), 1.115683); - if (lorentzVect.Rapidity() < yMin || lorentzVect.Rapidity() > yMax) - return false; return true; } @@ -379,9 +365,9 @@ struct strangeness_in_jets { return false; if (v0.dcaV0daughters() > dcaV0DaughtersMax) return false; - if (v0.dcapostopv() < dcapostoPVmin) + if (TMath::Abs(v0.dcapostopv()) < dcapostoPVmin) return false; - if (v0.dcanegtopv() < dcanegtoPVmin) + if (TMath::Abs(v0.dcanegtopv()) < dcanegtoPVmin) return false; // PID Selections (TPC) @@ -397,12 +383,6 @@ struct strangeness_in_jets { if (ntrack.tofNSigmaPr() < nsigmaTOFmin || ntrack.tofNSigmaPr() > nsigmaTOFmax) return false; } - - // Rapidity Selection - TLorentzVector lorentzVect; - lorentzVect.SetXYZM(v0.px(), v0.py(), v0.pz(), 1.115683); - if (lorentzVect.Rapidity() < yMin || lorentzVect.Rapidity() > yMax) - return false; return true; } @@ -436,9 +416,9 @@ struct strangeness_in_jets { return false; if (v0.dcaV0daughters() > dcaV0DaughtersMax) return false; - if (v0.dcapostopv() < dcapostoPVmin) + if (TMath::Abs(v0.dcapostopv()) < dcapostoPVmin) return false; - if (v0.dcanegtopv() < dcanegtoPVmin) + if (TMath::Abs(v0.dcanegtopv()) < dcanegtoPVmin) return false; // PID Selections (TPC) @@ -454,12 +434,6 @@ struct strangeness_in_jets { if (ntrack.tofNSigmaPi() < nsigmaTOFmin || ntrack.tofNSigmaPi() > nsigmaTOFmax) return false; } - - // Rapidity Selection - TLorentzVector lorentzVect; - lorentzVect.SetXYZM(v0.px(), v0.py(), v0.pz(), 0.497614); - if (lorentzVect.Rapidity() < yMin || lorentzVect.Rapidity() > yMax) - return false; return true; } @@ -559,12 +533,6 @@ struct strangeness_in_jets { if (btrack.tofNSigmaPi() < nsigmaTOFmin || btrack.tofNSigmaPi() > nsigmaTOFmax) return false; } - - // Rapidity Selection - TLorentzVector lorentzVect; - lorentzVect.SetXYZM(casc.px(), casc.py(), casc.pz(), 1.32171); - if (lorentzVect.Rapidity() < yMin || lorentzVect.Rapidity() > yMax) - return false; return true; } @@ -664,12 +632,6 @@ struct strangeness_in_jets { if (btrack.tofNSigmaKa() < nsigmaTOFmin || btrack.tofNSigmaKa() > nsigmaTOFmax) return false; } - - // Rapidity Selection - TLorentzVector lorentzVect; - lorentzVect.SetXYZM(casc.px(), casc.py(), casc.pz(), 1.6724); - if (lorentzVect.Rapidity() < yMin || lorentzVect.Rapidity() > yMax) - return false; return true; } @@ -700,9 +662,9 @@ struct strangeness_in_jets { template bool isHighPurityPion(const pionTrack& track) { - if (track.p() < 0.6 && abs(track.tpcNSigmaPi()) < 3.0) + if (track.p() < 0.6 && TMath::Abs(track.tpcNSigmaPi()) < 3.0) return true; - if (track.p() > 0.6 && abs(track.tpcNSigmaPi()) < 3.0 && abs(track.tofNSigmaPi()) < 3.0) + if (track.p() > 0.6 && TMath::Abs(track.tpcNSigmaPi()) < 3.0 && TMath::Abs(track.tofNSigmaPi()) < 3.0) return true; return false; } @@ -714,14 +676,12 @@ struct strangeness_in_jets { x_min = x1; if (x1 >= x2) x_min = x2; - return x_min; } double GetDeltaPhi(double a1, double a2) { double delta_phi(0); - double phi1 = TVector2::Phi_0_2pi(a1); double phi2 = TVector2::Phi_0_2pi(a2); double diff = TMath::Abs(phi1 - phi2); @@ -783,364 +743,501 @@ struct strangeness_in_jets { return; } - void processData(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s, aod::CascDataExt const& Cascades, FullTracks const& tracks) + double calculate_dij(TVector3 t1, TVector3 t2, double R) { + double distance_jet(0); + double x1 = 1.0 / (t1.Pt() * t1.Pt()); + double x2 = 1.0 / (t2.Pt() * t2.Pt()); + double deltaEta = t1.Eta() - t2.Eta(); + double deltaPhi = GetDeltaPhi(t1.Phi(), t2.Phi()); + double min = Minimum(x1, x2); + double Delta2 = deltaEta * deltaEta + deltaPhi * deltaPhi; + distance_jet = min * Delta2 / (R * R); + return distance_jet; + } + + bool overlap(TVector3 v1, TVector3 v2, double R) + { + double dx = v1.Eta() - v2.Eta(); + double dy = GetDeltaPhi(v1.Phi(), v2.Phi()); + double d = sqrt(dx * dx + dy * dy); + if (d < 2.0 * R) + return true; + return false; + } + + void processData(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s, aod::CascDataExt const& Cascades, StrHadronDaughterTracks const& tracks) + { + + // Event Counter: before event selection registryData.fill(HIST("number_of_events_data"), 0.5); + + // Event Selection if (!collision.sel8()) return; + // Event Counter: after event selection sel8 registryData.fill(HIST("number_of_events_data"), 1.5); - if (abs(collision.posZ()) > zVtx) + + // Cut on z-vertex + if (TMath::Abs(collision.posZ()) > zVtx) return; + // Event Counter: after z-vertex cut registryData.fill(HIST("number_of_events_data"), 2.5); - // Find Leading Particle - std::vector particle_ID; - std::vector particle_ID_copy; - int leading_ID(0); - float ptMax(0); + // List of Tracks + std::vector trk; - // Track Index - int i = -1; for (auto track : tracks) { - i++; - if (!passedTrackSelectionForJets(track)) + if (!passedTrackSelectionForJetReconstruction(track)) continue; - if (track.pt() > ptMax) { - leading_ID = i; - ptMax = track.pt(); - } - particle_ID.push_back(i); - particle_ID_copy.push_back(i); + TVector3 momentum(track.px(), track.py(), track.pz()); + trk.push_back(momentum); } - // Reject events with ptLeading lower than threshold - if (ptMax < ptLeadingMin) - return; - registryData.fill(HIST("number_of_events_data"), 3.5); - - // Momentum of the Leading Particle - auto const& leading_track = tracks.iteratorAt(leading_ID); - TVector3 p_jet(leading_track.px(), leading_track.py(), leading_track.pz()); - - // Jet Finder - int exit(0); - int nPartAssociated(0); - int nParticles = static_cast(particle_ID.size()); - std::vector jet_particle_ID; - jet_particle_ID.push_back(leading_ID); + // Anti-kt Jet Finder + int n_particles_removed(0); + std::vector jet; + std::vector ue1; + std::vector ue2; do { - // Initialization - float distance_jet_min(1e+08); - float distance_bkg_min(1e+08); - int label_jet_particle(0); - int i_jet_particle(0); - - for (int i = 0; i < nParticles; i++) { - - // Skip Leading Particle & Elements already associated to the Jet - if (particle_ID[i] == leading_ID || particle_ID[i] == -1) + double dij_min(1e+06), diB_min(1e+06); + int i_min(0), j_min(0), iB_min(0); + for (int i = 0; i < static_cast(trk.size()); i++) { + if (trk[i].Mag() == 0) continue; - - // Get Particle Momentum - auto stored_track = tracks.iteratorAt(particle_ID[i]); - TVector3 p_particle(stored_track.px(), stored_track.py(), stored_track.pz()); - - // Variables - double one_over_pt2_part = 1.0 / (p_particle.Pt() * p_particle.Pt()); - double one_over_pt2_lead = 1.0 / (p_jet.Pt() * p_jet.Pt()); - double deltaEta = p_particle.Eta() - p_jet.Eta(); - double deltaPhi = GetDeltaPhi(p_particle.Phi(), p_jet.Phi()); - double min = Minimum(one_over_pt2_part, one_over_pt2_lead); - double Delta2 = deltaEta * deltaEta + deltaPhi * deltaPhi; - - // Distances - float distance_jet = min * Delta2 / (Rjet * Rjet); - float distance_bkg = one_over_pt2_part; - - // Find Minimum Distance Jet - if (distance_jet < distance_jet_min) { - distance_jet_min = distance_jet; - label_jet_particle = particle_ID[i]; - i_jet_particle = i; + double diB = 1.0 / (trk[i].Pt() * trk[i].Pt()); + if (diB < diB_min) { + diB_min = diB; + iB_min = i; } - - // Find Minimum Distance Bkg - if (distance_bkg < distance_bkg_min) { - distance_bkg_min = distance_bkg; + for (int j = (i + 1); j < static_cast(trk.size()); j++) { + if (trk[j].Mag() == 0) + continue; + double dij = calculate_dij(trk[i], trk[j], Rjet); + if (dij < dij_min) { + dij_min = dij; + i_min = i; + j_min = j; + } } } + if (dij_min < diB_min) { + trk[i_min] = trk[i_min] + trk[j_min]; + trk[j_min].SetXYZ(0, 0, 0); + n_particles_removed++; + } + if (dij_min > diB_min) { + jet.push_back(trk[iB_min]); + trk[iB_min].SetXYZ(0, 0, 0); + n_particles_removed++; + } + } while (n_particles_removed < static_cast(trk.size())); + registryQC.fill(HIST("nJets_found"), static_cast(jet.size())); - if (distance_jet_min <= distance_bkg_min) { + // Jet Selection + std::vector isSelected; + for (int i = 0; i < static_cast(jet.size()); i++) { + isSelected.push_back(0); + } - // Add Particle to Jet - jet_particle_ID.push_back(label_jet_particle); + int n_jets_selected(0); + for (int i = 0; i < static_cast(jet.size()); i++) { - // Update Momentum of Leading Particle - auto jet_track = tracks.iteratorAt(label_jet_particle); - TVector3 p_i(jet_track.px(), jet_track.py(), jet_track.pz()); - p_jet = p_jet + p_i; + if ((TMath::Abs(jet[i].Eta()) + Rjet) > etaMax) + continue; - // Remove Element - particle_ID[i_jet_particle] = -1; - nPartAssociated++; - } + // Perpendicular cones + TVector3 ue_axis1(0, 0, 0); + TVector3 ue_axis2(0, 0, 0); + get_perpendicular_axis(jet[i], ue_axis1, +1); + get_perpendicular_axis(jet[i], ue_axis2, -1); + ue1.push_back(ue_axis1); + ue2.push_back(ue_axis2); + + double nPartJetPlusUE(0); + double nPartJet(0); + double nPartUE(0); + double ptJetPlusUE(0); + double ptJet(0); + double ptUE(0); - if (nPartAssociated >= (nParticles - 1)) - exit = 1; - if (distance_jet_min > distance_bkg_min) - exit = 2; + for (auto track : tracks) { - } while (exit == 0); + if (!passedTrackSelectionForJetReconstruction(track)) + continue; + TVector3 sel_track(track.px(), track.py(), track.pz()); + + double deltaEta_jet = sel_track.Eta() - jet[i].Eta(); + double deltaPhi_jet = GetDeltaPhi(sel_track.Phi(), jet[i].Phi()); + double deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); + double deltaEta_ue1 = sel_track.Eta() - ue_axis1.Eta(); + double deltaPhi_ue1 = GetDeltaPhi(sel_track.Phi(), ue_axis1.Phi()); + double deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); + double deltaEta_ue2 = sel_track.Eta() - ue_axis2.Eta(); + double deltaPhi_ue2 = GetDeltaPhi(sel_track.Phi(), ue_axis2.Phi()); + double deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + + if (deltaR_jet < Rjet) { + registryQC.fill(HIST("deltaEtadeltaPhi_jet"), deltaEta_jet, deltaPhi_jet); + nPartJetPlusUE++; + ptJetPlusUE = ptJetPlusUE + sel_track.Pt(); + } + if (deltaR_ue1 < Rjet) { + registryQC.fill(HIST("deltaEtadeltaPhi_ue"), deltaEta_ue1, deltaPhi_ue1); + nPartUE++; + ptUE = ptUE + sel_track.Pt(); + } + if (deltaR_ue2 < Rjet) { + registryQC.fill(HIST("deltaEtadeltaPhi_ue"), deltaEta_ue1, deltaPhi_ue1); + nPartUE++; + ptUE = ptUE + sel_track.Pt(); + } + } + nPartJet = nPartJetPlusUE - 0.5 * nPartUE; + ptJet = ptJetPlusUE - 0.5 * ptUE; + registryQC.fill(HIST("NchJetPlusUE"), nPartJetPlusUE); + registryQC.fill(HIST("NchJet"), nPartJet); + registryQC.fill(HIST("NchUE"), nPartUE); + registryQC.fill(HIST("sumPtJetPlusUE"), ptJetPlusUE); + registryQC.fill(HIST("sumPtJet"), ptJet); + registryQC.fill(HIST("sumPtUE"), ptUE); + + if (ptJet < min_jet_pt) + continue; + if (nPartJetPlusUE < min_nPartInJet) + continue; + n_jets_selected++; + isSelected[i] = 1; + } + registryQC.fill(HIST("nJets_selected"), n_jets_selected); - // Cut events with jet not fully inside acceptance - if ((abs(p_jet.Eta()) + Rmax) > etaMax) + if (n_jets_selected == 0) return; - registryData.fill(HIST("number_of_events_data"), 4.5); - - // Perpendicular Cones for UE - TVector3 ue_axis1(0.0, 0.0, 0.0); - TVector3 ue_axis2(0.0, 0.0, 0.0); - get_perpendicular_axis(p_jet, ue_axis1, +1.0); - get_perpendicular_axis(p_jet, ue_axis2, -1.0); + registryData.fill(HIST("number_of_events_data"), 3.5); - // Protection against delta<0 - if (ue_axis1.X() == 0 && ue_axis1.Y() == 0 && ue_axis1.Z() == 0) - return; - if (ue_axis2.X() == 0 && ue_axis2.Y() == 0 && ue_axis2.Z() == 0) - return; - registryData.fill(HIST("number_of_events_data"), 5.5); + // Overlaps + int nOverlaps(0); + for (int i = 0; i < static_cast(jet.size()); i++) { + if (isSelected[i] == 0) + continue; - // Loop over particles - double nChJetPlusUE(0); - double ptJetPlusUE(0); - double ptUE(0); - double ptJet(0); - - for (int i = 0; i < nParticles; i++) { - - auto track = tracks.iteratorAt(particle_ID_copy[i]); - TVector3 particle_dir(track.px(), track.py(), track.pz()); - double deltaEta_jet = particle_dir.Eta() - p_jet.Eta(); - double deltaPhi_jet = GetDeltaPhi(particle_dir.Phi(), p_jet.Phi()); - double deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); - double deltaEta_ue1 = particle_dir.Eta() - ue_axis1.Eta(); - double deltaPhi_ue1 = GetDeltaPhi(particle_dir.Phi(), ue_axis1.Phi()); - double deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); - double deltaEta_ue2 = particle_dir.Eta() - ue_axis2.Eta(); - double deltaPhi_ue2 = GetDeltaPhi(particle_dir.Phi(), ue_axis2.Phi()); - double deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); - - if (deltaR_jet < Rmax) { - nChJetPlusUE++; - ptJetPlusUE = ptJetPlusUE + track.pt(); - } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - ptUE = ptUE + track.pt(); + for (int j = 0; j < static_cast(jet.size()); j++) { + if (isSelected[j] == 0 || i == j) + continue; + if (overlap(jet[i], ue1[j], Rjet) || overlap(jet[i], ue2[j], Rjet)) + nOverlaps++; } } - ptJet = ptJetPlusUE - 0.5 * ptUE; + registryQC.fill(HIST("jet_ue_overlaps"), n_jets_selected, nOverlaps); - // Event Counter: Skip Events with n. particles in jet less than given value - if (nChJetPlusUE < nPartInJetMin) + if (n_jets_selected > n_jets_per_event_max) return; - registryData.fill(HIST("number_of_events_data"), 6.5); + registryData.fill(HIST("number_of_events_data"), 4.5); - // Event Counter: Skip Events with Jet Pt lower than threshold - if (ptJet < ptJetMin) + if (requireNoOverlap && nOverlaps > 0) return; - registryData.fill(HIST("number_of_events_data"), 7.5); + registryData.fill(HIST("number_of_events_data"), 5.5); // Event multiplicity float multiplicity = collision.centFT0M(); - // Vzeros - if (particle_of_interest == option::vzeros) { - for (auto& v0 : fullV0s) { + registryData.fill(HIST("number_of_events_vsmultiplicity"), multiplicity); - const auto& pos = v0.posTrack_as(); - const auto& neg = v0.negTrack_as(); - TVector3 v0dir(v0.px(), v0.py(), v0.pz()); + for (int i = 0; i < static_cast(jet.size()); i++) { - float deltaEta_jet = v0dir.Eta() - p_jet.Eta(); - float deltaPhi_jet = GetDeltaPhi(v0dir.Phi(), p_jet.Phi()); - float deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); - float deltaEta_ue1 = v0dir.Eta() - ue_axis1.Eta(); - float deltaPhi_ue1 = GetDeltaPhi(v0dir.Phi(), ue_axis1.Phi()); - float deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); - float deltaEta_ue2 = v0dir.Eta() - ue_axis2.Eta(); - float deltaPhi_ue2 = GetDeltaPhi(v0dir.Phi(), ue_axis2.Phi()); - float deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + if (isSelected[i] == 0) + continue; - // K0s - if (passedK0ShortSelection(v0, pos, neg)) { - if (deltaR_jet < Rmax) { - registryData.fill(HIST("K0s_in_jet"), multiplicity, v0.pt(), v0.mK0Short()); + // Vzeros + if (particle_of_interest == option::vzeros) { + for (auto& v0 : fullV0s) { + + const auto& pos = v0.posTrack_as(); + const auto& neg = v0.negTrack_as(); + TVector3 v0dir(v0.px(), v0.py(), v0.pz()); + + float deltaEta_jet = v0dir.Eta() - jet[i].Eta(); + float deltaPhi_jet = GetDeltaPhi(v0dir.Phi(), jet[i].Phi()); + float deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); + float deltaEta_ue1 = v0dir.Eta() - ue1[i].Eta(); + float deltaPhi_ue1 = GetDeltaPhi(v0dir.Phi(), ue1[i].Phi()); + float deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); + float deltaEta_ue2 = v0dir.Eta() - ue2[i].Eta(); + float deltaPhi_ue2 = GetDeltaPhi(v0dir.Phi(), ue2[i].Phi()); + float deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + + // K0s + if (passedK0ShortSelection(v0, pos, neg)) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("K0s_in_jet"), multiplicity, v0.pt(), v0.mK0Short()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("K0s_in_ue"), multiplicity, v0.pt(), v0.mK0Short()); + } } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - registryData.fill(HIST("K0s_in_ue"), multiplicity, v0.pt(), v0.mK0Short()); + // Lambda + if (passedLambdaSelection(v0, pos, neg)) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("Lambda_in_jet"), multiplicity, v0.pt(), v0.mLambda()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("Lambda_in_ue"), multiplicity, v0.pt(), v0.mLambda()); + } + } + // AntiLambda + if (passedAntiLambdaSelection(v0, pos, neg)) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("AntiLambda_in_jet"), multiplicity, v0.pt(), v0.mAntiLambda()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("AntiLambda_in_ue"), multiplicity, v0.pt(), v0.mAntiLambda()); + } } } - // Lambda - if (passedLambdaSelection(v0, pos, neg)) { - if (deltaR_jet < Rmax) { - registryData.fill(HIST("Lambda_in_jet"), multiplicity, v0.pt(), v0.mLambda()); + } + + // Cascades + if (particle_of_interest == option::cascades) { + for (auto& casc : Cascades) { + + auto bach = casc.bachelor_as(); + auto pos = casc.posTrack_as(); + auto neg = casc.negTrack_as(); + + TVector3 cascade_dir(casc.px(), casc.py(), casc.pz()); + float deltaEta_jet = cascade_dir.Eta() - jet[i].Eta(); + float deltaPhi_jet = GetDeltaPhi(cascade_dir.Phi(), jet[i].Phi()); + float deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); + float deltaEta_ue1 = cascade_dir.Eta() - ue1[i].Eta(); + float deltaPhi_ue1 = GetDeltaPhi(cascade_dir.Phi(), ue1[i].Phi()); + float deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); + float deltaEta_ue2 = cascade_dir.Eta() - ue2[i].Eta(); + float deltaPhi_ue2 = GetDeltaPhi(cascade_dir.Phi(), ue2[i].Phi()); + float deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + + // Xi+ + if (passedXiSelection(casc, pos, neg, bach, collision) && + bach.sign() > 0) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("XiPos_in_jet"), multiplicity, casc.pt(), casc.mXi()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("XiPos_in_ue"), multiplicity, casc.pt(), casc.mXi()); + } } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - registryData.fill(HIST("Lambda_in_ue"), multiplicity, v0.pt(), v0.mLambda()); + // Xi- + if (passedXiSelection(casc, pos, neg, bach, collision) && + bach.sign() < 0) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("XiNeg_in_jet"), multiplicity, casc.pt(), casc.mXi()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("XiNeg_in_ue"), multiplicity, casc.pt(), casc.mXi()); + } } - } - // AntiLambda - if (passedAntiLambdaSelection(v0, pos, neg)) { - if (deltaR_jet < Rmax) { - registryData.fill(HIST("AntiLambda_in_jet"), multiplicity, v0.pt(), v0.mAntiLambda()); + // Omega+ + if (passedOmegaSelection(casc, pos, neg, bach, collision) && + bach.sign() > 0) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("OmegaPos_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("OmegaPos_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + } } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - registryData.fill(HIST("AntiLambda_in_ue"), multiplicity, v0.pt(), v0.mAntiLambda()); + // Omega- + if (passedOmegaSelection(casc, pos, neg, bach, collision) && + bach.sign() < 0) { + if (deltaR_jet < Rjet) { + registryData.fill(HIST("OmegaNeg_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryData.fill(HIST("OmegaNeg_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + } } } } - } - // Cascades - if (particle_of_interest == option::cascades) { - for (auto& casc : Cascades) { - - auto bach = casc.bachelor_as(); - auto pos = casc.posTrack_as(); - auto neg = casc.negTrack_as(); - - TVector3 cascade_dir(casc.px(), casc.py(), casc.pz()); - float deltaEta_jet = cascade_dir.Eta() - p_jet.Eta(); - float deltaPhi_jet = GetDeltaPhi(cascade_dir.Phi(), p_jet.Phi()); - float deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); - float deltaEta_ue1 = cascade_dir.Eta() - ue_axis1.Eta(); - float deltaPhi_ue1 = GetDeltaPhi(cascade_dir.Phi(), ue_axis1.Phi()); - float deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); - float deltaEta_ue2 = cascade_dir.Eta() - ue_axis2.Eta(); - float deltaPhi_ue2 = GetDeltaPhi(cascade_dir.Phi(), ue_axis2.Phi()); - float deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + // Pions + if (particle_of_interest == option::pions) { + for (auto track : tracks) { - // Xi+ - if (passedXiSelection(casc, pos, neg, bach, collision) && bach.sign() > 0) { - if (deltaR_jet < Rmax) { - registryData.fill(HIST("XiPos_in_jet"), multiplicity, casc.pt(), casc.mXi()); + if (!passedTrackSelectionForPions(track)) + continue; + + TVector3 track_dir(track.px(), track.py(), track.pz()); + float deltaEta_jet = track_dir.Eta() - jet[i].Eta(); + float deltaPhi_jet = GetDeltaPhi(track_dir.Phi(), jet[i].Phi()); + float deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); + float deltaEta_ue1 = track_dir.Eta() - ue1[i].Eta(); + float deltaPhi_ue1 = GetDeltaPhi(track_dir.Phi(), ue1[i].Phi()); + float deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); + float deltaEta_ue2 = track_dir.Eta() - ue2[i].Eta(); + float deltaPhi_ue2 = GetDeltaPhi(track_dir.Phi(), ue2[i].Phi()); + float deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + + bool isInJet = false; + bool isInUe = false; + if (deltaR_jet < Rjet) + isInJet = true; + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) + isInUe = true; + + if (isHighPurityPion(track) && track.sign() > 0) { + if (isInJet) + registryData.fill(HIST("piplus_dcaxy_in_jet"), multiplicity, track.pt(), track.dcaXY()); + if (isInUe) + registryData.fill(HIST("piplus_dcaxy_in_ue"), multiplicity, track.pt(), track.dcaXY()); } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - registryData.fill(HIST("XiPos_in_ue"), multiplicity, casc.pt(), casc.mXi()); + if (isHighPurityPion(track) && track.sign() < 0) { + if (isInJet) + registryData.fill(HIST("piminus_dcaxy_in_jet"), multiplicity, track.pt(), track.dcaXY()); + if (isInUe) + registryData.fill(HIST("piminus_dcaxy_in_ue"), multiplicity, track.pt(), track.dcaXY()); } - } - // Xi- - if (passedXiSelection(casc, pos, neg, bach, collision) && bach.sign() < 0) { - if (deltaR_jet < Rmax) { - registryData.fill(HIST("XiNeg_in_jet"), multiplicity, casc.pt(), casc.mXi()); + + // DCAxy Selection + if (TMath::Abs(track.dcaXY()) > dcaxyMax) + continue; + + // TPC + if (isInJet && track.sign() > 0) { + registryData.fill(HIST("piplus_tpc_in_jet"), multiplicity, track.pt(), track.tpcNSigmaPi()); } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - registryData.fill(HIST("XiNeg_in_ue"), multiplicity, casc.pt(), casc.mXi()); + if (isInUe && track.sign() > 0) { + registryData.fill(HIST("piplus_tpc_in_ue"), multiplicity, track.pt(), track.tpcNSigmaPi()); } - } - // Omega+ - if (passedOmegaSelection(casc, pos, neg, bach, collision) && bach.sign() > 0) { - if (deltaR_jet < Rmax) { - registryData.fill(HIST("OmegaPos_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + if (isInJet && track.sign() < 0) { + registryData.fill(HIST("piminus_tpc_in_jet"), multiplicity, track.pt(), track.tpcNSigmaPi()); } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - registryData.fill(HIST("OmegaPos_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + if (isInUe && track.sign() < 0) { + registryData.fill(HIST("piminus_tpc_in_ue"), multiplicity, track.pt(), track.tpcNSigmaPi()); } - } - // Omega- - if (passedOmegaSelection(casc, pos, neg, bach, collision) && bach.sign() < 0) { - if (deltaR_jet < Rmax) { - registryData.fill(HIST("OmegaNeg_in_jet"), multiplicity, casc.pt(), casc.mOmega()); + if (track.tpcNSigmaPi() < nsigmaTPCmin || track.tpcNSigmaPi() > nsigmaTPCmax) + continue; + if (!track.hasTOF()) + continue; + + // TOF + if (isInJet && track.sign() > 0) { + registryData.fill(HIST("piplus_tof_in_jet"), multiplicity, track.pt(), track.tofNSigmaPi()); } - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) { - registryData.fill(HIST("OmegaNeg_in_ue"), multiplicity, casc.pt(), casc.mOmega()); + if (isInUe && track.sign() > 0) { + registryData.fill(HIST("piplus_tof_in_ue"), multiplicity, track.pt(), track.tofNSigmaPi()); + } + if (isInJet && track.sign() < 0) { + registryData.fill(HIST("piminus_tof_in_jet"), multiplicity, track.pt(), track.tofNSigmaPi()); + } + if (isInUe && track.sign() < 0) { + registryData.fill(HIST("piminus_tof_in_ue"), multiplicity, track.pt(), track.tofNSigmaPi()); } } } } + } + PROCESS_SWITCH(strangeness_in_jets, processData, "Process data", true); - // Pions - if (particle_of_interest == option::pions) { - for (auto track : tracks) { + void processK0s(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s, StrHadronDaughterTracks const&) + { + registryData.fill(HIST("number_of_events_data"), 10.5); + if (!collision.sel8()) + return; + registryData.fill(HIST("number_of_events_data"), 11.5); + if (TMath::Abs(collision.posZ()) > zVtx) + return; + registryData.fill(HIST("number_of_events_data"), 12.5); - if (!passedTrackSelectionForPions(track)) - continue; + for (auto& v0 : fullV0s) { + const auto& ptrack = v0.posTrack_as(); + const auto& ntrack = v0.negTrack_as(); - TVector3 track_dir(track.px(), track.py(), track.pz()); - float deltaEta_jet = track_dir.Eta() - p_jet.Eta(); - float deltaPhi_jet = GetDeltaPhi(track_dir.Phi(), p_jet.Phi()); - float deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); - float deltaEta_ue1 = track_dir.Eta() - ue_axis1.Eta(); - float deltaPhi_ue1 = GetDeltaPhi(track_dir.Phi(), ue_axis1.Phi()); - float deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); - float deltaEta_ue2 = track_dir.Eta() - ue_axis2.Eta(); - float deltaPhi_ue2 = GetDeltaPhi(track_dir.Phi(), ue_axis2.Phi()); - float deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); - - bool isInJet = false; - bool isInUe = false; - if (deltaR_jet < Rmax) - isInJet = true; - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) - isInUe = true; - - if (isHighPurityPion(track) && track.sign() > 0) { - if (isInJet) - registryData.fill(HIST("piplus_dcaxy_in_jet"), multiplicity, track.pt(), track.dcaXY()); - if (isInUe) - registryData.fill(HIST("piplus_dcaxy_in_ue"), multiplicity, track.pt(), track.dcaXY()); - } - if (isHighPurityPion(track) && track.sign() < 0) { - if (isInJet) - registryData.fill(HIST("piminus_dcaxy_in_jet"), multiplicity, track.pt(), track.dcaXY()); - if (isInUe) - registryData.fill(HIST("piminus_dcaxy_in_ue"), multiplicity, track.pt(), track.dcaXY()); - } + registryQC.fill(HIST("survivedK0"), 0.5); - // DCAxy Selection - if (TMath::Abs(track.dcaXY()) > dcaxyMax) - continue; + // Single-Track Selections + if (!passedSingleTrackSelection(ptrack)) + continue; + registryQC.fill(HIST("survivedK0"), 1.5); - // TPC - if (isInJet && track.sign() > 0) { - registryData.fill(HIST("piplus_tpc_in_jet"), multiplicity, track.pt(), track.tpcNSigmaPi()); - } - if (isInUe && track.sign() > 0) { - registryData.fill(HIST("piplus_tpc_in_ue"), multiplicity, track.pt(), track.tpcNSigmaPi()); - } - if (isInJet && track.sign() < 0) { - registryData.fill(HIST("piminus_tpc_in_jet"), multiplicity, track.pt(), track.tpcNSigmaPi()); - } - if (isInUe && track.sign() < 0) { - registryData.fill(HIST("piminus_tpc_in_ue"), multiplicity, track.pt(), track.tpcNSigmaPi()); - } - if (track.tpcNSigmaPi() < nsigmaTPCmin || track.tpcNSigmaPi() > nsigmaTPCmax) - continue; - if (!track.hasTOF()) + if (!passedSingleTrackSelection(ntrack)) + continue; + registryQC.fill(HIST("survivedK0"), 2.5); + + // Momentum K0s Daughters + TVector3 pion_pos(v0.pxpos(), v0.pypos(), v0.pzpos()); + TVector3 pion_neg(v0.pxneg(), v0.pyneg(), v0.pzneg()); + + if (pion_pos.Pt() < ptMin_K0_pion) + continue; + registryQC.fill(HIST("survivedK0"), 3.5); + + if (pion_pos.Pt() > ptMax_K0_pion) + continue; + registryQC.fill(HIST("survivedK0"), 4.5); + + if (pion_neg.Pt() < ptMin_K0_pion) + continue; + registryQC.fill(HIST("survivedK0"), 5.5); + + if (pion_neg.Pt() > ptMax_K0_pion) + continue; + registryQC.fill(HIST("survivedK0"), 6.5); + + // V0 Selections + if (v0.v0cosPA() < v0cospaMin) + continue; + registryQC.fill(HIST("survivedK0"), 7.5); + + if (v0.v0radius() < minimumV0Radius || v0.v0radius() > maximumV0Radius) + continue; + registryQC.fill(HIST("survivedK0"), 8.5); + + if (v0.dcaV0daughters() > dcaV0DaughtersMax) + continue; + registryQC.fill(HIST("survivedK0"), 9.5); + + if (TMath::Abs(v0.dcapostopv()) < dcapostoPVmin) + continue; + registryQC.fill(HIST("survivedK0"), 10.5); + + if (TMath::Abs(v0.dcanegtopv()) < dcanegtoPVmin) + continue; + registryQC.fill(HIST("survivedK0"), 11.5); + + // PID Selections (TPC) + if (ptrack.tpcNSigmaPi() < nsigmaTPCmin || ptrack.tpcNSigmaPi() > nsigmaTPCmax) + continue; + registryQC.fill(HIST("survivedK0"), 12.5); + + if (ntrack.tpcNSigmaPi() < nsigmaTPCmin || ntrack.tpcNSigmaPi() > nsigmaTPCmax) + continue; + registryQC.fill(HIST("survivedK0"), 13.5); + + // PID Selections (TOF) + if (requireTOF) { + if (ptrack.tofNSigmaPi() < nsigmaTOFmin || ptrack.tofNSigmaPi() > nsigmaTOFmax) continue; + registryQC.fill(HIST("survivedK0"), 14.5); - // TOF - if (isInJet && track.sign() > 0) { - registryData.fill(HIST("piplus_tof_in_jet"), multiplicity, track.pt(), track.tofNSigmaPi()); - } - if (isInUe && track.sign() > 0) { - registryData.fill(HIST("piplus_tof_in_ue"), multiplicity, track.pt(), track.tofNSigmaPi()); - } - if (isInJet && track.sign() < 0) { - registryData.fill(HIST("piminus_tof_in_jet"), multiplicity, track.pt(), track.tofNSigmaPi()); - } - if (isInUe && track.sign() < 0) { - registryData.fill(HIST("piminus_tof_in_ue"), multiplicity, track.pt(), track.tofNSigmaPi()); - } + if (ntrack.tofNSigmaPi() < nsigmaTOFmin || ntrack.tofNSigmaPi() > nsigmaTOFmax) + continue; + registryQC.fill(HIST("survivedK0"), 15.5); } } + + for (auto& v0 : fullV0s) { + const auto& ptrack = v0.posTrack_as(); + const auto& ntrack = v0.negTrack_as(); + if (!passedK0ShortSelection(v0, ptrack, ntrack)) + continue; + registryQC.fill(HIST("survivedK0"), 16.5); + } } - PROCESS_SWITCH(strangeness_in_jets, processData, "Process data", true); + PROCESS_SWITCH(strangeness_in_jets, processK0s, "Process K0s", false); Preslice perCollisionV0 = o2::aod::v0data::collisionId; Preslice perCollisionCasc = o2::aod::cascade::collisionId; @@ -1155,7 +1252,7 @@ struct strangeness_in_jets { continue; registryMC.fill(HIST("number_of_events_mc"), 1.5); - if (abs(collision.posZ()) > 10.0) + if (TMath::Abs(collision.posZ()) > 10.0) continue; registryMC.fill(HIST("number_of_events_mc"), 2.5); @@ -1195,7 +1292,6 @@ struct strangeness_in_jets { if (pdg_parent == 0) continue; - // K0s if (passedK0ShortSelection(v0, pos, neg) && pdg_parent == 310) { registryMC.fill(HIST("K0s_reconstructed_incl"), multiplicity, v0.pt()); } @@ -1208,7 +1304,6 @@ struct strangeness_in_jets { if (!isPhysPrim) continue; - // K0s if (passedK0ShortSelection(v0, pos, neg) && pdg_parent == 310) { registryMC.fill(HIST("K0s_reconstructed"), multiplicity, v0.pt()); } @@ -1249,7 +1344,7 @@ struct strangeness_in_jets { for (auto& particleMotherOfBach : bachParticle.mothers_as()) { if (particleMotherOfNeg != particleMotherOfPos) continue; - if (abs(particleMotherOfNeg.pdgCode()) != 3122) + if (TMath::Abs(particleMotherOfNeg.pdgCode()) != 3122) continue; if (!particleMotherOfBach.isPhysicalPrimary()) continue; @@ -1289,7 +1384,7 @@ struct strangeness_in_jets { continue; const auto particle = track.mcParticle(); - if (abs(particle.pdgCode()) != 211) + if (TMath::Abs(particle.pdgCode()) != 211) continue; if (particle.isPhysicalPrimary()) { @@ -1298,7 +1393,6 @@ struct strangeness_in_jets { if (track.sign() < 0) registryMC.fill(HIST("piminus_dcaxy_prim"), multiplicity, track.pt(), track.dcaXY()); } - if (!particle.isPhysicalPrimary()) { if (track.sign() > 0) registryMC.fill(HIST("piplus_dcaxy_sec"), multiplicity, track.pt(), track.dcaXY()); @@ -1333,7 +1427,7 @@ struct strangeness_in_jets { for (auto& mcParticle : mcParticles_per_coll) { - if (mcParticle.y() < yMin || mcParticle.y() > yMax) + if (mcParticle.eta() < etaMin || mcParticle.eta() > etaMax) continue; if (!mcParticle.isPhysicalPrimary()) continue; @@ -1386,214 +1480,257 @@ struct strangeness_in_jets { } PROCESS_SWITCH(strangeness_in_jets, processMCefficiency, "Process MC Efficiency", false); - void processWeights(SimCollisions const& collisions, aod::McParticles const& mcParticles) + void processGen(o2::aod::McCollisions const& mcCollisions, aod::McParticles const& mcParticles) { - // Loop over MC Collisions - for (const auto& collision : collisions) { + for (const auto& mccollision : mcCollisions) { + + registryMC.fill(HIST("number_of_events_mc"), 3.5); // Selection on z_{vertex} - if (abs(collision.posZ()) > 10) + if (TMath::Abs(mccollision.posZ()) > 10) continue; + registryMC.fill(HIST("number_of_events_mc"), 4.5); // MC Particles per Collision - auto mcParticles_per_coll = mcParticles.sliceBy(perMCCollision, collision.globalIndex()); + auto mcParticles_per_coll = mcParticles.sliceBy(perMCCollision, mccollision.globalIndex()); - std::vector particle_ID; - int leading_ID(0); - float pt_max(0); - int i = -1; + // List of Tracks + std::vector trk; for (auto& particle : mcParticles_per_coll) { - // Particle Index - i++; + int pdg = TMath::Abs(particle.pdgCode()); + + if (particle.isPhysicalPrimary() && pdg == 211) { + registryMC.fill(HIST("Pion_eta_pt_pythia"), particle.pt(), particle.eta()); + } + if (particle.isPhysicalPrimary() && pdg == 310) { + registryMC.fill(HIST("K0s_eta_pt_pythia"), particle.pt(), particle.eta()); + } + if (particle.isPhysicalPrimary() && pdg == 3122) { + registryMC.fill(HIST("Lambda_eta_pt_pythia"), particle.pt(), particle.eta()); + } + if (particle.isPhysicalPrimary() && pdg == 3312) { + registryMC.fill(HIST("Xi_eta_pt_pythia"), particle.pt(), particle.eta()); + } + if (particle.isPhysicalPrimary() && pdg == 3334) { + registryMC.fill(HIST("Omega_eta_pt_pythia"), particle.pt(), particle.eta()); + } // Select Primary Particles - float deltaX = particle.vx() - collision.posX(); - float deltaY = particle.vy() - collision.posY(); - float deltaZ = particle.vz() - collision.posZ(); - float deltaR = sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ); - if (deltaR > 0.1) + double dx = particle.vx() - mccollision.posX(); + double dy = particle.vy() - mccollision.posY(); + double dz = particle.vz() - mccollision.posZ(); + double dcaxy = sqrt(dx * dx + dy * dy); + double dcaz = TMath::Abs(dz); + if (particle.pt() < 0.15) continue; - - // Pseudorapidity Selection - if (abs(particle.eta()) > 0.8) + if (dcaxy > (par0 + par1 / particle.pt())) continue; - - if (particle.pt() < 0.15) + if (dcaz > (par0 + par1 / particle.pt())) + continue; + if (TMath::Abs(particle.eta()) > 0.8) continue; // PDG Selection - int pdg = abs(particle.pdgCode()); if ((pdg != 11) && (pdg != 211) && (pdg != 321) && (pdg != 2212)) continue; - // Find pt Leading - if (particle.pt() > pt_max) { - leading_ID = i; - pt_max = particle.pt(); - } - - // Store Array Element - particle_ID.push_back(i); + TVector3 momentum(particle.px(), particle.py(), particle.pz()); + trk.push_back(momentum); } - // Skip Events with pt jet; + std::vector ue1; + std::vector ue2; - // Number of Stored Particles - int nParticles = static_cast(particle_ID.size()); - - // Momentum of the Leading Particle - auto const& leading_track = mcParticles_per_coll.iteratorAt(leading_ID); - TVector3 p_leading(leading_track.px(), leading_track.py(), leading_track.pz()); - registryQC.fill(HIST("deltaPt_leading"), pt_max - leading_track.pt()); - - // Labels - int exit(0); - int nPartAssociated(0); - - // Jet Finder do { - // Initialization - float distance_jet_min(1e+08); - float distance_bkg_min(1e+08); - int label_jet_particle(0); - int i_jet_particle(0); - - for (int i = 0; i < nParticles; i++) { - - // Skip Leading Particle & Elements already associated to the Jet - if (particle_ID[i] == leading_ID || particle_ID[i] == -1) + double dij_min(1e+06), diB_min(1e+06); + int i_min(0), j_min(0), iB_min(0); + for (int i = 0; i < static_cast(trk.size()); i++) { + if (trk[i].Mag() == 0) continue; - - // Get Particle Momentum - auto stored_track = mcParticles_per_coll.iteratorAt(particle_ID[i]); - TVector3 p_particle(stored_track.px(), stored_track.py(), stored_track.pz()); - - // Variables - float one_over_pt2_part = 1.0 / (p_particle.Pt() * p_particle.Pt()); - float one_over_pt2_lead = 1.0 / (p_leading.Pt() * p_leading.Pt()); - float deltaEta = p_particle.Eta() - p_leading.Eta(); - float deltaPhi = GetDeltaPhi(p_particle.Phi(), p_leading.Phi()); - float min = Minimum(one_over_pt2_part, one_over_pt2_lead); - float Delta2 = deltaEta * deltaEta + deltaPhi * deltaPhi; - - // Distances - float distance_jet = min * Delta2 / (Rjet * Rjet); - float distance_bkg = one_over_pt2_part; - - // Find Minimum Distance Jet - if (distance_jet < distance_jet_min) { - distance_jet_min = distance_jet; - label_jet_particle = particle_ID[i]; - i_jet_particle = i; + double diB = 1.0 / (trk[i].Pt() * trk[i].Pt()); + if (diB < diB_min) { + diB_min = diB; + iB_min = i; } - - // Find Minimum Distance Bkg - if (distance_bkg < distance_bkg_min) { - distance_bkg_min = distance_bkg; + for (int j = (i + 1); j < static_cast(trk.size()); j++) { + if (trk[j].Mag() == 0) + continue; + double dij = calculate_dij(trk[i], trk[j], Rjet); + if (dij < dij_min) { + dij_min = dij; + i_min = i; + j_min = j; + } } } - - if (distance_jet_min <= distance_bkg_min) { - - // Add Particle to Jet - // jet_particle_ID.push_back(label_jet_particle); - - // Update Momentum of Leading Particle - auto jet_track = mcParticles_per_coll.iteratorAt(label_jet_particle); - TVector3 p_i(jet_track.px(), jet_track.py(), jet_track.pz()); - p_leading = p_leading + p_i; - - // Remove Element - particle_ID[i_jet_particle] = -1; - nPartAssociated++; + if (dij_min < diB_min) { + trk[i_min] = trk[i_min] + trk[j_min]; + trk[j_min].SetXYZ(0, 0, 0); + n_particles_removed++; } + if (dij_min > diB_min) { + jet.push_back(trk[iB_min]); + trk[iB_min].SetXYZ(0, 0, 0); + n_particles_removed++; + } + } while (n_particles_removed < static_cast(trk.size())); - if (nPartAssociated >= (nParticles - 1)) - exit = 1; - if (distance_jet_min > distance_bkg_min) - exit = 2; - - } while (exit == 0); - - // Jet Axis - TVector3 p_jet(p_leading.X(), p_leading.Y(), p_leading.Z()); + // Jet Selection + std::vector isSelected; + for (int i = 0; i < static_cast(jet.size()); i++) { + isSelected.push_back(0); + } - if ((abs(p_jet.Eta()) + Rmax) > etaMax) - return; + int n_jets_selected(0); + for (int i = 0; i < static_cast(jet.size()); i++) { - // Perpendicular Cones for UE - TVector3 ue_axis1(0.0, 0.0, 0.0); - TVector3 ue_axis2(0.0, 0.0, 0.0); - get_perpendicular_axis(p_jet, ue_axis1, +1.0); - get_perpendicular_axis(p_jet, ue_axis2, -1.0); + if ((TMath::Abs(jet[i].Eta()) + Rjet) > etaMax) + continue; - // Protection against delta<0 - if (ue_axis1.X() == 0 && ue_axis1.Y() == 0 && ue_axis1.Z() == 0) - return; - if (ue_axis2.X() == 0 && ue_axis2.Y() == 0 && ue_axis2.Z() == 0) - return; + // Perpendicular cones + TVector3 ue_axis1(0, 0, 0); + TVector3 ue_axis2(0, 0, 0); + get_perpendicular_axis(jet[i], ue_axis1, +1); + get_perpendicular_axis(jet[i], ue_axis2, -1); + ue1.push_back(ue_axis1); + ue2.push_back(ue_axis2); + + double nPartJetPlusUE(0); + double ptJetPlusUE(0); + double ptJet(0); + double ptUE(0); + + for (auto& particle : mcParticles_per_coll) { + + // Select Primary Particles + double dx = particle.vx() - mccollision.posX(); + double dy = particle.vy() - mccollision.posY(); + double dz = particle.vz() - mccollision.posZ(); + double dcaxy = sqrt(dx * dx + dy * dy); + double dcaz = TMath::Abs(dz); + if (particle.pt() < 0.15) + continue; + if (dcaxy > (par0 + par1 / particle.pt())) + continue; + if (dcaz > (par0 + par1 / particle.pt())) + continue; + if (TMath::Abs(particle.eta()) > 0.8) + continue; - // Generated Particles - for (auto& particle : mcParticles_per_coll) { + // PDG Selection + int pdg = TMath::Abs(particle.pdgCode()); + if ((pdg != 11) && (pdg != 211) && (pdg != 321) && (pdg != 2212)) + continue; - // PDG Selection - int pdg = particle.pdgCode(); + TVector3 sel_track(particle.px(), particle.py(), particle.pz()); + + double deltaEta_jet = sel_track.Eta() - jet[i].Eta(); + double deltaPhi_jet = GetDeltaPhi(sel_track.Phi(), jet[i].Phi()); + double deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); + double deltaEta_ue1 = sel_track.Eta() - ue_axis1.Eta(); + double deltaPhi_ue1 = GetDeltaPhi(sel_track.Phi(), ue_axis1.Phi()); + double deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); + double deltaEta_ue2 = sel_track.Eta() - ue_axis2.Eta(); + double deltaPhi_ue2 = GetDeltaPhi(sel_track.Phi(), ue_axis2.Phi()); + double deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + + if (deltaR_jet < Rjet) { + nPartJetPlusUE++; + ptJetPlusUE = ptJetPlusUE + sel_track.Pt(); + } + if (deltaR_ue1 < Rjet) { + ptUE = ptUE + sel_track.Pt(); + } + if (deltaR_ue2 < Rjet) { + ptUE = ptUE + sel_track.Pt(); + } + } + ptJet = ptJetPlusUE - 0.5 * ptUE; - if (!particle.isPhysicalPrimary()) + if (ptJet < min_jet_pt) continue; - if (particle.y() < yMin || particle.y() > yMax) + if (nPartJetPlusUE < min_nPartInJet) continue; + n_jets_selected++; + isSelected[i] = 1; + } + if (n_jets_selected == 0) + continue; - TVector3 p_particle(particle.px(), particle.py(), particle.pz()); - float deltaEta_jet = p_particle.Eta() - p_jet.Eta(); - float deltaPhi_jet = GetDeltaPhi(p_particle.Phi(), p_jet.Phi()); - float deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); - float deltaEta_ue1 = p_particle.Eta() - ue_axis1.Eta(); - float deltaPhi_ue1 = GetDeltaPhi(p_particle.Phi(), ue_axis1.Phi()); - float deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); - float deltaEta_ue2 = p_particle.Eta() - ue_axis2.Eta(); - float deltaPhi_ue2 = GetDeltaPhi(p_particle.Phi(), ue_axis2.Phi()); - float deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); - - // Fill K0s - if (abs(pdg) == 310) { - if (deltaR_jet < Rmax) - registryMC.fill(HIST("K0s_eta_pt_jet"), particle.pt(), particle.eta()); - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) - registryMC.fill(HIST("K0s_eta_pt_ue"), particle.pt(), particle.eta()); - } + for (int i = 0; i < static_cast(jet.size()); i++) { - // Fill Lambda - if (abs(pdg) == 3122) { - if (deltaR_jet < Rmax) - registryMC.fill(HIST("Lambda_eta_pt_jet"), particle.pt(), particle.eta()); - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) - registryMC.fill(HIST("Lambda_eta_pt_ue"), particle.pt(), particle.eta()); - } + if (isSelected[i] == 0) + continue; - // Fill Xi - if (abs(pdg) == 3312) { - if (deltaR_jet < Rmax) - registryMC.fill(HIST("Xi_eta_pt_jet"), particle.pt(), particle.eta()); - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) - registryMC.fill(HIST("Xi_eta_pt_ue"), particle.pt(), particle.eta()); - } + // Generated Particles + for (auto& particle : mcParticles_per_coll) { + + if (!particle.isPhysicalPrimary()) + continue; - // Fill Omega - if (abs(pdg) == 3334) { - if (deltaR_jet < Rmax) - registryMC.fill(HIST("Omega_eta_pt_jet"), particle.pt(), particle.eta()); - if (deltaR_ue1 < Rmax || deltaR_ue2 < Rmax) - registryMC.fill(HIST("Omega_eta_pt_ue"), particle.pt(), particle.eta()); + TVector3 particle_dir(particle.px(), particle.py(), particle.pz()); + double deltaEta_jet = particle_dir.Eta() - jet[i].Eta(); + double deltaPhi_jet = GetDeltaPhi(particle_dir.Phi(), jet[i].Phi()); + double deltaR_jet = sqrt(deltaEta_jet * deltaEta_jet + deltaPhi_jet * deltaPhi_jet); + double deltaEta_ue1 = particle_dir.Eta() - ue1[i].Eta(); + double deltaPhi_ue1 = GetDeltaPhi(particle_dir.Phi(), ue1[i].Phi()); + double deltaR_ue1 = sqrt(deltaEta_ue1 * deltaEta_ue1 + deltaPhi_ue1 * deltaPhi_ue1); + double deltaEta_ue2 = particle_dir.Eta() - ue2[i].Eta(); + double deltaPhi_ue2 = GetDeltaPhi(particle_dir.Phi(), ue2[i].Phi()); + double deltaR_ue2 = sqrt(deltaEta_ue2 * deltaEta_ue2 + deltaPhi_ue2 * deltaPhi_ue2); + + int pdg = TMath::Abs(particle.pdgCode()); + + if (pdg == 211) { + if (deltaR_jet < Rjet) { + registryMC.fill(HIST("Pion_eta_pt_jet"), particle.pt(), particle.eta()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryMC.fill(HIST("Pion_eta_pt_ue"), particle.pt(), particle.eta()); + } + } + if (pdg == 310) { + if (deltaR_jet < Rjet) { + registryMC.fill(HIST("K0s_eta_pt_jet"), particle.pt(), particle.eta()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryMC.fill(HIST("K0s_eta_pt_ue"), particle.pt(), particle.eta()); + } + } + if (pdg == 3122) { + if (deltaR_jet < Rjet) { + registryMC.fill(HIST("Lambda_eta_pt_jet"), particle.pt(), particle.eta()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryMC.fill(HIST("Lambda_eta_pt_ue"), particle.pt(), particle.eta()); + } + } + if (pdg == 3312) { + if (deltaR_jet < Rjet) { + registryMC.fill(HIST("Xi_eta_pt_jet"), particle.pt(), particle.eta()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryMC.fill(HIST("Xi_eta_pt_ue"), particle.pt(), particle.eta()); + } + } + if (pdg == 3334) { + if (deltaR_jet < Rjet) { + registryMC.fill(HIST("Omega_eta_pt_jet"), particle.pt(), particle.eta()); + } + if (deltaR_ue1 < Rjet || deltaR_ue2 < Rjet) { + registryMC.fill(HIST("Omega_eta_pt_ue"), particle.pt(), particle.eta()); + } + } } } } } - PROCESS_SWITCH(strangeness_in_jets, processWeights, "Process Weights", false); + PROCESS_SWITCH(strangeness_in_jets, processGen, "Process generated MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/Tasks/Strangeness/v0postprocessing.cxx b/PWGLF/Tasks/Strangeness/v0postprocessing.cxx index 1844390a3da..d66f2814e1e 100644 --- a/PWGLF/Tasks/Strangeness/v0postprocessing.cxx +++ b/PWGLF/Tasks/Strangeness/v0postprocessing.cxx @@ -42,11 +42,14 @@ struct v0postprocessing { Configurable v0rejK0s{"v0rejK0s", 0.005, "V0 rej K0s"}; Configurable v0rejLambda{"v0rejLambda", 0.01, "V0 rej K0s"}; Configurable ntpcsigma{"ntpcsigma", 5, "N sigma TPC"}; + Configurable ntpcsigmaMC{"ntpcsigmaMC", 100, "N sigma TPC for MC"}; Configurable etadau{"etadau", 0.8, "Eta Daughters"}; Configurable isMC{"isMC", 1, "isMC"}; Configurable evSel{"evSel", 1, "evSel"}; Configurable hasTOF2Leg{"hasTOF2Leg", 0, "hasTOF2Leg"}; Configurable hasTOF1Leg{"hasTOF1Leg", 1, "hasTOF1Leg"}; + Configurable paramArmenterosCut{"paramArmenterosCut", 0.2, "parameter Armenteros Cut"}; + Configurable doArmenterosCut{"doArmenterosCut", 1, "do Armenteros Cut"}; HistogramRegistry registry{"registry"}; @@ -66,14 +69,16 @@ struct v0postprocessing { if (isMC) { registry.add("hMassK0Short_MC", ";M_{#pi^{+}#pi^{-}} [GeV/c^{2}]", {HistType::kTH1F, {{200, 0.4f, 0.6f}}}); - registry.add("hMassVsPtK0Short_MC", ";p_{T} [GeV/c];M_{#pi^{+}#pi^{-}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {200, 0.4f, 0.6f}, {100, 0.f, 100.f}}}); + registry.add("hMassVsPtK0Short_MC", ";p_{T} [GeV/c];M_{#pi^{+}#pi^{-}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {100, 0.f, 100.f}, {200, 0.4f, 0.6f}}}); registry.add("hMassLambda_MC", "hMassLambda", {HistType::kTH1F, {{200, 1.016f, 1.216f}}}); - registry.add("hMassVsPtLambda_MC", "hMassVsPtLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); + registry.add("hMassVsPtLambda_MC", ";p_{T} [GeV/c];M_{p^{+}#pi^{-}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {100, 0.f, 100.f}, {200, 1.016f, 1.216f}}}); registry.add("hMassAntiLambda_MC", "hMassAntiLambda", {HistType::kTH1F, {{200, 1.016f, 1.216f}}}); - registry.add("hMassVsPtAntiLambda_MC", "hMassVsPtAntiLambda", {HistType::kTH2F, {{100, 0.0f, 10.0f}, {200, 1.016f, 1.216f}}}); + registry.add("hMassVsPtAntiLambda_MC", ";p_{T} [GeV/c];M_{p^{-}#pi^{+}} [GeV/c^{2}]", {HistType::kTH3F, {{250, 0.0f, 25.0f}, {100, 0.f, 100.f}, {200, 1.016f, 1.216f}}}); } // QA + registry.add("hArmenterosPodolanski", "hArmenterosPodolanski", {HistType::kTH2F, {{1000, -1.0f, 1.0f, "#alpha"}, {1000, 0.0f, 0.30f, "#it{Q}_{T}"}}}); + registry.add("hArmenterosPodolanski_Sel", "hArmenterosPodolanski_Sel", {HistType::kTH2F, {{1000, -1.0f, 1.0f, "#alpha"}, {1000, 0.0f, 0.30f, "#it{Q}_{T}"}}}); registry.add("hK0sV0Radius", "hK0sV0Radius", {HistType::kTH1D, {{200, 0.0f, 40.0f}}}); registry.add("hK0sCosPA", "hK0sCosPA", {HistType::kTH1F, {{100, 0.9f, 1.0f}}}); registry.add("hK0sV0DCANegToPV", "hK0sV0DCANegToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); @@ -85,38 +90,34 @@ struct v0postprocessing { registry.add("hK0sTPCNSigmaPosPi", "hK0sTPCNSigmaPosPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); registry.add("hK0sTPCNSigmaNegPi", "hK0sTPCNSigmaNegPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - /* registry.add("hLambdaV0Radius", "hLambdaV0Radius", {HistType::kTH1D, {{200, 0.0f, 40.0f}}}); - registry.add("hLambdaCosPA", "hLambdaCosPA", {HistType::kTH1F, {{100, 0.9f, 1.0f}}}); - registry.add("hLambdaV0DCANegToPV", "hLambdaV0DCANegToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); - registry.add("hLambdaV0DCAPosToPV", "hLambdaV0DCAPosToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); - registry.add("hLambdaV0DCAV0Daughters", "hLambdaV0DCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.20f}}}); - registry.add("hLambdaCtau", "hLambdaCtau", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); - registry.add("hLambdaEtaDau", "hLambdaEtaDau", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); - registry.add("hLambdaRap", "hLambdaRap", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); - registry.add("hLambdaTPCNSigmaPosPi", "hLambdaTPCNSigmaPosPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("hLambdaTPCNSigmaNegPi", "hLambdaTPCNSigmaNegPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("hLambdaTPCNSigmaNegPr", "hLambdaTPCNSigmaNegPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("hLambdaTPCNSigmaPosPr", "hLambdaTPCNSigmaPosPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - - registry.add("hAntiLambdaV0Radius", "hAntiLambdaV0Radius", {HistType::kTH1D, {{200, 0.0f, 40.0f}}}); - registry.add("hAntiLambdaCosPA", "hAntiLambdaCosPA", {HistType::kTH1F, {{100, 0.9f, 1.0f}}}); - registry.add("hAntiLambdaV0DCANegToPV", "hAntiLambdaV0DCANegToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); - registry.add("hAntiLambdaV0DCAPosToPV", "hAntiLambdaV0DCAPosToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); - registry.add("hAntiLambdaV0DCAV0Daughters", "hAntiLambdaV0DCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.20f}}}); - registry.add("hAntiLambdaCtau", "hAntiLambdaCtau", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); - registry.add("hAntiLambdaEtaDau", "hAntiLambdaEtaDau", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); - registry.add("hAntiLambdaRap", "hAntiLambdaRap", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); - registry.add("hAntiLambdaTPCNSigmaPosPi", "hAntiLambdaTPCNSigmaPosPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("hAntiLambdaTPCNSigmaNegPi", "hAntiLambdaTPCNSigmaNegPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("hAntiLambdaTPCNSigmaNegPr", "hAntiLambdaTPCNSigmaNegPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("hAntiLambdaTPCNSigmaPosPr", "hAntiLambdaTPCNSigmaPosPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - - registry.add("TPCNSigmaPosPr", "TPCNSigmaPosPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("TPCNSigmaNegPr", "TPCNSigmaNegPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("TOFNSigmaPosPi", "TOFNSigmaPosPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("TOFNSigmaNegPi", "TOFNSigmaNegPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("TOFNSigmaPosPr", "TOFNSigmaPosPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); - registry.add("TOFNSigmaNegPr", "TOFNSigmaNegPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); */ + registry.add("hLambdaV0Radius", "hLambdaV0Radius", {HistType::kTH1D, {{200, 0.0f, 40.0f}}}); + registry.add("hLambdaCosPA", "hLambdaCosPA", {HistType::kTH1F, {{100, 0.9f, 1.0f}}}); + registry.add("hLambdaV0DCANegToPV", "hLambdaV0DCANegToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); + registry.add("hLambdaV0DCAPosToPV", "hLambdaV0DCAPosToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); + registry.add("hLambdaV0DCAV0Daughters", "hLambdaV0DCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.20f}}}); + registry.add("hLambdaCtau", "hLambdaCtau", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); + registry.add("hLambdaEtaDau", "hLambdaEtaDau", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); + registry.add("hLambdaRap", "hLambdaRap", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); + registry.add("hLambdaTPCNSigmaNegPi", "hLambdaTPCNSigmaNegPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + registry.add("hLambdaTPCNSigmaPosPr", "hLambdaTPCNSigmaPosPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + + registry.add("hAntiLambdaV0Radius", "hAntiLambdaV0Radius", {HistType::kTH1D, {{200, 0.0f, 40.0f}}}); + registry.add("hAntiLambdaCosPA", "hAntiLambdaCosPA", {HistType::kTH1F, {{100, 0.9f, 1.0f}}}); + registry.add("hAntiLambdaV0DCANegToPV", "hAntiLambdaV0DCANegToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); + registry.add("hAntiLambdaV0DCAPosToPV", "hAntiLambdaV0DCAPosToPV", {HistType::kTH1F, {{200, -1.0f, 1.0f}}}); + registry.add("hAntiLambdaV0DCAV0Daughters", "hAntiLambdaV0DCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.20f}}}); + registry.add("hAntiLambdaCtau", "hAntiLambdaCtau", {HistType::kTH1F, {{100, 0.0f, 50.0f}}}); + registry.add("hAntiLambdaEtaDau", "hAntiLambdaEtaDau", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); + registry.add("hAntiLambdaRap", "hAntiLambdaRap", {HistType::kTH1F, {{100, -1.0f, 1.0f}}}); + registry.add("hAntiLambdaTPCNSigmaPosPi", "hAntiLambdaTPCNSigmaPosPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + registry.add("hAntiLambdaTPCNSigmaNegPr", "hAntiLambdaTPCNSigmaNegPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + + /*registry.add("TPCNSigmaPosPr", "TPCNSigmaPosPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + registry.add("TPCNSigmaNegPr", "TPCNSigmaNegPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + registry.add("TOFNSigmaPosPi", "TOFNSigmaPosPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + registry.add("TOFNSigmaNegPi", "TOFNSigmaNegPi", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + registry.add("TOFNSigmaPosPr", "TOFNSigmaPosPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); + registry.add("TOFNSigmaNegPr", "TOFNSigmaNegPr", {HistType::kTH1F, {{100, -10.0f, 10.0f}}}); */ } void process(aod::MyV0Candidates const& myv0s) @@ -136,10 +137,6 @@ struct v0postprocessing { continue; if (candidate.v0dcav0daughters() > dcav0dau) continue; - if (TMath::Abs(candidate.ntpcsigmanegpi()) > ntpcsigma) - continue; - if (TMath::Abs(candidate.ntpcsigmapospi()) > ntpcsigma) - continue; if (evSel && candidate.evflag() < 1) continue; if (hasTOF1Leg && !candidate.poshastof() && !candidate.neghastof()) @@ -152,57 +149,88 @@ struct v0postprocessing { TMath::Abs(candidate.rapk0short()) < rap && candidate.ctauk0short() < ctauK0s && TMath::Abs(candidate.massk0short() - o2::constants::physics::MassK0Short) < 0.075 && - TMath::Abs(candidate.masslambda() - o2::constants::physics::MassLambda0) > v0rejK0s) { - - registry.fill(HIST("hMassK0Short"), candidate.massk0short()); - registry.fill(HIST("hMassVsPtK0Short"), candidate.v0pt(), candidate.massk0short()); - registry.fill(HIST("hMassVsPtK0ShortVsCentFT0M"), candidate.v0pt(), candidate.multft0m(), candidate.massk0short()); - registry.fill(HIST("hMassVsPtK0ShortVsCentFV0A"), candidate.v0pt(), candidate.multfv0a(), candidate.massk0short()); - - // QA - if (!isMC) { - registry.fill(HIST("hK0sV0Radius"), candidate.v0radius()); - registry.fill(HIST("hK0sCosPA"), candidate.v0cospa()); - registry.fill(HIST("hK0sV0DCANegToPV"), candidate.v0dcanegtopv()); - registry.fill(HIST("hK0sV0DCAPosToPV"), candidate.v0dcapostopv()); - registry.fill(HIST("hK0sV0DCAV0Daughters"), candidate.v0dcav0daughters()); - registry.fill(HIST("hK0sCtau"), candidate.ctauk0short()); - registry.fill(HIST("hK0sEtaDau"), candidate.v0poseta()); - registry.fill(HIST("hK0sRap"), candidate.rapk0short()); - registry.fill(HIST("hK0sTPCNSigmaPosPi"), candidate.ntpcsigmapospi()); - registry.fill(HIST("hK0sTPCNSigmaNegPi"), candidate.ntpcsigmanegpi()); + TMath::Abs(candidate.masslambda() - o2::constants::physics::MassLambda0) > v0rejK0s && + TMath::Abs(candidate.ntpcsigmanegpi()) <= ntpcsigma && + TMath::Abs(candidate.ntpcsigmapospi()) <= ntpcsigma) { + + registry.fill(HIST("hArmenterosPodolanski"), candidate.alpha(), candidate.qtarm()); + + if (doArmenterosCut && candidate.qtarm() > (paramArmenterosCut * TMath::Abs(candidate.alpha()))) { + registry.fill(HIST("hArmenterosPodolanski_Sel"), candidate.alpha(), candidate.qtarm()); + registry.fill(HIST("hMassK0Short"), candidate.massk0short()); + registry.fill(HIST("hMassVsPtK0Short"), candidate.v0pt(), candidate.massk0short()); + registry.fill(HIST("hMassVsPtK0ShortVsCentFT0M"), candidate.v0pt(), candidate.multft0m(), candidate.massk0short()); + registry.fill(HIST("hMassVsPtK0ShortVsCentFV0A"), candidate.v0pt(), candidate.multfv0a(), candidate.massk0short()); + + // QA + if (!isMC) { + registry.fill(HIST("hK0sV0Radius"), candidate.v0radius()); + registry.fill(HIST("hK0sCosPA"), candidate.v0cospa()); + registry.fill(HIST("hK0sV0DCANegToPV"), candidate.v0dcanegtopv()); + registry.fill(HIST("hK0sV0DCAPosToPV"), candidate.v0dcapostopv()); + registry.fill(HIST("hK0sV0DCAV0Daughters"), candidate.v0dcav0daughters()); + registry.fill(HIST("hK0sCtau"), candidate.ctauk0short()); + registry.fill(HIST("hK0sEtaDau"), candidate.v0poseta()); + registry.fill(HIST("hK0sRap"), candidate.rapk0short()); + registry.fill(HIST("hK0sTPCNSigmaPosPi"), candidate.ntpcsigmapospi()); + registry.fill(HIST("hK0sTPCNSigmaNegPi"), candidate.ntpcsigmanegpi()); + } } } // Lambda analysis - /* if (candidate.v0cospa() > cospaLambda && - TMath::Abs(candidate.raplambda()) < rap && - candidate.ctaulambda() < ctauK0s && - TMath::Abs(candidate.masslambda() - o2::constants::physics::MassLambda0) < 0.075 && - TMath::Abs(candidate.massk0short() - o2::constants::physics::MassK0Short) > v0rejLambda) { - - registry.fill(HIST("hMassLambda"), candidate.masslambda()); - registry.fill(HIST("hMassVsPtLambda"), candidate.v0pt(), candidate.masslambda()); - registry.fill(HIST("hMassVsPtLambdaVsCentFT0M"), candidate.v0pt(), candidate.multft0m(), candidate.masslambda()); - registry.fill(HIST("hMassVsPtLambdaVsCentFV0A"), candidate.v0pt(), candidate.multfv0a(), candidate.masslambda()); - - // QA - if (!isMC) { - registry.fill(HIST("hLambdaV0Radius"), candidate.v0radius()); - registry.fill(HIST("hLambdaCosPA"), candidate.v0cospa()); - registry.fill(HIST("hLambdaV0DCANegToPV"), candidate.v0dcanegtopv()); - registry.fill(HIST("hLambdaV0DCAPosToPV"), candidate.v0dcapostopv()); - registry.fill(HIST("hLambdaV0DCAV0Daughters"), candidate.v0dcav0daughters()); - registry.fill(HIST("hLambdaCtau"), candidate.ctaulambda()); - registry.fill(HIST("hLambdaEtaDau"), candidate.v0poseta()); - registry.fill(HIST("hLambdaRap"), candidate.raplambda()); - registry.fill(HIST("hLambdaTPCNSigmaPosPi"), candidate.ntpcsigmapospi()); - registry.fill(HIST("hLambdaTPCNSigmaPosPr"), candidate.ntpcsigmapospr()); - registry.fill(HIST("hLambdaTPCNSigmaNegPi"), candidate.ntpcsigmanegpi()); - registry.fill(HIST("hLambdaTPCNSigmaNegPr"), candidate.ntpcsigmanegpr()); - } - } - */ + if (candidate.v0cospa() > cospaLambda && + TMath::Abs(candidate.raplambda()) < rap && + TMath::Abs(candidate.massk0short() - o2::constants::physics::MassK0Short) > v0rejLambda) { + + // Lambda + if (TMath::Abs(candidate.ntpcsigmanegpi()) <= ntpcsigma && TMath::Abs(candidate.ntpcsigmapospr()) <= ntpcsigma && + candidate.ctaulambda() < ctauLambda && + TMath::Abs(candidate.masslambda() - o2::constants::physics::MassLambda0) < 0.075) { + + registry.fill(HIST("hMassLambda"), candidate.masslambda()); + registry.fill(HIST("hMassVsPtLambda"), candidate.v0pt(), candidate.masslambda()); + registry.fill(HIST("hMassVsPtLambdaVsCentFT0M"), candidate.v0pt(), candidate.multft0m(), candidate.masslambda()); + + // QA + if (!isMC) { + registry.fill(HIST("hLambdaV0Radius"), candidate.v0radius()); + registry.fill(HIST("hLambdaCosPA"), candidate.v0cospa()); + registry.fill(HIST("hLambdaV0DCANegToPV"), candidate.v0dcanegtopv()); + registry.fill(HIST("hLambdaV0DCAPosToPV"), candidate.v0dcapostopv()); + registry.fill(HIST("hLambdaV0DCAV0Daughters"), candidate.v0dcav0daughters()); + registry.fill(HIST("hLambdaCtau"), candidate.ctaulambda()); + registry.fill(HIST("hLambdaEtaDau"), candidate.v0poseta()); + registry.fill(HIST("hLambdaRap"), candidate.raplambda()); + registry.fill(HIST("hLambdaTPCNSigmaPosPr"), candidate.ntpcsigmapospr()); + registry.fill(HIST("hLambdaTPCNSigmaNegPi"), candidate.ntpcsigmanegpi()); + } + } + // AntiLambda + if (TMath::Abs(candidate.ntpcsigmanegpr()) <= ntpcsigma && TMath::Abs(candidate.ntpcsigmapospi()) <= ntpcsigma && + candidate.ctauantilambda() < ctauLambda && + TMath::Abs(candidate.massantilambda() - o2::constants::physics::MassLambda0) < 0.075) { + + registry.fill(HIST("hMassAntiLambda"), candidate.massantilambda()); + registry.fill(HIST("hMassVsPtAntiLambda"), candidate.v0pt(), candidate.massantilambda()); + registry.fill(HIST("hMassVsPtAntiLambdaVsCentFT0M"), candidate.v0pt(), candidate.multft0m(), candidate.massantilambda()); + + // QA + if (!isMC) { + registry.fill(HIST("hAntiLambdaV0Radius"), candidate.v0radius()); + registry.fill(HIST("hAntiLambdaCosPA"), candidate.v0cospa()); + registry.fill(HIST("hAntiLambdaV0DCANegToPV"), candidate.v0dcanegtopv()); + registry.fill(HIST("hAntiLambdaV0DCAPosToPV"), candidate.v0dcapostopv()); + registry.fill(HIST("hAntiLambdaV0DCAV0Daughters"), candidate.v0dcav0daughters()); + registry.fill(HIST("hAntiLambdaCtau"), candidate.ctauantilambda()); + registry.fill(HIST("hAntiLambdaEtaDau"), candidate.v0poseta()); + registry.fill(HIST("hAntiLambdaRap"), candidate.raplambda()); + registry.fill(HIST("hAntiLambdaTPCNSigmaNegPr"), candidate.ntpcsigmanegpr()); + registry.fill(HIST("hAntiLambdaTPCNSigmaPosPi"), candidate.ntpcsigmapospi()); + } + } + } + if (isMC) { if (candidate.isphysprimary() == 0) @@ -214,23 +242,77 @@ struct v0postprocessing { candidate.ctauk0short() < ctauK0s && TMath::Abs(candidate.massk0short() - o2::constants::physics::MassK0Short) < 0.075 && TMath::Abs(candidate.masslambda() - o2::constants::physics::MassLambda0) > v0rejK0s && + TMath::Abs(candidate.ntpcsigmanegpi()) <= ntpcsigmaMC && + TMath::Abs(candidate.ntpcsigmapospi()) <= ntpcsigmaMC && (candidate.pdgcode() == 310)) { - registry.fill(HIST("hMassK0Short_MC"), candidate.massk0short()); - registry.fill(HIST("hMassVsPtK0Short_MC"), candidate.v0pt(), candidate.multft0m(), candidate.massk0short()); - - registry.fill(HIST("hK0sV0Radius"), candidate.v0radius()); - registry.fill(HIST("hK0sCosPA"), candidate.v0cospa()); - registry.fill(HIST("hK0sV0DCANegToPV"), candidate.v0dcanegtopv()); - registry.fill(HIST("hK0sV0DCAPosToPV"), candidate.v0dcapostopv()); - registry.fill(HIST("hK0sV0DCAV0Daughters"), candidate.v0dcav0daughters()); - registry.fill(HIST("hK0sCtau"), candidate.ctauk0short()); - registry.fill(HIST("hK0sEtaDau"), candidate.v0poseta()); - registry.fill(HIST("hK0sRap"), candidate.rapk0short()); - registry.fill(HIST("hK0sTPCNSigmaPosPi"), candidate.ntpcsigmapospi()); - registry.fill(HIST("hK0sTPCNSigmaNegPi"), candidate.ntpcsigmanegpi()); - } - } + registry.fill(HIST("hArmenterosPodolanski"), candidate.alpha(), candidate.qtarm()); + + if (doArmenterosCut && candidate.qtarm() > (paramArmenterosCut * TMath::Abs(candidate.alpha()))) { + registry.fill(HIST("hArmenterosPodolanski_Sel"), candidate.alpha(), candidate.qtarm()); + registry.fill(HIST("hMassK0Short_MC"), candidate.massk0short()); + registry.fill(HIST("hMassVsPtK0Short_MC"), candidate.v0pt(), candidate.multft0m(), candidate.massk0short()); + + registry.fill(HIST("hK0sV0Radius"), candidate.v0radius()); + registry.fill(HIST("hK0sCosPA"), candidate.v0cospa()); + registry.fill(HIST("hK0sV0DCANegToPV"), candidate.v0dcanegtopv()); + registry.fill(HIST("hK0sV0DCAPosToPV"), candidate.v0dcapostopv()); + registry.fill(HIST("hK0sV0DCAV0Daughters"), candidate.v0dcav0daughters()); + registry.fill(HIST("hK0sCtau"), candidate.ctauk0short()); + registry.fill(HIST("hK0sEtaDau"), candidate.v0poseta()); + registry.fill(HIST("hK0sRap"), candidate.rapk0short()); + registry.fill(HIST("hK0sTPCNSigmaPosPi"), candidate.ntpcsigmapospi()); + registry.fill(HIST("hK0sTPCNSigmaNegPi"), candidate.ntpcsigmanegpi()); + } + } // k0 + + // Lambda analysis + if (candidate.v0cospa() > cospaLambda && + TMath::Abs(candidate.raplambda()) < rap && + TMath::Abs(candidate.massk0short() - o2::constants::physics::MassK0Short) > v0rejLambda) { + + // Lambda + if (TMath::Abs(candidate.ntpcsigmanegpi()) <= ntpcsigmaMC && TMath::Abs(candidate.ntpcsigmapospr()) <= ntpcsigmaMC && + candidate.ctaulambda() < ctauLambda && + TMath::Abs(candidate.masslambda() - o2::constants::physics::MassLambda0) < 0.075 && + candidate.pdgcode() == 3122) { + + registry.fill(HIST("hMassLambda_MC"), candidate.masslambda()); + registry.fill(HIST("hMassVsPtLambda_MC"), candidate.v0pt(), candidate.multft0m(), candidate.masslambda()); + + registry.fill(HIST("hLambdaV0Radius"), candidate.v0radius()); + registry.fill(HIST("hLambdaCosPA"), candidate.v0cospa()); + registry.fill(HIST("hLambdaV0DCANegToPV"), candidate.v0dcanegtopv()); + registry.fill(HIST("hLambdaV0DCAPosToPV"), candidate.v0dcapostopv()); + registry.fill(HIST("hLambdaV0DCAV0Daughters"), candidate.v0dcav0daughters()); + registry.fill(HIST("hLambdaCtau"), candidate.ctaulambda()); + registry.fill(HIST("hLambdaEtaDau"), candidate.v0poseta()); + registry.fill(HIST("hLambdaRap"), candidate.raplambda()); + registry.fill(HIST("hLambdaTPCNSigmaPosPr"), candidate.ntpcsigmapospr()); + registry.fill(HIST("hLambdaTPCNSigmaNegPi"), candidate.ntpcsigmanegpi()); + } + // AntiLambda + if (TMath::Abs(candidate.ntpcsigmanegpr()) <= ntpcsigmaMC && TMath::Abs(candidate.ntpcsigmapospi()) <= ntpcsigmaMC && + candidate.ctauantilambda() < ctauLambda && + TMath::Abs(candidate.massantilambda() - o2::constants::physics::MassLambda0) < 0.075 && + candidate.pdgcode() == -3122) { + + registry.fill(HIST("hMassAntiLambda_MC"), candidate.massantilambda()); + registry.fill(HIST("hMassVsPtAntiLambda_MC"), candidate.v0pt(), candidate.multft0m(), candidate.massantilambda()); + + registry.fill(HIST("hAntiLambdaV0Radius"), candidate.v0radius()); + registry.fill(HIST("hAntiLambdaCosPA"), candidate.v0cospa()); + registry.fill(HIST("hAntiLambdaV0DCANegToPV"), candidate.v0dcanegtopv()); + registry.fill(HIST("hAntiLambdaV0DCAPosToPV"), candidate.v0dcapostopv()); + registry.fill(HIST("hAntiLambdaV0DCAV0Daughters"), candidate.v0dcav0daughters()); + registry.fill(HIST("hAntiLambdaCtau"), candidate.ctauantilambda()); + registry.fill(HIST("hAntiLambdaEtaDau"), candidate.v0poseta()); + registry.fill(HIST("hAntiLambdaRap"), candidate.raplambda()); + registry.fill(HIST("hAntiLambdaTPCNSigmaPosPi"), candidate.ntpcsigmapospi()); + registry.fill(HIST("hAntiLambdaTPCNSigmaNegPr"), candidate.ntpcsigmanegpr()); + } + } // lambda + } // is MC } } }; diff --git a/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx new file mode 100644 index 00000000000..10049865bb5 --- /dev/null +++ b/PWGLF/Tasks/Strangeness/v0ptinvmassplots.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. +/// +/// \brief V0 task for production of invariant mass plots for Optimised Topological Cuts Analysis +/// \author Nikolaos Karatzenis (nikolaos.karatzenis@cern.ch) +/// \author Roman Lietava (roman.lietava@cern.ch) + +/*Description +This task creates 20 histograms that are filled with the V0 invariant mass under the K0, Lambda and Antilambda mass assumption +for different pt ranges (constituting bins), so 3x20=60 plots.The values are inserted as configurable strings for convinience. +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 "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Common/DataModel/PIDResponse.h" + +// namespace to be used for pt plots and bins +namespace pthistos +{ +std::shared_ptr KaonPt[20]; +static std::vector kaonptbins; +std::shared_ptr LambdaPt[20]; +static std::vector lambdaptbins; +std::shared_ptr AntilambdaPt[20]; +static std::vector antilambdaptbins; +} // namespace pthistos +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct v0ptinvmassplots { + // Histogram Registries + HistogramRegistry rPtAnalysis{"PtAnalysis", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rKaonshMassPlots_per_PtBin{"KaonshMassPlots_per_PtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rLambdaMassPlots_per_PtBin{"LambdaMassPlots_per_PtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rAntilambdaMassPlots_per_PtBin{"AntilambdaMassPlots_per_PtBin", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // 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"}; + Configurable kaonshsetting_dcapostopv{"kaonshsetting_dcapostopv", 0.05, "DCA Pos To PV"}; + Configurable kaonshsetting_dcanegtopv{"kaonshsetting_dcanegtopv", 0.05, "DCA Neg To PV"}; + Configurable kaonshsetting_cospa{"kaonshsetting_cospa", 0.50, "V0 CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0 + Configurable kaonshsetting_radius{"kaonshsetting_radius", 0.50, "v0radius"}; + + // Configurable Lambda Topological Cuts (best cuts determined by v0topologicalcuts task) + Configurable lambdasetting_dcav0dau{"lambdasetting_dcav0dau", 100.0, "DCA V0 Daughters"}; + Configurable lambdasetting_dcapostopv{"lambdasetting_dcapostopv", 0.05, "DCA Pos To PV"}; + Configurable lambdasetting_dcanegtopv{"lambdasetting_dcanegtopv", 0.05, "DCA Neg To PV"}; + Configurable lambdasetting_cospa{"lambdasetting_cospa", 0.50, "V0 CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0 + Configurable lambdasetting_radius{"lambdasetting_radius", 0.50, "v0radius"}; + + // Configurable Antilambda Topological Cuts (best cuts determined by v0topologicalcuts task) + Configurable antilambdasetting_dcav0dau{"antilambdasetting_dcav0dau", 100.0, "DCA V0 Daughters"}; + Configurable antilambdasetting_dcapostopv{"antilambdasetting_dcapostopv", 0.05, "DCA Pos To PV"}; + Configurable antilambdasetting_dcanegtopv{"antilambdasetting_dcanegtopv", 0.05, "DCA Neg To PV"}; + Configurable antilambdasetting_cospa{"antilambdasetting_cospa", 0.50, "V0 CosPA"}; // double -> N.B. dcos(x)/dx = 0 at x=0 + Configurable antilambdasetting_radius{"antilambdasetting_radius", 0.50, "v0radius"}; + + // Configurables for Specific V0s analysis + Configurable kzerosh_analysis{"kzerosh_analysis", true, "Enable Kzerosh Pt Analysis"}; + Configurable lambda_analysis{"lambda_analysis", true, "Enable Lambda Pt Analysis"}; + Configurable antilambda_analysis{"antilambda_analysis", true, "Enable Antilambda Pt Analysis"}; + + // Configurable string for Different Pt Bins + Configurable kzeroshsetting_pt_string{"kzerosetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Kzero Pt Bin Values"}; + Configurable lambdasetting_pt_string{"lambdasetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Lambda Pt Bin Values"}; + Configurable antilambdasetting_pt_string{"antilambdasetting_ptbins", {"0_0,0_15,0_3,0_45,0_6,0_75,0_9,1_05,1_2,1_35,1_5,1_65,1_8,1_95,2_1,2_25,2_4,2_55,2_7,2_85,3_0"}, "Antilambda Pt Bin Values"}; + + void init(InitContext const&) + { + // Axes + AxisSpec K0ShortMassAxis = {nBins, 0.45f, 0.55f, "#it{M} #pi^{+}#pi^{-} [GeV/#it{c}^{2}]"}; + 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 = {xaxisgenbins, xaxismingenbin, xaxismaxgenbin, "#it{p}_{T} (GeV/#it{c})"}; + + rPtAnalysis.add("hV0PtAll", "hV0PtAll", {HistType::kTH1F, {{nBins, 0.0f, 10.0f}}}); + + // setting strings from configurable strings in order to manipulate them + size_t commapos = 0; + std::string token1; + // Adding Kzerosh Histograms to registry + if (kzerosh_analysis == true) { + // getting the bin values for the names of the plots for the five topological cuts + std::string kzeroshsetting_ptbins = kzeroshsetting_pt_string; + for (int i = 0; i < 21; i++) { // we have 21 pt values (for the 20 histos) as they are the ranges + commapos = kzeroshsetting_ptbins.find(","); // find comma that separates the values in the string + token1 = kzeroshsetting_ptbins.substr(0, commapos); // store the substring (first individual value) + pthistos::kaonptbins.push_back(token1); // fill the namespace with the value + kzeroshsetting_ptbins.erase(0, commapos + 1); // erase the value from the set string so it moves to the next + } + rPtAnalysis.add("hK0ShortReconstructedPtSpectrum", "hK0ShortReconstructedPtSpectrum", {HistType::kTH1F, {ptAxis}}); + rPtAnalysis.add("hMassK0ShortAll", "hMassK0ShortAll", {HistType::kTH1F, {K0ShortMassAxis}}); + rPtAnalysis.add("hK0ShortPtSpectrumBeforeCuts", "hK0ShortPtSpectrumBeforeCuts", {HistType::kTH1F, {ptAxis}}); + rPtAnalysis.add("hMassK0ShortAllAfterCuts", "hMassK0ShortAllAfterCuts", {HistType::kTH1F, {K0ShortMassAxis}}); + rPtAnalysis.add("hK0ShGeneratedPtSpectrum", "hK0ShGeneratedPtSpectrum", {HistType::kTH1F, {GenptAxis}}); + rPtAnalysis.add("hLambdaGeneratedPtSpectrum", "hLambdaGeneratedPtSpectrum", {HistType::kTH1F, {GenptAxis}}); + rPtAnalysis.add("hAntilambdaGeneratedPtSpectrum", "hAntilambdaGeneratedPtSpectrum", {HistType::kTH1F, {GenptAxis}}); + for (int i = 0; i < 20; i++) { + pthistos::KaonPt[i] = rKaonshMassPlots_per_PtBin.add(fmt::format("hPt_from_{0}_to_{1}", pthistos::kaonptbins[i], pthistos::kaonptbins[i + 1]).data(), fmt::format("hPt from {0} to {1}", pthistos::kaonptbins[i], pthistos::kaonptbins[i + 1]).data(), {HistType::kTH1D, {{K0ShortMassAxis}}}); + } + } + // Adding Lambda Histograms + if (lambda_analysis == true) { + // same method as in Kzerosh above + std::string lambdasetting_ptbins = lambdasetting_pt_string; + for (int i = 0; i < 21; i++) { + commapos = lambdasetting_ptbins.find(","); + token1 = lambdasetting_ptbins.substr(0, commapos); + pthistos::lambdaptbins.push_back(token1); + lambdasetting_ptbins.erase(0, commapos + 1); + } + rPtAnalysis.add("hLambdaReconstructedPtSpectrum", "hLambdaReconstructedPtSpectrum", {HistType::kTH1F, {ptAxis}}); + rPtAnalysis.add("hMassLambdaAll", "hMassLambdaAll", {HistType::kTH1F, {LambdaMassAxis}}); + rPtAnalysis.add("hLambdaPtSpectrumBeforeCuts", "hLambdaPtSpectrumBeforeCuts", {HistType::kTH1F, {ptAxis}}); + rPtAnalysis.add("hMassLambdaAllAfterCuts", "hMassLambdaAllAfterCuts", {HistType::kTH1F, {LambdaMassAxis}}); + for (int i = 0; i < 20; i++) { + pthistos::LambdaPt[i] = rLambdaMassPlots_per_PtBin.add(fmt::format("hPt_from_{0}_to_{1}", pthistos::lambdaptbins[i], pthistos::lambdaptbins[i + 1]).data(), fmt::format("hPt from {0} to {1}", pthistos::lambdaptbins[i], pthistos::lambdaptbins[i + 1]).data(), {HistType::kTH1D, {{LambdaMassAxis}}}); + } + } + // Adding Antilambda Histograms + if (antilambda_analysis == true) { + // same method as in Lambda and Kzerosh above + std::string antilambdasetting_ptbins = antilambdasetting_pt_string; + for (int i = 0; i < 21; i++) { + commapos = antilambdasetting_ptbins.find(","); + token1 = antilambdasetting_ptbins.substr(0, commapos); + pthistos::antilambdaptbins.push_back(token1); + antilambdasetting_ptbins.erase(0, commapos + 1); + } + rPtAnalysis.add("hAntilambdaReconstructedPtSpectrum", "hAntilambdaReconstructedPtSpectrum", {HistType::kTH1F, {ptAxis}}); + rPtAnalysis.add("hMassAntilambdaAll", "hMassAntilambdaAll", {HistType::kTH1F, {AntiLambdaMassAxis}}); + rPtAnalysis.add("hAntilambdaPtSpectrumBeforeCuts", "hAntilambdaPtSpectrumBeforeCuts", {HistType::kTH1F, {ptAxis}}); + rPtAnalysis.add("hMassAntilambdaAllAfterCuts", "hMassAntilambdaAllAfterCuts", {HistType::kTH1F, {AntiLambdaMassAxis}}); + for (int i = 0; i < 20; i++) { + pthistos::AntilambdaPt[i] = rAntilambdaMassPlots_per_PtBin.add(fmt::format("hPt_from_{0}_to_{1}", pthistos::antilambdaptbins[i], pthistos::antilambdaptbins[i + 1]).data(), fmt::format("hPt from {0} to {1}", pthistos::antilambdaptbins[i], pthistos::antilambdaptbins[i + 1]).data(), {HistType::kTH1D, {{AntiLambdaMassAxis}}}); + } + } + } + + // 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(soa::Filtered::iterator const&, + const soa::SmallGroups>&, + aod::McParticles const& mcParticles) + { + for (const auto& mcParticle : mcParticles) { + 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()); + } + } + } + } + } + // This is the Process for the MC reconstructed Data + 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& 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 (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()); + } + } + } + } + } + // 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()); + } + } + } + } + } + } + } + } + } + // This is the process for Real Data + void Dataprocess(soa::Filtered>::iterator const&, + aod::V0Datas const& V0s) + { + for (const auto& v0 : V0s) { + // kzero analysis + if (kzerosh_analysis == true) { + // 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 + rPtAnalysis.fill(HIST("hMassK0ShortAll"), v0.mK0Short()); + // 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()); + for (int i = 0; i < 20; i++) { // same as above MC-process we fill the namespace histos with the kaon invariant mass of the particle within the pt range of the histo + std::string pt1 = pthistos::kaonptbins[i]; + std::string pt2 = pthistos::kaonptbins[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::KaonPt[i]->Fill(v0.mK0Short()); + } + } + } + } + // lambda analysis + if (lambda_analysis == true) { + // Filling the five lambda invariant mass plots for different cuts (which are taken from namespace), for full explanation see the first kzero cut filling in the MC process + rPtAnalysis.fill(HIST("hMassLambdaAll"), v0.mLambda()); + // 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()); + for (int i = 0; i < 20; i++) { // same as above MC-process we fill the namespace histos with the lambda invariant mass of the particle within the pt range of the histo + 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()); + } + } + } + } + // anti-lambda analysis + if (antilambda_analysis == true) { + // Filling the five Antilambda invariant mass plots for different cuts (which are taken from namespace), for full explanation see the first kzero cut filling in the MC process + rPtAnalysis.fill(HIST("hMassAntilambdaAll"), v0.mAntiLambda()); + // 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()); + for (int i = 0; i < 20; i++) { // same as above MC-process we fill the namespace histos with the antilambda invariant mass of the particle within the pt range of the histo + 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()); + } + } + } + } + } + } + PROCESS_SWITCH(v0ptinvmassplots, GenMCprocess, "Process Run 3 MC Generated", false); + PROCESS_SWITCH(v0ptinvmassplots, RecMCprocess, "Process Run 3 MC", false); + PROCESS_SWITCH(v0ptinvmassplots, Dataprocess, "Process Run 3 Data,", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} 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/inelGt.h b/PWGLF/Utils/inelGt.h index f0a3514adc1..2ed513a902c 100644 --- a/PWGLF/Utils/inelGt.h +++ b/PWGLF/Utils/inelGt.h @@ -137,10 +137,10 @@ struct ParticleCounter { } // is neutral if (requireNeutral) { - if (abs(p->Charge()) > 1e-3) + if (std::abs(p->Charge()) > 1e-3) continue; } else { - if (abs(p->Charge()) <= 1e-3) + if (std::abs(p->Charge()) <= 1e-3) continue; } // in acceptance @@ -154,6 +154,8 @@ struct ParticleCounter { float countFT0A(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, 3.5f, 4.9f); } float countFT0C(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, -3.3f, -2.1f); } float countFV0A(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, 2.2f, 5.1f); } + float countV0A(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, 2.8f, 5.1f); } + float countV0C(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, -3.7f, -1.7f); } float countFDDA(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, 4.9f, 6.3f); } float countFDDC(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, -7.f, -4.9f); } @@ -161,6 +163,8 @@ struct ParticleCounter { float countZNC(const aod::McParticles& mcParticles) { return countEnergyInAcceptance(mcParticles, -100.f, -8.8f, true); } float countITSIB(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, -2.f, 2.f); } + float countEta05(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, -0.5f, 0.5f); } + float countEta08(const aod::McParticles& mcParticles) { return countMultInAcceptance(mcParticles, -0.8f, 0.8f); } }; } // namespace pwglf diff --git a/PWGLF/Utils/mcParticle.h b/PWGLF/Utils/mcParticle.h index dc0f476cc8a..e85d98ca5f0 100644 --- a/PWGLF/Utils/mcParticle.h +++ b/PWGLF/Utils/mcParticle.h @@ -53,6 +53,8 @@ class PIDExtended static constexpr ID Hyperhydrog4 = 14; static constexpr ID XiMinus = 15; static constexpr ID OmegaMinus = 16; + static constexpr ID HyperHelium4 = 17; + static constexpr ID HyperHelium5 = 18; static_assert(Electron == o2::track::PID::Electron, "PID::Electron mismatch"); static_assert(Muon == o2::track::PID::Muon, "PID::Muon mismatch"); @@ -71,59 +73,60 @@ class PIDExtended static_assert(Hyperhydrog4 == o2::track::PID::Hyperhydrog4, "PID::Hyperhydrog4 mismatch"); static_assert(XiMinus == o2::track::PID::XiMinus, "PID::XiMinus mismatch"); static_assert(OmegaMinus == o2::track::PID::OmegaMinus, "PID::OmegaMinus mismatch"); + // static_assert(HyperHelium4 == o2::track::PID::HyperHelium4, "PID::HyperHelium4 mismatch"); + // static_assert(HyperHelium5 == o2::track::PID::HyperHelium5, "PID::HyperHelium5 mismatch"); static constexpr ID PIDCountsUntilAl = 9; // Number of indices defined in PID.h equivalent to o2::track::PID::NIDs - static_assert(PIDCountsUntilAl == o2::track::PID::NIDs, "PID::NIDs mismatch"); + // static_assert(PIDCountsUntilAl == o2::track::PID::NIDs, "PID::NIDs mismatch"); - static constexpr ID PIDCounts = 17; // Number of indices defined in PID.h - static_assert(PIDCounts == o2::track::PID::NIDsTot, "PID::NIDsTot mismatch"); + static constexpr ID PIDCounts = 19; // Number of indices defined in PID.h + // static_assert(PIDCounts == o2::track::PID::NIDsTot, "PID::NIDsTot mismatch"); // Define an array of IDs static constexpr std::array mIDsUntilAl = {Electron, Muon, Pion, Kaon, Proton, Deuteron, Triton, Helium3, Alpha}; - static constexpr std::array mIDs = {Electron, Muon, Pion, Kaon, Proton, Deuteron, Triton, Helium3, Alpha, PI0, Photon, K0, Lambda, HyperTriton, Hyperhydrog4, XiMinus, OmegaMinus}; + static constexpr std::array mIDs = {Electron, Muon, Pion, Kaon, Proton, Deuteron, Triton, Helium3, Alpha, PI0, Photon, K0, Lambda, HyperTriton, Hyperhydrog4, XiMinus, OmegaMinus, HyperHelium4, HyperHelium5}; // Define the antiparticles - static constexpr ID Positron = 17; - static constexpr ID MuonPlus = 18; - static constexpr ID PionMinus = 19; - static constexpr ID KaonMinus = 20; - static constexpr ID AntiProton = 21; - static constexpr ID AntiDeuteron = 22; - static constexpr ID AntiTriton = 23; - static constexpr ID AntiHelium3 = 24; - static constexpr ID AntiAlpha = 25; - static constexpr ID AntiLambda = 26; - static constexpr ID AntiHyperTriton = 27; - static constexpr ID AntiHyperhydrog4 = 28; - static constexpr ID XiPlus = 29; - static constexpr ID OmegaPlus = 30; + static constexpr ID Positron = PIDCounts; + static constexpr ID MuonPlus = PIDCounts + 1; + static constexpr ID PionMinus = PIDCounts + 2; + static constexpr ID KaonMinus = PIDCounts + 3; + static constexpr ID AntiProton = PIDCounts + 4; + static constexpr ID AntiDeuteron = PIDCounts + 5; + static constexpr ID AntiTriton = PIDCounts + 6; + static constexpr ID AntiHelium3 = PIDCounts + 7; + static constexpr ID AntiAlpha = PIDCounts + 8; + static constexpr ID AntiLambda = PIDCounts + 9; + static constexpr ID AntiHyperTriton = PIDCounts + 10; + static constexpr ID AntiHyperhydrog4 = PIDCounts + 11; + static constexpr ID XiPlus = PIDCounts + 12; + static constexpr ID OmegaPlus = PIDCounts + 13; + static constexpr ID AntiHyperHelium4 = PIDCounts + 14; + static constexpr ID AntiHyperHelium5 = PIDCounts + 15; - static constexpr ID Neutron = 31; - static constexpr ID AntiNeutron = 32; - static constexpr ID HyperHelium4 = 33; - static constexpr ID AntiHyperHelium4 = 34; - static constexpr ID Phi = 35; - - static constexpr ID BZero = 36; - static constexpr ID BPlus = 37; - static constexpr ID BS = 38; - static constexpr ID D0 = 39; - static constexpr ID DPlus = 40; - static constexpr ID DS = 41; - static constexpr ID DStar = 42; - static constexpr ID ChiC1 = 43; - static constexpr ID JPsi = 44; - static constexpr ID LambdaB0 = 45; - static constexpr ID LambdaCPlus = 46; - static constexpr ID OmegaC0 = 47; - static constexpr ID SigmaC0 = 48; - static constexpr ID SigmaCPlusPlus = 49; - static constexpr ID X3872 = 50; - static constexpr ID Xi0 = 51; - static constexpr ID XiB0 = 52; - static constexpr ID XiCCPlusPlus = 53; - static constexpr ID XiCPlus = 54; - static constexpr ID XiC0 = 55; - static constexpr ID NIDsTot = 56; + static constexpr ID Neutron = PIDCounts + 16; + static constexpr ID AntiNeutron = PIDCounts + 17; + static constexpr ID Phi = PIDCounts + 18; + static constexpr ID BZero = PIDCounts + 19; + static constexpr ID BPlus = PIDCounts + 20; + static constexpr ID BS = PIDCounts + 21; + static constexpr ID D0 = PIDCounts + 22; + static constexpr ID DPlus = PIDCounts + 23; + static constexpr ID DS = PIDCounts + 24; + static constexpr ID DStar = PIDCounts + 25; + static constexpr ID ChiC1 = PIDCounts + 26; + static constexpr ID JPsi = PIDCounts + 27; + static constexpr ID LambdaB0 = PIDCounts + 28; + static constexpr ID LambdaCPlus = PIDCounts + 29; + static constexpr ID OmegaC0 = PIDCounts + 30; + static constexpr ID SigmaC0 = PIDCounts + 31; + static constexpr ID SigmaCPlusPlus = PIDCounts + 32; + static constexpr ID X3872 = PIDCounts + 33; + static constexpr ID Xi0 = PIDCounts + 34; + static constexpr ID XiB0 = PIDCounts + 35; + static constexpr ID XiCCPlusPlus = PIDCounts + 36; + static constexpr ID XiCPlus = PIDCounts + 37; + static constexpr ID XiC0 = PIDCounts + 38; + static constexpr ID NIDsTot = PIDCounts + 39; static constexpr const char* sNames[NIDsTot + 1] = { o2::track::pid_constants::sNames[Electron], // Electron @@ -143,6 +146,8 @@ class PIDExtended o2::track::pid_constants::sNames[Hyperhydrog4], // Hyperhydrog4 o2::track::pid_constants::sNames[XiMinus], // XiMinus o2::track::pid_constants::sNames[OmegaMinus], // OmegaMinus + "HyperHelium4", // HyperHelium4 + "HyperHelium5", // HyperHelium5 "Positron", // Positron "MuonPlus", // MuonPlus "PionMinus", // PionMinus @@ -157,10 +162,10 @@ class PIDExtended "AntiHyperhydrog4", // AntiHyperhydrog4 "XiPlus", // XiPlus "OmegaPlus", // OmegaPlus + "AntiHyperHelium4", // AntiHyperHelium4 + "AntiHyperHelium5", // AntiHyperHelium5 "Neutron", // Neutron "AntiNeutron", // AntiNeutron - "HyperHelium4", // HyperHelium4 - "AntiHyperHelium4", // AntiHyperHelium4 "Phi", // Phi "BZero", // BZero "BPlus", // BPlus @@ -244,6 +249,10 @@ class PIDExtended return HyperHelium4; case -o2::constants::physics::Pdg::kHyperHelium4: return AntiHyperHelium4; + case o2::constants::physics::Pdg::kHyperHelium5: + return HyperHelium5; + case -o2::constants::physics::Pdg::kHyperHelium5: + return AntiHyperHelium5; case 111: return PI0; case 22: diff --git a/PWGLF/Utils/strangenessMasks.h b/PWGLF/Utils/strangenessMasks.h new file mode 100644 index 00000000000..7b567218de6 --- /dev/null +++ b/PWGLF/Utils/strangenessMasks.h @@ -0,0 +1,150 @@ +// Copyright 2019-2024 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 Roman Nepeivoda (roman.nepeivoda@cern.ch) +/// \since August 27, 2024 + +#ifndef PWGLF_UTILS_STRANGENESSMASKS_H_ +#define PWGLF_UTILS_STRANGENESSMASKS_H_ + +enum selectionsCombined : int { selV0CosPA = 0, + selV0Radius, + selV0RadiusMax, + selDCANegToPV, + selDCAPosToPV, + selDCAV0Dau, + selK0ShortRapidity, + selLambdaRapidity, + 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 + selPosEta, + selNegEta, + // cascade selections + selCascCosPA, + selMassWinXi, + selMassWinOmega, + selDCACascDau, + selDCAV0ToPV, + selCascRadius, + selCascRadiusMax, + selBachBaryon, + selRejCompXi, + selRejCompOmega, + selBachToPV, + selMesonToPV, + selBaryonToPV, + selXiRapidity, + selXiCTau, + selConsiderXi, + selConsiderAntiXi, + selPhysPrimXi, + selPhysPrimAntiXi, + selOmegaRapidity, + selOmegaCTau, + selConsiderOmega, + selConsiderAntiOmega, + selPhysPrimOmega, + selPhysPrimAntiOmega, + selBachItsOnly, + selBachNotTPCOnly, + selBachGoodTPCTrack, + selBachGoodITSTrack, + selTPCPIDBachPion, + selTPCPIDBachKaon, + selTOFNSigmaBachPionXi, + selTOFNSigmaBachKaonOmega, + selTOFNSigmaPositiveProtonLambdaXi, + selTOFNSigmaPositiveProtonLambdaOmega, + selTOFNSigmaPositivePionLambdaXi, + selTOFNSigmaPositivePionLambdaOmega, + selTOFNSigmaNegativePionLambdaXi, + selTOFNSigmaNegativePionLambdaOmega, + selTOFNSigmaNegativeProtonLambdaXi, + selTOFNSigmaNegativeProtonLambdaOmega, + selTOFDeltaTPositiveProtonLambdaXi, + selTOFDeltaTPositiveProtonLambdaOmega, + selTOFDeltaTPositivePionLambdaXi, + selTOFDeltaTPositivePionLambdaOmega, + selTOFDeltaTNegativeProtonLambdaXi, + selTOFDeltaTNegativeProtonLambdaOmega, + selTOFDeltaTNegativePionLambdaXi, + selTOFDeltaTNegativePionLambdaOmega, + selTOFDeltaTBachPionXi, + selTOFDeltaTBachKaonOmega, + selBachEta, + selLambdaMassWin, + selCount, +}; + +static constexpr int selNum = static_cast(selectionsCombined::selCount); + +// constants +const float ctauxiPDG = 4.91; // from PDG +const float ctauomegaPDG = 2.461; // from PDG + +// bit masks +std::bitset maskTopologicalV0; +std::bitset maskTopologicalCasc; + +std::bitset maskKinematicV0; +std::bitset maskKinematicCasc; + +std::bitset maskTrackPropertiesV0; +std::bitset maskTrackPropertiesCasc; + +std::bitset maskK0ShortSpecific; +std::bitset maskLambdaSpecific; +std::bitset maskAntiLambdaSpecific; +std::bitset maskXiSpecific; +std::bitset maskAntiXiSpecific; +std::bitset maskOmegaSpecific; +std::bitset maskAntiOmegaSpecific; + +std::bitset maskSelectionK0Short; +std::bitset maskSelectionLambda; +std::bitset maskSelectionAntiLambda; +std::bitset maskSelectionXi; +std::bitset maskSelectionAntiXi; +std::bitset maskSelectionOmega; +std::bitset maskSelectionAntiOmega; + +#endif // PWGLF_UTILS_STRANGENESSMASKS_H_ diff --git a/PWGMM/Lumi/Tasks/lumiStability.cxx b/PWGMM/Lumi/Tasks/lumiStability.cxx index 0a6c62f35b9..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,8 +47,10 @@ 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"}; Service ccdb; int nBCsPerOrbit = 3564; @@ -68,12 +75,30 @@ struct lumiStabilityTask { const AxisSpec axisCounts{6, -0.5, 5.5}; const AxisSpec axisV0Counts{5, -0.5, 4.5}; const AxisSpec axisTriggger{nBCsPerOrbit, -0.5f, nBCsPerOrbit - 0.5f}; + const AxisSpec axisPos{1000, -1, 1}; + const AxisSpec axisPosZ{1000, -25, 25}; + const AxisSpec axisNumContrib{1001, -0.5, 1000}; + const AxisSpec axisColisionTime{1000, -50, 50}; + 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}); histos.add("hBcB", "BC pattern B; BC ; It is present", kTH1F, {axisTriggger}); histos.add("hBcE", "BC pattern Empty; BC ; It is present", kTH1F, {axisTriggger}); - + histos.add("hvertexX", "Pos X vertex trigger; Pos x; Count ", kTH1F, {axisPos}); + histos.add("hvertexXvsTime", "Pos X vertex vs Collision Time; vertex X (cm) ; time (ns)", {HistType::kTH2F, {{axisPos}, {axisColisionTime}}}); + histos.add("hvertexY", "Pos Y vertex trigger; Pos y; Count ", kTH1F, {axisPos}); + 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}); histos.add("FDD/bcVertexTrigger", "vertex trigger per BC (FDD);BC in FDD; counts", kTH1F, {axisTriggger}); @@ -105,6 +130,28 @@ struct lumiStabilityTask { histos.add("FDD/timeACbcA", "time bcA ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); histos.add("FDD/timeACbcC", "time bcC ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); histos.add("FDD/timeACbcE", "time bcE ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FDD/hTimeAVertex", "FDD time A; ns ; count", kTH1F, {axisTimeFDD}); + histos.add("FDD/hTimeCVertex", "FDD time C; ns ; count", kTH1F, {axisTimeFDD}); + histos.add("FDD/hTimeACoinc", "FDD time A; ns ; count", kTH1F, {axisTimeFDD}); + histos.add("FDD/hTimeCCoinc", "FDD time C; ns ; count", kTH1F, {axisTimeFDD}); + histos.add("FDD/hCountsTimeA2022", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FDD/hCountsTimeC2022", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FDD/hCountsTime2022", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FDD/hValidTimeAvsBC2022", "Valid Time A vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hInvTimeAvsBC2022", "Invalid Time A vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hValidTimeCvsBC2022", "Valid Time C vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hInvTimeCvsBC2022", "Invalid Time C vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hValidTimevsBC2022", "Valid Time vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hInvTimevsBC2022", "Invalid Time vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hCountsTimeA", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FDD/hCountsTimeC", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FDD/hCountsTime", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FDD/hValidTimeAvsBC", "Valid Time A vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hInvTimeAvsBC", "Invalid Time A vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hValidTimeCvsBC", "Valid Time C vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hInvTimeCvsBC", "Invalid Time C vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hValidTimevsBC", "Valid Time vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FDD/hInvTimevsBC", "Invalid Time vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); histos.add("FT0/hCounts", "0 FT0Count - 1 FT0VertexCount - 2 FT0PPVertexCount - 3 FT0PPBothSidesCount; Number; counts", kTH1F, {axisCounts}); histos.add("FT0/bcVertexTrigger", "vertex trigger per BC (FT0);BC in FT0; counts", kTH1F, {axisTriggger}); @@ -122,6 +169,17 @@ struct lumiStabilityTask { histos.add("FT0/timeACbcA", "time bcA ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); histos.add("FT0/timeACbcC", "time bcC ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); histos.add("FT0/timeACbcE", "time bcE ; A (ns); C (ns)", {HistType::kTH2F, {{300, -15, 15}, {300, -15, 15}}}); + histos.add("FT0/hTimeA", "FT0 time A; ns ; count", kTH1F, {axisTime}); + histos.add("FT0/hTimeC", "FT0 time C; ns ; count", kTH1F, {axisTime}); + histos.add("FT0/hCountsTimeA", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FT0/hCountsTimeC", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FT0/hCountsTime", "0 Dummy Time - 1 Valid Time ; Kind of Time; counts", kTH1F, {axisCounts}); + histos.add("FT0/hValidTimeAvsBC", "Valid Time A vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FT0/hInvTimeAvsBC", "Invalid Time A vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); + histos.add("FT0/hValidTimeCvsBC", "Valid Time C vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FT0/hInvTimeCvsBC", "Invalid Time C vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); + histos.add("FT0/hValidTimevsBC", "Valid Time vs BC id;BC in FT0;valid time counts", kTH1F, {axisTriggger}); + histos.add("FT0/hInvTimevsBC", "Invalid Time vs BC id;BC in FT0;invalid time counts", kTH1F, {axisTriggger}); histos.add("FV0/hCounts", "0 CountCentralFV0 - 1 CountPFPCentralFV0 - 2 CountPFPOutInFV0 - 3 CountPPCentralFV0 - 4 CountPPOutInFV0; Number; counts", kTH1F, {axisV0Counts}); histos.add("FV0/bcOutTrigger", "Out trigger per BC (FV0);BC in V0; counts", kTH1F, {axisTriggger}); @@ -132,6 +190,14 @@ struct lumiStabilityTask { histos.add("FV0/bcCenTriggerPPCentral", "Central trigger per BC (FV0) with PP in central trigger;BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcCenTriggerPFPOutIn", "Central trigger per BC (FV0) with PFP in Out and In trigger;BC in V0; counts", kTH1F, {axisTriggger}); histos.add("FV0/bcCenTriggerPPOutIn", "Central trigger per BC (FV0) with PP in Out and In trigger;BC in V0; counts", kTH1F, {axisTriggger}); + histos.add("FV0/hBcA", "BC pattern A in FV0; BC in FV0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FV0/hBcC", "BC pattern C in FV0; BC in FV0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FV0/hBcB", "BC pattern B in FV0; BC in FV0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FV0/hBcE", "BC pattern Empty in FV0; BC in FV0 ; It is present", kTH1F, {axisTriggger}); + histos.add("FV0/timeAbcB", "time bcB ; A (ns)", kTH1F, {{300, -15, 15}}); + histos.add("FV0/timeAbcA", "time bcA ; A (ns)", kTH1F, {{300, -15, 15}}); + histos.add("FV0/timeAbcC", "time bcC ; A (ns)", kTH1F, {{300, -15, 15}}); + histos.add("FV0/timeAbcE", "time bcE ; A (ns)", kTH1F, {{300, -15, 15}}); } bool checkAnyCoincidence(const std::vector& channels) @@ -153,12 +219,15 @@ struct lumiStabilityTask { void processMain(aod::FDDs const& fdds, aod::FT0s const& ft0s, aod::FV0As const& fv0s, aod::BCsWithTimestamps const& bcs) { - uint32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023 + int executionCounter = 0; + // uint32_t nOrbitsPerTF = 128; // 128 in 2022, 32 in 2023 int runNumber = bcs.iteratorAt(0).runNumber(); - if (runNumber != lastRunNumber) { + // std::string histName = "hOrbitFDDVertexCoinc_" + std::to_string(runNumber); + if (runNumber != lastRunNumber && executionCounter < 1) { lastRunNumber = runNumber; // do it only once - int64_t tsSOR = 0; - int64_t tsEOR = 1; + executionCounter++; + // 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(); @@ -187,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 @@ -212,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("hOrbitFDD", "FDD Orbits; Orbit; Entries", kTH1F, {axisOrbits}); - histos.add("hOrbitFDDVertex", "FDD Orbits; Orbit; Entries", kTH1F, {axisOrbits}); - histos.add("hOrbitFT0", "FT0 Orbits; Orbit; Entries", kTH1F, {axisOrbits}); - histos.add("hOrbitFV0", "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) { @@ -260,23 +331,6 @@ struct lumiStabilityTask { histos.fill(HIST("FDD/hCounts"), 1); histos.fill(HIST("hOrbitFDDVertex"), orbit - minOrbit); - if (bcPatternA[localBC]) { - histos.fill(HIST("FDD/timeACbcAVertex"), fdd.timeA(), fdd.timeC()); - histos.fill(HIST("FDD/hBcAVertex"), localBC); - } - if (bcPatternC[localBC]) { - histos.fill(HIST("FDD/timeACbcCVertex"), fdd.timeA(), fdd.timeC()); - histos.fill(HIST("FDD/hBcCVertex"), localBC); - } - if (bcPatternB[localBC]) { - histos.fill(HIST("FDD/timeACbcBVertex"), fdd.timeA(), fdd.timeC()); - histos.fill(HIST("FDD/hBcBVertex"), localBC); - } - if (bcPatternE[localBC]) { - histos.fill(HIST("FDD/timeACbcEVertex"), fdd.timeA(), fdd.timeC()); - histos.fill(HIST("FDD/hBcEVertex"), localBC); - } - int deltaIndex = 0; // backward move counts int deltaBC = 0; // current difference wrt globalBC bool pastActivityFDDVertex = false; @@ -301,12 +355,56 @@ struct lumiStabilityTask { if (pastActivityFDDVertex == false) { histos.fill(HIST("FDD/hCounts"), 2); histos.fill(HIST("FDD/bcVertexTriggerPP"), localBC); + if (bcPatternA[localBC]) { + histos.fill(HIST("FDD/timeACbcAVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcAVertex"), localBC); + } + if (bcPatternC[localBC]) { + histos.fill(HIST("FDD/timeACbcCVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcCVertex"), localBC); + } + if (bcPatternB[localBC]) { + histos.fill(HIST("FDD/timeACbcBVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcBVertex"), localBC); + histos.fill(HIST("FDD/hTimeAVertex"), fdd.timeA()); + histos.fill(HIST("FDD/hTimeCVertex"), fdd.timeC()); + if (is2022Data) { + if (fdd.timeA() > 30) { + histos.fill(HIST("FDD/hCountsTimeA2022"), 0); + histos.fill(HIST("FDD/hInvTimeAvsBC2022"), localBC); + } else { + histos.fill(HIST("FDD/hCountsTimeA2022"), 1); + histos.fill(HIST("FDD/hValidTimeAvsBC2022"), localBC); + } + + if (fdd.timeC() > 30) { + histos.fill(HIST("FDD/hCountsTimeC2022"), 0); + histos.fill(HIST("FDD/hInvTimeCvsBC2022"), localBC); + } else { + histos.fill(HIST("FDD/hCountsTimeC2022"), 1); + histos.fill(HIST("FDD/hValidTimeCvsBC2022"), localBC); + } + + if (fdd.timeA() > 30 || fdd.timeC() > 30) { + histos.fill(HIST("FDD/hCountsTime2022"), 0); + histos.fill(HIST("FDD/hInvTimevsBC2022"), localBC); + } + if (fdd.timeA() < 30 && fdd.timeC() < 30) { + histos.fill(HIST("FDD/hCountsTime2022"), 1); + histos.fill(HIST("FDD/hValidTimevsBC2022"), localBC); + } + } + } + if (bcPatternE[localBC]) { + histos.fill(HIST("FDD/timeACbcEVertex"), fdd.timeA(), fdd.timeC()); + histos.fill(HIST("FDD/hBcEVertex"), localBC); + } } if (isCoinA && isCoinC) { histos.fill(HIST("FDD/bcVertexTriggerCoincidence"), localBC); - histos.fill(HIST("FDD/hCounts"), 1); - histos.fill(HIST("hOrbitFDD"), orbit - minOrbit); + histos.fill(HIST("FDD/hCounts"), 3); + histos.fill(HIST("hOrbitFDDVertexCoinc"), orbit - minOrbit); if (bcPatternA[localBC]) { histos.fill(HIST("FDD/timeACbcA"), fdd.timeA(), fdd.timeC()); @@ -319,6 +417,34 @@ struct lumiStabilityTask { if (bcPatternB[localBC]) { histos.fill(HIST("FDD/timeACbcB"), fdd.timeA(), fdd.timeC()); histos.fill(HIST("FDD/hBcB"), localBC); + histos.fill(HIST("FDD/hTimeACoinc"), fdd.timeA()); + histos.fill(HIST("FDD/hTimeCCoinc"), fdd.timeC()); + if (!is2022Data) { + if (fdd.timeA() > 30) { + histos.fill(HIST("FDD/hCountsTimeA"), 0); + histos.fill(HIST("FDD/hInvTimeAvsBC"), localBC); + } else { + histos.fill(HIST("FDD/hCountsTimeA"), 1); + histos.fill(HIST("FDD/hValidTimeAvsBC"), localBC); + } + + if (fdd.timeC() > 30) { + histos.fill(HIST("FDD/hCountsTimeC"), 0); + histos.fill(HIST("FDD/hInvTimeCvsBC"), localBC); + } else { + histos.fill(HIST("FDD/hCountsTimeC"), 1); + histos.fill(HIST("FDD/hValidTimeCvsBC"), localBC); + } + + if (fdd.timeA() > 30 || fdd.timeC() > 30) { + histos.fill(HIST("FDD/hCountsTime"), 0); + histos.fill(HIST("FDD/hInvTimevsBC"), localBC); + } + if (fdd.timeA() < 30 && fdd.timeC() < 30) { + histos.fill(HIST("FDD/hCountsTime"), 1); + histos.fill(HIST("FDD/hValidTimevsBC"), localBC); + } + } } if (bcPatternE[localBC]) { histos.fill(HIST("FDD/timeACbcE"), fdd.timeA(), fdd.timeC()); @@ -368,15 +494,16 @@ struct lumiStabilityTask { deltaBC = 0; if (pastActivityFDDVertexCoincidences == false) { - histos.fill(HIST("FDD/hCounts"), 2); + histos.fill(HIST("FDD/hCounts"), 4); histos.fill(HIST("FDD/bcVertexTriggerCoincidencePP"), localBC); } if (pastActivityFDDTriggerACoincidenceA == false || pastActivityFDDTriggerCCoincidenceC == false) { - histos.fill(HIST("FDD/hCounts"), 3); + histos.fill(HIST("FDD/hCounts"), 5); histos.fill(HIST("FDD/bcVertexTriggerBothSidesCoincidencePP"), localBC); } } // coincidences - } // vertex true + + } // vertex true if (scentral) { histos.fill(HIST("FDD/bcSCentralTrigger"), localBC); @@ -405,7 +532,7 @@ struct lumiStabilityTask { histos.fill(HIST("FDD/bcVCTriggerCoincidence"), localBC); } } // vertex and scentral true - } // loop over FDD events + } // loop over FDD events for (auto const& ft0 : ft0s) { auto bc = ft0.bc_as(); @@ -425,7 +552,7 @@ struct lumiStabilityTask { histos.fill(HIST("FT0/hCounts"), 0); if (vertex) { histos.fill(HIST("FT0/bcVertexTrigger"), localBC); - histos.fill(HIST("hOrbitFT0"), orbit - minOrbit); + histos.fill(HIST("hOrbitFT0vertex"), orbit - minOrbit); if (bcPatternA[localBC]) { histos.fill(HIST("FT0/timeACbcA"), ft0.timeA(), ft0.timeC()); @@ -438,6 +565,33 @@ struct lumiStabilityTask { if (bcPatternB[localBC]) { histos.fill(HIST("FT0/timeACbcB"), ft0.timeA(), ft0.timeC()); histos.fill(HIST("FT0/hBcB"), localBC); + histos.fill(HIST("FT0/hTimeA"), ft0.timeA()); + histos.fill(HIST("FT0/hTimeC"), ft0.timeC()); + + if (ft0.timeA() > 30) { + histos.fill(HIST("FT0/hCountsTimeA"), 0); + histos.fill(HIST("FT0/hInvTimeAvsBC"), localBC); + } else { + histos.fill(HIST("FT0/hCountsTimeA"), 1); + histos.fill(HIST("FT0/hValidTimeAvsBC"), localBC); + } + + if (ft0.timeC() > 30) { + histos.fill(HIST("FT0/hCountsTimeC"), 0); + histos.fill(HIST("FT0/hInvTimeCvsBC"), localBC); + } else { + histos.fill(HIST("FT0/hCountsTimeC"), 1); + histos.fill(HIST("FT0/hValidTimeCvsBC"), localBC); + } + + if (ft0.timeA() > 30 || ft0.timeC() > 30) { + histos.fill(HIST("FT0/hCountsTime"), 0); + histos.fill(HIST("FT0/hInvTimevsBC"), localBC); + } + if (ft0.timeA() < 30 && ft0.timeC() < 30) { + histos.fill(HIST("FT0/hCountsTime"), 1); + histos.fill(HIST("FT0/hValidTimevsBC"), localBC); + } } if (bcPatternE[localBC]) { histos.fill(HIST("FT0/timeACbcE"), ft0.timeA(), ft0.timeC()); @@ -530,9 +684,26 @@ struct lumiStabilityTask { } if (aCen) { - histos.fill(HIST("hOrbitFV0"), orbit - minOrbit); + histos.fill(HIST("hOrbitFV0Central"), orbit - minOrbit); histos.fill(HIST("FV0/bcCenTrigger"), localBC); + if (bcPatternA[localBC]) { + histos.fill(HIST("FV0/timeAbcA"), fv0.time()); + histos.fill(HIST("FV0/hBcA"), localBC); + } + if (bcPatternC[localBC]) { + histos.fill(HIST("FV0/timeAbcC"), fv0.time()); + histos.fill(HIST("FV0/hBcC"), localBC); + } + if (bcPatternB[localBC]) { + histos.fill(HIST("FV0/timeAbcB"), fv0.time()); + histos.fill(HIST("FV0/hBcB"), localBC); + } + if (bcPatternE[localBC]) { + histos.fill(HIST("FV0/timeAbcE"), fv0.time()); + histos.fill(HIST("FV0/hBcE"), localBC); + } + int deltaIndex = 0; // backward move counts int deltaBC = 0; // current difference wrt globalBC bool pastActivityFV0Cen = false; @@ -607,9 +778,21 @@ struct lumiStabilityTask { } } } // loop over V0 events - } // end processMain + } // end processMain PROCESS_SWITCH(lumiStabilityTask, processMain, "Process FDD and FT0 to lumi stability analysis", true); + + void processCollisions(aod::Collision const& collision) + { + histos.fill(HIST("hvertexX"), collision.posX()); + histos.fill(HIST("hvertexY"), collision.posY()); + histos.fill(HIST("hvertexZ"), collision.posZ()); + histos.fill(HIST("hnumContrib"), collision.numContrib()); + histos.fill(HIST("hcollisinTime"), collision.collisionTime()); + histos.fill(HIST("hvertexXvsTime"), collision.posX(), collision.collisionTime()); + } + + PROCESS_SWITCH(lumiStabilityTask, processCollisions, "Process collision to get vertex position", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) 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/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 61778ff522e..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" @@ -42,6 +43,9 @@ #include "Framework/runDataProcessing.h" #include "ReconstructionDataFormats/GlobalTrackID.h" #include "ReconstructionDataFormats/Track.h" +#include "Index.h" +#include "Common/DataModel/PIDResponse.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" using namespace o2; using namespace o2::framework; @@ -57,6 +61,7 @@ using TrackMCTrueTable = aod::McParticles; using CollisionMCRecTable = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; +using v0trackcandidates = soa::Join; enum { kTrackTypebegin = 0, @@ -74,6 +79,19 @@ enum { kGenpTend }; +enum { + kSpeciesbegin = 0, + kSpPion = 1, + kSpKaon, + kSpProton, + kSpOther, + kSpStrangeDecay, + kBkg, + kSpNotPrimary, + kSpAll, + kSpeciesend +}; + static constexpr TrackSelectionFlags::flagtype trackSelectionITS = TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | TrackSelectionFlags::kITSHits; @@ -86,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"}; @@ -94,6 +112,9 @@ AxisSpec axisPhi2{629, 0, 2 * M_PI, "#phi"}; AxisSpec axisCent{100, 0, 100, "#Cent"}; AxisSpec AxisTrackType = {kTrackTypeend - 1, +kTrackTypebegin + 0.5, +kTrackTypeend - 0.5, "", "TrackTypeAxis"}; AxisSpec AxisGenpTVary = {kGenpTend - 1, +kGenpTbegin + 0.5, +kGenpTend - 0.5, "", "GenpTVaryAxis"}; +AxisSpec AxisSpecies = {kSpeciesend - 1, +kSpeciesbegin + 0.5, +kSpeciesend - 0.5, "", "SpeciesAxis"}; +AxisSpec AxisMassK0s = {200, 0.4, 0.6, "K0sMass", "K0sMass"}; +AxisSpec AxisMassLambda = {200, 1.07, 1.17, "Lambda/AntiLamda Mass", "Lambda/AntiLamda Mass"}; AxisSpec axisTracks{9, 0.5, 9.5, "#tracks", "TrackAxis"}; struct HeavyIonMultiplicity { @@ -105,6 +126,13 @@ struct HeavyIonMultiplicity { Configurable etaRange{"eta-range", 1.0f, "Eta range to consider"}; Configurable VtxRange{"vertex-range", 10.0f, "Vertex Z range to consider"}; Configurable dcaZ{"dcaZ", 0.2f, "Custom DCA Z cut (ignored if negative)"}; + Configurable v0radiusCut{"v0radiusCut", 1.2f, "RadiusCut"}; + Configurable dcapostopvCut{"dcapostopvCut", 0.05f, "dcapostopvCut"}; + Configurable dcanegtopvCut{"dcanegtopvCut", 0.05f, "dcanegtopvCut"}; + Configurable v0cospaCut{"v0cospaCut", 0.995f, "v0cospaCut"}; + Configurable dcav0daughtercut{"dcav0daughtercut", 1.0f, "dcav0daughtercut"}; + Configurable minTPCnClsCut{"minTPCnClsCut", 50.0f, "minTPCnClsCut"}; + Configurable NSigmaTPCcut{"NSigmaTPCcut", 5.0f, "NSigmaTPCcut"}; ConfigurableAxis multHistBin{"MultDistBinning", {501, -0.5, 500.5}, ""}; ConfigurableAxis PVHistBin{"PVDistBinning", {501, -0.5, 500.5}, ""}; ConfigurableAxis FV0AmultHistBin{"FV0AMultDistBinning", {501, -0.5, 500.5}, ""}; @@ -112,6 +140,7 @@ struct HeavyIonMultiplicity { ConfigurableAxis FT0CmultHistBin{"FT0CMultDistBinning", {501, -0.5, 500.5}, ""}; ConfigurableAxis pTHistBin{"pTHistBin", {200, 0., 20.}, ""}; ConfigurableAxis CentralityBinning{"CentralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; + ConfigurableAxis OccupancyBin{"OccupancyBin", {VARIABLE_WIDTH, 0, 500, 1000, 2000, 5000, 10000}, ""}; Configurable IsApplySameBunchPileup{"IsApplySameBunchPileup", true, "Enable SameBunchPileup cut"}; Configurable IsApplyGoodZvtxFT0vsPV{"IsApplyGoodZvtxFT0vsPV", true, "Enable GoodZvtxFT0vsPV cut"}; @@ -122,16 +151,19 @@ 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&) { - AxisSpec axisMult = {multHistBin}; - AxisSpec axisPV = {PVHistBin}; - AxisSpec axisFV0AMult = {FV0AmultHistBin}; - AxisSpec axisFT0AMult = {FT0AmultHistBin}; - AxisSpec axisFT0CMult = {FT0CmultHistBin}; + AxisSpec axisMult = {multHistBin, "Mult", "MultAxis"}; + AxisSpec axisPV = {PVHistBin, "PV", "PVAxis"}; + AxisSpec axisFV0AMult = {FV0AmultHistBin, "fv0a", "FV0AMultAxis"}; + AxisSpec axisFT0AMult = {FT0AmultHistBin, "ft0a", "FT0AMultAxis"}; + AxisSpec axisFT0CMult = {FT0CmultHistBin, "ft0c", "FT0CMultAxis"}; AxisSpec CentAxis = {CentralityBinning, "Centrality", "CentralityAxis"}; - AxisSpec axisPT = {pTHistBin}; + AxisSpec axisPT = {pTHistBin, "pT", "pTAxis"}; + AxisSpec axisOccupancy = {OccupancyBin, "occupancy", "OccupancyAxis"}; histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false); histos.add("VtxZHist", "VtxZHist", kTH1D, {axisVtxZ}, false); @@ -147,29 +179,30 @@ 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); - histos.add("CentHistInsideTrackloop", "CentHistInsideTrackloop", kTH1D, {axisCent}, false); histos.add("hdatamult", "hdatamult", kTHnSparseD, {axisVtxZ, axisMult, CentAxis}, false); - histos.add("hdatadndeta", "hdatadndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisEta, axisPhi, axisPT, AxisTrackType}, false); - histos.add("hdatazvtxcent", "hdatazvtxcent", kTH2D, {axisVtxZ, CentAxis}, false); - histos.add("PhiVsEtaHistBeforePhiCut", "PhiVsEtaHistBeforePhiCut", kTH2D, {axisPhi2, axisEta}, false); - histos.add("PhiVsEtaHistAfterPhiCut", "PhiVsEtaHistAfterPhiCut", kTH2D, {axisPhi2, axisEta}, false); + histos.add("hdatadndeta", "hdatadndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisOccupancy, axisEta, axisPhi, AxisTrackType}, false); + histos.add("hdatazvtxcent", "hdatazvtxcent", kTH3D, {axisVtxZ, CentAxis, axisOccupancy}, false); + histos.add("PhiVsEtaHist", "PhiVsEtaHist", kTH2D, {axisPhi2, axisEta}, false); } - if (doprocessMonteCarlo || doprocessMCpTefficiency || doprocessMCcheckFakeTracks) { + if (doprocessMonteCarlo || doprocessMCpTefficiency || doprocessMCcheckFakeTracks || doprocessMCfillspecies) { histos.add("CentPercentileMCRecHist", "CentPercentileMCRecHist", kTH1D, {axisCent}, false); - histos.add("hmczvtxcent", "hmczvtxcent", kTH2D, {axisVtxZ, CentAxis}, false); + histos.add("hmczvtxcent", "hmczvtxcent", kTH3D, {axisVtxZ, CentAxis, axisOccupancy}, false); } if (doprocessMonteCarlo) { - histos.add("MCCentHistInsideTrackloop", "MCCentHistInsideTrackloop", kTH1D, {axisCent}, false); - histos.add("MCrecPhiVsEtaHistBeforePhiCut", "MCrecPhiVsEtaHistBeforePhiCut", kTH2D, {axisPhi2, axisEta}, false); - histos.add("MCrecPhiVsEtaHistAfterPhiCut", "MCrecPhiVsEtaHistAfterPhiCut", kTH2D, {axisPhi2, axisEta}, false); - histos.add("hmcrecdndeta", "hmcrecdndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisEta, axisPhi}, false); + histos.add("MCrecPhiVsEtaHist", "MCrecPhiVsEtaHist", kTH2D, {axisPhi2, axisEta}, false); + histos.add("hmcrecdndeta", "hmcrecdndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisOccupancy, axisEta, axisPhi}, false); histos.add("hmcgendndeta", "hmcgendndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisEta, axisPhi, AxisGenpTVary}, false); - histos.add("hdndeta0_5", "hdndeta0_5", kTH1D, {axisEta}, false); + } + + if (doprocessMCfillspecies) { + histos.add("FillMCrecSpecies", "FillMCrecSpecies", kTHnSparseD, {CentAxis, axisOccupancy, axisEta, AxisSpecies}, false); + histos.add("FillMCgenSpecies", "FillMCgenSpecies", kTHnSparseD, {CentAxis, axisEta, AxisSpecies}, false); } if (doprocessMCpTefficiency) { @@ -195,8 +228,50 @@ struct HeavyIonMultiplicity { histos.add("GlobalMult_vs_FV0A", "GlobalMult_vs_FV0A", kTH2F, {axisMult, axisFV0AMult}, true); histos.add("NPVtracks_vs_GlobalMult", "NPVtracks_vs_GlobalMult", kTH2F, {axisPV, axisMult}, true); } + + if (doprocessStrangeYield) { + histos.add("hzvtxcent", "hzvtxcent", kTH2D, {axisVtxZ, CentAxis}, false); + histos.add("K0sCentEtaMass", "K0sCentEtaMass", kTH3D, {CentAxis, axisEta, AxisMassK0s}, false); + histos.add("LambdaCentEtaMass", "LambdaCentEtaMass", kTH3D, {CentAxis, axisEta, AxisMassLambda}, false); + histos.add("AntiLambdaCentEtaMass", "AntiLambdaCentEtaMass", kTH3D, {CentAxis, axisEta, AxisMassLambda}, false); + } } + template + bool IsTrackSelected(CheckTrack const& track) + { + if (std::abs(track.eta()) >= etaRange) { + return false; + } + if (IsApplyExtraPhiCut && ((track.phi() > 3.07666 && track.phi() < 3.12661) || track.phi() <= 0.03 || track.phi() >= 6.253)) { + return false; + } + return true; + } + template + bool IsGenTrackSelected(CheckGenTrack const& track) + { + if (!track.isPhysicalPrimary()) { + return false; + } + if (!track.producedByGenerator()) { + return false; + } + auto pdgTrack = pdg->GetParticle(track.pdgCode()); + if (pdgTrack == nullptr) { + return false; + } + if (std::abs(pdgTrack->Charge()) < 3) { + return false; + } + if (std::abs(track.eta()) >= etaRange) { + return false; + } + if (IsApplyExtraPhiCut && ((track.phi() > 3.07666 && track.phi() < 3.12661) || track.phi() <= 0.03 || track.phi() >= 6.253)) { + return false; + } + return true; + } template bool IsEventSelected(CheckCol const& col) { @@ -242,6 +317,10 @@ struct HeavyIonMultiplicity { } histos.fill(HIST("EventHist"), 9); + if (IsApplyNoCollInTimeRangeStandard && !col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { + return false; + } + histos.fill(HIST("EventHist"), 10); return true; } @@ -254,54 +333,42 @@ struct HeavyIonMultiplicity { void processData(CollisionDataTable::iterator const& collision, FilTrackDataTable const& tracks) { - if (!IsEventSelected(collision)) { return; } - histos.fill(HIST("VtxZHist"), collision.posZ()); histos.fill(HIST("CentPercentileHist"), collision.centFT0C()); - histos.fill(HIST("hdatazvtxcent"), collision.posZ(), collision.centFT0C()); + auto OccupancyValue = IsApplyFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange(); + histos.fill(HIST("hdatazvtxcent"), collision.posZ(), collision.centFT0C(), OccupancyValue); auto NchTracks = 0; for (auto& track : tracks) { - if (std::abs(track.eta()) >= etaRange) { + if (!IsTrackSelected(track)) { continue; } - histos.fill(HIST("PhiVsEtaHistBeforePhiCut"), track.phi(), track.eta()); - if (IsApplyExtraPhiCut) { - if ((track.phi() > 3.07666 && track.phi() < 3.12661) || track.phi() <= 0.03 || track.phi() >= 6.253) { - continue; - } - } - histos.fill(HIST("PhiVsEtaHistAfterPhiCut"), track.phi(), track.eta()); + histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); NchTracks++; - histos.fill(HIST("CentHistInsideTrackloop"), collision.centFT0C()); - histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), track.eta(), track.phi(), track.pt(), 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(), track.eta(), track.phi(), track.pt(), kGlobalonly); + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), OccupancyValue, track.eta(), track.phi(), kGlobalonly); } else { - histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), track.eta(), track.phi(), track.pt(), kITSonly); + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), OccupancyValue, track.eta(), track.phi(), kITSonly); } } histos.fill(HIST("hdatamult"), collision.posZ(), NchTracks, collision.centFT0C()); } - PROCESS_SWITCH(HeavyIonMultiplicity, processData, "process data CentFT0C", false); void processCorrelation(CollisionDataTable::iterator const& collision, FilTrackDataTable const& tracks) { - if (!IsEventSelected(collision)) { return; } - - if (std::abs(collision.posZ()) > VtxRange) { + if (std::abs(collision.posZ()) >= VtxRange) { return; } - histos.fill(HIST("VtxZHist"), collision.posZ()); + auto NchTracks = 0; for (auto& track : tracks) { if (std::abs(track.eta()) >= etaRange) { @@ -309,77 +376,39 @@ struct HeavyIonMultiplicity { } NchTracks++; } - histos.fill(HIST("GlobalMult_vs_FT0A"), NchTracks, collision.multFT0A()); histos.fill(HIST("GlobalMult_vs_FT0C"), NchTracks, collision.multFT0C()); histos.fill(HIST("NPVtracks_vs_FT0C"), collision.multNTracksPV(), collision.multFT0C()); histos.fill(HIST("GlobalMult_vs_FV0A"), NchTracks, collision.multFV0A()); histos.fill(HIST("NPVtracks_vs_GlobalMult"), collision.multNTracksPV(), NchTracks); } - PROCESS_SWITCH(HeavyIonMultiplicity, processCorrelation, "do correlation study in data", false); void processMonteCarlo(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { - for (auto& RecCollision : RecCollisions) { - if (!IsEventSelected(RecCollision)) { continue; } - histos.fill(HIST("VtxZHist"), RecCollision.posZ()); histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C()); + 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) { - if (std::abs(Rectrack.eta()) >= etaRange) { + if (!IsTrackSelected(Rectrack)) { continue; } - histos.fill(HIST("MCrecPhiVsEtaHistBeforePhiCut"), Rectrack.phi(), Rectrack.eta()); - if (IsApplyExtraPhiCut) { - if ((Rectrack.phi() > 3.07666 && Rectrack.phi() < 3.12661) || Rectrack.phi() <= 0.03 || Rectrack.phi() >= 6.253) { - continue; - } - } - histos.fill(HIST("MCrecPhiVsEtaHistAfterPhiCut"), Rectrack.phi(), Rectrack.eta()); - histos.fill(HIST("MCCentHistInsideTrackloop"), RecCollision.centFT0C()); - histos.fill(HIST("hmcrecdndeta"), RecCollision.posZ(), RecCollision.centFT0C(), Rectrack.eta(), Rectrack.phi()); - if (RecCollision.centFT0C() >= 0 && RecCollision.centFT0C() < 5.0) { - histos.fill(HIST("hdndeta0_5"), Rectrack.eta()); - } + histos.fill(HIST("MCrecPhiVsEtaHist"), Rectrack.phi(), Rectrack.eta()); + histos.fill(HIST("hmcrecdndeta"), RecCollision.posZ(), RecCollision.centFT0C(), OccupancyValue, Rectrack.eta(), Rectrack.phi()); } // track (mcrec) loop for (auto& particle : GenParticles) { - - if (!particle.isPhysicalPrimary()) { + if (!IsGenTrackSelected(particle)) { continue; } - - if (!particle.producedByGenerator()) { - continue; - } - - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle == nullptr) { - continue; - } - - if (std::abs(pdgParticle->Charge()) < 3) { - continue; - } - - if (std::abs(particle.eta()) >= etaRange) { - continue; - } - if (IsApplyExtraPhiCut) { - if ((particle.phi() > 3.07666 && particle.phi() < 3.12661) || particle.phi() <= 0.03 || particle.phi() >= 6.253) { - continue; - } - } histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kNoGenpTVar); - if (particle.pt() < 0.1) { histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kGenpTup, -10.0 * particle.pt() + 2); histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kGenpTdown, 5.0 * particle.pt() + 0.5); @@ -388,27 +417,23 @@ struct HeavyIonMultiplicity { histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kGenpTdown); } } // track (mcgen) loop - } // collision loop + } // collision loop } - PROCESS_SWITCH(HeavyIonMultiplicity, processMonteCarlo, "process MC CentFT0C", false); void processMCpTefficiency(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { - for (auto& RecCollision : RecCollisions) { - if (!IsEventSelected(RecCollision)) { continue; } - - if (std::abs(RecCollision.posZ()) > VtxRange) { + if (std::abs(RecCollision.posZ()) >= VtxRange) { continue; } - histos.fill(HIST("VtxZHist"), RecCollision.posZ()); histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C()); + 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) { @@ -424,25 +449,7 @@ struct HeavyIonMultiplicity { } for (auto& particle : GenParticles) { - - if (!particle.isPhysicalPrimary()) { - continue; - } - - if (!particle.producedByGenerator()) { - continue; - } - - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle == nullptr) { - continue; - } - - if (std::abs(pdgParticle->Charge()) < 3) { - continue; - } - - if (std::abs(particle.eta()) >= etaRange) { + if (!IsGenTrackSelected(particle)) { continue; } histos.fill(HIST("hmcgendndpt"), RecCollision.centFT0C(), particle.pt(), kNoGenpTVar); @@ -456,25 +463,21 @@ struct HeavyIonMultiplicity { } } } - PROCESS_SWITCH(HeavyIonMultiplicity, processMCpTefficiency, "process MC pTefficiency", false); void processMCcheckFakeTracks(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCollisions, FilTrackMCRecTable const& RecTracks) { - for (auto& RecCollision : RecCollisions) { - if (!IsEventSelected(RecCollision)) { continue; } - - if (std::abs(RecCollision.posZ()) > VtxRange) { + if (std::abs(RecCollision.posZ()) >= VtxRange) { continue; } - histos.fill(HIST("VtxZHist"), RecCollision.posZ()); histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C()); + 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) { @@ -500,8 +503,134 @@ struct HeavyIonMultiplicity { } } } - PROCESS_SWITCH(HeavyIonMultiplicity, processMCcheckFakeTracks, "Check Fake tracks", false); + + void processMCfillspecies(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + { + for (auto& RecCollision : RecCollisions) { + if (!IsEventSelected(RecCollision)) { + continue; + } + if (std::abs(RecCollision.posZ()) >= VtxRange) { + continue; + } + histos.fill(HIST("VtxZHist"), RecCollision.posZ()); + histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); + 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; + for (auto& Rectrack : Rectrackspart) { + if (!IsTrackSelected(Rectrack)) { + continue; + } + 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(); + if (mcpart.isPhysicalPrimary()) { + switch (std::abs(mcpart.pdgCode())) { + case 211: + pid = kSpPion; + break; + case 321: + pid = kSpKaon; + break; + case 2212: + pid = kSpProton; + break; + default: + pid = kSpOther; + break; + } + } else { + pid = kSpNotPrimary; + } + if (mcpart.has_mothers()) { + auto mcpartMother = mcpart.template mothers_as().front(); + if (mcpartMother.pdgCode() == 310 || std::abs(mcpartMother.pdgCode()) == 3122) { + pid = kSpStrangeDecay; + } + } + if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) { + pid = kBkg; + } + mclabels.push_back(Rectrack.mcParticleId()); + histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), OccupancyValue, Rectrack.eta(), Double_t(pid)); + } else { + histos.fill(HIST("FillMCrecSpecies"), RecCollision.centFT0C(), OccupancyValue, Rectrack.eta(), Double_t(kBkg)); + } + } // rec track loop + + for (auto& particle : GenParticles) { + if (!IsGenTrackSelected(particle)) { + continue; + } + histos.fill(HIST("FillMCgenSpecies"), RecCollision.centFT0C(), particle.eta(), Double_t(kSpAll)); + Int_t pid = 0; + switch (std::abs(particle.pdgCode())) { + case 211: + pid = kSpPion; + break; + case 321: + pid = kSpKaon; + break; + case 2212: + pid = kSpProton; + break; + default: + pid = kSpOther; + break; + } + histos.fill(HIST("FillMCgenSpecies"), RecCollision.centFT0C(), particle.eta(), Double_t(pid)); + } // gen track loop + } // collision loop + } + PROCESS_SWITCH(HeavyIonMultiplicity, processMCfillspecies, "Fill particle species in MC", false); + + void processStrangeYield(CollisionDataTable::iterator const& collision, v0trackcandidates const&, aod::V0Datas const& v0data) + { + if (!IsEventSelected(collision)) { + return; + } + if (std::abs(collision.posZ()) >= VtxRange) { + return; + } + histos.fill(HIST("hzvtxcent"), collision.posZ(), collision.centFT0C()); + for (auto& v0track : v0data) { + auto v0pTrack = v0track.template posTrack_as(); + auto v0nTrack = v0track.template negTrack_as(); + if (std::abs(v0pTrack.eta()) > 0.9 || std::abs(v0nTrack.eta()) > 0.9) { + continue; + } + if (v0pTrack.tpcNClsFound() < minTPCnClsCut) { + continue; + } + if (v0nTrack.tpcNClsFound() < minTPCnClsCut) { + continue; + } + if (std::abs(v0pTrack.tpcNSigmaPi()) > NSigmaTPCcut) { + continue; + } + if (std::abs(v0nTrack.tpcNSigmaPi()) > NSigmaTPCcut) { + continue; + } + if (std::abs(v0pTrack.tpcNSigmaPr()) > NSigmaTPCcut) { + continue; + } + if (std::abs(v0nTrack.tpcNSigmaPr()) > NSigmaTPCcut) { + continue; + } + if (std::abs(v0track.dcapostopv()) < dcapostopvCut || std::abs(v0track.dcanegtopv()) < dcanegtopvCut || v0track.v0radius() < v0radiusCut || v0track.v0cosPA() < v0cospaCut || std::abs(v0track.dcaV0daughters()) > dcav0daughtercut) { + continue; + } + histos.fill(HIST("K0sCentEtaMass"), collision.centFT0C(), v0track.eta(), v0track.mK0Short()); + histos.fill(HIST("LambdaCentEtaMass"), collision.centFT0C(), v0track.eta(), v0track.mLambda()); + histos.fill(HIST("AntiLambdaCentEtaMass"), collision.centFT0C(), v0track.eta(), v0track.mAntiLambda()); + } + } + PROCESS_SWITCH(HeavyIonMultiplicity, processStrangeYield, "Strange particle yield", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGMM/UE/Tasks/CMakeLists.txt b/PWGMM/UE/Tasks/CMakeLists.txt index 19a0ecba60a..9bfee98cbbb 100644 --- a/PWGMM/UE/Tasks/CMakeLists.txt +++ b/PWGMM/UE/Tasks/CMakeLists.txt @@ -18,8 +18,3 @@ o2physics_add_dpl_workflow(ue-zdc-analysis SOURCES ue-zdc-analysys.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) - -o2physics_add_dpl_workflow(ue-lambdak0sflattenicity - SOURCES lambdak0sflattenicity.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore - COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/PWGMM/UE/Tasks/lambdak0sflattenicity.cxx b/PWGMM/UE/Tasks/lambdak0sflattenicity.cxx deleted file mode 100755 index f949a2fbed4..00000000000 --- a/PWGMM/UE/Tasks/lambdak0sflattenicity.cxx +++ /dev/null @@ -1,1051 +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. -/// -/// 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) - -#include -#include - -#include "Framework/ASoAHelpers.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.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/DataModel/EventSelection.h" -#include "Common/DataModel/Multiplicity.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include - -#include "PWGLF/DataModel/LFStrangenessTables.h" -#include "Common/DataModel/PIDResponse.h" - -using namespace o2; -using namespace o2::framework; -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}; - - static constexpr std::string_view nhEst[8] = { - "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"}; - static constexpr std::string_view nhPtEst[8] = { - "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 nBinspT{"nBinspT", 250, "N bins in pT"}; - - // Configurable for event selection - Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; - - // Configurables for Flattenicity - Configurable applyCalibCh{"applyCalibCh", false, "equalize FV0"}; - Configurable applyCalibVtx{"applyCalibVtx", false, "equalize FV0 vs vtx"}; - Configurable applyNorm{"applyNorm", false, "normalization to eta"}; - - // 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 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 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 parameters for PID selection - Configurable NSigmaTPCPion{"NSigmaTPCPion", 5, "NSigmaTPCPion"}; - Configurable NSigmaTPCProton{"NSigmaTPCProton", 5, "NSigmaTPCProton"}; - - // 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 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 vertexZAxis = {nBinsVz, -15., 15., "vrtx_{Z} [cm]"}; - AxisSpec ptAxis = {nBinspT, 0.0f, 25.0f, "#it{p}_{T} (GeV/#it{c})"}; - - 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}; - float upEdgeEst[8] = {99.5, 49999.5, 1.01, 499.5, 1.01, 499.5, 1.01, 150.0}; - - // 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}}}); - - if (doprocessGenMC) { - rEventSelection.add("hVertexZGen", "hVertexZGen", {HistType::kTH1F, {vertexZAxis}}); - rEventSelection.add("hEventSelectionMCGen", "hEventSelectionMCGen", {HistType::kTH1F, {{11, -0.5, 10.5}}}); - } - // K0s reconstruction - // Mass - rKzeroShort.add("hMassK0s", "hMassK0s", {HistType::kTH1F, {K0sMassAxis}}); - rKzeroShort.add("hMassK0sSelected", "hMassK0sSelected", {HistType::kTH1F, {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}}}); - - if (doprocessGenMC) { - rKzeroShort.add("hPtK0ShortGen", "hPtK0ShortGen", {HistType::kTH1F, {ptAxis}}); - rKzeroShort.add("K0sCounterMCGen", "K0sCounterMCGen", {HistType::kTH1F, {{10, 0, 10}}}); - } - // Lambda reconstruction - // Mass - rLambda.add("hMassLambda", "hMassLambda", {HistType::kTH1F, {LambdaMassAxis}}); - rLambda.add("hMassLambdaSelected", "hMassLambdaSelected", {HistType::kTH1F, {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}}}); - - if (doprocessGenMC) { - rLambda.add("hPtLambdaGen", "hPtLambdaGen", {HistType::kTH1F, {ptAxis}}); - rLambda.add("LambdaCounterMCGen", "LambdaCounterMCGen", {HistType::kTH1F, {{10, 0, 10}}}); - } - // AntiLambda reconstruction - // Mass - rAntiLambda.add("hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {AntiLambdaMassAxis}}); - rAntiLambda.add("hMassAntiLambdaSelected", "hMassAntiLambdaSelected", {HistType::kTH1F, {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}}}); - } - - 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"}}); - } - - // 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("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"}}); - - 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("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("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("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("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"}}); - - 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"); - } - if (!doprocessDataRun3 && !(doprocessRecMC || doprocessGenMC)) { - 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"); - } - } - - int getT0ASector(int i_ch) - { - int i_sec_t0a = -1; - for (int i_sec = 0; i_sec < 24; ++i_sec) { - if (i_ch >= 4 * i_sec && i_ch <= 3 + 4 * i_sec) { - i_sec_t0a = i_sec; - break; - } - } - return i_sec_t0a; - } - - int getT0CSector(int i_ch) - { - int i_sec_t0c = -1; - for (int i_sec = 0; i_sec < 28; ++i_sec) { - if (i_ch >= 4 * i_sec && i_ch <= 3 + 4 * i_sec) { - i_sec_t0c = i_sec; - break; - } - } - return i_sec_t0c; - } - - int getFV0Ring(int i_ch) - { - int i_ring = -1; - if (i_ch < 8) { - i_ring = 0; - } else if (i_ch >= 8 && i_ch < 16) { - i_ring = 1; - } else if (i_ch >= 16 && i_ch < 24) { - i_ring = 2; - } else if (i_ch >= 24 && i_ch < 32) { - i_ring = 3; - } else { - i_ring = 4; - } - return i_ring; - } - - int getFV0IndexPhi(int i_ch) - { - int i_ring = -1; - - if (i_ch >= 0 && i_ch < 8) { - if (i_ch < 4) { - i_ring = i_ch; - } else { - if (i_ch == 7) { - i_ring = 4; - } else if (i_ch == 6) { - i_ring = 5; - } else if (i_ch == 5) { - i_ring = 6; - } else if (i_ch == 4) { - i_ring = 7; - } - } - } else if (i_ch >= 8 && i_ch < 16) { - if (i_ch < 12) { - i_ring = i_ch; - } else { - if (i_ch == 15) { - i_ring = 12; - } else if (i_ch == 14) { - i_ring = 13; - } else if (i_ch == 13) { - i_ring = 14; - } else if (i_ch == 12) { - i_ring = 15; - } - } - } else if (i_ch >= 16 && i_ch < 24) { - if (i_ch < 20) { - i_ring = i_ch; - } else { - if (i_ch == 23) { - i_ring = 20; - } else if (i_ch == 22) { - i_ring = 21; - } else if (i_ch == 21) { - i_ring = 22; - } else if (i_ch == 20) { - i_ring = 23; - } - } - } else if (i_ch >= 24 && i_ch < 32) { - if (i_ch < 28) { - i_ring = i_ch; - } else { - if (i_ch == 31) { - i_ring = 28; - } else if (i_ch == 30) { - i_ring = 29; - } else if (i_ch == 29) { - i_ring = 30; - } else if (i_ch == 28) { - i_ring = 31; - } - } - } else if (i_ch == 32) { - i_ring = 32; - } else if (i_ch == 40) { - i_ring = 33; - } else if (i_ch == 33) { - i_ring = 34; - } else if (i_ch == 41) { - i_ring = 35; - } else if (i_ch == 34) { - i_ring = 36; - } else if (i_ch == 42) { - i_ring = 37; - } else if (i_ch == 35) { - i_ring = 38; - } else if (i_ch == 43) { - i_ring = 39; - } else if (i_ch == 47) { - i_ring = 40; - } else if (i_ch == 39) { - i_ring = 41; - } else if (i_ch == 46) { - i_ring = 42; - } else if (i_ch == 38) { - i_ring = 43; - } else if (i_ch == 45) { - i_ring = 44; - } else if (i_ch == 37) { - i_ring = 45; - } else if (i_ch == 44) { - i_ring = 46; - } else if (i_ch == 36) { - i_ring = 47; - } - return i_ring; - } - - float GetFlatenicity(std::span signals) - { - int entries = signals.size(); - float flat = 9999; - float mRho = 0; - for (int iCell = 0; iCell < entries; ++iCell) { - mRho += 1.0 * signals[iCell]; - } - // average activity per cell - mRho /= (1.0 * entries); - // get sigma - float sRho_tmp = 0; - for (int iCell = 0; iCell < entries; ++iCell) { - sRho_tmp += TMath::Power(1.0 * signals[iCell] - mRho, 2); - } - sRho_tmp /= (1.0 * entries * entries); - float sRho = TMath::Sqrt(sRho_tmp); - if (mRho > 0) { - flat = sRho / mRho; - } - return flat; - } - 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}; - // 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}; - // 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}; - // 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}; - - // 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}; - // 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}; - // 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 int nEta5 = 2; // FT0C + FT0A - static constexpr float weigthsEta5[nEta5] = {0.0490638, 0.010958415}; - static constexpr float deltaEeta5[nEta5] = {1.1, 1.2}; - - static constexpr int nEta6 = 2; // FT0C + FV0 - static constexpr float weigthsEta6[nEta6] = {0.0490638, 0.00353962}; - static constexpr float deltaEeta6[nEta6] = {1.1, 2.9}; - - static constexpr int innerFV0 = 32; - static constexpr float maxEtaFV0 = 5.1; - static constexpr float minEtaFV0 = 2.2; - static constexpr float detaFV0 = (maxEtaFV0 - minEtaFV0) / 5.0; - - static constexpr int nCells = 48; // 48 sectors in FV0 - std::array RhoLattice; - std::array ampchannel; - std::array ampchannelBefore; - static constexpr int nCellsT0A = 24; - std::array RhoLatticeT0A; - static constexpr int nCellsT0C = 28; - std::array RhoLatticeT0C; - - std::array estimator; - - template - bool isEventSelected(TCollision const& collision) - { - rEventSelection.fill(HIST("hEventsSelected"), 0); - - if (collision.isInelGt0() == false) { - rEventSelection.fill(HIST("hEventsRejected"), 1); - return false; - } - rEventSelection.fill(HIST("hEventsSelected"), 1); - - if (!collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { - rEventSelection.fill(HIST("hEventsRejected"), 2); - return false; - } - rEventSelection.fill(HIST("hEventsSelected"), 2); - - if (!collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) { - rEventSelection.fill(HIST("hEventsRejected"), 3); - return false; - } - rEventSelection.fill(HIST("hEventsSelected"), 3); - - if (!collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - rEventSelection.fill(HIST("hEventsRejected"), 4); - return false; - } - rEventSelection.fill(HIST("hEventsSelected"), 4); - - if (!collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - rEventSelection.fill(HIST("hEventsRejected"), 5); - return false; - } - rEventSelection.fill(HIST("hEventsSelected"), 5); - - if (!collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - rEventSelection.fill(HIST("hEventsRejected"), 6); - return false; - } - rEventSelection.fill(HIST("hEventsSelected"), 6); - - return true; - } - - // ============== Flattenicity estimation begins ===================== // - template - void EstimateFlattenicity(TCollision const& collision, Tracks const& tracks) - { - const int nDetVtx = 3; - TGraph* gVtx[nDetVtx]; - const char* nameDet[nDetVtx] = {"AmpV0", "AmpT0A", "AmpT0C"}; - - float ampl5[nEta5] = {0, 0}; - float ampl6[nEta6] = {0, 0}; - - for (int i_d = 0; i_d < nDetVtx; ++i_d) { - gVtx[i_d] = 0; - gVtx[i_d] = new TGraph(); - } - for (int i_v = 0; i_v < 30; ++i_v) { - gVtx[0]->SetPoint(i_v, biningVtxt[i_v], calibFV0vtx[i_v]); - } - for (int i_v = 0; i_v < 30; ++i_v) { - gVtx[1]->SetPoint(i_v, biningVtxt[i_v], calibFT0Avtx[i_v]); - } - for (int i_v = 0; i_v < 30; ++i_v) { - gVtx[2]->SetPoint(i_v, biningVtxt[i_v], calibFT0Cvtx[i_v]); - } - - for (int i_d = 0; i_d < nDetVtx; ++i_d) { - gVtx[i_d]->SetName(Form("g%s", nameDet[i_d])); - } - auto vtxZ = collision.posZ(); - - float sumAmpFV0 = 0; - float sumAmpFV01to4Ch = 0; - - ampchannel.fill(0.0); - ampchannelBefore.fill(0.0); - RhoLattice.fill(0); - - if (collision.has_foundFV0()) { - - auto fv0 = collision.foundFV0(); - for (std::size_t ich = 0; ich < fv0.amplitude().size(); ich++) { - float phiv0 = -999.0; - float etav0 = -999.0; - int channelv0 = fv0.channel()[ich]; - float ampl_ch = fv0.amplitude()[ich]; - int ringindex = getFV0Ring(channelv0); - int channelv0phi = getFV0IndexPhi(channelv0); - etav0 = maxEtaFV0 - (detaFV0 / 2.0) * (2.0 * ringindex + 1); - if (channelv0 < innerFV0) { - phiv0 = (2.0 * (channelv0phi - 8 * ringindex) + 1) * M_PI / (8.0); - } else { - phiv0 = ((2.0 * channelv0phi) + 1 - 64.0) * 2.0 * M_PI / (32.0); - } - ampchannelBefore[channelv0phi] = ampl_ch; - if (applyCalibCh) { - ampl_ch *= calib[channelv0phi]; - } - sumAmpFV0 += ampl_ch; - - if (channelv0 >= 8) { // exclude the 1st ch, eta 2.2,4.52 - sumAmpFV01to4Ch += ampl_ch; - } - rFlattenicity.fill(HIST("fEtaPhiFv0"), phiv0, etav0, ampl_ch); - ampchannel[channelv0phi] = ampl_ch; - if (channelv0 < innerFV0) { - RhoLattice[channelv0phi] = ampl_ch; - } else { - RhoLattice[channelv0phi] = ampl_ch / 2.0; // two channels per bin - } - } - - rFlattenicity.fill(HIST("hAmpV0vsVtxBeforeCalibration"), vtxZ, sumAmpFV0); - if (applyCalibVtx) { - sumAmpFV0 *= gVtx[0]->Eval(vtxZ); - sumAmpFV01to4Ch *= gVtx[0]->Eval(vtxZ); - } - rFlattenicity.fill(HIST("hAmpV0vsVtx"), vtxZ, sumAmpFV0); - } - - float flattenicityfv0 = 9999; - flattenicityfv0 = GetFlatenicity({RhoLattice.data(), RhoLattice.size()}); - - // global tracks - float ptT = 0.; - int multGlob = 0; - for (auto& track : tracks) { - if (!track.isGlobalTrack()) { - continue; - } - if (track.pt() > ptT) { - ptT = track.pt(); - } - multGlob++; - } - - // FT0 - float sumAmpFT0A = 0.f; - float sumAmpFT0C = 0.f; - - RhoLatticeT0A.fill(0); - RhoLatticeT0C.fill(0); - - if (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]; - } - 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++) { - float amplitude = ft0.amplitudeC()[i_c]; - sumAmpFT0C += amplitude; - uint8_t channel = ft0.channelC()[i_c]; - int sector = getT0CSector(channel); - if (sector >= 0 && sector < 28) { - RhoLatticeT0C[sector] += amplitude; - rFlattenicity.fill(HIST("hAmpT0CVsChBeforeCalibration"), sector, amplitude); - if (applyCalibCh) { - amplitude *= calibT0C[sector]; - } - rFlattenicity.fill(HIST("hAmpT0CVsCh"), sector, amplitude); - } - rFlattenicity.fill(HIST("hFT0C"), amplitude); - } - - 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); - } - float flatenicity_t0a = 9999; - flatenicity_t0a = GetFlatenicity({RhoLatticeT0A.data(), RhoLatticeT0A.size()}); - float flatenicity_t0c = 9999; - flatenicity_t0c = GetFlatenicity({RhoLatticeT0C.data(), RhoLatticeT0C.size()}); - - bool isOK_estimator5 = false; - bool isOK_estimator6 = false; - float combined_estimator5 = 0; - float combined_estimator6 = 0; - - for (int i_e = 0; i_e < 8; ++i_e) { - estimator[i_e] = 0; - } - - if (collision.has_foundFV0() && collision.has_foundFT0()) { - float all_weights = 0; - // option 5 - ampl5[0] = sumAmpFT0C; - ampl5[1] = sumAmpFT0A; - if (sumAmpFT0C > 0 && sumAmpFT0A > 0) { - isOK_estimator5 = true; - } - if (isOK_estimator5) { - if (applyNorm) { - all_weights = 0; - for (int i_5 = 0; i_5 < nEta5; ++i_5) { - combined_estimator5 += - ampl5[i_5] * weigthsEta5[i_5] / deltaEeta5[i_5]; - all_weights += weigthsEta5[i_5]; - } - combined_estimator5 /= all_weights; - } else { - for (int i_5 = 0; i_5 < nEta5; ++i_5) { - combined_estimator5 += ampl5[i_5] * weigthsEta5[i_5]; - } - } - } - // option 6: FT0C + FV0 - ampl6[0] = sumAmpFT0C; - ampl6[1] = sumAmpFV0; - if (sumAmpFT0C > 0 && sumAmpFV0 > 0) { - isOK_estimator6 = true; - } - if (isOK_estimator6) { - if (applyNorm) { - all_weights = 0; - for (int i_6 = 0; i_6 < nEta6; ++i_6) { - combined_estimator6 += - ampl6[i_6] * weigthsEta6[i_6] / deltaEeta6[i_6]; - all_weights += weigthsEta6[i_6]; - } - combined_estimator6 /= all_weights; - } else { - for (int i_6 = 0; i_6 < nEta6; ++i_6) { - combined_estimator6 += ampl6[i_6] * weigthsEta6[i_6]; - } - } - } - 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; - estimator[3] = combined_estimator5; - float flatenicity_ft0 = (flatenicity_t0a + flatenicity_t0c) / 2.0; - estimator[4] = 1.0 - flatenicity_ft0; - estimator[5] = combined_estimator6; - float flatenicity_ft0v0 = 0.5 * flattenicityfv0 + 0.5 * flatenicity_t0c; - estimator[6] = 1.0 - flatenicity_ft0v0; - estimator[7] = ptT; - - 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); - } - - for (int iCh = 0; iCh < 48; ++iCh) { - rFlattenicity.fill(HIST("hAmpV0VsCh"), iCh, ampchannel[iCh]); - rFlattenicity.fill(HIST("hAmpV0VsChBeforeCalibration"), iCh, - ampchannelBefore[iCh]); - } - rFlattenicity.fill(HIST("fMultFv0"), sumAmpFV0); - rFlattenicity.fill(HIST("hFlatFT0CvsFlatFT0A"), flatenicity_t0c, flatenicity_t0a); - } - } - // ====================== 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 - 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>; - - 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*/) - { - if (!(isEventSelected(collision))) { // Checking if the event passes the selection criteria - return; - } - - auto vtxZ = collision.posZ(); - auto vtxY = collision.posY(); - auto vtxX = collision.posX(); - - EstimateFlattenicity(collision, tracks); - - rEventSelection.fill(HIST("hVertexZ"), vtxZ); - - 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) { - continue; - } - 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; - - // 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) { - - 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()); - } - } - - // 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) { - - 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()); - } - } - - // 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) { - - 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()); - } - } - } - } - - 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&) - { - if (!(isEventSelected(collision))) { // Checking if the event passes the selection criteria - return; - } - - auto vtxZ = collision.posZ(); - auto vtxY = collision.posY(); - auto vtxX = collision.posX(); - - EstimateFlattenicity(collision, tracks); - - rEventSelection.fill(HIST("hVertexZ"), vtxZ); - - for (const auto& v0 : V0s) { - - const auto& posDaughterTrack = v0.posTrack_as(); - const auto& negDaughterTrack = v0.negTrack_as(); - - if (!posDaughterTrack.has_mcParticle() || !negDaughterTrack.has_mcParticle()) { - continue; - } - if (TMath::Abs(posDaughterTrack.eta()) > 0.8 || TMath::Abs(negDaughterTrack.eta()) > 0.8) { - continue; - } - - auto mcnegtrack = negDaughterTrack.mcParticle_as(); - auto mcpostrack = posDaughterTrack.mcParticle_as(); - - 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; - - // Cut on dynamic columns for K0s - - 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()); - } - } - - // 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()); - } - } - - // 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()); - } - } - } - } - } - } - } - - // Filter posZFilterMC = (nabs(o2::aod::mccollision::posZ) < cutzvertex); - 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; - // } - - std::vector SelectedEvents(collisions.size()); - int nevts = 0; - for (const auto& collision : collisions) { - if (!collision.sel8()) { - continue; - } - SelectedEvents[nevts++] = collision.mcCollision_as().globalIndex(); - } - SelectedEvents.resize(nevts); - - const auto evtReconstructedAndSelected = std::find(SelectedEvents.begin(), SelectedEvents.end(), mcCollision.globalIndex()) != SelectedEvents.end(); - - rEventSelection.fill(HIST("hEventSelectionMCGen"), 0); - - if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection - return; - } - rEventSelection.fill(HIST("hEventSelectionMCGen"), 1); // hSelAndRecoMcCollCounter - - if (abs(mcCollision.posZ()) > cutzvertex) { // 10cm - return; - } - rEventSelection.fill(HIST("hEventSelectionMCGen"), 2); - - rEventSelection.fill(HIST("hVertexZGen"), mcCollision.posZ()); - - for (const auto& mcParticle : mcParticles) { - - if (mcParticle.isPhysicalPrimary() && mcParticle.y() < 0.5) { - if (!mcParticle.has_daughters()) { - 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); - } - } - } - } - - 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); - } - } - } - } - - 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); - } - } - } - } - } - } - } - - 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)}; -} 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/UDHelpers.h b/PWGUD/Core/UDHelpers.h index 32349280419..6c77b28f007 100644 --- a/PWGUD/Core/UDHelpers.h +++ b/PWGUD/Core/UDHelpers.h @@ -101,29 +101,31 @@ float rPVtrwTOF(TCs tracks, int nPVTracks) // true BC. // template -T compatibleBCs(uint64_t meanBC, int deltaBC, T const& bcs); +T compatibleBCs(uint64_t const& meanBC, int const& deltaBC, T const& bcs); -template -T compatibleBCs(I& bcIter, uint64_t meanBC, int deltaBC, T const& bcs); +template +T compatibleBCs(B const& bc, uint64_t const& meanBC, int const& deltaBC, T const& bcs); // In this variant of compatibleBCs the bcIter is ideally placed within // [minBC, maxBC], but it does not need to be. The range is given by meanBC +- delatBC. -template -T compatibleBCs(I& bcIter, uint64_t meanBC, int deltaBC, T const& bcs) +template +T compatibleBCs(B const& bc, uint64_t const& meanBC, int const& deltaBC, T const& bcs) { + // get BCs iterator + auto bcIter = bcs.iteratorAt(bc.globalIndex()); + // range of BCs to consider uint64_t minBC = (uint64_t)deltaBC < meanBC ? meanBC - (uint64_t)deltaBC : 0; uint64_t maxBC = meanBC + (uint64_t)deltaBC; - LOGF(debug, " minBC %d maxBC %d bcIterator %d (%d)", minBC, maxBC, bcIter.globalBC(), bcIter.globalIndex()); + LOGF(debug, " minBC %d maxBC %d bcIterator %d (%d) #BCs %d", minBC, maxBC, bcIter.globalBC(), bcIter.globalIndex(), bcs.size()); // check [min,max]BC to overlap with [bcs.iteratorAt([0,bcs.size() - 1]) if (maxBC < bcs.iteratorAt(0).globalBC() || minBC > bcs.iteratorAt(bcs.size() - 1).globalBC()) { - LOGF(debug, " No overlap of [%d, %d] and [%d, %d]", minBC, maxBC, bcs.iteratorAt(0).globalBC(), bcs.iteratorAt(bcs.size() - 1).globalBC()); + LOGF(info, " No overlap of [%d, %d] and [%d, %d]", minBC, maxBC, bcs.iteratorAt(0).globalBC(), bcs.iteratorAt(bcs.size() - 1).globalBC()); return T{{bcs.asArrowTable()->Slice(0, 0)}, (uint64_t)0}; } // find slice of BCs table with BC in [minBC, maxBC] - int moveCount = 0; int64_t minBCId = bcIter.globalIndex(); int64_t maxBCId = bcIter.globalIndex(); @@ -131,14 +133,12 @@ T compatibleBCs(I& bcIter, uint64_t meanBC, int deltaBC, T const& bcs) if (bcIter.globalBC() < minBC) { while (bcIter != bcs.end() && bcIter.globalBC() < minBC) { ++bcIter; - ++moveCount; minBCId = bcIter.globalIndex(); } } else { while (bcIter.globalIndex() > 0 && bcIter.globalBC() >= minBC) { minBCId = bcIter.globalIndex(); --bcIter; - --moveCount; } } @@ -147,26 +147,19 @@ T compatibleBCs(I& bcIter, uint64_t meanBC, int deltaBC, T const& bcs) while (bcIter != bcs.end() && bcIter.globalBC() <= maxBC) { maxBCId = bcIter.globalIndex(); ++bcIter; - ++moveCount; } - } else { while (bcIter.globalIndex() > 0 && bcIter.globalBC() > maxBC) { --bcIter; - --moveCount; maxBCId = bcIter.globalIndex(); } } - LOGF(debug, " BC range: %d - %d", minBCId, maxBCId); - - // reset bcIter - bcIter.moveByIndex(-moveCount); // create bc slice - T slice{{bcs.asArrowTable()->Slice(minBCId, maxBCId - minBCId + 1)}, (uint64_t)minBCId}; - bcs.copyIndexBindings(slice); - LOGF(debug, " size of slice %d", slice.size()); - return slice; + T bcslice{{bcs.asArrowTable()->Slice(minBCId, maxBCId - minBCId + 1)}, (uint64_t)minBCId}; + bcs.copyIndexBindings(bcslice); + LOGF(debug, " size of slice %d", bcslice.size()); + return bcslice; } // In this variant of compatibleBCs the range of compatible BCs is calculated from the @@ -200,7 +193,7 @@ T compatibleBCs(C const& collision, int ndt, T const& bcs, int nMinBCs = 7) // In this variant of compatibleBCs the range of compatible BCs is defined by meanBC +- deltaBC. template -T compatibleBCs(uint64_t meanBC, int deltaBC, T const& bcs) +T compatibleBCs(uint64_t const& meanBC, int const& deltaBC, T const& bcs) { // find BC with globalBC ~ meanBC uint64_t ind = (uint64_t)(bcs.size() / 2); @@ -212,13 +205,13 @@ T compatibleBCs(uint64_t meanBC, int deltaBC, T const& bcs) // ----------------------------------------------------------------------------- // Same as above but for collisions with MC information template -T MCcompatibleBCs(F const& collision, int ndt, T const& bcs, int nMinBCs = 7) +T MCcompatibleBCs(F const& collision, int const& ndt, T const& bcs, int const& nMinBCs = 7) { LOGF(debug, "Collision time / resolution [ns]: %f / %f", collision.collisionTime(), collision.collisionTimeRes()); // return if collisions has no associated BC if (!collision.has_foundBC()) { - LOGF(info, "Collision %i - no BC found!", collision.globalIndex()); + LOGF(debug, "Collision %i - no BC found!", collision.globalIndex()); return T{{bcs.asArrowTable()->Slice(0, 0)}, (uint64_t)0}; } @@ -651,6 +644,9 @@ void fillBGBBFlags(upchelpers::FITInfo& info, uint64_t const& minbc, BCR const& // 0 <= bit <= 31 auto bit = bc.globalBC() - minbc; + if (bit < 0 || bit > 31) + continue; + if (!bc.selection_bit(o2::aod::evsel::kNoBGT0A)) SETBIT(info.BGFT0Apf, bit); if (!bc.selection_bit(o2::aod::evsel::kNoBGT0C)) @@ -676,52 +672,42 @@ void fillBGBBFlags(upchelpers::FITInfo& info, uint64_t const& minbc, BCR const& // ----------------------------------------------------------------------------- // extract FIT information -template -void getFITinfo(upchelpers::FITInfo& info, uint64_t const& bcnum, B const& bcs, aod::FT0s const& ft0s, aod::FV0As const& fv0as, aod::FDDs const& fdds) -{ - // find bc with globalBC = bcnum - Partition selbc = aod::bc::globalBC == bcnum; - selbc.bindTable(bcs); - - // if BC exists then update FIT information for this BC - if (selbc.size() > 0) { - auto bc = selbc.begin(); - - // FV0A - if (bc.has_foundFV0()) { - auto fv0 = fv0as.iteratorAt(bc.foundFV0Id()); - info.timeFV0A = fv0.time(); - info.ampFV0A = FV0AmplitudeA(fv0); - info.triggerMaskFV0A = fv0.triggerMask(); - } +template +void getFITinfo(upchelpers::FITInfo& info, BC& bc, BCS const& bcs, aod::FT0s const& ft0s, aod::FV0As const& fv0as, aod::FDDs const& fdds) +{ + // FV0A + if (bc.has_foundFV0()) { + auto fv0 = fv0as.iteratorAt(bc.foundFV0Id()); + info.timeFV0A = fv0.time(); + info.ampFV0A = FV0AmplitudeA(fv0); + info.triggerMaskFV0A = fv0.triggerMask(); + } - // FT0 - if (bc.has_foundFT0()) { - auto ft0 = ft0s.iteratorAt(bc.foundFT0Id()); - info.timeFT0A = ft0.timeA(); - info.timeFT0C = ft0.timeC(); - info.ampFT0A = FT0AmplitudeA(ft0); - info.ampFT0C = FT0AmplitudeC(ft0); - info.triggerMaskFT0 = ft0.triggerMask(); - } + // FT0 + if (bc.has_foundFT0()) { + auto ft0 = ft0s.iteratorAt(bc.foundFT0Id()); + info.timeFT0A = ft0.timeA(); + info.timeFT0C = ft0.timeC(); + info.ampFT0A = FT0AmplitudeA(ft0); + info.ampFT0C = FT0AmplitudeC(ft0); + info.triggerMaskFT0 = ft0.triggerMask(); + } - // FDD - if (bc.has_foundFDD()) { - auto fdd = fdds.iteratorAt(bc.foundFDDId()); - info.timeFDDA = fdd.timeA(); - info.timeFDDC = fdd.timeC(); - info.ampFDDA = FDDAmplitudeA(fdd); - info.ampFDDC = FDDAmplitudeC(fdd); - info.triggerMaskFDD = fdd.triggerMask(); - } + // FDD + if (bc.has_foundFDD()) { + auto fdd = fdds.iteratorAt(bc.foundFDDId()); + info.timeFDDA = fdd.timeA(); + info.timeFDDC = fdd.timeC(); + info.ampFDDA = FDDAmplitudeA(fdd); + info.ampFDDC = FDDAmplitudeC(fdd); + info.triggerMaskFDD = fdd.triggerMask(); } // fill BG and BB flags - auto minbc = bcnum - 16; - auto maxbc = bcnum + 15; - Partition bcrange = aod::bc::globalBC >= minbc && aod::bc::globalBC <= maxbc; - bcrange.bindTable(bcs); - fillBGBBFlags(info, minbc, bcrange); + auto bcnum = bc.globalBC(); + auto bcrange = compatibleBCs(bc, bcnum, 16, bcs); + LOGF(debug, "size of bcrange %d", bcrange.size()); + fillBGBBFlags(info, bcnum - 16, bcrange); } // ----------------------------------------------------------------------------- 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 46f379c24d5..b24bcdb2b77 100644 --- a/PWGUD/DataModel/UDTables.h +++ b/PWGUD/DataModel/UDTables.h @@ -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 @@ -151,7 +156,7 @@ DECLARE_SOA_INDEX_COLUMN(UDMcCollision, udMcCollision); } // namespace udcollision -DECLARE_SOA_TABLE(UDCollisions, "AOD", "UDCOLLISION", +DECLARE_SOA_TABLE(UDCollisions_000, "AOD", "UDCOLLISION", o2::soa::Index<>, udcollision::GlobalBC, udcollision::RunNumber, @@ -161,6 +166,18 @@ DECLARE_SOA_TABLE(UDCollisions, "AOD", "UDCOLLISION", collision::NumContrib, udcollision::NetCharge, udcollision::RgtrwTOF); +// Version with UPC Reco Flag +DECLARE_SOA_TABLE_VERSIONED(UDCollisions_001, "AOD", "UDCOLLISION", 1, + o2::soa::Index<>, + udcollision::GlobalBC, + udcollision::RunNumber, + collision::PosX, + collision::PosY, + collision::PosZ, + collision::Flags, + collision::NumContrib, + udcollision::NetCharge, + udcollision::RgtrwTOF); DECLARE_SOA_TABLE(SGCollisions, "AOD", "SGCOLLISION", udcollision::GapSide); @@ -186,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, @@ -208,11 +232,14 @@ DECLARE_SOA_TABLE(UDCollsLabels, "AOD", "UDCOLLSLABEL", DECLARE_SOA_TABLE(UDMcCollsLabels, "AOD", "UDMCCOLLSLABEL", udcollision::UDMcCollisionId); +using UDCollisions = UDCollisions_001; + using UDCollision = UDCollisions::iterator; 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; @@ -264,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/Converters/CMakeLists.txt b/PWGUD/TableProducer/Converters/CMakeLists.txt index b8d13cc587e..3bcb34f6ac2 100644 --- a/PWGUD/TableProducer/Converters/CMakeLists.txt +++ b/PWGUD/TableProducer/Converters/CMakeLists.txt @@ -14,3 +14,9 @@ o2physics_add_dpl_workflow(fwd-tracks-extra-converter PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(collisions-converter + SOURCES UDCollisionsConverter.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGUD/TableProducer/Converters/UDCollisionsConverter.cxx b/PWGUD/TableProducer/Converters/UDCollisionsConverter.cxx new file mode 100644 index 00000000000..8be7bce717b --- /dev/null +++ b/PWGUD/TableProducer/Converters/UDCollisionsConverter.cxx @@ -0,0 +1,58 @@ +// 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 UDCollisionsConverter.cxx +/// \brief Converts UDCollisions table from version 000 to 001 + +/// This task allows for the conversion of the UDCollisions table from the version 000, +/// that is before the introduction of Flags for UPC reconstruction +/// to the version 001, that includes it + +/// executable name o2-analysis-ud-collisions-converter + +/// \author Sasha Bylinkin + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "PWGUD/DataModel/UDTables.h" + +using namespace o2; +using namespace o2::framework; + +// Converts UDCollisions for version 000 to 001 +struct UDCollisionsConverter { + Produces udCollisions_001; + + void process(o2::aod::UDCollisions_000 const& collisions) + { + + for (const auto& collision : collisions) { + + udCollisions_001(collision.globalBC(), + collision.runNumber(), + collision.posX(), + collision.posY(), + collision.posZ(), + 0.0f, // dummy UPC reco flag, not available in version 000 + collision.numContrib(), + collision.netCharge(), + collision.rgtrwTOF()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc), + }; +} diff --git a/PWGUD/TableProducer/DGBCCandProducer.cxx b/PWGUD/TableProducer/DGBCCandProducer.cxx index d765be9afc6..97b60c42c9e 100644 --- a/PWGUD/TableProducer/DGBCCandProducer.cxx +++ b/PWGUD/TableProducer/DGBCCandProducer.cxx @@ -17,6 +17,7 @@ #include #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" +#include "ReconstructionDataFormats/Vertex.h" #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/UDHelpers.h" #include "PWGUD/Core/UPCHelpers.h" @@ -279,11 +280,11 @@ struct DGBCCandProducer { // update UDTables template - void updateUDTables(bool onlyPV, int64_t colID, uint64_t bcnum, int rnum, float vx, float vy, float vz, + void updateUDTables(bool onlyPV, int64_t colID, uint64_t bcnum, int rnum, float vx, float vy, float vz, int flag, uint16_t const& ntrks, int8_t const& ncharge, float const& rtrwTOF, TTracks const& tracks, upchelpers::FITInfo const& fitInfo) { - outputCollisions(bcnum, rnum, vx, vy, vz, ntrks, ncharge, rtrwTOF); + outputCollisions(bcnum, rnum, vx, vy, vz, flag, ntrks, ncharge, rtrwTOF); outputCollisionsSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, fitInfo.triggerMaskFT0, fitInfo.ampFDDA, fitInfo.ampFDDC, fitInfo.timeFDDA, fitInfo.timeFDDC, @@ -380,11 +381,10 @@ struct DGBCCandProducer { // fill FITInfo auto bcnum = tibc.bcnum(); upchelpers::FITInfo fitInfo{}; - udhelpers::getFITinfo(fitInfo, bcnum, bcs, ft0s, fv0as, fdds); // check if DG event // distinguish between cases with and without associated BC - // 1. candidate has associated BC and associated collision -> vertex position: col.[posX(), posY(), posZ()] + // 1. candidate has associated BC and associated collision -> position: col.[posX(), posY(), posZ()] // 2. candidate has associated BC but no associated collision -> [-2., 2., -2.] // 3. candidate has no associated BC -> [-3., 3., -3.] int isDG = -1; @@ -395,6 +395,7 @@ struct DGBCCandProducer { // get associated bc auto bc = tibc.bc_as(); + udhelpers::getFITinfo(fitInfo, bc, bcs, ft0s, fv0as, fdds); // is there an associated collision? Partition colSlize = aod::evsel::foundBCId == bc.globalIndex(); @@ -415,8 +416,11 @@ struct DGBCCandProducer { registry.get(HIST("table/candCase"))->Fill(1, 1.); rtrwTOF = udhelpers::rPVtrwTOF(colTracks, col.numContrib()); nCharge = udhelpers::netCharge(colTracks); - - updateUDTables(false, col.globalIndex(), bc.globalBC(), bc.runNumber(), col.posX(), col.posY(), col.posZ(), + int upc_flag = 0; + ushort flags = col.flags(); + if (flags & dataformats::Vertex>::Flags::UPCMode) + upc_flag = 1; + updateUDTables(false, col.globalIndex(), bc.globalBC(), bc.runNumber(), col.posX(), col.posY(), col.posZ(), upc_flag, col.numContrib(), nCharge, rtrwTOF, colTracks, fitInfo); } } else { @@ -448,7 +452,7 @@ struct DGBCCandProducer { rtrwTOF = udhelpers::rPVtrwTOF(tracksArray, tracksArray.size()); nCharge = udhelpers::netCharge(tracksArray); - updateUDTables(false, -1, bc.globalBC(), bc.runNumber(), -2., 2., -2, + updateUDTables(false, -1, bc.globalBC(), bc.runNumber(), -2., 2., -2, 0, tracksArray.size(), nCharge, rtrwTOF, tracksArray, fitInfo); } } @@ -494,7 +498,7 @@ struct DGBCCandProducer { rtrwTOF = udhelpers::rPVtrwTOF(tracksArray, tracksArray.size()); nCharge = udhelpers::netCharge(tracksArray); - updateUDTables(false, -1, bcnum, tibc.runNumber(), -3., 3., -3, + updateUDTables(false, -1, bcnum, tibc.runNumber(), -3., 3., -3, 0, tracksArray.size(), nCharge, rtrwTOF, tracksArray, fitInfo); } } @@ -611,8 +615,12 @@ struct DGBCCandProducer { auto rtrwTOF = udhelpers::rPVtrwTOF(colTracks, col.numContrib()); auto nCharge = udhelpers::netCharge(colTracks); - udhelpers::getFITinfo(fitInfo, bcnum, bcs, ft0s, fv0as, fdds); - updateUDTables(false, col.globalIndex(), bcnum, bc.runNumber(), col.posX(), col.posY(), col.posZ(), + udhelpers::getFITinfo(fitInfo, bc, bcs, ft0s, fv0as, fdds); + int upc_flag = 0; + ushort flags = col.flags(); + if (flags & dataformats::Vertex>::Flags::UPCMode) + upc_flag = 1; + updateUDTables(false, col.globalIndex(), bcnum, bc.runNumber(), col.posX(), col.posY(), col.posZ(), upc_flag, col.numContrib(), nCharge, rtrwTOF, colTracks, fitInfo); // fill UDZdcs if (bc.has_zdc()) { @@ -661,7 +669,7 @@ struct DGBCCandProducer { auto rtrwTOF = udhelpers::rPVtrwTOF(tracksArray, tracksArray.size()); auto nCharge = udhelpers::netCharge(tracksArray); - udhelpers::getFITinfo(fitInfo, bcnum, bcs, ft0s, fv0as, fdds); + udhelpers::getFITinfo(fitInfo, bc, bcs, ft0s, fv0as, fdds); // distinguish different cases if (bc.globalBC() == bcnum) { @@ -681,7 +689,11 @@ struct DGBCCandProducer { } int64_t colID = withCollision ? col.globalIndex() : -1; - updateUDTables(false, colID, bcnum, tibc.runNumber(), vpos[0], vpos[1], vpos[2], + int upc_flag = 0; + ushort flags = col.flags(); + if (flags & dataformats::Vertex>::Flags::UPCMode) + upc_flag = 1; + updateUDTables(false, colID, bcnum, tibc.runNumber(), vpos[0], vpos[1], vpos[2], upc_flag, tracksArray.size(), nCharge, rtrwTOF, tracksArray, fitInfo); // fill UDZdcs if (bc.globalBC() == bcnum) { diff --git a/PWGUD/TableProducer/DGCandProducer.cxx b/PWGUD/TableProducer/DGCandProducer.cxx index e0a6f5df303..855b60b6e86 100644 --- a/PWGUD/TableProducer/DGCandProducer.cxx +++ b/PWGUD/TableProducer/DGCandProducer.cxx @@ -11,9 +11,12 @@ // // \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" #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/UPCHelpers.h" #include "PWGUD/Core/DGSelector.h" @@ -136,8 +139,10 @@ struct DGCandProducer { template void fillFIThistograms(TBC const& bc) { + LOGF(debug, ""); std::array triggers{{true, !udhelpers::cleanFIT(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits()), udhelpers::TVX(bc), udhelpers::TSC(bc), udhelpers::TCE(bc)}}; + LOGF(debug, "triggers %d %d %d %d %d", triggers[0], triggers[1], triggers[2], triggers[3], triggers[4]); if (bc.has_foundFV0()) { auto fv0 = bc.foundFV0(); auto ampA = udhelpers::FV0AmplitudeA(fv0); @@ -212,11 +217,12 @@ struct DGCandProducer { // 4: TCE 8: no TCE // 9: IsBBXXX 10: !IsBBXXX // 11: kNoBGXXX 12: !kNoBGXXX - registry.add("reco/fv0", "FV0 amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); - registry.add("reco/ft0A", "FT0A amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); - registry.add("reco/ft0C", "FT0C amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); - registry.add("reco/fddA", "FDDA amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); - registry.add("reco/fddC", "FDDC amplitudes", {HistType::kTH2F, {{20001, -0.5, 20000.5}, {13, -0.5, 12.5}}}); + const int nXbinsFITH = 201; + registry.add("reco/fv0", "FV0 amplitudes", {HistType::kTH2F, {{nXbinsFITH, -0.5, nXbinsFITH - 0.5}, {13, -0.5, 12.5}}}); + registry.add("reco/ft0A", "FT0A amplitudes", {HistType::kTH2F, {{nXbinsFITH, -0.5, nXbinsFITH - 0.5}, {13, -0.5, 12.5}}}); + registry.add("reco/ft0C", "FT0C amplitudes", {HistType::kTH2F, {{nXbinsFITH, -0.5, nXbinsFITH - 0.5}, {13, -0.5, 12.5}}}); + registry.add("reco/fddA", "FDDA amplitudes", {HistType::kTH2F, {{nXbinsFITH, -0.5, nXbinsFITH - 0.5}, {13, -0.5, 12.5}}}); + registry.add("reco/fddC", "FDDC amplitudes", {HistType::kTH2F, {{nXbinsFITH, -0.5, nXbinsFITH - 0.5}, {13, -0.5, 12.5}}}); std::string labels[nXbinsInStatH] = {"all", "hasBC", "accepted", "FITveto", "MID trk", "global not PV trk", "not global PV trk", "ITS-only PV trk", "TOF PV trk fraction", "n PV trks", "PID", "pt", "eta", "net charge", @@ -262,12 +268,16 @@ struct DGCandProducer { // fill FITInfo upchelpers::FITInfo fitInfo{}; - udhelpers::getFITinfo(fitInfo, bc.globalBC(), bcs, ft0s, fv0as, fdds); + udhelpers::getFITinfo(fitInfo, bc, bcs, ft0s, fv0as, fdds); // update DG candidates tables auto rtrwTOF = udhelpers::rPVtrwTOF(tracks, collision.numContrib()); + int upc_flag = 0; + ushort flags = collision.flags(); + if (flags & dataformats::Vertex>::Flags::UPCMode) + upc_flag = 1; outputCollisions(bc.globalBC(), bc.runNumber(), - collision.posX(), collision.posY(), collision.posZ(), + collision.posX(), collision.posY(), collision.posZ(), upc_flag, collision.numContrib(), udhelpers::netCharge(tracks), rtrwTOF); outputCollisionsSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, @@ -406,38 +416,59 @@ struct McDGCandProducer { template void updateUDMcParticles(TMcParticles const& McParts, int64_t McCollisionId, std::map& mcPartIsSaved) { + LOGF(debug, "number of McParticles %d", McParts.size()); // save McParts // new mother and daughter ids std::vector newmids; int32_t newdids[2] = {-1, -1}; int64_t newval = -1; + // Determine the particle indices within the UDMcParticles table + // before filling the table + // This is needed to be able to assign the new daughter indices + std::map oldnew; + auto lastId = outputMcParticles.lastIndex(); + for (auto mcpart : McParts) { + auto oldId = mcpart.globalIndex(); + if (mcPartIsSaved.find(oldId) != mcPartIsSaved.end()) { + oldnew[oldId] = mcPartIsSaved[oldId]; + } else { + lastId++; + oldnew[oldId] = lastId; + } + } + // all particles of the McCollision are saved for (auto mcpart : McParts) { + LOGF(debug, " p (%d) %d", mcpart.pdgCode(), mcpart.globalIndex()); if (mcPartIsSaved.find(mcpart.globalIndex()) == mcPartIsSaved.end()) { - // correct mother and daughter IDs + // mothers newmids.clear(); auto oldmids = mcpart.mothersIds(); - for (uint ii = 0; ii < oldmids.size(); ii++) { - if (mcPartIsSaved.find(oldmids[ii]) != mcPartIsSaved.end()) { - newval = mcPartIsSaved[oldmids[ii]]; - LOGF(debug, " mid %i / %i", oldmids[ii], newval); + for (auto oldmid : oldmids) { + auto m = McParts.rawIteratorAt(oldmid); + LOGF(debug, " m %d", m.globalIndex()); + if (mcPartIsSaved.find(oldmid) != mcPartIsSaved.end()) { + newval = mcPartIsSaved[oldmid]; } else { newval = -1; } + LOGF(debug, " mid o %i n %i", oldmid, newval); newmids.push_back(newval); } + + // daughters auto olddids = mcpart.daughtersIds(); for (uint ii = 0; ii < olddids.size(); ii++) { - if (mcPartIsSaved.find(olddids[ii]) != mcPartIsSaved.end()) { - newval = mcPartIsSaved[olddids[ii]]; - LOGF(debug, " did %i / %i", olddids[ii], newval); + if (oldnew.find(olddids[ii]) != oldnew.end()) { + newval = oldnew[olddids[ii]]; } else { newval = -1; } + LOGF(debug, " did o %i n %i", olddids[ii], newval); newdids[ii] = newval; } - LOGF(debug, " ms %i ds %i", oldmids.size(), olddids.size()); + LOGF(debug, " ms %i ds %i", oldmids.size(), olddids.size()); // update UDMcParticles outputMcParticles(McCollisionId, @@ -452,6 +483,7 @@ struct McDGCandProducer { mcpart.pz(), mcpart.e()); mcPartIsSaved[mcpart.globalIndex()] = outputMcParticles.lastIndex(); + LOGF(debug, " mcpart %d -> udmcpart %d", mcpart.globalIndex(), mcPartIsSaved[mcpart.globalIndex()]); } } } @@ -543,29 +575,33 @@ struct McDGCandProducer { // advance dgcand and mccol until both are AtEnd int64_t mccolId = mccol.globalIndex(); int64_t mcdgId = -1; + int64_t colId = -1; auto dgcandAtEnd = dgcand == lastdgcand; auto mccolAtEnd = mccol == lastmccol; - bool goon = true; + bool goon = !dgcandAtEnd || !mccolAtEnd; + while (goon) { - // check if dgcand has an associated McCollision - if (!dgcand.has_collision()) { - mcdgId = -1; - } else { + // check if dgcand has an associated Collision and McCollision + if (dgcand.has_collision()) { auto dgcandCol = dgcand.collision_as(); - if (!dgcandCol.has_mcCollision()) { - mcdgId = -1; - } else { + colId = dgcandCol.globalIndex(); + if (dgcandCol.has_mcCollision()) { mcdgId = dgcandCol.mcCollision().globalIndex(); + } else { + mcdgId = -1; } + } else { + colId = -1; + mcdgId = -1; } - LOGF(info, "\nStart of loop mcdgId %d mccolId %d", mcdgId, mccolId); + LOGF(debug, ""); + LOGF(debug, "dgcand %d mcdgId %d colId %d mccolId %d - UDMcCollsLabels %d UDMcCollisions %d", dgcand.globalIndex(), mcdgId, colId, mccolId, outputMcCollsLabels.lastIndex(), outputMcCollisions.lastIndex()); // two cases to consider - // 1. the event to process is a dgcand. In this case the Mc tables as well as the McLabel tables are updated - // 2. the event to process is an event of interest. In this case only the Mc tables are updated + // 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 ((!dgcandAtEnd && !mccolAtEnd && (mcdgId <= mccolId)) || mccolAtEnd) { // this is case 1. - LOGF(info, "Doing case 1 with mcdgId %d", mcdgId); // update UDMcCollisions and UDMcColsLabels (for each UDCollision -> UDMcCollisions) // update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles) @@ -576,14 +612,15 @@ struct McDGCandProducer { // McParticles are saved if (mcdgId >= 0) { if (mcColIsSaved.find(mcdgId) == mcColIsSaved.end()) { - LOGF(info, " Saving McCollision %d", mcdgId); // update UDMcCollisions + LOGF(debug, " writing mcCollision %d to UDMcCollisions", mcdgId); auto dgcandMcCol = dgcand.collision_as().mcCollision(); updateUDMcCollisions(dgcandMcCol); mcColIsSaved[mcdgId] = outputMcCollisions.lastIndex(); } // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) + LOGF(debug, " writing %d to outputMcCollsLabels", mcColIsSaved[mcdgId]); outputMcCollsLabels(mcColIsSaved[mcdgId]); // update UDMcParticles @@ -596,9 +633,9 @@ struct McDGCandProducer { } else { // If the dgcand has no associated McCollision then only the McParticles which are associated // with the tracks of the dgcand are saved - LOGF(info, " Saving McCollision %d", -1); // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) + LOGF(debug, " writing %d to UDMcCollsLabels", -1); outputMcCollsLabels(-1); // update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles) @@ -626,12 +663,12 @@ struct McDGCandProducer { } } else { // this is case 2. - LOGF(info, "Doing case 2"); // update UDMcCollisions and UDMcParticles if (mcColIsSaved.find(mccolId) == mcColIsSaved.end()) { - LOGF(info, " Saving McCollision %d", mccolId); + // update UDMcCollisions + LOGF(debug, " writing mcCollision %d to UDMcCollisions", mccolId); updateUDMcCollisions(mccol); mcColIsSaved[mccolId] = outputMcCollisions.lastIndex(); @@ -648,9 +685,8 @@ struct McDGCandProducer { mccolAtEnd = true; } } - + LOGF(debug, " UDMcCollsLabels %d (of %d) UDMcCollisions %d", outputMcCollsLabels.lastIndex(), dgcands.size() - 1, outputMcCollisions.lastIndex()); goon = !dgcandAtEnd || !mccolAtEnd; - LOGF(info, "End of loop mcdgId %d mccolId %d", mcdgId, mccolId); } } PROCESS_SWITCH(McDGCandProducer, processMC, "Produce MC tables", false); diff --git a/PWGUD/TableProducer/SGCandProducer.cxx b/PWGUD/TableProducer/SGCandProducer.cxx index a38dc6a334c..aabaa4357ae 100644 --- a/PWGUD/TableProducer/SGCandProducer.cxx +++ b/PWGUD/TableProducer/SGCandProducer.cxx @@ -10,8 +10,11 @@ // or submit itself to any jurisdiction. #include +#include +#include #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" +#include "ReconstructionDataFormats/Vertex.h" #include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/EventSelection.h" #include "CommonConstants/LHCConstants.h" @@ -38,6 +41,11 @@ struct SGCandProducer { Configurable noSameBunchPileUp{"noSameBunchPileUp", true, "reject SameBunchPileUp"}; Configurable IsGoodVertex{"IsGoodVertex", false, "Select FT0 PV vertex matching"}; Configurable ITSTPCVertex{"ITSTPCVertex", true, "reject ITS-only vertex"}; // if one wants to look at Single Gap pp events + + // Configurables to decide which tables are filled + Configurable fillTrackTables{"fillTrackTables", true, "Fill track tables"}; + Configurable fillFwdTrackTables{"fillFwdTrackTables", true, "Fill forward track tables"}; + // SG selector SGSelector sgSelector; @@ -47,11 +55,12 @@ struct SGCandProducer { Produces outputCollisionsSels; Produces outputCollsLabels; Produces outputZdcs; - Produces udZdcsReduced; + Produces udZdcsReduced; Produces outputTracks; Produces outputTracksCov; Produces outputTracksDCA; Produces outputTracksPID; + Produces outputTracksPIDExtra; Produces outputTracksExtra; Produces outputTracksFlag; Produces outputFwdTracks; @@ -70,7 +79,9 @@ struct SGCandProducer { using BC = BCs::iterator; using TCs = soa::Join; using FWs = aod::FwdTracks; @@ -121,6 +132,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(), @@ -193,7 +212,7 @@ struct SGCandProducer { auto isSGEvent = sgSelector.IsSelected(sameCuts, collision, bcRange, bc); // auto isSGEvent = sgSelector.IsSelected(sameCuts, collision, bcRange, tracks); int issgevent = isSGEvent.value; - if (isSGEvent.bc) { + if (isSGEvent.bc && issgevent < 2) { newbc = *(isSGEvent.bc); } else { LOGF(info, "No Newbc %i", bc.globalBC()); @@ -206,12 +225,17 @@ struct SGCandProducer { return; } upchelpers::FITInfo fitInfo{}; - udhelpers::getFITinfo(fitInfo, newbc.globalBC(), bcs, ft0s, fv0as, fdds); + udhelpers::getFITinfo(fitInfo, newbc, bcs, ft0s, fv0as, fdds); // update SG candidates tables + int upc_flag = 0; + ushort flags = collision.flags(); + if (flags & dataformats::Vertex>::Flags::UPCMode) + upc_flag = 1; outputCollisions(bc.globalBC(), bc.runNumber(), - collision.posX(), collision.posY(), collision.posZ(), + collision.posX(), collision.posY(), collision.posZ(), upc_flag, collision.numContrib(), udhelpers::netCharge(tracks), 1.); // rtrwTOF); //omit the calculation to speed up the things while skimming + outputSGCollisions(issgevent); outputCollisionsSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, fitInfo.triggerMaskFT0, @@ -229,32 +253,380 @@ struct SGCandProducer { udZdcsReduced(outputCollisions.lastIndex(), -999, -999, -999, -999); } // update SGTracks tables - for (auto& track : tracks) { - if (track.pt() > sameCuts.minPt() && track.eta() > sameCuts.minEta() && track.eta() < sameCuts.maxEta()) { - if (track.isPVContributor()) { - updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); - } else if (saveAllTracks) { - if (track.itsClusterSizes() && track.itsChi2NCl() > 0 && ((track.tpcNClsFindable() == 0 && savenonPVCITSOnlyTracks) || track.tpcNClsFindable() > 50)) + if (fillTrackTables) { + for (auto& track : tracks) { + if (track.pt() > sameCuts.minPt() && track.eta() > sameCuts.minEta() && track.eta() < sameCuts.maxEta()) { + if (track.isPVContributor()) { updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); - // if (track.isPVContributor()) updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); + } else if (saveAllTracks) { + if (track.itsClusterSizes() && track.itsChi2NCl() > 0 && ((track.tpcNClsFindable() == 0 && savenonPVCITSOnlyTracks) || track.tpcNClsFindable() > 50)) + updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); + // if (track.isPVContributor()) updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC()); + } } } } // update SGFwdTracks tables - if (sameCuts.withFwdTracks()) { - for (auto& fwdtrack : fwdtracks) { - if (!sgSelector.FwdTrkSelector(fwdtrack)) - updateUDFwdTrackTables(fwdtrack, bc.globalBC()); + if (fillFwdTrackTables) { + if (sameCuts.withFwdTracks()) { + for (auto& fwdtrack : fwdtracks) { + if (!sgSelector.FwdTrkSelector(fwdtrack)) + updateUDFwdTrackTables(fwdtrack, bc.globalBC()); + } + } + } + } + } +}; + +struct McSGCandProducer { + // MC tables + Produces outputMcCollisions; + Produces outputMcParticles; + Produces outputMcCollsLabels; + Produces outputMcTrackLabels; + + using CCs = soa::Join; + using BCs = soa::Join; + using TCs = soa::Join; + using UDCCs = soa::Join; + using UDTCs = soa::Join; + + // prepare slices + SliceCache cache; + PresliceUnsorted mcPartsPerMcCollision = aod::mcparticle::mcCollisionId; + Preslice udtracksPerUDCollision = aod::udtrack::udCollisionId; + + // initialize histogram registry + HistogramRegistry registry{ + "registry", + {}}; + + template + void updateUDMcCollisions(TMcCollision const& mccol, uint64_t globBC) + { + // save mccol + outputMcCollisions(globBC, + mccol.generatorsID(), + mccol.posX(), + mccol.posY(), + mccol.posZ(), + mccol.t(), + mccol.weight(), + mccol.impactParameter()); + } + + template + void updateUDMcParticle(TMcParticle const& McPart, int64_t McCollisionId, std::map& mcPartIsSaved) + { + // save McPart + // mother and daughter indices are set to -1 + // ATTENTION: this can be improved to also include mother and daughter indices + std::vector newmids; + int32_t newdids[2] = {-1, -1}; + + // update UDMcParticles + if (mcPartIsSaved.find(McPart.globalIndex()) == mcPartIsSaved.end()) { + outputMcParticles(McCollisionId, + McPart.pdgCode(), + McPart.statusCode(), + McPart.flags(), + newmids, + newdids, + McPart.weight(), + McPart.px(), + McPart.py(), + McPart.pz(), + McPart.e()); + mcPartIsSaved[McPart.globalIndex()] = outputMcParticles.lastIndex(); + } + } + + template + void updateUDMcParticles(TMcParticles const& McParts, int64_t McCollisionId, std::map& mcPartIsSaved) + { + // save McParts + // new mother and daughter ids + std::vector newmids; + int32_t newdids[2] = {-1, -1}; + int64_t newval = -1; + + // Determine the particle indices within the UDMcParticles table + // before filling the table + // This is needed to be able to assign the new daughter indices + std::map oldnew; + auto lastId = outputMcParticles.lastIndex(); + for (auto mcpart : McParts) { + auto oldId = mcpart.globalIndex(); + if (mcPartIsSaved.find(oldId) != mcPartIsSaved.end()) { + oldnew[oldId] = mcPartIsSaved[oldId]; + } else { + lastId++; + oldnew[oldId] = lastId; + } + } + + // all particles of the McCollision are saved + for (auto mcpart : McParts) { + if (mcPartIsSaved.find(mcpart.globalIndex()) == mcPartIsSaved.end()) { + // mothers + newmids.clear(); + auto oldmids = mcpart.mothersIds(); + for (auto oldmid : oldmids) { + auto m = McParts.rawIteratorAt(oldmid); + LOGF(debug, " m %d", m.globalIndex()); + if (mcPartIsSaved.find(oldmid) != mcPartIsSaved.end()) { + newval = mcPartIsSaved[oldmid]; + } else { + newval = -1; + } + newmids.push_back(newval); + } + // daughters + auto olddids = mcpart.daughtersIds(); + for (uint ii = 0; ii < olddids.size(); ii++) { + if (oldnew.find(olddids[ii]) != oldnew.end()) { + newval = oldnew[olddids[ii]]; + } else { + newval = -1; + } + newdids[ii] = newval; + } + LOGF(debug, " ms %i ds %i", oldmids.size(), olddids.size()); + + // update UDMcParticles + outputMcParticles(McCollisionId, + mcpart.pdgCode(), + mcpart.statusCode(), + mcpart.flags(), + newmids, + newdids, + mcpart.weight(), + mcpart.px(), + mcpart.py(), + mcpart.pz(), + mcpart.e()); + mcPartIsSaved[mcpart.globalIndex()] = outputMcParticles.lastIndex(); + } + } + } + + template + void updateUDMcTrackLabel(TTrack const& udtrack, std::map& mcPartIsSaved) + { + // udtrack (UDTCs) -> track (TCs) -> mcTrack (McParticles) -> udMcTrack (UDMcParticles) + auto trackId = udtrack.trackId(); + if (trackId >= 0) { + auto track = udtrack.template track_as(); + auto mcTrackId = track.mcParticleId(); + if (mcTrackId >= 0) { + if (mcPartIsSaved.find(mcTrackId) != mcPartIsSaved.end()) { + outputMcTrackLabels(mcPartIsSaved[mcTrackId], track.mcMask()); + } else { + outputMcTrackLabels(-1, track.mcMask()); + } + } else { + outputMcTrackLabels(-1, track.mcMask()); + } + } else { + outputMcTrackLabels(-1, -1); + } + } + + template + void updateUDMcTrackLabels(TTrack const& udtracks, std::map& mcPartIsSaved) + { + // loop over all tracks + for (auto udtrack : udtracks) { + // udtrack (UDTCs) -> track (TCs) -> mcTrack (McParticles) -> udMcTrack (UDMcParticles) + auto trackId = udtrack.trackId(); + if (trackId >= 0) { + auto track = udtrack.template track_as(); + auto mcTrackId = track.mcParticleId(); + if (mcTrackId >= 0) { + if (mcPartIsSaved.find(mcTrackId) != mcPartIsSaved.end()) { + outputMcTrackLabels(mcPartIsSaved[mcTrackId], track.mcMask()); + } else { + outputMcTrackLabels(-1, track.mcMask()); + } + } else { + outputMcTrackLabels(-1, track.mcMask()); } + } else { + outputMcTrackLabels(-1, -1); } } } + + void init(InitContext& context) + { + // add histograms for the different process functions + if (context.mOptions.get("processMC")) { + registry.add("mcTruth/collisions", "Number of associated collisions", {HistType::kTH1F, {{11, -0.5, 10.5}}}); + registry.add("mcTruth/collType", "Collision type", {HistType::kTH1F, {{5, -0.5, 4.5}}}); + registry.add("mcTruth/IVMpt", "Invariant mass versus p_{T}", {HistType::kTH2F, {{150, 0.0, 3.0}, {150, 0.0, 3.0}}}); + } + } + + // process function for MC data + // save the MC truth of all events of interest and of the DG events + void processMC(aod::McCollisions const& mccols, aod::McParticles const& mcparts, + 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 (sgcands.size() <= 0) { + LOGF(info, "No DG candidates to save!"); + return; + } + + // use a hash table to keep track of the McCollisions which have been added to the UDMcCollision table + // {McCollisionId : udMcCollisionId} + // similar for the McParticles which have been added to the UDMcParticle table + // {McParticleId : udMcParticleId} + std::map mcColIsSaved; + std::map mcPartIsSaved; + + // loop over McCollisions and UDCCs simultaneously + auto mccol = mccols.iteratorAt(0); + auto sgcand = sgcands.iteratorAt(0); + auto lastmccol = mccols.iteratorAt(mccols.size() - 1); + auto lastsgcand = sgcands.iteratorAt(sgcands.size() - 1); + + // advance dgcand and mccol until both are AtEnd + int64_t mccolId = mccol.globalIndex(); + int64_t mcsgId = -1; + // int64_t colId = -1; + auto sgcandAtEnd = sgcand == lastsgcand; + auto mccolAtEnd = mccol == lastmccol; + bool goon = !sgcandAtEnd || !mccolAtEnd; + 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(); + // colId = sgcandCol.globalIndex(); + if (sgcandCol.has_mcCollision()) { + mcsgId = sgcandCol.mcCollision().globalIndex(); + } else { + mcsgId = -1; + } + } else { + // colId = -1; + mcsgId = -1; + } + 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); + + // update UDMcCollisions and UDMcColsLabels (for each UDCollision -> UDMcCollisions) + // update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles) + // get dgcand tracks + auto sgTracks = udtracks.sliceByCached(aod::udtrack::udCollisionId, sgcand.globalIndex(), cache); + + // If the sgcand has an associated McCollision then the McCollision and all associated + // McParticles are saved + if (mcsgId >= 0) { + if (mcColIsSaved.find(mcsgId) == mcColIsSaved.end()) { + LOGF(info, " Saving McCollision %d", mcsgId); + // update UDMcCollisions + auto sgcandMcCol = sgcand.collision_as().mcCollision(); + updateUDMcCollisions(sgcandMcCol, globBC); + mcColIsSaved[mcsgId] = outputMcCollisions.lastIndex(); + } + + // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) + outputMcCollsLabels(mcColIsSaved[mcsgId]); + + // update UDMcParticles + auto mcPartsSlice = mcparts.sliceBy(mcPartsPerMcCollision, mcsgId); + updateUDMcParticles(mcPartsSlice, mcColIsSaved[mcsgId], mcPartIsSaved); + + // update UDMcTrackLabels (for each UDTrack -> UDMcParticles) + updateUDMcTrackLabels(sgTracks, mcPartIsSaved); + + } 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); + + // update UDMcColsLabels (for each UDCollision -> UDMcCollisions) + outputMcCollsLabels(-1); + + // update UDMcParticles and UDMcTrackLabels (for each UDTrack -> UDMcParticles) + // loop over tracks of dgcand + for (auto sgtrack : sgTracks) { + if (sgtrack.has_track()) { + auto track = sgtrack.track_as(); + if (track.has_mcParticle()) { + auto mcPart = track.mcParticle(); + updateUDMcParticle(mcPart, -1, mcPartIsSaved); + updateUDMcTrackLabel(sgtrack, mcPartIsSaved); + } else { + outputMcTrackLabels(-1, track.mcMask()); + } + } else { + outputMcTrackLabels(-1, -1); + } + } + } + // advance sgcand + if (sgcand != lastsgcand) { + sgcand++; + } else { + sgcandAtEnd = true; + } + } else { + // this is case 2. + LOGF(info, "Doing case 2"); + + // update UDMcCollisions and UDMcParticles + if (mcColIsSaved.find(mccolId) == mcColIsSaved.end()) { + LOGF(info, " Saving McCollision %d", mccolId); + // update UDMcCollisions + updateUDMcCollisions(mccol, globBC); + mcColIsSaved[mccolId] = outputMcCollisions.lastIndex(); + + // update UDMcParticles + auto mcPartsSlice = mcparts.sliceBy(mcPartsPerMcCollision, mccolId); + updateUDMcParticles(mcPartsSlice, mcColIsSaved[mccolId], mcPartIsSaved); + } + + // advance mccol + if (mccol != lastmccol) { + mccol++; + mccolId = mccol.globalIndex(); + } else { + mccolAtEnd = true; + } + } + + goon = !sgcandAtEnd || !mccolAtEnd; + // 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!"); + } + PROCESS_SWITCH(McSGCandProducer, processDummy, "Dummy function", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"sgcandproducer"})}; - + adaptAnalysisTask(cfgc, TaskName{"sgcandproducer"}), + adaptAnalysisTask(cfgc, TaskName{"mcsgcandproducer"})}; return workflow; } diff --git a/PWGUD/TableProducer/UPCCandidateProducer.cxx b/PWGUD/TableProducer/UPCCandidateProducer.cxx index 47da6d3ffbd..6443f67fa45 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" @@ -22,6 +29,7 @@ #include "PWGUD/Core/UPCCutparHolder.h" #include "PWGUD/Core/UPCHelpers.h" #include "PWGUD/DataModel/UDTables.h" +#include "DataFormatsITSMFT/ROFRecord.h" using namespace o2::framework; using namespace o2::framework::expressions; @@ -52,6 +60,7 @@ struct UpcCandProducer { Produces eventCandidatesSels; Produces eventCandidatesSelsCent; Produces eventCandidatesSelsFwd; + Produces eventCandidatesSelExtras; Produces udZdcsReduced; @@ -72,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"}; @@ -86,10 +95,13 @@ 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}; - using BCsWithBcSels = o2::soa::Join; + using BCsWithBcSels = o2::soa::Join; using ForwardTracks = o2::soa::Join; @@ -466,10 +478,11 @@ struct UpcCandProducer { return hasNoFT0; } + template void processFITInfo(upchelpers::FITInfo& fitInfo, uint64_t midbc, std::vector>& v, - BCsWithBcSels const& bcs, + TBCs const& bcs, o2::aod::FT0s const& /*ft0s*/, o2::aod::FDDs const& /*fdds*/, o2::aod::FV0As const& /*fv0as*/) @@ -720,9 +733,10 @@ struct UpcCandProducer { return 0; // found exactly tracksToFind tracks in [midbc - range, midbc + range] } + template void createCandidatesCentral(BarrelTracks const& barrelTracks, o2::aod::AmbiguousTracks const& ambBarrelTracks, - o2::aod::BCs const& bcs, + TBCs const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& /*fdds*/, @@ -737,7 +751,7 @@ struct UpcCandProducer { // trackID -> index in amb. track table std::unordered_map ambBarrelTrBCs; if (upcCuts.getAmbigSwitch() != 1) - collectAmbTrackBCs<0, o2::aod::BCs>(ambBarrelTrBCs, ambBarrelTracks); + collectAmbTrackBCs<0, BCsWithBcSels>(ambBarrelTrBCs, ambBarrelTracks); collectBarrelTracks(bcsMatchedTrIdsTOF, 0, @@ -758,7 +772,7 @@ struct UpcCandProducer { std::map mapGlobalBcWithTVX{}; std::map mapGlobalBcWithTSC{}; for (const auto& ft0 : ft0s) { - uint64_t globalBC = ft0.bc_as().globalBC(); + uint64_t globalBC = ft0.bc_as().globalBC(); int32_t globalIndex = ft0.globalIndex(); if (!(std::abs(ft0.timeA()) > 2.f && std::abs(ft0.timeC()) > 2.f)) mapGlobalBcWithTOR[globalBC] = globalIndex; @@ -779,7 +793,7 @@ struct UpcCandProducer { for (const auto& fv0a : fv0as) { if (std::abs(fv0a.time()) > 15.f) continue; - uint64_t globalBC = fv0a.bc_as().globalBC(); + uint64_t globalBC = fv0a.bc_as().globalBC(); mapGlobalBcWithV0A[globalBC] = fv0a.globalIndex(); } @@ -791,7 +805,7 @@ struct UpcCandProducer { histRegistry.get(HIST("hCountersTrg"))->Fill("ZNA", 1); if (!(std::abs(zdc.timeZNC()) > 2.f)) histRegistry.get(HIST("hCountersTrg"))->Fill("ZNC", 1); - auto globalBC = zdc.bc_as().globalBC(); + auto globalBC = zdc.bc_as().globalBC(); mapGlobalBcWithZdc[globalBC] = zdc.globalIndex(); } @@ -870,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(); @@ -884,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()); @@ -916,8 +930,12 @@ struct UpcCandProducer { } RgtrwTOF = RgtrwTOF / static_cast(numContrib); // store used tracks + int upc_flag = 0; + // TODO: introduce better check on association of collision and reconstruction mode + if (bcs.iteratorAt(0).flags() == o2::itsmft::ROFRecord::VtxUPCMode) + upc_flag = 1; fillBarrelTracks(barrelTracks, barrelTrackIDs, candID, globalBC, closestBcITSTPC, mcBarrelTrackLabels, ambBarrelTrBCs); - eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, numContrib, netCharge, RgtrwTOF); + eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, upc_flag, numContrib, netCharge, RgtrwTOF); eventCandidatesSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, fitInfo.triggerMaskFT0, fitInfo.ampFDDA, fitInfo.ampFDDC, fitInfo.timeFDDA, fitInfo.timeFDDC, fitInfo.triggerMaskFDD, fitInfo.ampFV0A, fitInfo.timeFV0A, fitInfo.triggerMaskFV0A, @@ -935,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(); @@ -949,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()); @@ -981,8 +999,12 @@ struct UpcCandProducer { } RgtrwTOF = RgtrwTOF / static_cast(numContrib); // store used tracks + int upc_flag = 0; + // TODO: introduce better check on association of collision and reconstruction mode + if (bcs.iteratorAt(0).flags() == o2::itsmft::ROFRecord::VtxUPCMode) + upc_flag = 1; fillBarrelTracks(barrelTracks, barrelTrackIDs, candID, globalBC, closestBcITSTPC, mcBarrelTrackLabels, ambBarrelTrBCs); - eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, numContrib, netCharge, RgtrwTOF); + eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, upc_flag, numContrib, netCharge, RgtrwTOF); eventCandidatesSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, fitInfo.triggerMaskFT0, fitInfo.ampFDDA, fitInfo.ampFDDC, fitInfo.timeFDDA, fitInfo.timeFDDC, fitInfo.triggerMaskFDD, fitInfo.ampFV0A, fitInfo.timeFV0A, fitInfo.triggerMaskFV0A, @@ -1002,12 +1024,13 @@ struct UpcCandProducer { bcsMatchedTrIdsTOF.clear(); } + template void createCandidatesSemiFwd(BarrelTracks const& barrelTracks, o2::aod::AmbiguousTracks const& ambBarrelTracks, ForwardTracks const& fwdTracks, o2::aod::FwdTrkCls const& /*fwdTrkClusters*/, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, - BCsWithBcSels const& bcs, + TBCs const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, @@ -1157,9 +1180,13 @@ struct UpcCandProducer { } RgtrwTOF = RgtrwTOF / static_cast(numContrib); // store used tracks + int upc_flag = 0; + // TODO: introduce better check on association of collision and reconstruction mode + if (bcs.iteratorAt(0).flags() == o2::itsmft::ROFRecord::VtxUPCMode) + upc_flag = 1; fillFwdTracks(fwdTracks, fwdTrackIDs, candID, bc, bc, mcFwdTrackLabels); fillBarrelTracks(barrelTracks, barrelTrackIDs, candID, bc, bc, mcBarrelTrackLabels, ambBarrelTrBCs); - eventCandidates(bc, runNumber, dummyX, dummyY, dummyZ, numContrib, netCharge, RgtrwTOF); + eventCandidates(bc, runNumber, dummyX, dummyY, dummyZ, upc_flag, numContrib, netCharge, RgtrwTOF); eventCandidatesSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, fitInfo.triggerMaskFT0, fitInfo.ampFDDA, fitInfo.ampFDDC, fitInfo.timeFDDA, fitInfo.timeFDDC, fitInfo.triggerMaskFDD, fitInfo.ampFV0A, fitInfo.timeFV0A, fitInfo.triggerMaskFV0A, @@ -1181,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); @@ -1207,13 +1234,14 @@ struct UpcCandProducer { } } + template void createCandidatesFwd(ForwardTracks const& fwdTracks, o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, - o2::aod::BCs const& bcs, + 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) @@ -1224,7 +1252,7 @@ struct UpcCandProducer { // trackID -> index in amb. track table std::unordered_map ambFwdTrBCs; - collectAmbTrackBCs<1, o2::aod::BCs>(ambFwdTrBCs, ambFwdTracks); + collectAmbTrackBCs<1, BCsWithBcSels>(ambFwdTrBCs, ambFwdTracks); collectForwardTracks(bcsMatchedTrIdsMID, o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack, @@ -1251,7 +1279,7 @@ struct UpcCandProducer { } if (std::abs(ft0.timeA()) > 2.f) continue; - uint64_t globalBC = ft0.bc_as().globalBC(); + uint64_t globalBC = ft0.bc_as().globalBC(); mapGlobalBcWithT0A[globalBC] = ft0.globalIndex(); } @@ -1261,7 +1289,7 @@ struct UpcCandProducer { continue; if (std::abs(fv0a.time()) > 15.f) continue; - uint64_t globalBC = fv0a.bc_as().globalBC(); + uint64_t globalBC = fv0a.bc_as().globalBC(); mapGlobalBcWithV0A[globalBC] = fv0a.globalIndex(); } @@ -1273,14 +1301,33 @@ struct UpcCandProducer { histRegistry.get(HIST("hCountersTrg"))->Fill("ZNA", 1); if (!(std::abs(zdc.timeZNC()) > 2.f)) histRegistry.get(HIST("hCountersTrg"))->Fill("ZNC", 1); - auto globalBC = zdc.bc_as().globalBC(); + auto globalBC = zdc.bc_as().globalBC(); 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.; @@ -1297,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{}; @@ -1312,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()); @@ -1329,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); @@ -1343,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); @@ -1356,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()) { @@ -1378,14 +1454,19 @@ struct UpcCandProducer { selTrackIds.push_back(id); } // store used tracks + int upc_flag = 0; + // TODO: introduce better check on association of collision and reconstruction mode + if (bcs.iteratorAt(0).flags() == o2::itsmft::ROFRecord::VtxUPCMode) + upc_flag = 1; fillFwdTracks(fwdTracks, trkCandIDs, candID, globalBC, closestBcMCH, mcFwdTrackLabels); - eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, numContrib, netCharge, RgtrwTOF); + eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, upc_flag, numContrib, netCharge, RgtrwTOF); eventCandidatesSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, fitInfo.triggerMaskFT0, fitInfo.ampFDDA, fitInfo.ampFDDC, fitInfo.timeFDDA, fitInfo.timeFDDC, fitInfo.triggerMaskFDD, fitInfo.ampFV0A, fitInfo.timeFV0A, fitInfo.triggerMaskFV0A, 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, @@ -1404,15 +1485,17 @@ struct UpcCandProducer { bcsMatchedTrIdsMCH.clear(); mapGlobalBcWithT0A.clear(); mapGlobalBcWithV0A.clear(); + mapGlobalBcWithFDD.clear(); } + template void createCandidatesFwdGlobal(ForwardTracks const& fwdTracks, o2::aod::FwdTrkCls const& /*fwdTrkClusters*/, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, - o2::aod::BCs const& bcs, + 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) @@ -1424,7 +1507,7 @@ struct UpcCandProducer { // trackID -> index in amb. track table std::unordered_map ambFwdTrBCs; - collectAmbTrackBCs<1, o2::aod::BCs>(ambFwdTrBCs, ambFwdTracks); + collectAmbTrackBCs<1, BCsWithBcSels>(ambFwdTrBCs, ambFwdTracks); collectForwardTracks(bcsMatchedTrIdsMID, o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack, @@ -1459,7 +1542,7 @@ struct UpcCandProducer { } if (std::abs(ft0.timeA()) > 2.f) continue; - uint64_t globalBC = ft0.bc_as().globalBC(); + uint64_t globalBC = ft0.bc_as().globalBC(); mapGlobalBcWithT0A[globalBC] = ft0.globalIndex(); } @@ -1469,7 +1552,7 @@ struct UpcCandProducer { continue; if (std::abs(fv0a.time()) > 15.f) continue; - uint64_t globalBC = fv0a.bc_as().globalBC(); + uint64_t globalBC = fv0a.bc_as().globalBC(); mapGlobalBcWithV0A[globalBC] = fv0a.globalIndex(); } @@ -1481,13 +1564,32 @@ struct UpcCandProducer { histRegistry.get(HIST("hCountersTrg"))->Fill("ZNA", 1); if (!(std::abs(zdc.timeZNC()) > 2.f)) histRegistry.get(HIST("hCountersTrg"))->Fill("ZNC", 1); - auto globalBC = zdc.bc_as().globalBC(); + auto globalBC = zdc.bc_as().globalBC(); 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.; @@ -1500,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; 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{}; @@ -1524,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); @@ -1538,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); @@ -1551,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()) { @@ -1573,14 +1712,19 @@ struct UpcCandProducer { selTrackIdsGlobal.push_back(id); } // store used tracks + int upc_flag = 0; + // TODO: introduce better check on association of collision and reconstruction mode + if (bcs.iteratorAt(0).flags() == o2::itsmft::ROFRecord::VtxUPCMode) + upc_flag = 1; fillFwdTracks(fwdTracks, trkCandIDs, candID, globalBC, closestBcMCH, mcFwdTrackLabels); - eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, numContrib, netCharge, RgtrwTOF); + eventCandidates(globalBC, runNumber, dummyX, dummyY, dummyZ, upc_flag, numContrib, netCharge, RgtrwTOF); eventCandidatesSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C, fitInfo.triggerMaskFT0, fitInfo.ampFDDA, fitInfo.ampFDDC, fitInfo.timeFDDA, fitInfo.timeFDDC, fitInfo.triggerMaskFDD, fitInfo.ampFV0A, fitInfo.timeFV0A, fitInfo.triggerMaskFV0A, 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, @@ -1588,6 +1732,7 @@ struct UpcCandProducer { amplitudesV0A, relBCsV0A); candID++; + midIt++; trkCandIDs.clear(); } @@ -1598,6 +1743,7 @@ struct UpcCandProducer { bcsMatchedTrIdsGlobal.clear(); mapGlobalBcWithT0A.clear(); mapGlobalBcWithV0A.clear(); + mapGlobalBcWithFDD.clear(); } // data processors @@ -1628,7 +1774,7 @@ struct UpcCandProducer { // create candidates for central region void processCentral(BarrelTracks const& barrelTracks, o2::aod::AmbiguousTracks const& ambBarrelTracks, - o2::aod::BCs const& bcs, + BCsWithBcSels const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, @@ -1674,7 +1820,7 @@ struct UpcCandProducer { // create candidates for central region void processCentralMC(BarrelTracks const& barrelTracks, o2::aod::AmbiguousTracks const& ambBarrelTracks, - o2::aod::BCs const& bcs, + BCsWithBcSels const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, @@ -1697,7 +1843,7 @@ struct UpcCandProducer { void processForward(ForwardTracks const& fwdTracks, o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, - o2::aod::BCs const& bcs, + BCsWithBcSels const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, @@ -1714,7 +1860,7 @@ struct UpcCandProducer { void processForwardMC(ForwardTracks const& fwdTracks, o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, - o2::aod::BCs const& bcs, + BCsWithBcSels const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, @@ -1737,7 +1883,7 @@ struct UpcCandProducer { void processForwardGlobal(ForwardTracks const& fwdTracks, o2::aod::FwdTrkCls const& fwdTrkClusters, o2::aod::AmbiguousFwdTracks const& ambFwdTracks, - o2::aod::BCs const& bcs, + BCsWithBcSels const& bcs, o2::aod::Collisions const& collisions, o2::aod::FT0s const& ft0s, o2::aod::FDDs const& fdds, 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/dgCandAnalyzer.cxx b/PWGUD/Tasks/dgCandAnalyzer.cxx index d0966dc794d..90d4bd8e011 100644 --- a/PWGUD/Tasks/dgCandAnalyzer.cxx +++ b/PWGUD/Tasks/dgCandAnalyzer.cxx @@ -217,7 +217,11 @@ struct DGCandAnalyzer { } } - void processReco(UDCollisionFull const& dgcand, UDTracksFull const& dgtracks) + // PV contributors + Filter PVContributorFilter = aod::udtrack::isPVContributor == true; + using PVTracks = soa::Filtered; + + void processReco(UDCollisionFull const& dgcand, UDTracksFull const& dgtracks, PVTracks const& PVContributors) { // count collisions registry.fill(HIST("stat/candCaseAll"), 0., 1.); @@ -273,8 +277,8 @@ struct DGCandAnalyzer { registry.fill(HIST("FIT/FDDCAmplitude"), dgcand.totalFDDAmplitudeC(), 1.); // skip events with too few/many tracks - Partition PVContributors = aod::udtrack::isPVContributor == true; - PVContributors.bindTable(dgtracks); + // Partition PVContributors = aod::udtrack::isPVContributor == true; + // PVContributors.bindTable(dgtracks); if (dgcand.numContrib() != PVContributors.size()) { LOGF(info, "Missmatch of PVContributors %d != %d", dgcand.numContrib(), PVContributors.size()); } diff --git a/PWGUD/Tasks/diffMCDataScanner.cxx b/PWGUD/Tasks/diffMCDataScanner.cxx index 05a3e497e17..8ad8d7ae853 100644 --- a/PWGUD/Tasks/diffMCDataScanner.cxx +++ b/PWGUD/Tasks/diffMCDataScanner.cxx @@ -102,9 +102,21 @@ struct collisionsInfo { using MFs = aod::MFTTracks; using FWs = aod::FwdTracks; - void process(CC const& collision, BCs const& bct0s, - TCs& tracks, /* MFs& mfttracks,*/ FWs& fwdtracks, aod::FT0s& /*ft0s*/, aod::FV0As& /*fv0as*/, aod::FDDs& /*fdds*/, - aod::McCollisions& /*McCols*/, aod::McParticles& /*McParts*/) + // filter for global tracks + Filter globalTrackFilter = requireGlobalTrackInFilter(); + using globalTracks = soa::Filtered; + + void process(CC const& collision, + BCs const& bct0s, + TCs& tracks, + /* MFs& mfttracks,*/ + FWs& fwdtracks, + globalTracks& goodTracks, + aod::FT0s& /*ft0s*/, + aod::FV0As& /*fv0as*/, + aod::FDDs& /*fdds*/, + aod::McCollisions& /*McCols*/, + aod::McParticles& /*McParts*/) { // obtain slice of compatible BCs @@ -123,8 +135,6 @@ struct collisionsInfo { } // global tracks - Partition goodTracks = requireGlobalTrackInFilter(); - goodTracks.bindTable(tracks); int cntGlobal = goodTracks.size(); // count tracks diff --git a/PWGUD/Tasks/diffMCQA.cxx b/PWGUD/Tasks/diffMCQA.cxx index 4d199892762..19bf3016a97 100644 --- a/PWGUD/Tasks/diffMCQA.cxx +++ b/PWGUD/Tasks/diffMCQA.cxx @@ -239,12 +239,26 @@ struct DiffMCQA { PROCESS_SWITCH(DiffMCQA, processMCTruth, "Process MC truth", true); // ............................................................................................................... - void processMain(CC const& collision, BCs const& bct0s, - TCs const& tracks, FWs const& fwdtracks, ATs const& /*ambtracks*/, AFTs const& /*ambfwdtracks*/, - aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, - aod::Zdcs& zdcs, aod::Calos& calos, - aod::V0s const& v0s, aod::Cascades const& cascades, - aod::McCollisions const& /*McCols*/, aod::McParticles const& McParts) + // filter for global tracks + Filter globalTrackFilter = requireGlobalTrackInFilter(); + using globalTracks = soa::Filtered; + + void processMain(CC const& collision, + BCs const& bct0s, + TCs const& tracks, + FWs const& fwdtracks, + globalTracks const& goodTracks, + ATs const& /*ambtracks*/, + AFTs const& /*ambfwdtracks*/, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs& zdcs, + aod::Calos& calos, + aod::V0s const& v0s, + aod::Cascades const& cascades, + aod::McCollisions const& /*McCols*/, + aod::McParticles const& McParts) { bool isDGcandidate = true; @@ -263,10 +277,6 @@ struct DiffMCQA { registry.get(HIST("all/mcCols"))->Fill(0., 1.); } - // global tracks - Partition goodTracks = requireGlobalTrackInFilter(); - goodTracks.bindTable(tracks); - // update collision histograms if (isPythiaDiff) { registry.get(HIST("MBRDiff/Stat"))->Fill(0., 1.); diff --git a/PWGUD/Tasks/diffQA.cxx b/PWGUD/Tasks/diffQA.cxx index f219bc4eccb..a1e9ec34185 100644 --- a/PWGUD/Tasks/diffQA.cxx +++ b/PWGUD/Tasks/diffQA.cxx @@ -218,11 +218,24 @@ struct DiffQA { } // ............................................................................................................... - void processMain(CC const& collision, BCs const& bct0s, - TCs const& tracks, FWs const& fwdtracks, ATs const& /*ambtracks*/, AFTs const& /*ambfwdtracks*/, - aod::FT0s const& /*ft0s*/, aod::FV0As const& /*fv0as*/, aod::FDDs const& /*fdds*/, - aod::Zdcs& zdcs, aod::Calos& calos, - aod::V0s const& v0s, aod::Cascades const& cascades) + // filter for global tracks + Filter globalTrackFilter = requireGlobalTrackInFilter(); + using globalTracks = soa::Filtered; + + void processMain(CC const& collision, + BCs const& bct0s, + TCs const& tracks, + FWs const& fwdtracks, + globalTracks const& goodTracks, + ATs const& /*ambtracks*/, + AFTs const& /*ambfwdtracks*/, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs& zdcs, + aod::Calos& calos, + aod::V0s const& v0s, + aod::Cascades const& cascades) { LOGF(debug, " Collision %d", collision.globalIndex()); LOGF(debug, " Start %i", abcrs.size()); @@ -239,8 +252,6 @@ struct DiffQA { // vertex tracks registry.get(HIST("collisions/PVTracks"))->Fill(collision.numContrib()); // global tracks - Partition goodTracks = requireGlobalTrackInFilter(); - goodTracks.bindTable(tracks); registry.get(HIST("collisions/globalTracks"))->Fill(goodTracks.size()); // loop over all tracks 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/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..93bc69fb917 --- /dev/null +++ b/PWGUD/Tasks/sgPIDAnalyzer.cxx @@ -0,0 +1,216 @@ +// 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", + {198, 0.1, 10.0}, + "Pt binning"}; + + ConfigurableAxis sigmaAxis{"sigmaAxis", {100, -50, 50}, "nSigma TPC 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"}; + 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_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_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_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/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_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_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_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("TOF/pPi", "Positive TPC Pi vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nPi", "Negative TPC Pi vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pKa", "Positive TPC Ka vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nKa", "Negative TPC Ka vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pPr", "Positive TPC Pr vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nPr", "Negative TPC Pr vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pEl", "Positive TPC El vs TOF El vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nEl", "Negative TPC El vs TOF El vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pDe", "Positive TPC De vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nDe", "Negative TPC De vs TOF Pi vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pTr", "Positive TPC Tr vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nTr", "Negative TPC Tr vs TOF Ka vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pHe", "Positive TPC He vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nHe", "Negative TPC He vs TOF Pr vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pAl", "Positive TPC Al vs TOF El vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nAl", "Negative TPC Al vs TOF El vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/pMu", "Positive TPC Mu vs TOF El vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + histos.add("TOF/nMu", "Negative TPC Mu vs TOF El vs pt", {HistType::kTH3F, {ptBins, nSigmaBins, nSigmaBins}}); + } + + void process(aod::SGEvents const&, aod::SGTracks const& tracks) + { + 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()); + } + 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()); + } + 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()); + } + 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()); + } + } 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()); + } + 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()); + } + 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()); + } + 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()); + } + } + } 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()); + } 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()); + } + } + } + } +}; + +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/sgTwoPiAnalyzer.cxx b/PWGUD/Tasks/sgTwoPiAnalyzer.cxx index a9ff6b9e517..b7015745448 100644 --- a/PWGUD/Tasks/sgTwoPiAnalyzer.cxx +++ b/PWGUD/Tasks/sgTwoPiAnalyzer.cxx @@ -34,7 +34,25 @@ using namespace o2; using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; +namespace o2::aod +{ +namespace rho +{ +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(Pt, pt, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(Minv, minv, float); +DECLARE_SOA_COLUMN(Sign, sign, float); +} // namespace rho +DECLARE_SOA_TABLE(Rho, "AOD", "RHO", + rho::Run, rho::Flag, rho::GS, rho::ZNA, rho::ZNC, rho::Pt, rho::Eta, rho::Minv, rho::Sign); +} // namespace o2::aod struct SGTwoPiAnalyzer { + Produces rhoByRun; SGSelector sgSelector; Service pdg; Configurable FV0_cut{"FV0", 50., "FV0A threshold"}; @@ -129,7 +147,7 @@ struct SGTwoPiAnalyzer { } // Apply pion hypothesis and create pairs // Opposite sign pairs - + rhoByRun(collision.runNumber(), collision.flags(), gapSide, collision.energyCommonZNA(), collision.energyCommonZNC(), v01.Pt(), v01.Eta(), v01.M(), sign); if (sign == 0) { registry.fill(HIST("os_2Pi_pT"), v01.Pt()); registry.fill(HIST("os_2Pi_eTa"), v01.Eta()); diff --git a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx index a7b9e859e10..90b692a9af3 100644 --- a/PWGUD/Tasks/sginclusivePhiKstarSD.cxx +++ b/PWGUD/Tasks/sginclusivePhiKstarSD.cxx @@ -16,13 +16,19 @@ #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" -#include "iostream" +#include "Framework/ASoA.h" +#include "Framework/ASoAHelpers.h" #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/SGSelector.h" #include "PWGUD/Core/SGTrackSelector.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; using namespace o2::aod; @@ -71,33 +77,34 @@ struct SGResonanceAnalyzer { Configurable phi{"phi", true, ""}; Configurable rho{"rho", true, ""}; Configurable kstar{"kstar", true, ""}; + Configurable fourpion{"fourpion", true, ""}; 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, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {220, 0.9, 1.12}}); - registry.add("os_KK_pT_1", "pt kaon pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {220, 0.9, 1.12}}); - registry.add("os_KK_pT_2", "pt kaon pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {220, 0.9, 1.12}}); - registry.add("os_KK_ls_pT_0", "kaon pair like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {220, 0.9, 1.12}}); - registry.add("os_KK_ls_pT_1", "kaon pair like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {220, 0.9, 1.12}}); - registry.add("os_KK_ls_pT_2", "kaon pair like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {220, 0.9, 1.12}}); + 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}}); } if (rho) { - registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {350, 0.0, 3.5}}); - registry.add("os_pp_pT_1", "pt pion pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {350, 0.0, 3.5}}); - registry.add("os_pp_pT_2", "pt pion pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {350, 0.0, 3.5}}); - registry.add("os_pp_ls_pT_0", "pion pair like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {350, 0.0, 3.5}}); - registry.add("os_pp_ls_pT_1", "pion pair like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {350, 0.0, 3.5}}); - registry.add("os_pp_ls_pT_2", "pion pair like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {350, 0.0, 3.5}}); + registry.add("os_pp_pT_0", "pt pion pair", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_pT_1", "pt pion pair", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_pT_2", "pt pion pair", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_ls_pT_0", "pion pair like sign", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_ls_pT_1", "pion pair like sign", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_pp_ls_pT_2", "pion pair like sign", kTH3F, {{120, 1.44, 2.04}, {80, -2.0, 2.0}, {100, 0, 10}}); } if (kstar) { - registry.add("os_pk_pT_0", "pion-kaon pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {400, 0.0, 2.0}}); - registry.add("os_pk_pT_1", "pion-kaon pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {400, 0.0, 2.0}}); - registry.add("os_pk_pT_2", "pion-kaon pair", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {400, 0.0, 2.0}}); - registry.add("os_pk_ls_pT_0", "pion-kaon pair like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {400, 0.0, 2.0}}); - registry.add("os_pk_ls_pT_1", "pion-kaon like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {400, 0.0, 2.0}}); - registry.add("os_pk_ls_pT_2", "pion-kaon like sign", kTH3F, {{100, 0.0, 10.0}, {80, -2.0, 2.0}, {400, 0.0, 2.0}}); + 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_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}}); } // QA plots if (QA) { @@ -131,15 +138,6 @@ struct SGResonanceAnalyzer { registry.add("mult_0", "mult0", kTH1F, {{150, 0, 150}}); registry.add("mult_1", "mult1", kTH1F, {{150, 0, 150}}); registry.add("mult_2", "mult2", kTH1F, {{150, 0, 150}}); - registry.add("mult_0_pt", "mult0_pt", kTH1F, {{150, 0, 150}}); - registry.add("mult_1_pt", "mult1_pt", kTH1F, {{150, 0, 150}}); - registry.add("mult_2_pt", "mult2_pt", kTH1F, {{150, 0, 150}}); - registry.add("mult_0_pt1", "mult0_pt1", kTH1F, {{150, 0, 150}}); - registry.add("mult_1_pt1", "mult1_pt1", kTH1F, {{150, 0, 150}}); - registry.add("mult_2_pt1", "mult2_pt1", kTH1F, {{150, 0, 150}}); - registry.add("mult_0_pt2", "mult0_pt2", kTH1F, {{150, 0, 150}}); - registry.add("mult_1_pt2", "mult1_pt2", kTH1F, {{150, 0, 150}}); - registry.add("mult_2_pt2", "mult2_pt2", kTH1F, {{150, 0, 150}}); registry.add("event_rap_gap", "rap_gap", kTH1F, {{15, 0, 15.0}}); registry.add("rap_mult1", "rap_mult1", kTH1F, {{150, 0, 150}}); registry.add("rap_mult2", "rap_mult2", kTH1F, {{150, 0, 150}}); @@ -157,29 +155,125 @@ struct SGResonanceAnalyzer { 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 mass", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass_rap1", "phi mass", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass_rap2", "phi mass", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap", "phi mass gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap1", "phi mass gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass1_rap2", "phi mass gap1", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap", "phi mass DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap1", "phi mass DG", kTH3F, {{220, 0.98, 1.12}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kk_mass2_rap2", "phi mass 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.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}}); + + // 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}}); } if (rapidity_gap && kstar) { - registry.add("os_kp_mass_rap", "kstar mass", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass_rap1", "kstar mass", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass_rap2", "kstar mass", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass1_rap", "kstar mass gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass1_rap1", "kstar mass gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass1_rap2", "kstar mass gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass2_rap", "kstar mass DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass2_rap1", "kstar mass DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); - registry.add("os_kp_mass2_rap2", "kstar mass DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass_rap", "kstar mass1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass_rap1", "kstar mass2", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass_rap2", "kstar mass3", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass1_rap", "kstar mass1 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass1_rap1", "kstar mass2 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass1_rap2", "kstar mass3 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass2_rap", "kstar mass1 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass2_rap1", "kstar mass2 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_mass2_rap2", "kstar mass3 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + + // like sign bkg + + registry.add("os_kp_ls_mass_rap", "kstar ls mass1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass_rap1", "kstar ls mass2", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass_rap2", "kstar ls mass3", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass1_rap", "kstar ls mass1 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass1_rap1", "kstar ls mass2 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass1_rap2", "kstar ls mass3 gap1", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass2_rap", "kstar ls mass1 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass2_rap1", "kstar ls mass2 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + registry.add("os_kp_ls_mass2_rap2", "kstar ls mass3 DG", kTH3F, {{400, 0.0, 2.0}, {80, -2.0, 2.0}, {100, 0, 10}}); + } + if (fourpion) { + registry.add("os_pppp_pT_2", "4 pion pair", kTH3F, {{800, 0.5, 4.5}, {250, 0.0, 5.0}, {30, -1.5, 1.5}}); + registry.add("os_pppp_pT_2_ls", "4 pion pair", kTH3F, {{800, 0.5, 4.5}, {250, 0.0, 5.0}, {30, -1.5, 1.5}}); + registry.add("os_pp_vs_pp_mass", "pair1 vd pair2 ", kTH2F, {{800, 0.5, 4.5}, {800, 0.5, 4.5}}); + registry.add("os_pp_vs_pp_pt", "pair1 pt vs pair2 pt", kTH2F, {{250, 0.0, 5.0}, {250, 0.0, 5.0}}); + registry.add("os_pp_vs_pp_mass1", "pair3 vd pair4 ", kTH2F, {{800, 0.5, 4.5}, {800, 0.5, 4.5}}); + registry.add("os_pp_vs_pp_pt1", "pair3 pt vs pair4 pt", kTH2F, {{250, 0.0, 5.0}, {250, 0.0, 5.0}}); + registry.add("phi_dis", "phi_dis", kTH1F, {{360, 0, 6.28}}); + registry.add("costheta_dis", "costheta_dis", kTH1F, {{40, -1.0, 1.0}}); + registry.add("costheta_vs_phi", "costheta_vs_phi", kTH2F, {{40, -1.0, 1.0}, {360, 0.0, 6.28}}); + registry.add("phi_dis1", "phi_dis1", kTH1F, {{360, 0, 6.28}}); + registry.add("costheta_dis1", "costheta_dis1", kTH1F, {{40, -1.0, 1.0}}); + registry.add("costheta_vs_phi1", "costheta_vs_phi1", kTH2F, {{40, -1.0, 1.0}, {360, 0.0, 6.28}}); } } + + //_____________________________________________________________________________ + Double_t CosThetaCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, + ROOT::Math::PtEtaPhiMVector pair2, + ROOT::Math::PtEtaPhiMVector fourpion) + { + Double_t HalfSqrtSnn = 2680.; + Double_t MassOfLead208 = 193.6823; + Double_t MomentumBeam = TMath::Sqrt(HalfSqrtSnn * HalfSqrtSnn * 208 * 208 - MassOfLead208 * MassOfLead208); + + TLorentzVector pProjCM(0., 0., -MomentumBeam, HalfSqrtSnn * 208); // projectile + TLorentzVector pTargCM(0., 0., MomentumBeam, HalfSqrtSnn * 208); // target + + // TVector3 beta = (-1. / fourpion.E()) * fourpion.Vect(); + ROOT::Math::PtEtaPhiMVector v1 = pair1; + ROOT::Math::PtEtaPhiMVector v2 = pair2; + ROOT::Math::PtEtaPhiMVector v12 = fourpion; + + // Boost to center of mass frame + ROOT::Math::Boost boostv12{v12.BoostToCM()}; + ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()}; + ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam1_CM{(boostv12(pProjCM).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam2_CM{(boostv12(pTargCM).Vect()).Unit()}; + + // Axes + ROOT::Math::XYZVectorF zaxis_CS{((Beam1_CM.Unit() - Beam2_CM.Unit()).Unit())}; + + Double_t CosThetaCS = zaxis_CS.Dot((v1_CM)); + return CosThetaCS; + } + //------------------------------------------------------------------------------------------------------ + Double_t PhiCollinsSoperFrame(ROOT::Math::PtEtaPhiMVector pair1, ROOT::Math::PtEtaPhiMVector pair2, ROOT::Math::PtEtaPhiMVector fourpion) + { + // Half of the energy per pair of the colliding nucleons. + Double_t HalfSqrtSnn = 2680.; + Double_t MassOfLead208 = 193.6823; + Double_t MomentumBeam = TMath::Sqrt(HalfSqrtSnn * HalfSqrtSnn * 208 * 208 - MassOfLead208 * MassOfLead208); + + TLorentzVector pProjCM(0., 0., -MomentumBeam, HalfSqrtSnn * 208); // projectile + TLorentzVector pTargCM(0., 0., MomentumBeam, HalfSqrtSnn * 208); // target + ROOT::Math::PtEtaPhiMVector v1 = pair1; + ROOT::Math::PtEtaPhiMVector v2 = pair2; + ROOT::Math::PtEtaPhiMVector v12 = fourpion; + // Boost to center of mass frame + ROOT::Math::Boost boostv12{v12.BoostToCM()}; + ROOT::Math::XYZVectorF v1_CM{(boostv12(v1).Vect()).Unit()}; + ROOT::Math::XYZVectorF v2_CM{(boostv12(v2).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam1_CM{(boostv12(pProjCM).Vect()).Unit()}; + ROOT::Math::XYZVectorF Beam2_CM{(boostv12(pTargCM).Vect()).Unit()}; + // Axes + ROOT::Math::XYZVectorF zaxis_CS{((Beam1_CM.Unit() - Beam2_CM.Unit()).Unit())}; + ROOT::Math::XYZVectorF yaxis_CS{(Beam1_CM.Cross(Beam2_CM)).Unit()}; + ROOT::Math::XYZVectorF xaxis_CS{(yaxis_CS.Cross(zaxis_CS)).Unit()}; + + Double_t phi = TMath::ATan2(yaxis_CS.Dot(v1_CM), xaxis_CS.Dot(v1_CM)); + return phi; + } + using udtracks = soa::Join; using udtracksfull = soa::Join; using UDCollisionsFull = soa::Join; // @@ -190,6 +284,19 @@ struct SGResonanceAnalyzer { TLorentzVector v0; TLorentzVector v1; TLorentzVector v01; + TLorentzVector v0_1; + ROOT::Math::PtEtaPhiMVector phiv; + ROOT::Math::PtEtaPhiMVector phiv1; + + std::vector onlyPionTracks_p; + std::vector rawPionTracks_p; + + std::vector onlyPionTracks_pm; + std::vector rawPionTracks_pm; + + 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}; @@ -214,7 +321,6 @@ struct SGResonanceAnalyzer { Int_t mult0 = 0; Int_t mult1 = 0; Int_t mult2 = 0; - Int_t mult_pt[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; Int_t trackgapA = 0; Int_t trackgapC = 0; Int_t trackDG = 0; @@ -224,41 +330,28 @@ struct SGResonanceAnalyzer { if (!trackselector(track1, parameters)) continue; v0.SetXYZM(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); - if (gapSide == 0) { - mult0++; - if (v0.Pt() < 1.0) { - mult_pt[0]++; + ROOT::Math::PtEtaPhiMVector vv1(v0.Pt(), v0.Eta(), v0.Phi(), o2::constants::physics::MassPionCharged); + if (selectionPIDPion(track1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + onlyPionTracks_pm.push_back(vv1); + rawPionTracks_pm.push_back(track1); + if (track1.sign() == 1) { + onlyPionTracks_p.push_back(vv1); + rawPionTracks_p.push_back(track1); } - if (v0.Pt() >= 1.0 && v0.Pt() < 3.0) { - mult_pt[1]++; - } - if (v0.Pt() >= 3.0) { - mult_pt[2]++; + if (track1.sign() == -1) { + onlyPionTracks_n.push_back(vv1); + rawPionTracks_n.push_back(track1); } } + + if (gapSide == 0) { + mult0++; + } if (gapSide == 1) { mult1++; - if (v0.Pt() < 1.0) { - mult_pt[3]++; - } - if (v0.Pt() >= 1.0 && v0.Pt() < 3.0) { - mult_pt[4]++; - } - if (v0.Pt() >= 3.0) { - mult_pt[5]++; - } } if (gapSide == 2) { mult2++; - if (v0.Pt() < 1.0) { - mult_pt[6]++; - } - if (v0.Pt() >= 1.0 && v0.Pt() < 3.0) { - mult_pt[7]++; - } - if (v0.Pt() >= 3.0) { - mult_pt[8]++; - } } if (TMath::Abs(v0.Eta()) < EtaDG) { trackDG++; @@ -306,9 +399,6 @@ struct SGResonanceAnalyzer { registry.fill(HIST("ZDC_A_0"), collision.energyCommonZNA()); registry.fill(HIST("ZDC_C_0"), collision.energyCommonZNC()); registry.fill(HIST("mult_0"), mult0); - registry.fill(HIST("mult_0_pt"), mult_pt[0]); - registry.fill(HIST("mult_1_pt"), mult_pt[1]); - registry.fill(HIST("mult_2_pt"), mult_pt[2]); } if (gapSide == 1) { registry.fill(HIST("V0A_1"), collision.totalFV0AmplitudeA()); @@ -317,9 +407,6 @@ struct SGResonanceAnalyzer { registry.fill(HIST("ZDC_A_1"), collision.energyCommonZNA()); registry.fill(HIST("ZDC_C_1"), collision.energyCommonZNC()); registry.fill(HIST("mult_1"), mult1); - registry.fill(HIST("mult_0_pt1"), mult_pt[3]); - registry.fill(HIST("mult_1_pt1"), mult_pt[4]); - registry.fill(HIST("mult_2_pt1"), mult_pt[5]); } if (gapSide == 2) { registry.fill(HIST("V0A"), collision.totalFV0AmplitudeA()); @@ -328,9 +415,6 @@ struct SGResonanceAnalyzer { registry.fill(HIST("ZDC_A"), collision.energyCommonZNA()); registry.fill(HIST("ZDC_C"), collision.energyCommonZNC()); registry.fill(HIST("mult_2"), mult2); - registry.fill(HIST("mult_0_pt2"), mult_pt[6]); - registry.fill(HIST("mult_1_pt2"), mult_pt[7]); - registry.fill(HIST("mult_2_pt2"), mult_pt[8]); } if (rapidity_gap) { if (trackgapC > 0 && trackgapA == 0 && trackextra == 0) { @@ -400,6 +484,17 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_kk_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } } + if (t0.sign() == t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_kk_ls_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_kk_ls_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_kk_ls_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } } 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) { // Apply kaon hypothesis and create pairs @@ -418,6 +513,17 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_kp_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); } } + if (t0.sign() == t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_kp_ls_mass_rap"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_kp_ls_mass1_rap"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_kp_ls_mass2_rap"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } } } } @@ -443,6 +549,17 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_kk_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } } + if (t0.sign() == t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_kk_ls_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_kk_ls_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_kk_ls_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } } 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) { // Apply kaon hypothesis and create pairs @@ -461,6 +578,17 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_kp_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); } } + if (t0.sign() == t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_kp_ls_mass_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_kp_ls_mass1_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_kp_ls_mass2_rap1"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } } } } @@ -485,6 +613,17 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_kk_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } } + if (t0.sign() == t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_kk_ls_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_kk_ls_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_kk_ls_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } } 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) { // Apply kaon hypothesis and create pairs @@ -503,6 +642,17 @@ struct SGResonanceAnalyzer { registry.fill(HIST("os_kp_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); } } + if (t0.sign() == t1.sign()) { + if (gapSide == 0) { + registry.fill(HIST("os_kp_ls_mass_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 1) { + registry.fill(HIST("os_kp_ls_mass1_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + if (gapSide == 2) { + registry.fill(HIST("os_kp_ls_mass2_rap2"), v01.M(), v01.Rapidity(), v01.Pt()); + } + } } } } @@ -519,53 +669,53 @@ struct SGResonanceAnalyzer { // Opposite sign pairs if (t0.sign() != t1.sign()) { if (gapSide == 0) { - registry.fill(HIST("os_KK_pT_0"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_KK_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 1) { - registry.fill(HIST("os_KK_pT_1"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_KK_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 2) { - registry.fill(HIST("os_KK_pT_2"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_KK_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // samesignpair if (t0.sign() == t1.sign()) { if (gapSide == 0) { - registry.fill(HIST("os_KK_ls_pT_0"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_KK_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 1) { - registry.fill(HIST("os_KK_ls_pT_1"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_KK_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 2) { - registry.fill(HIST("os_KK_ls_pT_2"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_KK_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } } - if (rho && selectionPIDPion(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && selectionPIDPion(t1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { - v0.SetXYZM(t0.px(), t0.py(), t0.pz(), o2::constants::physics::MassPionCharged); + if (rho && selectionPIDProton(t0, use_tof, nsigmatpc_cut, nsigmatof_cut) && selectionPIDPion(t1, use_tof, nsigmatpc_cut, nsigmatof_cut)) { + v0.SetXYZM(t0.px(), t0.py(), t0.pz(), mproton); v1.SetXYZM(t1.px(), t1.py(), t1.pz(), o2::constants::physics::MassPionCharged); v01 = v0 + v1; // Opposite sign pairs if (t0.sign() != t1.sign()) { if (gapSide == 0) { - registry.fill(HIST("os_pp_pT_0"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pp_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 1) { - registry.fill(HIST("os_pp_pT_1"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pp_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 2) { - registry.fill(HIST("os_pp_pT_2"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pp_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // same sign pair if (t0.sign() == t1.sign()) { if (gapSide == 0) { - registry.fill(HIST("os_pp_ls_pT_0"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pp_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 1) { - registry.fill(HIST("os_pp_ls_pT_1"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pp_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 2) { - registry.fill(HIST("os_pp_ls_pT_2"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pp_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } } @@ -576,28 +726,70 @@ struct SGResonanceAnalyzer { // Opposite sign pairs if (t0.sign() != t1.sign()) { if (gapSide == 0) { - registry.fill(HIST("os_pk_pT_0"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pk_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 1) { - registry.fill(HIST("os_pk_pT_1"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pk_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 2) { - registry.fill(HIST("os_pk_pT_2"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pk_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } // same sign pair if (t0.sign() == t1.sign()) { if (gapSide == 0) { - registry.fill(HIST("os_pk_ls_pT_0"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pk_ls_pT_0"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 1) { - registry.fill(HIST("os_pk_ls_pT_1"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pk_ls_pT_1"), v01.M(), v01.Rapidity(), v01.Pt()); } if (gapSide == 2) { - registry.fill(HIST("os_pk_ls_pT_2"), v01.Pt(), v01.Rapidity(), v01.M()); + registry.fill(HIST("os_pk_ls_pT_2"), v01.M(), v01.Rapidity(), v01.Pt()); } } } } + if (fourpion) { + if (gapSide == 2 && mult2 == 4) { + + ROOT::Math::PtEtaPhiMVector pair1, pair2, pair3, pair4; + if (onlyPionTracks_p.size() == 2 && onlyPionTracks_n.size() == 2) { + ROOT::Math::PtEtaPhiMVector k1 = onlyPionTracks_p.at(0); + ROOT::Math::PtEtaPhiMVector k2 = onlyPionTracks_p.at(1); + ROOT::Math::PtEtaPhiMVector k3 = onlyPionTracks_n.at(0); + ROOT::Math::PtEtaPhiMVector k4 = onlyPionTracks_n.at(1); + phiv = k1 + k2 + k3 + k4; + pair1 = k1 + k3; + pair2 = k2 + k4; + pair3 = k1 + k4; + pair4 = k2 + k3; + registry.fill(HIST("os_pppp_pT_2"), phiv.M(), phiv.Pt(), phiv.Rapidity()); + registry.fill(HIST("os_pp_vs_pp_mass"), pair1.M(), pair2.M()); + registry.fill(HIST("os_pp_vs_pp_pt"), pair1.Pt(), pair2.Pt()); + auto costhetaPair = CosThetaCollinsSoperFrame(pair1, pair2, phiv); + auto phiPair = 1. * TMath::Pi() + PhiCollinsSoperFrame(pair1, pair2, phiv); + registry.fill(HIST("phi_dis"), phiPair); + registry.fill(HIST("costheta_dis"), costhetaPair); + registry.fill(HIST("costheta_vs_phi"), costhetaPair, phiPair); + registry.fill(HIST("os_pp_vs_pp_mass1"), pair3.M(), pair4.M()); + registry.fill(HIST("os_pp_vs_pp_pt1"), pair3.Pt(), pair4.Pt()); + auto costhetaPair1 = CosThetaCollinsSoperFrame(pair3, pair4, phiv); + auto phiPair1 = 1. * TMath::Pi() + PhiCollinsSoperFrame(pair3, pair4, phiv); + registry.fill(HIST("phi_dis1"), phiPair1); + registry.fill(HIST("costheta_dis1"), costhetaPair1); + registry.fill(HIST("costheta_vs_phi1"), costhetaPair1, phiPair1); + } + if (onlyPionTracks_p.size() != 2 && onlyPionTracks_n.size() != 2) { + if (onlyPionTracks_p.size() + onlyPionTracks_n.size() != 4) + return; + ROOT::Math::PtEtaPhiMVector l1 = onlyPionTracks_pm.at(0); + ROOT::Math::PtEtaPhiMVector l2 = onlyPionTracks_pm.at(1); + ROOT::Math::PtEtaPhiMVector l3 = onlyPionTracks_pm.at(2); + ROOT::Math::PtEtaPhiMVector l4 = onlyPionTracks_pm.at(3); + phiv1 = l1 + l2 + l3 + l4; + registry.fill(HIST("os_pppp_pT_2_ls"), phiv1.M(), phiv1.Pt(), phiv1.Rapidity()); + } + } + } } }; diff --git a/PWGUD/Tasks/upcEventITSROFcounter.cxx b/PWGUD/Tasks/upcEventITSROFcounter.cxx index a49ee0c8f07..1da6fbfd26c 100644 --- a/PWGUD/Tasks/upcEventITSROFcounter.cxx +++ b/PWGUD/Tasks/upcEventITSROFcounter.cxx @@ -17,6 +17,9 @@ #include "Common/DataModel/EventSelection.h" +#include "PWGUD/DataModel/UDTables.h" +#include "PWGUD/Core/SGSelector.h" + #include using namespace o2; @@ -25,14 +28,23 @@ using namespace o2::framework::expressions; using BCsWithRun3Matchings = soa::Join; using CCs = soa::Join; +using FullSGUDCollision = soa::Join::iterator; struct UpcEventITSROFcounter { Service ccdb; + SGSelector sgSelector; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable nTracksForUPCevent{"nTracksForUPCevent", 16, {"Maximum of tracks defining a UPC collision"}}; + Configurable useTrueGap{"useTrueGap", true, {"Calculate gapSide for a given FV0/FT0/ZDC thresholds"}}; + Configurable cutMyGapSideFV0{"FV0", -1, "FV0A threshold for SG selector"}; + Configurable cutMyGapSideFT0A{"FT0A", 150., "FT0A threshold for SG selector"}; + Configurable cutMyGapSideFT0C{"FT0C", 50., "FT0C threshold for SG selector"}; + Configurable cutMyGapSideZDC{"ZDC", 10., "ZDC threshold for SG selector"}; + ConfigurableAxis axisRunNumbers{"axisRunNumbers", {1400, 544000.5, 545400.5}, "Range of run numbers"}; + void init(InitContext&) { @@ -41,9 +53,18 @@ struct UpcEventITSROFcounter { histos.add("Events/hCountCollisionsInROFborderMatching", ";;Number of collision (-)", HistType::kTH1D, {{11, -0.5, 10.5}}); histos.add("Events/hCountUPCcollisionsInROFborderMatching", ";;Number of UPC (mult < 17) collision (-)", HistType::kTH1D, {{11, -0.5, 10.5}}); + histos.add("Runs/hStdModeCollDG", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + histos.add("Runs/hUpcModeCollDG", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + histos.add("Runs/hStdModeCollSG1", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + histos.add("Runs/hUpcModeCollSG1", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + histos.add("Runs/hStdModeCollSG0", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + histos.add("Runs/hUpcModeCollSG0", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + histos.add("Runs/hStdModeCollNG", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + histos.add("Runs/hUpcModeCollNG", ";Run number;Number of events (-)", HistType::kTH1D, {axisRunNumbers}); + } // end init - void process(BCsWithRun3Matchings const& bcs, CCs const& collisions) + void processCounterPerITSROF(BCsWithRun3Matchings const& bcs, CCs const& collisions) { int nAllColls = 0; int nUPCcolls = 0; @@ -119,7 +140,40 @@ struct UpcEventITSROFcounter { } } - PROCESS_SWITCH(UpcEventITSROFcounter, process, "Counts number of collisions within ITSROF", true); + void processCounterPerRun(FullSGUDCollision const& coll) + { + + int gapSide = coll.gapSide(); + int trueGapSide = sgSelector.trueGap(coll, cutMyGapSideFV0, cutMyGapSideFT0A, cutMyGapSideFT0C, cutMyGapSideZDC); + if (useTrueGap) { + gapSide = trueGapSide; + } + + if (coll.flags() == 0) { + if (gapSide == 2) { + histos.get(HIST("Runs/hStdModeCollDG"))->Fill(coll.runNumber()); + } else if (gapSide == 1) { + histos.get(HIST("Runs/hStdModeCollSG1"))->Fill(coll.runNumber()); + } else if (gapSide == 0) { + histos.get(HIST("Runs/hStdModeCollSG0"))->Fill(coll.runNumber()); + } else { + histos.get(HIST("Runs/hStdModeCollNG"))->Fill(coll.runNumber()); + } + } else { + if (gapSide == 2) { + histos.get(HIST("Runs/hUpcModeCollDG"))->Fill(coll.runNumber()); + } else if (gapSide == 1) { + histos.get(HIST("Runs/hUpcModeCollSG1"))->Fill(coll.runNumber()); + } else if (gapSide == 0) { + histos.get(HIST("Runs/hUpcModeCollSG0"))->Fill(coll.runNumber()); + } else { + histos.get(HIST("Runs/hUpcModeCollNG"))->Fill(coll.runNumber()); + } + } + } + + PROCESS_SWITCH(UpcEventITSROFcounter, processCounterPerITSROF, "Counts number of collisions per ITSROF", false); + PROCESS_SWITCH(UpcEventITSROFcounter, processCounterPerRun, "Counts number of whatever per RUN", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx b/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx index 3c461999f34..8464ead5f1e 100644 --- a/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx +++ b/PWGUD/Tasks/upcJpsiCentralBarrelCorr.cxx @@ -13,6 +13,8 @@ /// \author Sara Haidlova, sara.haidlova@cern.ch /// \since March 2024 +#include + // O2 headers #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -25,6 +27,7 @@ #include "PWGUD/DataModel/UDTables.h" #include "PWGUD/Core/UDHelpers.h" #include "PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h" +#include "PWGUD/Core/SGSelector.h" // ROOT headers #include "TLorentzVector.h" @@ -34,46 +37,76 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::constants::math; +SGSelector sgSelector; + struct UpcJpsiCentralBarrel { // configurable axes - ConfigurableAxis IVMAxis{"IVMAxis", {350.0f, 2.0f, 4.5f}, "M_#it{inv} (GeV/#it{c}^{2})"}; - ConfigurableAxis IVMAxisWide{"IVMAxisWide", {350.0f, 0.0f, 4.5f}, "M_#it{inv} (GeV/#it{c}^{2})"}; - ConfigurableAxis ptAxis{"ptAxis", {250.0f, 0.1f, 3.0f}, "#it{p}_T (GeV/#it{c})"}; - ConfigurableAxis pAxis{"pAxis", {250.0f, 0.1f, 3.0f}, "#it{p} (GeV/#it{c})"}; - ConfigurableAxis etaAxis{"etaAxis", {250.0f, -1.5f, 1.5f}, "#eta (-)"}; - ConfigurableAxis countAxis{"countAxis", {10.0f, 0.0f, 10.0f}, "Number of events (-)"}; - ConfigurableAxis phiAxis{"phiAxis", {250.0f, 0, TwoPI}, "#phi (rad)"}; - ConfigurableAxis accoplAxis{"accoplAxis", {250.0f, -0.2f, 0.2f}, "accAngle"}; - ConfigurableAxis thetaAxis{"thetaAxis", {250.0f, -1.5f, 1.5f}, "cos #theta (-)"}; - ConfigurableAxis sigTPCAxis{"sigTPCAxis", {100.0f, 0, 200.0f}, "TPC d#it{E}/d#it{x}"}; - ConfigurableAxis sigTOFAxis{"sigTOFAxis", {100.0f, 0, 200.0f}, "TOF d#it{E}/d#it{x}"}; - ConfigurableAxis betaTOFAxis{"betaTOFAxis", {100.0f, 0, 1.5}, "TOF #beta"}; - ConfigurableAxis sigmaAxis{"sigmaAxis", {20, -10, 10}, "#sigma"}; + 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 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", {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", {1000.0f, 0, 200.0f}, "TPC d#it{E}/d#it{x}"}; + ConfigurableAxis axisTOF{"axisTOF", {1000.0f, 0, 200.0f}, "TOF d#it{E}/d#it{x}"}; + ConfigurableAxis axisBetaTOF{"axisBetaTOF", {100.0f, 0, 1.5}, "TOF #beta"}; + 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", {1000, 0.0, 100.0}, "Chi2"}; + ConfigurableAxis axisIVMSel{"axisIVMSel", {1000, 0.0, 10.0}, "IVM"}; + ConfigurableAxis axisCounterSel{"axisCounterSel", {1000, 0.0, 200.0}, "Selection"}; // configurable cuts (modify in json) + // track quality cuts Configurable TPCNClsCrossedRows{"TPCNClsCrossedRows", 70, "number of crossed rows in TPC"}; - Configurable TOFBothTracks{"TOFBothTracks", false, "both candidate tracks have TOF hits"}; - Configurable TOFAtLeastOneTrack{"TOFAtLeastOneTrack", false, "at least candidate tracks has TOF hits"}; - Configurable TOFOneTrack{"TOFOneTrack", false, "one candidate track has TOF hits"}; 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 TPCPIDOnly{"TPCPIDOnly", false, "Only TPC PID"}; - Configurable smallestPID{"smallestPID", false, "Use smallest PID hypo."}; Configurable DCAcut{"DCAcut", false, "DCA cut from run2."}; + Configurable newCutTPC{"newCutTPC", false, "New cuts for TPC quality tracks."}; Configurable TPCNSigmaMu{"TPCNSigmaMu", 3, "PID for TPC Mu track"}; Configurable EtaCut{"EtaCut", 0.9f, "acceptance cut per track"}; - Configurable RapCut{"RapCut", 0.8f, "choose event in midrapidity"}; + Configurable cutPtTrack{"cutPtTrack", 0.7f, "pT cut per track"}; + Configurable cutVertexZ{"cutVertexZ", 10.0f, "cut on vertex position in Z"}; + 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"}; Configurable ITSChi2NClsCut{"ITSChi2NClsCut", 36, "minimal Chi2/cluster for the ITS track"}; 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 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."}; + Configurable chargeOrdered{"chargeOrdered", false, "Order tracks based on charge."}; + Configurable doOnlyUPC{"doOnlyUPC", false, "Analyse only collisions with UPC settings."}; + Configurable doOnlyStandard{"doOnlyStandard", false, "Analyse only collisions with standard settings."}; + // initialize histogram registry HistogramRegistry Statistics{ "Statistics", @@ -83,6 +116,10 @@ struct UpcJpsiCentralBarrel { "RawData", {}}; + HistogramRegistry Selections{ + "Selections", + {}}; + HistogramRegistry PVContributors{ "PVContributors", {}}; @@ -135,28 +172,15 @@ struct UpcJpsiCentralBarrel { "Asymmetry", {}}; - using UDCollisionsFull = soa::Join; + using UDCollisionsFull = soa::Join; using UDCollisionFull = UDCollisionsFull::iterator; using UDTracksFull = soa::Join; using UDTrackFull = UDTracksFull::iterator; + using SGUDCollisionFull = soa::Join::iterator; void init(InitContext&) { - const AxisSpec axisIVM{IVMAxis, "IVM axis"}; - const AxisSpec axisIVMWide{IVMAxisWide, "IVM axis wide"}; - const AxisSpec axispt{ptAxis, "pt axis"}; - const AxisSpec axiseta{etaAxis, "eta axis"}; - const AxisSpec axisCounter{countAxis, "counter axis"}; - const AxisSpec axisAccAngle{accoplAxis, "accAngle"}; - const AxisSpec axisAngTheta{thetaAxis, "cosTheta"}; - const AxisSpec axisPhi{phiAxis, "phi"}; - const AxisSpec axisp{pAxis, "p axis"}; - const AxisSpec axisTPC{sigTPCAxis, ""}; - const AxisSpec axisTOF{sigTOFAxis, ""}; - const AxisSpec axisBetaTOF{betaTOFAxis, ""}; - const AxisSpec axisSigma{sigmaAxis, ""}; - // statistics histograms for counters Statistics.add("Statistics/hNumberOfCollisions", "hNumberOfCollisions", {HistType::kTH1F, {axisCounter}}); Statistics.add("Statistics/hNumberOfTracks", "hNumberOfTracks", {HistType::kTH1F, {axisCounter}}); @@ -169,314 +193,581 @@ struct UpcJpsiCentralBarrel { 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/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/hTrackPt", "hTrackPt", {HistType::kTH1F, {axisPt}}); + RawData.add("RawData/hTrackEta", "hTrackEta", {HistType::kTH1F, {axisEta}}); RawData.add("RawData/hTrackPhi", "hTrackPhi", {HistType::kTH1F, {axisPhi}}); - RawData.add("RawData/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - RawData.add("RawData/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + 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", "hITSNCls", {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/hZNATime", "hZNATime", {HistType::kTH1F, {axisZDCTime}}); + RawData.add("RawData/hZNCTime", "hZNCTime", {HistType::kTH1F, {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/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}}); + RawData.add("RawData/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); + + // Selection checks + Selections.add("Selections/Electron/Mass/Leading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Leading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Leading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Leading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Leading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Subleading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Subleading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Subleading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Subleading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Electron/Mass/Subleading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + + Selections.add("Selections/Electron/Rapidity/Leading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Leading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Leading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Leading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Leading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Electron/Rapidity/Subleading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + + Selections.add("Selections/Electron/Pt/Leading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Leading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Leading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Leading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Leading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Subleading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Subleading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Subleading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Subleading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Electron/Pt/Subleading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + + Selections.add("Selections/Muon/Mass/Leading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Leading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Leading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Leading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Leading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Subleading/hITSNClsVsM", "hITSNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Subleading/hITSChi2NClsVsM", "hITSChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Subleading/hTPCNClsVsM", "hTPCNClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Subleading/hTPCChi2NClsVsM", "hTPCChi2NClsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + Selections.add("Selections/Muon/Mass/Subleading/hTPCNClsCrossedRowsVsM", "hTPCNClsCrossedRowsVsM", {HistType::kTH2F, {axisIVMSel, axisCounterSel}}); + + Selections.add("Selections/Muon/Rapidity/Leading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Leading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Leading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Leading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Leading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hITSNClsVsY", "hITSNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hITSChi2NClsVsY", "hITSChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hTPCNClsVsY", "hTPCNClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hTPCChi2NClsVsY", "hTPCChi2NClsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + Selections.add("Selections/Muon/Rapidity/Subleading/hTPCNClsCrossedRowsVsY", "hTPCNClsCrossedRowsVsY", {HistType::kTH2F, {axisEta, axisCounterSel}}); + + Selections.add("Selections/Muon/Pt/Leading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Leading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Leading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Leading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Leading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Subleading/hITSNClsVsPt", "hITSNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Subleading/hITSChi2NClsVsPt", "hITSChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Subleading/hTPCNClsVsPt", "hTPCNClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Subleading/hTPCChi2NClsVsPt", "hTPCChi2NClsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); + Selections.add("Selections/Muon/Pt/Subleading/hTPCNClsCrossedRowsVsPt", "hTPCNClsCrossedRowsVsPt", {HistType::kTH2F, {axisPt, axisCounterSel}}); // PVContributors histograms - PVContributors.add("PVContributors/hTrackPt", "hTrackPt", {HistType::kTH1F, {axispt}}); - PVContributors.add("PVContributors/hTrackEta", "hTrackEta", {HistType::kTH1F, {axiseta}}); + PVContributors.add("PVContributors/hTrackPt", "hTrackPt", {HistType::kTH1F, {axisPt}}); + PVContributors.add("PVContributors/hTrackEta", "hTrackEta", {HistType::kTH1F, {axisEta}}); PVContributors.add("PVContributors/hTrackPhi", "hTrackPhi", {HistType::kTH1F, {axisPhi}}); - PVContributors.add("PVContributors/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - PVContributors.add("PVContributors/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + PVContributors.add("PVContributors/hTPCNClsFindable", "hTPCNClsFindable", {HistType::kTH1F, {axisTPC}}); + PVContributors.add("PVContributors/hTPCNClsFindableMinusFound", "hTPCNClsFindableMinusFound", {HistType::kTH1F, {axisTPC}}); + PVContributors.add("PVContributors/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); + 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/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}}); + PVContributors.add("PVContributors/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TG histograms - TG.add("TG/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axispt}}); - TG.add("TG/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axiseta}}); + TG.add("TG/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); + TG.add("TG/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axisEta}}); TG.add("TG/hTrackPhi1", "hTrackPhi1", {HistType::kTH1F, {axisPhi}}); - TG.add("TG/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axispt}}); - TG.add("TG/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axiseta}}); + TG.add("TG/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axisPt}}); + TG.add("TG/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axisEta}}); TG.add("TG/hTrackPhi2", "hTrackPhi2", {HistType::kTH1F, {axisPhi}}); - TG.add("TG/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - TG.add("TG/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + TG.add("TG/hTPCNClsFindable", "hTPCNClsFindable", {HistType::kTH1F, {axisTPC}}); + TG.add("TG/hTPCNClsFindableMinusFound", "hTPCNClsFindableMinusFound", {HistType::kTH1F, {axisTPC}}); + TG.add("TG/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); + 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/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/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/TPCPosSignal", "TPCPosSignal", HistType::kTH1F, {axisTPC}); - TG.add("TG/TPC/TPCNegSignal", "TPCNegSignal", HistType::kTH1F, {axisTPC}); + TG.add("TG/TPC/TPCNegVsPosSignal", "TPCNegVsPosSignal", HistType::kTH2F, {axisTPC, 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}}); - TGmu.add("TGmu/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axiseta}}); + TGmu.add("TGmu/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); + TGmu.add("TGmu/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axisEta}}); TGmu.add("TGmu/hTrackPhi1", "hTrackPhi1", {HistType::kTH1F, {axisPhi}}); - TGmu.add("TGmu/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axispt}}); - TGmu.add("TGmu/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axiseta}}); + 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/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - TGmu.add("TGmu/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, 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/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}}); + TGmu.add("TGmu/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGmuCand histograms - TGmuCand.add("TGmuCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axispt}}); - TGmuCand.add("TGmuCand/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axiseta}}); + TGmuCand.add("TGmuCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); + TGmuCand.add("TGmuCand/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axisEta}}); TGmuCand.add("TGmuCand/hTrackPhi1", "hTrackPhi1", {HistType::kTH1F, {axisPhi}}); - TGmuCand.add("TGmuCand/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axispt}}); - TGmuCand.add("TGmuCand/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axiseta}}); + 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/hPairPt", "hPairPt", {HistType::kTH1F, {axisPt}}); TGmuCand.add("TGmuCand/hPairIVM", "hPairIVM", {HistType::kTH1F, {axisIVMWide}}); - TGmuCand.add("TGmuCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axispt}}); - TGmuCand.add("TGmuCand/hJpsiRap", "hJpsiRap", {HistType::kTH1F, {axiseta}}); - TGmuCand.add("TGmuCand/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - TGmuCand.add("TGmuCand/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + TGmuCand.add("TGmuCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axisPt}}); + TGmuCand.add("TGmuCand/hJpsiRap", "hJpsiRap", {HistType::kTH1F, {axisEta}}); + 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/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}}); + TGmuCand.add("TGmuCand/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGel histograms - TGel.add("TGel/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axispt}}); - TGel.add("TGel/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axiseta}}); + TGel.add("TGel/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); + TGel.add("TGel/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axisEta}}); TGel.add("TGel/hTrackPhi1", "hTrackPhi1", {HistType::kTH1F, {axisPhi}}); - TGel.add("TGel/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axispt}}); - TGel.add("TGel/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axiseta}}); + 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/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - TGel.add("TGel/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, 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/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}}); + TGel.add("TGel/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGelCand histograms - TGelCand.add("TGelCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axispt}}); - TGelCand.add("TGelCand/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axiseta}}); + TGelCand.add("TGelCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); + TGelCand.add("TGelCand/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axisEta}}); TGelCand.add("TGelCand/hTrackPhi1", "hTrackPhi1", {HistType::kTH1F, {axisPhi}}); - TGelCand.add("TGelCand/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axispt}}); - TGelCand.add("TGelCand/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axiseta}}); + 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/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/hPairPt", "hPairPt", {HistType::kTH1F, {axisPt}}); TGelCand.add("TGelCand/hPairIVM", "hPairIVM", {HistType::kTH1F, {axisIVMWide}}); - TGelCand.add("TGelCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axispt}}); - TGelCand.add("TGelCand/hJpsiRap", "hJpsiRap", {HistType::kTH1F, {axiseta}}); - TGelCand.add("TGelCand/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - TGelCand.add("TGelCand/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + TGelCand.add("TGelCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axisPt}}); + TGelCand.add("TGelCand/hJpsiRap", "hJpsiRap", {HistType::kTH1F, {axisEta}}); + TGelCand.add("TGelCand/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); + 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/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}}); + TGelCand.add("TGelCand/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGp histograms - TGp.add("TGp/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axispt}}); - TGp.add("TGp/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axiseta}}); + TGp.add("TGp/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); + TGp.add("TGp/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axisEta}}); TGp.add("TGp/hTrackPhi1", "hTrackPhi1", {HistType::kTH1F, {axisPhi}}); - TGp.add("TGp/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axispt}}); - TGp.add("TGp/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axiseta}}); + 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/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/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}}); + TGp.add("TGp/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // TGpCand histograms - TGpCand.add("TGpCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axispt}}); - TGpCand.add("TGpCand/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axiseta}}); + TGpCand.add("TGpCand/hTrackPt1", "hTrackPt1", {HistType::kTH1F, {axisPt}}); + TGpCand.add("TGpCand/hTrackEta1", "hTrackEta1", {HistType::kTH1F, {axisEta}}); TGpCand.add("TGpCand/hTrackPhi1", "hTrackPhi1", {HistType::kTH1F, {axisPhi}}); - TGpCand.add("TGpCand/hTrackPt2", "hTrackPt2", {HistType::kTH1F, {axispt}}); - TGpCand.add("TGpCand/hTrackEta2", "hTrackEta2", {HistType::kTH1F, {axiseta}}); + 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/hPairPt", "hPairPt", {HistType::kTH1F, {axisPt}}); TGpCand.add("TGpCand/hPairIVM", "hPairIVM", {HistType::kTH1F, {axisIVMWide}}); - TGpCand.add("TGpCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axispt}}); - TGpCand.add("TGpCand/hJpsiRap", "hJpsiRap", {HistType::kTH1F, {axiseta}}); - TGpCand.add("TGpCand/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - TGpCand.add("TGpCand/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + TGpCand.add("TGpCand/hJpsiPt", "hJpsiPt", {HistType::kTH1F, {axisPt}}); + TGpCand.add("TGpCand/hJpsiRap", "hJpsiRap", {HistType::kTH1F, {axisEta}}); + TGpCand.add("TGpCand/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); + 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/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}}); + 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}}); - JPsiToEl.add("JPsiToEl/Coherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToEl.add("JPsiToEl/Coherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToEl.add("JPsiToEl/Coherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axiseta}}); - JPsiToEl.add("JPsiToEl/Coherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axiseta}}); + JPsiToEl.add("JPsiToEl/Coherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Coherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Coherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToEl.add("JPsiToEl/Coherent/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToEl.add("JPsiToEl/Coherent/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToEl.add("JPsiToEl/Coherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); - 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/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/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - JPsiToEl.add("JPsiToEl/Coherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + 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/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/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}}); - JPsiToEl.add("JPsiToEl/Incoherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToEl.add("JPsiToEl/Incoherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axiseta}}); - JPsiToEl.add("JPsiToEl/Incoherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axiseta}}); + 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}}); + JPsiToEl.add("JPsiToEl/Incoherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToEl.add("JPsiToEl/Incoherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToEl.add("JPsiToEl/Incoherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); 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/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/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/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - JPsiToEl.add("JPsiToEl/Incoherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + 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/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/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/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/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/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}}); + 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}}); - JPsiToMu.add("JPsiToMu/Coherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToMu.add("JPsiToMu/Coherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToMu.add("JPsiToMu/Coherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axiseta}}); - JPsiToMu.add("JPsiToMu/Coherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axiseta}}); + JPsiToMu.add("JPsiToMu/Coherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Coherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Coherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToMu.add("JPsiToMu/Coherent/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToMu.add("JPsiToMu/Coherent/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToMu.add("JPsiToMu/Coherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); - 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/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/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - JPsiToMu.add("JPsiToMu/Coherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + 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/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/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}}); - JPsiToMu.add("JPsiToMu/Incoherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToMu.add("JPsiToMu/Incoherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axiseta}}); - JPsiToMu.add("JPsiToMu/Incoherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axiseta}}); + 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}}); + JPsiToMu.add("JPsiToMu/Incoherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToMu.add("JPsiToMu/Incoherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToMu.add("JPsiToMu/Incoherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); 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/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/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/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - JPsiToMu.add("JPsiToMu/Incoherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + 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/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/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/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/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/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}}); + 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}}); - JPsiToP.add("JPsiToP/Coherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToP.add("JPsiToP/Coherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToP.add("JPsiToP/Coherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axiseta}}); - JPsiToP.add("JPsiToP/Coherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axiseta}}); + JPsiToP.add("JPsiToP/Coherent/hPt", "Pt of J/Psi ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToP.add("JPsiToP/Coherent/hPt1", "pT of track 1 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToP.add("JPsiToP/Coherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToP.add("JPsiToP/Coherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToP.add("JPsiToP/Coherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToP.add("JPsiToP/Coherent/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToP.add("JPsiToP/Coherent/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToP.add("JPsiToP/Coherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); - JPsiToP.add("JPsiToP/Coherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axiseta}}); - JPsiToP.add("JPsiToP/Coherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axiseta}}); + JPsiToP.add("JPsiToP/Coherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToP.add("JPsiToP/Coherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToP.add("JPsiToP/Coherent/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); - JPsiToP.add("JPsiToP/Coherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - JPsiToP.add("JPsiToP/Coherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + JPsiToP.add("JPsiToP/Coherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); + 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/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/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}}); - JPsiToP.add("JPsiToP/Incoherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axispt}}); - JPsiToP.add("JPsiToP/Incoherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axiseta}}); - JPsiToP.add("JPsiToP/Incoherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axiseta}}); + 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}}); + JPsiToP.add("JPsiToP/Incoherent/hPt2", "pT of track 2 ; p_{T} {GeV/c]", {HistType::kTH1F, {axisPt}}); + JPsiToP.add("JPsiToP/Incoherent/hEta1", "eta of track 1 ; #eta {-]", {HistType::kTH1F, {axisEta}}); + JPsiToP.add("JPsiToP/Incoherent/hEta2", "eta of track 2 ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToP.add("JPsiToP/Incoherent/hPhi1", "phi of track 1 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToP.add("JPsiToP/Incoherent/hPhi2", "phi of track 2 ; #phi {-]", {HistType::kTH1F, {axisPhi}}); JPsiToP.add("JPsiToP/Incoherent/hIVM", "J/Psi Invariant Mass ; m {GeV]", {HistType::kTH1F, {axisIVM}}); - JPsiToP.add("JPsiToP/Incoherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axiseta}}); - JPsiToP.add("JPsiToP/Incoherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axiseta}}); + JPsiToP.add("JPsiToP/Incoherent/hRap", "Rap of J/Psi ; y {-]", {HistType::kTH1F, {axisEta}}); + JPsiToP.add("JPsiToP/Incoherent/hEta", "Eta of J/Psi ; #eta {-]", {HistType::kTH1F, {axisEta}}); JPsiToP.add("JPsiToP/Incoherent/hPhi", "Phi of J/Psi ; #phi {-]", {HistType::kTH1F, {axisPhi}}); - JPsiToP.add("JPsiToP/Incoherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisp, axisTPC}}); - JPsiToP.add("JPsiToP/Incoherent/PID/hTPCVsPt", "hTPCVsPt", {HistType::kTH2F, {axispt, axisTPC}}); + JPsiToP.add("JPsiToP/Incoherent/PID/hTPCVsP", "hTPCVsP", {HistType::kTH2F, {axisP, axisTPC}}); + 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/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}}); + JPsiToP.add("JPsiToP/Incoherent/PID/hTOFVsEta", "hTOFVsEta", {HistType::kTH2F, {axisEta, axisTOF}}); // Correlation histograms Correlation.add("Correlation/Muon/Coherent/AccoplAngle", "AccoplAngle", {HistType::kTH1F, {axisAccAngle}}); @@ -517,44 +808,73 @@ struct UpcJpsiCentralBarrel { template bool GoodTrackCuts(T const& track) { - // kinematics + // 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/hCutCounterTracks"))->Fill(2); + return false; + } + // acceptance if (std::abs(RecoDecay::eta(std::array{track.px(), track.py(), track.pz()})) > EtaCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(3); return false; } // DCA - if (track.dcaZ() > dcaZCut) { + if (std::abs(track.dcaZ()) > dcaZCut) { return false; } if (DCAcut) { - float dcaXYCut = 0.0105f + 0.0350f / pow(track.pt(), 1.1f); - if (abs(track.dcaXY()) > dcaXYCut) { + float dcaXYPtCut = 0.0105f + 0.0350f / pow(track.pt(), 1.1f); + if (std::abs(track.dcaXY()) > dcaXYPtCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(4); return false; } } else { - if (track.dcaXY() > dcaXYCut) { + if (std::abs(track.dcaXY()) > dcaXYCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(4); return false; } } // ITS if (!track.hasITS()) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(5); return false; } if (track.itsNCls() < ITSNClsCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(6); return false; } if (track.itsChi2NCl() > ITSChi2NClsCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(7); return false; } // TPC if (!track.hasTPC()) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(8); return false; } if (track.tpcNClsCrossedRows() < TPCNClsCrossedRowsCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(9); return false; } if (track.tpcChi2NCl() > TPCChi2NCls) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(10); return false; // TPC chi2 } + if (newCutTPC) { + if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < TPCMinNCls) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(11); + return false; + } + if ((static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable())) < TPCCrossedOverFindable) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(12); + return false; + } + } return true; } @@ -563,19 +883,57 @@ struct UpcJpsiCentralBarrel { bool CandidateCuts(float massJpsi, float rapJpsi) { if (std::abs(rapJpsi) > RapCut) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(13); return false; } if (massJpsi < 2.0f) { + Statistics.get(HIST("Statistics/hCutCounterTracks"))->Fill(14); return false; } return true; } - void process(UDCollisionFull const&, UDTracksFull const& tracks) + template + void fillHistograms(C collision, Ts tracks) { - Statistics.get(HIST("Statistics/hNumberOfCollisions"))->Fill(0); // number of collisions without any cuts + Statistics.get(HIST("Statistics/hCutCounterCollisions"))->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()); + 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/hZNCTime"))->Fill(collision.timeZNC()); + RawData.get(HIST("RawData/hZNATime"))->Fill(collision.timeZNA()); + + // check UPC vs standard + if (doOnlyUPC) { + if (collision.flags() == 0) { + return; + } + } + if (doOnlyStandard) { + if (collision.flags() == 1) { + return; + } + } + + // 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) { @@ -584,6 +942,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()); @@ -595,6 +954,8 @@ struct UpcJpsiCentralBarrel { PVContributors.get(HIST("PVContributors/PID/hTPCVsPt"))->Fill(track.pt(), track.tpcSignal()); PVContributors.get(HIST("PVContributors/PID/hTPCVsEta"))->Fill(RecoDecay::eta(std::array{trkPx, trkPy, trkPz}), track.tpcSignal()); PVContributors.get(HIST("PVContributors/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(trkPx, trkPy), track.tpcSignal()); + PVContributors.get(HIST("PVContributors/hTPCNClsFindable"))->Fill(track.tpcNClsFindable()); + PVContributors.get(HIST("PVContributors/hTPCNClsFindableMinusFound"))->Fill(track.tpcNClsFindableMinusFound()); } if (track.hasTOF()) { @@ -609,6 +970,13 @@ struct UpcJpsiCentralBarrel { 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()); @@ -627,67 +995,37 @@ struct UpcJpsiCentralBarrel { } int countGT = 0; - int countGTselected = 0; - int countGTel = 0; - int countGTmu = 0; - int countGTp = 0; int countGTMuSigma = 0; int countGTElSigma = 0; int countGTPSigma = 0; int countGTPSigmaTOF = 0; std::vector trkIdx; // loop over tracks with selections + if (std::abs(collision.posZ()) > cutVertexZ) { + Statistics.get(HIST("Statistics/hCutCounterCollisions"))->Fill(1); + return; + } + for (auto& track : tracks) { - // select primary vertex contributors - if (track.isPVContributor() != 1) { - continue; - } + // select good tracks if (GoodTrackCuts(track) != 1) { continue; } + countGT++; trkIdx.push_back(track.index()); - if (smallestPID) { - int hypoID; - if (TPCPIDOnly) { - hypoID = testPIDhypoTPC(track); - } else { - hypoID = testPIDhypo(track); - } - if (hypoID == P_ELECTRON || hypoID == P_MUON || hypoID == P_PROTON) { - countGTselected++; - trkIdx.push_back(track.index()); - if (hypoID == P_ELECTRON) { - countGTel++; - } - if (hypoID == P_MUON) { - countGTmu++; - } - if (hypoID == P_PROTON) { - countGTp++; - } - } - - Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(3., countGTselected); - Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(4., countGTel); - Statistics.get(HIST("Statistics/hNumberOfTracks"))->Fill(5., countGTmu); - Statistics.get(HIST("Statistics/hNumberGTselected"))->Fill(countGTselected); - Statistics.get(HIST("Statistics/hNumberGTel"))->Fill(countGTel); - Statistics.get(HIST("Statistics/hNumberGTmu"))->Fill(countGTmu); - Statistics.get(HIST("Statistics/hNumberGTp"))->Fill(countGTp); - } - if (std::abs(track.tpcNSigmaMu()) < 3) { + if (std::abs(track.tpcNSigmaMu()) <= 3) { countGTMuSigma++; } - if (std::abs(track.tpcNSigmaEl()) < 3) { + if (std::abs(track.tpcNSigmaEl()) <= 3) { countGTElSigma++; } - if (std::abs(track.tpcNSigmaPr()) < 3) { + if (std::abs(track.tpcNSigmaPr()) <= 3) { countGTPSigma++; } - if (std::abs(track.tofNSigmaPr()) < 3) { + if (std::abs(track.tofNSigmaPr()) <= 3) { countGTPSigmaTOF++; } } @@ -705,25 +1043,26 @@ struct UpcJpsiCentralBarrel { if (countGT == 2) { TLorentzVector mom, daughter[2]; - auto trkDaughter1 = tracks.iteratorAt(trkIdx[0]); auto trkDaughter2 = tracks.iteratorAt(trkIdx[1]); - if ((trkDaughter1.sign() * trkDaughter2.sign()) > 0) { + if ((trkDaughter1.sign() * trkDaughter2.sign()) != -1) { return; } - /*auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massEl); - auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massEl); - daughter[0].SetPxPyPzE(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), ene1); - daughter[1].SetPxPyPzE(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), ene2); - mom = daughter[0] + daughter[1];*/ + if (chargeOrdered) { + if (tracks.iteratorAt(trkIdx[0]).sign() < 0) { + trkDaughter1 = tracks.iteratorAt(trkIdx[0]); + trkDaughter2 = tracks.iteratorAt(trkIdx[1]); + } else { + trkDaughter1 = tracks.iteratorAt(trkIdx[1]); + trkDaughter2 = tracks.iteratorAt(trkIdx[0]); + } + } std::array daughter1 = {trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()}; std::array daughter2 = {trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()}; - // std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; - TG.get(HIST("TG/hTrackPt1"))->Fill(trkDaughter1.pt()); TG.get(HIST("TG/hTrackPt2"))->Fill(trkDaughter2.pt()); TG.get(HIST("TG/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); @@ -739,10 +1078,12 @@ struct UpcJpsiCentralBarrel { 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()); - if (trkDaughter1.sign() > 0) { - TG.get(HIST("TG/TPC/TPCPosSignal"))->Fill(trkDaughter1.tpcSignal()); + TG.get(HIST("TG/hTPCNClsFindable"))->Fill(trkDaughter1.tpcNClsFindable()); + TG.get(HIST("TG/hTPCNClsFindableMinusFound"))->Fill(trkDaughter1.tpcNClsFindableMinusFound()); + if (trkDaughter1.sign() < 0) { + TG.get(HIST("TG/TPC/TPCNegVsPosSignal"))->Fill(trkDaughter1.tpcSignal(), trkDaughter2.tpcSignal()); } else { - TG.get(HIST("TG/TPC/TPCNegSignal"))->Fill(trkDaughter1.tpcSignal()); + TG.get(HIST("TG/TPC/TPCNegVsPosSignal"))->Fill(trkDaughter2.tpcSignal(), trkDaughter1.tpcSignal()); } } if (trkDaughter2.hasTPC()) { @@ -753,11 +1094,8 @@ struct UpcJpsiCentralBarrel { 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()); - if (trkDaughter2.sign() > 0) { - TG.get(HIST("TG/TPC/TPCPosSignal"))->Fill(trkDaughter2.tpcSignal()); - } else { - TG.get(HIST("TG/TPC/TPCNegSignal"))->Fill(trkDaughter2.tpcSignal()); - } + 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()); @@ -778,653 +1116,961 @@ struct UpcJpsiCentralBarrel { 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())) { + + auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massEl); + auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massEl); + daughter[0].SetPxPyPzE(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), ene1); + daughter[1].SetPxPyPzE(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), ene2); + mom = daughter[0] + daughter[1]; + + std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; + + auto arrMom = std::array{daughter1, daughter2}; + 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)); + TGel.get(HIST("TGel/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); + 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()); + } + 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 (RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaMu(), trkDaughter2.tpcNSigmaMu()) > RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaEl(), trkDaughter2.tpcNSigmaEl())) { - - auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massEl); - auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massEl); - daughter[0].SetPxPyPzE(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), ene1); - daughter[1].SetPxPyPzE(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), ene2); - 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()) + if (CandidateCuts(massJpsi, rapJpsi) != 1) { return; - } - - auto arrMom = std::array{daughter1, daughter2}; - float massJpsi = RecoDecay::m(arrMom, std::array{massEl, massEl}); - float rapJpsi = RecoDecay::y(mother, massJpsi); - - 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)); - TGel.get(HIST("TGel/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); - TGel.get(HIST("TGel/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); - TGel.get(HIST("TGel/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); - - 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.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()); - } - 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) { - return; - } - - TGelCand.get(HIST("TGelCand/hTrackPt1"))->Fill(trkDaughter1.pt()); - TGelCand.get(HIST("TGelCand/hTrackPt2"))->Fill(trkDaughter2.pt()); - TGelCand.get(HIST("TGelCand/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); - 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); - - if (trkDaughter1.hasTPC()) { - TGelCand.get(HIST("TGelCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); - TGelCand.get(HIST("TGelCand/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); - TGelCand.get(HIST("TGelCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - TGelCand.get(HIST("TGelCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - TGelCand.get(HIST("TGelCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - TGelCand.get(HIST("TGelCand/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - TGelCand.get(HIST("TGelCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - 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()); - } - 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 { - JPsiToEl.get(HIST("JPsiToEl/Incoherent/hIVM"))->Fill(massJpsi); - } + TGelCand.get(HIST("TGelCand/hTrackPt1"))->Fill(trkDaughter1.pt()); + TGelCand.get(HIST("TGelCand/hTrackPt2"))->Fill(trkDaughter2.pt()); + TGelCand.get(HIST("TGelCand/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); + 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); + + if (trkDaughter1.hasTPC()) { + TGelCand.get(HIST("TGelCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); + TGelCand.get(HIST("TGelCand/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); + TGelCand.get(HIST("TGelCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + TGelCand.get(HIST("TGelCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + 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 (trkDaughter2.hasTPC()) { + TGelCand.get(HIST("TGelCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + TGelCand.get(HIST("TGelCand/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + TGelCand.get(HIST("TGelCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + 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()); + } + 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 (massJpsi < maxJpsiMass && massJpsi > minJpsiMass) { - TGelCand.get(HIST("TGelCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); - TGelCand.get(HIST("TGelCand/hJpsiRap"))->Fill(rapJpsi); if (RecoDecay::pt(mother) < 0.2f) { - // fill track histos - JPsiToEl.get(HIST("JPsiToEl/Coherent/hPt1"))->Fill(trkDaughter1.pt()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/hPt2"))->Fill(trkDaughter2.pt()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); - 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 (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()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); - } + JPsiToEl.get(HIST("JPsiToEl/Coherent/hIVM"))->Fill(massJpsi); + } else { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/hIVM"))->Fill(massJpsi); + } - 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)); - JPsiToEl.get(HIST("JPsiToEl/Coherent/hEta"))->Fill(RecoDecay::eta(mother)); - JPsiToEl.get(HIST("JPsiToEl/Coherent/hPhi"))->Fill(RecoDecay::phi(mother)); - JPsiToEl.get(HIST("JPsiToEl/Coherent/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.); - Correlation.get(HIST("Correlation/Electron/Coherent/Phi"))->Fill(q[1], 1.); - Correlation.get(HIST("Correlation/Electron/Coherent/CosTheta"))->Fill(q[2], 1.); - Correlation.get(HIST("Correlation/Electron/Coherent/AccoplAngle"))->Fill(q[0], 1.); - Correlation.get(HIST("Correlation/Electron/Coherent/CosThetaPhi"))->Fill(q[2], q[1]); - - double dp = DeltaPhi(daughter[0], daughter[1]); - Asymmetry.get(HIST("Asymmetry/Electron/Coherent/DeltaPhi"))->Fill(dp); - - delete[] q; - } // end coherent electrons - if (RecoDecay::pt(mother) > 0.2f) { - // fill track histos - JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPt1"))->Fill(trkDaughter1.pt()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPt2"))->Fill(trkDaughter2.pt()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); - 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 (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()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); + if ((massJpsi < maxJpsiMass) && (massJpsi > minJpsiMass)) { + TGelCand.get(HIST("TGelCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); + TGelCand.get(HIST("TGelCand/hJpsiRap"))->Fill(rapJpsi); + if (RecoDecay::pt(mother) < 0.2f) { + // fill track histos + JPsiToEl.get(HIST("JPsiToEl/Coherent/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); + 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()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + } + if (trkDaughter2.hasTPC()) { + JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); + } + + 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)); + JPsiToEl.get(HIST("JPsiToEl/Coherent/hEta"))->Fill(RecoDecay::eta(mother)); + 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.); + Correlation.get(HIST("Correlation/Electron/Coherent/Phi"))->Fill(q[1], 1.); + Correlation.get(HIST("Correlation/Electron/Coherent/CosTheta"))->Fill(q[2], 1.); + Correlation.get(HIST("Correlation/Electron/Coherent/AccoplAngle"))->Fill(q[0], 1.); + Correlation.get(HIST("Correlation/Electron/Coherent/CosThetaPhi"))->Fill(q[2], q[1]); + + double dp = DeltaPhi(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Electron/Coherent/DeltaPhi"))->Fill(dp); + + delete[] q; + } // end coherent electrons + if (RecoDecay::pt(mother) > 0.2f) { + // fill track histos + JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); + 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()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + } + if (trkDaughter2.hasTPC()) { + JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter2), trkDaughter2.tpcSignal()); + } + + 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)); + JPsiToEl.get(HIST("JPsiToEl/Incoherent/hEta"))->Fill(RecoDecay::eta(mother)); + 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.); + Correlation.get(HIST("Correlation/Electron/Incoherent/Phi"))->Fill(q[1], 1.); + Correlation.get(HIST("Correlation/Electron/Incoherent/CosTheta"))->Fill(q[2], 1.); + Correlation.get(HIST("Correlation/Electron/Incoherent/AccoplAngle"))->Fill(q[0], 1.); + Correlation.get(HIST("Correlation/Electron/Incoherent/CosThetaPhi"))->Fill(q[2], q[1]); + + double dp = DeltaPhi(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/DeltaPhi"))->Fill(dp); + + delete[] q; + } // end incoherent electrons + } // end mass cut + } + } // end electrons + if (doMuons) { + if (RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaEl(), trkDaughter2.tpcNSigmaEl()) > RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaMu(), trkDaughter2.tpcNSigmaMu())) { + + auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massMu); + auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massMu); + daughter[0].SetPxPyPzE(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), ene1); + daughter[1].SetPxPyPzE(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), ene2); + mom = daughter[0] + daughter[1]; + + std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; + + 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)); + TGmu.get(HIST("TGmu/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); + 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 { + TGmu.get(HIST("TGmu/TPCNegVsPosSignal"))->Fill(trkDaughter2.tpcSignal(), trkDaughter1.tpcSignal()); } + } + if (trkDaughter2.hasTPC()) { + TGmu.get(HIST("TGmu/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + 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()); + } + 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 (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)); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/hEta"))->Fill(RecoDecay::eta(mother)); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/hPhi"))->Fill(RecoDecay::phi(mother)); - JPsiToEl.get(HIST("JPsiToEl/Incoherent/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.); - Correlation.get(HIST("Correlation/Electron/Incoherent/Phi"))->Fill(q[1], 1.); - Correlation.get(HIST("Correlation/Electron/Incoherent/CosTheta"))->Fill(q[2], 1.); - Correlation.get(HIST("Correlation/Electron/Incoherent/AccoplAngle"))->Fill(q[0], 1.); - Correlation.get(HIST("Correlation/Electron/Incoherent/CosThetaPhi"))->Fill(q[2], q[1]); - - double dp = DeltaPhi(daughter[0], daughter[1]); - Asymmetry.get(HIST("Asymmetry/Electron/Incoherent/DeltaPhi"))->Fill(dp); - - delete[] q; - } // end incoherent electrons - } // end mass cut - } // end electrons - if (RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaEl(), trkDaughter2.tpcNSigmaEl()) > RecoDecay::sumOfSquares(trkDaughter1.tpcNSigmaMu(), trkDaughter2.tpcNSigmaMu())) { - - auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massMu); - auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massMu); - daughter[0].SetPxPyPzE(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), ene1); - daughter[1].SetPxPyPzE(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), ene2); - 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()) + if (CandidateCuts(massJpsi, rapJpsi) != 1) { return; - } - - auto arrMom = std::array{daughter1, daughter2}; - float massJpsi = RecoDecay::m(arrMom, std::array{massMu, massMu}); - float rapJpsi = RecoDecay::y(mother, massJpsi); - - 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)); - TGmu.get(HIST("TGmu/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); - TGmu.get(HIST("TGmu/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); - TGmu.get(HIST("TGmu/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); - - 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 (trkDaughter2.hasTPC()) { - TGmu.get(HIST("TGmu/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - 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()); - } - 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) { - return; - } - - TGmuCand.get(HIST("TGmuCand/hTrackPt1"))->Fill(trkDaughter1.pt()); - TGmuCand.get(HIST("TGmuCand/hTrackPt2"))->Fill(trkDaughter2.pt()); - TGmuCand.get(HIST("TGmuCand/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); - 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); - - if (trkDaughter1.hasTPC()) { - TGmuCand.get(HIST("TGmuCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); - 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 (trkDaughter2.hasTPC()) { - TGmuCand.get(HIST("TGmuCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - TGmuCand.get(HIST("TGmuCand/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - TGmuCand.get(HIST("TGmuCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - 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()); - } - 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 { - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hIVM"))->Fill(massJpsi); - } + } - if (massJpsi < maxJpsiMass && massJpsi > minJpsiMass) { - TGmuCand.get(HIST("TGmuCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); - TGmuCand.get(HIST("TGmuCand/hJpsiRap"))->Fill(rapJpsi); + TGmuCand.get(HIST("TGmuCand/hTrackPt1"))->Fill(trkDaughter1.pt()); + TGmuCand.get(HIST("TGmuCand/hTrackPt2"))->Fill(trkDaughter2.pt()); + TGmuCand.get(HIST("TGmuCand/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); + 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); + + if (trkDaughter1.hasTPC()) { + TGmuCand.get(HIST("TGmuCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); + 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()); + TGmuCand.get(HIST("TGmuCand/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + TGmuCand.get(HIST("TGmuCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + 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()); + } + 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) { - // fill track histos - 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 (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()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - 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)); - JPsiToMu.get(HIST("JPsiToMu/Coherent/hEta"))->Fill(RecoDecay::eta(mother)); - JPsiToMu.get(HIST("JPsiToMu/Coherent/hPhi"))->Fill(RecoDecay::phi(mother)); - JPsiToMu.get(HIST("JPsiToMu/Coherent/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.); - Correlation.get(HIST("Correlation/Muon/Coherent/Phi"))->Fill(q[1], 1.); - Correlation.get(HIST("Correlation/Muon/Coherent/CosTheta"))->Fill(q[2], 1.); - Correlation.get(HIST("Correlation/Muon/Coherent/AccoplAngle"))->Fill(q[0], 1.); - Correlation.get(HIST("Correlation/Muon/Coherent/CosThetaPhi"))->Fill(q[2], q[1]); - - double dp = DeltaPhi(daughter[0], daughter[1]); - Asymmetry.get(HIST("Asymmetry/Muon/Coherent/DeltaPhi"))->Fill(dp); - - delete[] q; + JPsiToMu.get(HIST("JPsiToMu/Coherent/hIVM"))->Fill(massJpsi); + } else { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/hIVM"))->Fill(massJpsi); } - if (RecoDecay::pt(mother) > 0.2f) { - // fill track histos - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPt1"))->Fill(trkDaughter1.pt()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPt2"))->Fill(trkDaughter2.pt()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); - 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 (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()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - 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 ((massJpsi < maxJpsiMass) && (massJpsi > minJpsiMass)) { + TGmuCand.get(HIST("TGmuCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); + TGmuCand.get(HIST("TGmuCand/hJpsiRap"))->Fill(rapJpsi); + + if (RecoDecay::pt(mother) < 0.2f) { + // fill track histos + 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)); + } 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)); + } 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)); + } 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)); + } + + 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()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + } + if (trkDaughter2.hasTPC()) { + JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + JPsiToMu.get(HIST("JPsiToMu/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + 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)); + JPsiToMu.get(HIST("JPsiToMu/Coherent/hEta"))->Fill(RecoDecay::eta(mother)); + 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.); + Correlation.get(HIST("Correlation/Muon/Coherent/Phi"))->Fill(q[1], 1.); + Correlation.get(HIST("Correlation/Muon/Coherent/CosTheta"))->Fill(q[2], 1.); + Correlation.get(HIST("Correlation/Muon/Coherent/AccoplAngle"))->Fill(q[0], 1.); + Correlation.get(HIST("Correlation/Muon/Coherent/CosThetaPhi"))->Fill(q[2], q[1]); + + double dp = DeltaPhi(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Muon/Coherent/DeltaPhi"))->Fill(dp); + + delete[] q; } - 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()); + if (RecoDecay::pt(mother) > 0.2f) { + // fill track histos + JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); + 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()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + } + if (trkDaughter2.hasTPC()) { + JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + 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 + JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPt"))->Fill(RecoDecay::pt(mother)); + JPsiToMu.get(HIST("JPsiToMu/Incoherent/hEta"))->Fill(RecoDecay::eta(mother)); + 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.); + Correlation.get(HIST("Correlation/Muon/Incoherent/Phi"))->Fill(q[1], 1.); + Correlation.get(HIST("Correlation/Muon/Incoherent/CosTheta"))->Fill(q[2], 1.); + Correlation.get(HIST("Correlation/Muon/Incoherent/AccoplAngle"))->Fill(q[0], 1.); + Correlation.get(HIST("Correlation/Muon/Incoherent/CosThetaPhi"))->Fill(q[2], q[1]); + + double dp = DeltaPhi(daughter[0], daughter[1]); + Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/DeltaPhi"))->Fill(dp); + + delete[] q; } + } + } + } // end muons + if (doProtons) { + if (RecoDecay::sumOfSquares((trkDaughter1.hasTOF() ? trkDaughter1.tofNSigmaPr() : trkDaughter1.tpcNSigmaPr()), (trkDaughter2.hasTOF() ? trkDaughter2.tofNSigmaPr() : trkDaughter2.tpcNSigmaPr()) < 4)) { - // fill J/psi histos - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPt"))->Fill(RecoDecay::pt(mother)); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hEta"))->Fill(RecoDecay::eta(mother)); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hPhi"))->Fill(RecoDecay::phi(mother)); - JPsiToMu.get(HIST("JPsiToMu/Incoherent/hRap"))->Fill(rapJpsi); + auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massPr); + auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massPr); + daughter[0].SetPxPyPzE(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), ene1); + daughter[1].SetPxPyPzE(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), ene2); + mom = daughter[0] + daughter[1]; - 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.); - Correlation.get(HIST("Correlation/Muon/Incoherent/Phi"))->Fill(q[1], 1.); - Correlation.get(HIST("Correlation/Muon/Incoherent/CosTheta"))->Fill(q[2], 1.); - Correlation.get(HIST("Correlation/Muon/Incoherent/AccoplAngle"))->Fill(q[0], 1.); - Correlation.get(HIST("Correlation/Muon/Incoherent/CosThetaPhi"))->Fill(q[2], q[1]); + std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; - double dp = DeltaPhi(daughter[0], daughter[1]); - Asymmetry.get(HIST("Asymmetry/Muon/Incoherent/DeltaPhi"))->Fill(dp); + if (TOFBothProtons) { + if (!trkDaughter1.hasTOF() || !trkDaughter2.hasTOF()) + return; + } + if (TOFOneProton) { + if ((trkDaughter1.hasTOF() && trkDaughter2.hasTOF()) || (!trkDaughter1.hasTOF() && !trkDaughter2.hasTOF())) + return; + } + if (TOFAtLeastOneProton) { + if (!trkDaughter1.hasTOF() && !trkDaughter2.hasTOF()) + return; + } - delete[] q; + auto arrMom = std::array{daughter1, daughter2}; + float massJpsi = RecoDecay::m(arrMom, std::array{massPr, massPr}); + float rapJpsi = RecoDecay::y(mother, massJpsi); + + TGp.get(HIST("TGp/hTrackPt1"))->Fill(trkDaughter1.pt()); + TGp.get(HIST("TGp/hTrackPt2"))->Fill(trkDaughter2.pt()); + TGp.get(HIST("TGp/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); + TGp.get(HIST("TGp/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); + TGp.get(HIST("TGp/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); + TGp.get(HIST("TGp/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); + + if (trkDaughter1.hasTPC()) { + TGp.get(HIST("TGp/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); + 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()); + } + 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()); } - } - } // end muons - if (RecoDecay::sumOfSquares((trkDaughter1.hasTOF() ? trkDaughter1.tofNSigmaPr() : trkDaughter1.tpcNSigmaPr()), (trkDaughter2.hasTOF() ? trkDaughter2.tofNSigmaPr() : trkDaughter2.tpcNSigmaPr()) < 4)) { - auto ene1 = RecoDecay::e(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), massPr); - auto ene2 = RecoDecay::e(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), massPr); - daughter[0].SetPxPyPzE(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz(), ene1); - daughter[1].SetPxPyPzE(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz(), ene2); - mom = daughter[0] + daughter[1]; + if (CandidateCuts(massJpsi, rapJpsi) != 1) { + return; + } - std::array mother = {trkDaughter1.px() + trkDaughter2.px(), trkDaughter1.py() + trkDaughter2.py(), trkDaughter1.pz() + trkDaughter2.pz()}; + TGpCand.get(HIST("TGpCand/hTrackPt1"))->Fill(trkDaughter1.pt()); + TGpCand.get(HIST("TGpCand/hTrackPt2"))->Fill(trkDaughter2.pt()); + TGpCand.get(HIST("TGpCand/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); + 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); + + if (trkDaughter1.hasTPC()) { + TGpCand.get(HIST("TGpCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); + TGpCand.get(HIST("TGpCand/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); + TGpCand.get(HIST("TGpCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + TGpCand.get(HIST("TGpCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + } + if (trkDaughter2.hasTPC()) { + TGpCand.get(HIST("TGpCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + TGpCand.get(HIST("TGpCand/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + TGpCand.get(HIST("TGpCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + 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()); + } + 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 (TOFBothProtons) { - if (!trkDaughter1.hasTOF() || !trkDaughter2.hasTOF()) - return; - } - if (TOFOneProton) { - if ((trkDaughter1.hasTOF() && trkDaughter2.hasTOF()) || (!trkDaughter1.hasTOF() && !trkDaughter2.hasTOF())) - return; - } - if (TOFAtLeastOneProton) { - if (!trkDaughter1.hasTOF() && !trkDaughter2.hasTOF()) - return; - } + if (RecoDecay::pt(mother) < 0.2f) { + JPsiToP.get(HIST("JPsiToP/Coherent/hIVM"))->Fill(massJpsi); + } else { + JPsiToP.get(HIST("JPsiToP/Incoherent/hIVM"))->Fill(massJpsi); + } - auto arrMom = std::array{daughter1, daughter2}; - float massJpsi = RecoDecay::m(arrMom, std::array{massPr, massPr}); - float rapJpsi = RecoDecay::y(mother, massJpsi); - - TGp.get(HIST("TGp/hTrackPt1"))->Fill(trkDaughter1.pt()); - TGp.get(HIST("TGp/hTrackPt2"))->Fill(trkDaughter2.pt()); - TGp.get(HIST("TGp/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); - TGp.get(HIST("TGp/hTrackEta2"))->Fill(RecoDecay::eta(daughter2)); - TGp.get(HIST("TGp/hTrackPhi1"))->Fill(RecoDecay::phi(daughter1)); - TGp.get(HIST("TGp/hTrackPhi2"))->Fill(RecoDecay::phi(daughter2)); - - if (trkDaughter1.hasTPC()) { - TGp.get(HIST("TGp/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); - 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()); - } - 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 (massJpsi < maxJpsiMass && massJpsi > minJpsiMass) { + TGpCand.get(HIST("TGpCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); + TGpCand.get(HIST("TGpCand/hJpsiRap"))->Fill(rapJpsi); + if (RecoDecay::pt(mother) < 0.2f) { + // fill track histos + JPsiToP.get(HIST("JPsiToP/Coherent/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToP.get(HIST("JPsiToP/Coherent/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToP.get(HIST("JPsiToP/Coherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToP.get(HIST("JPsiToP/Coherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToP.get(HIST("JPsiToP/Coherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToP.get(HIST("JPsiToP/Coherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + if (trkDaughter1.hasTPC()) { + JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + } + if (trkDaughter2.hasTPC()) { + JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + 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)); + JPsiToP.get(HIST("JPsiToP/Coherent/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToP.get(HIST("JPsiToP/Coherent/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToP.get(HIST("JPsiToP/Coherent/hRap"))->Fill(rapJpsi); + } // end coherent + if (RecoDecay::pt(mother) > 0.2f) { + // fill track histos + JPsiToP.get(HIST("JPsiToP/Incoherent/hPt1"))->Fill(trkDaughter1.pt()); + JPsiToP.get(HIST("JPsiToP/Incoherent/hPt2"))->Fill(trkDaughter2.pt()); + JPsiToP.get(HIST("JPsiToP/Incoherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); + JPsiToP.get(HIST("JPsiToP/Incoherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); + JPsiToP.get(HIST("JPsiToP/Incoherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); + JPsiToP.get(HIST("JPsiToP/Incoherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); + if (trkDaughter1.hasTPC()) { + JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); + } + if (trkDaughter2.hasTPC()) { + JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); + JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); + 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)); + JPsiToP.get(HIST("JPsiToP/Incoherent/hEta"))->Fill(RecoDecay::eta(mother)); + JPsiToP.get(HIST("JPsiToP/Incoherent/hPhi"))->Fill(RecoDecay::phi(mother)); + JPsiToP.get(HIST("JPsiToP/Incoherent/hRap"))->Fill(rapJpsi); + } // end incoherent + } // end mass cut } + } // end protons + } // end two tracks + } // end process - if (CandidateCuts(massJpsi, rapJpsi) != 1) { - return; - } + void processDGrecoLevel(UDCollisionFull const& collision, UDTracksFull const& tracks) + { + fillHistograms(collision, tracks); + } // end DG process - TGpCand.get(HIST("TGpCand/hTrackPt1"))->Fill(trkDaughter1.pt()); - TGpCand.get(HIST("TGpCand/hTrackPt2"))->Fill(trkDaughter2.pt()); - TGpCand.get(HIST("TGpCand/hTrackEta1"))->Fill(RecoDecay::eta(daughter1)); - 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); - - if (trkDaughter1.hasTPC()) { - TGpCand.get(HIST("TGpCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); - TGpCand.get(HIST("TGpCand/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); - TGpCand.get(HIST("TGpCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - TGpCand.get(HIST("TGpCand/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - TGpCand.get(HIST("TGpCand/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - TGpCand.get(HIST("TGpCand/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - TGpCand.get(HIST("TGpCand/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - 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()); - } - 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()); - } + void processSGrecoLevel(SGUDCollisionFull const& collision, UDTracksFull const& tracks) + { + int gapSide = collision.gapSide(); + int trueGapSide = sgSelector.trueGap(collision, cutMyGapSideFV0, cutMyGapSideFT0A, cutMyGapSideFT0C, cutMyGapSideZDC); + if (useTrueGap) { + gapSide = trueGapSide; + } + if (gapSide != whichGapSide) { + return; + } + fillHistograms(collision, tracks); - if (RecoDecay::pt(mother) < 0.2f) { - JPsiToP.get(HIST("JPsiToP/Coherent/hIVM"))->Fill(massJpsi); - } else { - JPsiToP.get(HIST("JPsiToP/Incoherent/hIVM"))->Fill(massJpsi); - } + } // end SG process - if (massJpsi < maxJpsiMass && massJpsi > minJpsiMass) { - TGpCand.get(HIST("TGpCand/hJpsiPt"))->Fill(RecoDecay::pt(mother)); - TGpCand.get(HIST("TGpCand/hJpsiRap"))->Fill(rapJpsi); - if (RecoDecay::pt(mother) < 0.2f) { - // fill track histos - JPsiToP.get(HIST("JPsiToP/Coherent/hPt1"))->Fill(trkDaughter1.pt()); - JPsiToP.get(HIST("JPsiToP/Coherent/hPt2"))->Fill(trkDaughter2.pt()); - JPsiToP.get(HIST("JPsiToP/Coherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); - JPsiToP.get(HIST("JPsiToP/Coherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); - JPsiToP.get(HIST("JPsiToP/Coherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); - JPsiToP.get(HIST("JPsiToP/Coherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); - if (trkDaughter1.hasTPC()) { - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Coherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - 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)); - JPsiToP.get(HIST("JPsiToP/Coherent/hEta"))->Fill(RecoDecay::eta(mother)); - JPsiToP.get(HIST("JPsiToP/Coherent/hPhi"))->Fill(RecoDecay::phi(mother)); - JPsiToP.get(HIST("JPsiToP/Coherent/hRap"))->Fill(rapJpsi); - } // end coherent - if (RecoDecay::pt(mother) > 0.2f) { - // fill track histos - JPsiToP.get(HIST("JPsiToP/Incoherent/hPt1"))->Fill(trkDaughter1.pt()); - JPsiToP.get(HIST("JPsiToP/Incoherent/hPt2"))->Fill(trkDaughter2.pt()); - JPsiToP.get(HIST("JPsiToP/Incoherent/hEta1"))->Fill(RecoDecay::eta(daughter1)); - JPsiToP.get(HIST("JPsiToP/Incoherent/hEta2"))->Fill(RecoDecay::eta(daughter2)); - JPsiToP.get(HIST("JPsiToP/Incoherent/hPhi1"))->Fill(RecoDecay::phi(daughter1)); - JPsiToP.get(HIST("JPsiToP/Incoherent/hPhi2"))->Fill(RecoDecay::phi(daughter2)); - if (trkDaughter1.hasTPC()) { - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter1.px(), trkDaughter1.py(), trkDaughter1.pz()), trkDaughter1.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter1.pt(), trkDaughter1.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter1), trkDaughter1.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsPhi"))->Fill(RecoDecay::phi(daughter1), trkDaughter1.tpcSignal()); - } - if (trkDaughter2.hasTPC()) { - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsP"))->Fill(RecoDecay::sqrtSumOfSquares(trkDaughter2.px(), trkDaughter2.py(), trkDaughter2.pz()), trkDaughter2.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsPt"))->Fill(trkDaughter2.pt(), trkDaughter2.tpcSignal()); - JPsiToP.get(HIST("JPsiToP/Incoherent/PID/hTPCVsEta"))->Fill(RecoDecay::eta(daughter2), trkDaughter2.tpcSignal()); - 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)); - JPsiToP.get(HIST("JPsiToP/Incoherent/hEta"))->Fill(RecoDecay::eta(mother)); - JPsiToP.get(HIST("JPsiToP/Incoherent/hPhi"))->Fill(RecoDecay::phi(mother)); - JPsiToP.get(HIST("JPsiToP/Incoherent/hRap"))->Fill(rapJpsi); - } // end incoherent - } // end mass cut - } // end protons - } // end two tracks - } // end process -}; // end struct + PROCESS_SWITCH(UpcJpsiCentralBarrel, processDGrecoLevel, "Iterate over DG skimmed data.", true); + PROCESS_SWITCH(UpcJpsiCentralBarrel, processSGrecoLevel, "Iterate over SG skimmed data.", false); +}; // 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 c80b7457da6..e9bd2b8043c 100644 --- a/PWGUD/Tasks/upcRhoAnalysis.cxx +++ b/PWGUD/Tasks/upcRhoAnalysis.cxx @@ -14,13 +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" // used instead of TLorentzVector -#include "Math/Vector2D.h" #include "random" +#include "TLorentzVector.h" #include "Common/DataModel/PIDResponse.h" @@ -34,28 +36,75 @@ using namespace o2::framework::expressions; using FullUDSgCollision = soa::Join::iterator; using FullUDTracks = soa::Join; +namespace o2::aod +{ +namespace dipi +{ +// general +DECLARE_SOA_COLUMN(RunNumber, runNumber, int32_t); +DECLARE_SOA_COLUMN(NClass, nClass, int); +DECLARE_SOA_COLUMN(TotCharge, charge, int); +DECLARE_SOA_COLUMN(Pt, pT, double); +// system +DECLARE_SOA_COLUMN(M, m, double); +DECLARE_SOA_COLUMN(Rap, y, double); +DECLARE_SOA_COLUMN(PhiRandom, phiRandom, double); +DECLARE_SOA_COLUMN(PhiCharge, phiCharge, double); +// tracks +DECLARE_SOA_COLUMN(UdCollisionId, udCollisionId, int32_t); +DECLARE_SOA_COLUMN(Eta, eta, double); +DECLARE_SOA_COLUMN(Phi, phi, double); +DECLARE_SOA_COLUMN(Sign, sign, int); +DECLARE_SOA_COLUMN(DcaZ, dcaZ, double); +DECLARE_SOA_COLUMN(DcaXY, dcaXY, double); +DECLARE_SOA_COLUMN(NSigmaPi, nSigmaPi, double); +DECLARE_SOA_COLUMN(NSigmaEl, nSigmaEl, double); +} // namespace dipi +DECLARE_SOA_TABLE(SystemTree, "AOD", "SYSTEMTREE", dipi::RunNumber, dipi::NClass, dipi::TotCharge, dipi::M, dipi::Pt, dipi::Rap, dipi::PhiRandom, dipi::PhiCharge); +DECLARE_SOA_TABLE(TrackTree, "AOD", "TRACKTREE", dipi::RunNumber, dipi::NClass, dipi::UdCollisionId, dipi::Pt, dipi::Eta, dipi::Sign, dipi::DcaZ, dipi::DcaXY, dipi::NSigmaPi, dipi::NSigmaEl); +} // namespace o2::aod + struct upcRhoAnalysis { + Produces systemTree; + Produces trackTree; + double PcEtaCut = 0.9; // physics coordination recommendation + Configurable specifyGapSide{"specifyGapSide", true, "specify gap side for SG/DG produced data"}; - Configurable tracksTpcNSigmaPiCut{"tracksTpcNSigmaPiCut", 3.0, "TPC nSigma pion cut"}; - Configurable tracksDcaMaxCut{"tracksDcaMaxCut", 1.0, "max DCA cut on tracks"}; + Configurable gapSide{"gapSide", 2, "gap side for SG produced data"}; + Configurable requireTof{"requireTof", false, "require TOF signal"}; + Configurable collisionsPosZMaxCut{"collisionsPosZMaxCut", 10.0, "max Z position cut on collisions"}; Configurable ZNcommonEnergyCut{"ZNcommonEnergyCut", 0.0, "ZN common energy cut"}; Configurable ZNtimeCut{"ZNtimeCut", 2.0, "ZN time cut"}; - Configurable systemMassMinCut{"systemMassMinCut", 0.5, "min M cut for reco system"}; + + 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.4, "min M cut for reco system"}; Configurable systemMassMaxCut{"systemMassMaxCut", 1.2, "max M cut for reco system"}; - Configurable systemPtCut{"systemPtMaxCut", 0.3, "max pT 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", {30, 0.0, 0.3}, "p_{T} (GeV/#it{c})"}; - ConfigurableAxis pt2Axis{"pt2Axis", {90, 0.0, 0.09}, "p_{T}^{2} (GeV^{2}/#it{c}^{2})"}; + 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", {180, -0.9, 0.9}, "#eta"}; ConfigurableAxis yAxis{"yAxis", {180, -0.9, 0.9}, "y"}; - ConfigurableAxis phiAxis{"phiAxis", {180, 0.0, 2.0 * o2::constants::math::PI}, "#phi"}; - ConfigurableAxis phiAsymmAxis{"phiAsymmAxis", {364, 0, o2::constants::math::PI}, "#phi"}; + 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})"}; HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -68,215 +117,364 @@ struct upcRhoAnalysis { 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}}); // all tracks - registry.add("QC/allTracks/hTpcNSigmaPi", ";TPC n#sigma_{#pi};counts", kTH1D, {{400, -10.0, 30.0}}); - registry.add("QC/allTracks/hTofNSigmaPi", ";TOF n#sigma_{#pi};counts", kTH1D, {{400, -20.0, 20.0}}); - registry.add("QC/allTracks/hDcaXYZ", ";DCA_{z} (cm);DCA_{xy} (cm);counts", kTH2D, {{1000, -5.0, 5.0}, {1000, -5.0, 5.0}}); + 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/hTpcNCls", ";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}}); + // track quality selections vs system mass + registry.add("QC/tracks/2D/mass/leading/hItsNClsVsM", ";m (GeV/#it{c}^{2});ITS N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {11, -0.5, 10.5}}); + registry.add("QC/tracks/2D/mass/leading/hItsChi2NClVsM", ";m (GeV/#it{c}^{2});ITS #chi^{2}/N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/mass/leading/hTpcChi2NClVsM", ";m (GeV/#it{c}^{2});TPC #chi^{2}/N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/mass/leading/hTpcNClsVsM", ";m (GeV/#it{c}^{2});TPC N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/mass/leading/hTpcNClsCrossedRowsVsM", ";m (GeV/#it{c}^{2});TPC crossed rows of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/mass/leading/hTpcNClsCrossedRowsOverTpcNClsFindableVsM", ";m (GeV/#it{c}^{2});TPC crossed rows / TPC N_{cls} findable of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 10.0}}); + registry.add("QC/tracks/2D/mass/subleading/hItsNClsVsM", ";m (GeV/#it{c}^{2});ITS N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {11, -0.5, 10.5}}); + registry.add("QC/tracks/2D/mass/subleading/hItsChi2NClVsM", ";m (GeV/#it{c}^{2});ITS #chi^{2}/N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/mass/subleading/hTpcChi2NClVsM", ";m (GeV/#it{c}^{2});TPC #chi^{2}/N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/mass/subleading/hTpcNClsVsM", ";m (GeV/#it{c}^{2});TPC N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/mass/subleading/hTpcNClsCrossedRowsVsM", ";m (GeV/#it{c}^{2});TPC crossed rows of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/mass/subleading/hTpcNClsCrossedRowsOverTpcNClsFindableVsM", ";m (GeV/#it{c}^{2});TPC crossed rows / TPC N_{cls} findable of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 10.0}}); + // track quality selections vs system rapidity + registry.add("QC/tracks/2D/rapidity/leading/hItsNClsVsY", ";y;ITS N_{cls} of leading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {11, -0.5, 10.5}}); + registry.add("QC/tracks/2D/rapidity/leading/hItsChi2NClVsY", ";y;ITS #chi^{2}/N_{cls} of leading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/rapidity/leading/hTpcChi2NClVsY", ";y;TPC #chi^{2}/N_{cls} of leading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/rapidity/leading/hTpcNClsVsY", ";y;TPC N_{cls} of leading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/rapidity/leading/hTpcNClsCrossedRowsVsY", ";y;TPC crossed rows of leading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/rapidity/leading/hTpcNClsCrossedRowsOverTpcNClsFindableVsY", ";y;TPC crossed rows / TPC N_{cls} findable of leading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {1000, 0.0, 10.0}}); + registry.add("QC/tracks/2D/rapidity/subleading/hItsNClsVsY", ";y;ITS N_{cls} of subleading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {11, -0.5, 10.5}}); + registry.add("QC/tracks/2D/rapidity/subleading/hItsChi2NClVsY", ";y;ITS #chi^{2}/N_{cls} of subleading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/rapidity/subleading/hTpcChi2NClVsY", ";y;TPC #chi^{2}/N_{cls} of subleading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/rapidity/subleading/hTpcNClsVsY", ";y;TPC N_{cls} of subleading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/rapidity/subleading/hTpcNClsCrossedRowsVsY", ";y;TPC crossed rows of subleading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/rapidity/subleading/hTpcNClsCrossedRowsOverTpcNClsFindableVsY", ";y;TPC crossed rows / TPC N_{cls} findable of subleading-#it{p} track;counts", kTH2D, {{180, -0.9, 0.9}, {1000, 0.0, 10.0}}); + // track quality selections vs system pT + registry.add("QC/tracks/2D/pT/leading/hItsNClsVsPt", ";p_{T} (GeV/#it{c});ITS N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {11, -0.5, 10.5}}); + registry.add("QC/tracks/2D/pT/leading/hItsChi2NClVsPt", ";p_{T} (GeV/#it{c});ITS #chi^{2}/N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/pT/leading/hTpcChi2NClVsPt", ";p_{T} (GeV/#it{c});TPC #chi^{2}/N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/pT/leading/hTpcNClsVsPt", ";p_{T} (GeV/#it{c});TPC N_{cls} of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/pT/leading/hTpcNClsCrossedRowsVsPt", ";p_{T} (GeV/#it{c});TPC crossed rows of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/pT/leading/hTpcNClsCrossedRowsOverTpcNClsFindableVsPt", ";p_{T} (GeV/#it{c});TPC crossed rows / TPC N_{cls} findable of leading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 10.0}}); + registry.add("QC/tracks/2D/pT/subleading/hItsNClsVsPt", ";p_{T} (GeV/#it{c});ITS N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {11, -0.5, 10.5}}); + registry.add("QC/tracks/2D/pT/subleading/hItsChi2NClVsPt", ";p_{T} (GeV/#it{c});ITS #chi^{2}/N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/pT/subleading/hTpcChi2NClVsPt", ";p_{T} (GeV/#it{c});TPC #chi^{2}/N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 100.0}}); + registry.add("QC/tracks/2D/pT/subleading/hTpcNClsVsPt", ";p_{T} (GeV/#it{c});TPC N_{cls} of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/pT/subleading/hTpcNClsCrossedRowsVsPt", ";p_{T} (GeV/#it{c});TPC crossed rows of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {200, 0.0, 200.0}}); + registry.add("QC/tracks/2D/pT/subleading/hTpcNClsCrossedRowsOverTpcNClsFindableVsPt", ";p_{T} (GeV/#it{c});TPC crossed rows / TPC N_{cls} findable of subleading-#it{p} track;counts", kTH2D, {{1000, 0.0, 10.0}, {1000, 0.0, 10.0}}); // tracks passing selections - registry.add("QC/cutTracks/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/cutTracks/hTpcSignalVsPt", ";p_{T} (GeV/#it{c});TPC signal;counts", kTH2D, {ptAxis, {500, 0.0, 500.0}}); - registry.add("QC/cutTracks/hRemainingTracks", ";remaining tracks;counts", kTH1D, {{21, -0.5, 20.5}}); - + registry.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}}); + registry.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}}); + registry.add("QC/tracks/cut/hTpcSignalVsP", ";p (GeV/#it{c});TPC signal;counts", kTH2D, {ptAxis, {500, 0.0, 500.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}}); + // selection counter + std::vector selectionCounterLabels = {"all tracks", "PV contributor", "ITS hit", "ITS N_{clusters}", "ITS #chi^{2}/N_{clusters}", "TPC hit", "TPC N_{clusters}", "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 = registry.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 + registry.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("reco/pions/unlike-sign/hPt", ";p_{T}(#pi_{1}) (GeV/#it{c});p_{T}(#pi_{2}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); - registry.add("reco/pions/unlike-sign/hEta", ";#eta(#pi_{1});#eta(#pi_{2});counts", kTH2D, {etaAxis, etaAxis}); - registry.add("reco/pions/unlike-sign/hPhi", ";#phi(#pi_{1});#phi(#pi_{2});counts", kTH2D, {phiAxis, phiAxis}); - registry.add("reco/pions/like-sign/hPt", ";p_{T}(#pi_{1}) (GeV/#it{c});p_{T}(#pi_{2}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); - registry.add("reco/pions/like-sign/hEta", ";#eta(#pi_{1});#eta(#pi_{2});counts", kTH2D, {etaAxis, etaAxis}); - registry.add("reco/pions/like-sign/hPhi", ";#phi(#pi_{1});#phi(#pi_{2});counts", kTH2D, {phiAxis, phiAxis}); + registry.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}); + registry.add("pions/no-selection/unlike-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaAxis, etaAxis}); + registry.add("pions/no-selection/unlike-sign/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); + registry.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}); + registry.add("pions/no-selection/like-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaAxis, etaAxis}); + registry.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_{leading}) (GeV/#it{c});p_{T}(#pi_{subleading}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); + registry.add("pions/selected/unlike-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaAxis, etaAxis}); + registry.add("pions/selected/unlike-sign/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); + registry.add("pions/selected/like-sign/hPt", ";p_{T}(#pi_{leading}) (GeV/#it{c});p_{T}(#pi_{subleading}) (GeV/#it{c});counts", kTH2D, {ptAxis, ptAxis}); + registry.add("pions/selected/like-sign/hEta", ";#eta(#pi_{leading});#eta(#pi_{subleading});counts", kTH2D, {etaAxis, etaAxis}); + registry.add("pions/selected/like-sign/hPhi", ";#phi(#pi_{leading});#phi(#pi_{subleading});counts", kTH2D, {phiAxis, phiAxis}); // RAW RHOS - registry.add("reco/system/2pi/raw/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("reco/system/2pi/raw/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("reco/system/2pi/raw/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("reco/system/2pi/raw/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/raw/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("reco/system/2pi/raw/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("reco/system/2pi/raw/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("reco/system/2pi/raw/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/raw/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("reco/system/2pi/raw/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("reco/system/2pi/raw/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("reco/system/2pi/raw/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/raw/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + registry.add("system/raw/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + registry.add("system/raw/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); + registry.add("system/raw/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/raw/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + registry.add("system/raw/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + registry.add("system/raw/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); + registry.add("system/raw/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/raw/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); + registry.add("system/raw/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); + registry.add("system/raw/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); + registry.add("system/raw/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); // SELECTED RHOS // no selection - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/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("reco/system/2pi/cut/no-selection/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/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("reco/system/2pi/cut/no-selection/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/no-selection/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/no-selection/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/no-selection/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/no-selection/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/no-selection/unlike-sign/hTofClassVsM", ";m (GeV/#it{c}^{2});TOF class;counts", kTH2D, {mCutAxis, {4, -0.5, 3.5}}); + registry.add("system/cut/no-selection/unlike-sign/hTofClassVsPt", ";p_{T} (GeV/#it{c});TOF class;counts", kTH2D, {ptCutAxis, {4, -0.5, 3.5}}); + registry.add("system/cut/no-selection/unlike-sign/hTofClassVsY", ";y;TOF class;counts", kTH2D, {yAxis, {4, -0.5, 3.5}}); + + registry.add("system/cut/no-selection/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/no-selection/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/no-selection/like-sign/positive/hTofClassVsM", ";m (GeV/#it{c}^{2});TOF class;counts", kTH2D, {mCutAxis, {4, -0.5, 3.5}}); + registry.add("system/cut/no-selection/like-sign/positive/hTofClassVsPt", ";p_{T} (GeV/#it{c});TOF class;counts", kTH2D, {ptCutAxis, {4, -0.5, 3.5}}); + registry.add("system/cut/no-selection/like-sign/positive/hTofClassVsY", ";y;TOF class;counts", kTH2D, {yAxis, {4, -0.5, 3.5}}); + + registry.add("system/cut/no-selection/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/no-selection/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/no-selection/like-sign/negative/hTofClassVsM", ";m (GeV/#it{c}^{2});TOF class;counts", kTH2D, {mCutAxis, {4, -0.5, 3.5}}); + registry.add("system/cut/no-selection/like-sign/negative/hTofClassVsPt", ";p_{T} (GeV/#it{c});TOF class;counts", kTH2D, {ptCutAxis, {4, -0.5, 3.5}}); + registry.add("system/cut/no-selection/like-sign/negative/hTofClassVsY", ";y;TOF class;counts", kTH2D, {yAxis, {4, -0.5, 3.5}}); + // 0n0n - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0n0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/0n0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/0n0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/0n0n/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/0n0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/0n0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/0n0n/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/0n0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/0n0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0n0n/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.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("reco/system/2pi/cut/Xn0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/Xn0n/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/Xn0n/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/Xn0n/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/Xn0n/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/Xn0n/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/Xn0n/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.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("reco/system/2pi/cut/0nXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0nXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/0nXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/0nXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/0nXn/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/0nXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/0nXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/0nXn/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/0nXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/0nXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/0nXn/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.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("reco/system/2pi/cut/XnXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - registry.add("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); - - // 4PI AND 6PI SYSTEM - registry.add("reco/system/4pi/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("reco/system/4pi/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("reco/system/4pi/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("reco/system/4pi/hY", ";y;counts", kTH1D, {yAxis}); - registry.add("reco/system/6pi/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mAxis}); - registry.add("reco/system/6pi/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptAxis}); - registry.add("reco/system/6pi/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mAxis, ptAxis}); - registry.add("reco/system/6pi/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/XnXn/unlike-sign/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/XnXn/unlike-sign/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/XnXn/unlike-sign/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/XnXn/unlike-sign/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/XnXn/like-sign/positive/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/XnXn/like-sign/positive/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/XnXn/like-sign/positive/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + + registry.add("system/cut/XnXn/like-sign/negative/hM", ";m (GeV/#it{c}^{2});counts", kTH1D, {mCutAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPt", ";p_{T} (GeV/#it{c});counts", kTH1D, {ptCutAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPt2", ";p_{T}^{2} (GeV^{2}/#it{c}^{2});counts", kTH1D, {pt2Axis}); + registry.add("system/cut/XnXn/like-sign/negative/hPtVsM", ";m (GeV/#it{c}^{2});p_{T} (GeV/#it{c});counts", kTH2D, {mCutAxis, ptCutAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hY", ";y;counts", kTH1D, {yAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPhiRandom", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPhiCharge", ";#phi;counts", kTH1D, {phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPhiRandomVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPhiChargeVsM", ";m (GeV/#it{c}^{2});#phi;counts", kTH2D, {mCutAxis, phiAsymmAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPyVsPxRandom", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); + registry.add("system/cut/XnXn/like-sign/negative/hPyVsPxCharge", ";p_{x} (GeV/#it{c});p_{y} (GeV/#it{c});counts", kTH2D, {momentumFromPhiAxis, momentumFromPhiAxis}); } - template - bool collisionPassesCuts(T const& collision) // collision cuts + template + bool collisionPassesCuts(const C& collision) // collision cuts { if (std::abs(collision.posZ()) > collisionsPosZMaxCut) return false; - if (specifyGapSide && collision.gapSide() != 2) + if (specifyGapSide && collision.gapSide() != gapSide) return false; return true; } template - bool trackPassesCuts(T const& track) // track cuts (PID done separately) + bool trackPassesCuts(const T& track) // track cuts (PID done separately) { if (!track.isPVContributor()) return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 1); + if (!track.hasITS()) return false; - if (std::abs(track.dcaZ()) > tracksDcaMaxCut || std::abs(track.dcaXY()) > tracksDcaMaxCut) + registry.fill(HIST("QC/tracks/hSelectionCounter"), 2); + + if (track.itsNCls() < tracksMinItsNClsCut) + return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 3); + + if (track.itsChi2NCl() > tracksMaxItsChi2NClCut) + return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 4); + + if (!track.hasTPC()) + return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 5); + + if ((track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()) < tracksMinTpcNClsCut) + return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 6); + + if (track.tpcChi2NCl() > tracksMaxTpcChi2NClCut || track.tpcChi2NCl() < tracksMinTpcChi2NClCut) + return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 7); + + if (track.tpcNClsCrossedRows() < tracksMinTpcNClsCrossedRowsCut) return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 8); + + if (static_cast(track.tpcNClsCrossedRows()) / static_cast(track.tpcNClsFindable()) < tracksMinTpcNClsCrossedOverFindableCut) + return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 9); + + if (requireTof && !track.hasTOF()) + return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 10); + + if (track.pt() < tracksMinPtCut) + return false; + registry.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"), 12); + if (std::abs(eta(track.px(), track.py(), track.pz())) > PcEtaCut) return false; + registry.fill(HIST("QC/tracks/hSelectionCounter"), 13); + // if all selections passed return true; } @@ -290,16 +488,15 @@ 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; } - template - bool systemPassCuts(const T& system) // system cuts + bool systemPassCuts(const TLorentzVector& system) // system cuts { if (system.M() < systemMassMinCut || system.M() > systemMassMaxCut) return false; @@ -310,45 +507,41 @@ 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; } - template - double getPhiRandom(const T& cutTracks) // 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::XYVector pOne(cutTracks[indices[0]].px(), cutTracks[indices[0]].py()); - ROOT::Math::XYVector pTwo(cutTracks[indices[1]].px(), cutTracks[indices[1]].py()); - auto pPlus = pOne + pTwo; - auto pMinus = pOne - pTwo; - // no method for direct calculation of angle -> use dot product formula - double cosPhi = (pPlus.Dot(pMinus)) / (std::sqrt(pPlus.Mag2()) * std::sqrt(pMinus.Mag2())); - return std::acos(cosPhi); + 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) + double getPhiCharge(const T& cutTracks, const std::vector& cutTracks4Vecs) { // two possible definitions of phi: charge-based assignment - ROOT::Math::XYVector pOne, pTwo; + TLorentzVector pOne, pTwo; if (cutTracks[0].sign() > 0) { - pOne.SetXY(cutTracks[0].px(), cutTracks[0].py()); - pTwo.SetXY(cutTracks[1].px(), cutTracks[1].py()); + pOne = cutTracks4Vecs[0]; + pTwo = cutTracks4Vecs[1]; } else { - pOne.SetXY(cutTracks[1].px(), cutTracks[1].py()); - pTwo.SetXY(cutTracks[0].px(), cutTracks[0].py()); + pOne = cutTracks4Vecs[1]; + pTwo = cutTracks4Vecs[0]; } - auto pPlus = pOne + pTwo; - auto pMinus = pOne - pTwo; - double cosPhi = (pPlus.Dot(pMinus)) / (std::sqrt(pPlus.Mag2()) * std::sqrt(pMinus.Mag2())); - return std::acos(cosPhi); + TLorentzVector pPlus = pOne + pTwo; + TLorentzVector pMinus = pOne - pTwo; + return pPlus.DeltaPhi(pMinus); } void processReco(FullUDSgCollision const& collision, FullUDTracks const& tracks) @@ -358,8 +551,6 @@ struct upcRhoAnalysis { 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()); if (!collisionPassesCuts(collision)) @@ -367,250 +558,411 @@ struct upcRhoAnalysis { // event tagging bool XnXn = false, OnOn = false, XnOn = false, OnXn = false; // note: On == 0n... - if (collision.energyCommonZNA() < ZNcommonEnergyCut && collision.energyCommonZNC() < ZNcommonEnergyCut) + int nClass = -1; + if (collision.energyCommonZNA() < ZNcommonEnergyCut && collision.energyCommonZNC() < ZNcommonEnergyCut) { OnOn = true; + nClass = 0; + } if (collision.energyCommonZNA() > ZNcommonEnergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && - collision.energyCommonZNC() > ZNcommonEnergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) + collision.energyCommonZNC() > ZNcommonEnergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) { XnXn = true; - if (collision.energyCommonZNA() > ZNcommonEnergyCut && std::abs(collision.timeZNA()) < ZNtimeCut && collision.energyCommonZNC() < ZNcommonEnergyCut) + nClass = 3; + } + 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) + nClass = 1; + } + if (collision.energyCommonZNA() < ZNcommonEnergyCut && collision.energyCommonZNC() > ZNcommonEnergyCut && std::abs(collision.timeZNC()) < ZNtimeCut) { OnXn = true; + nClass = 2; + } // 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/allTracks/hTpcNSigmaPi"), track.tpcNSigmaPi()); - registry.fill(HIST("QC/allTracks/hTofNSigmaPi"), track.tofNSigmaPi()); - registry.fill(HIST("QC/allTracks/hDcaXYZ"), track.dcaZ(), track.dcaXY()); + // double p = momentum(track.px(), track.py(), track.pz()); + 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/hTpcNCls"), track.tpcNClsFindable() - track.tpcNClsFindableMinusFound()); + registry.fill(HIST("QC/tracks/raw/hTpcNClsCrossedRows"), track.tpcNClsCrossedRows()); + registry.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/cutTracks/hTpcSignalVsPt"), track.pt(), track.tpcSignal()); + TLorentzVector track4Vec; + track4Vec.SetXYZM(track.px(), track.py(), track.pz(), o2::constants::physics::MassPionCharged); // apriori assume pion mass + cutTracks4Vecs.push_back(track4Vec); + registry.fill(HIST("QC/tracks/cut/hTpcSignalVsP"), momentum(track.px(), track.py(), track.pz()), track.tpcSignal()); + 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/cutTracks/hRemainingTracks"), trackCounter); + registry.fill(HIST("QC/tracks/cut/hRemainingTracks"), trackCounter); - if (cutTracks.size() == 2) - registry.fill(HIST("QC/cutTracks/hTpcNsigmaPi2D"), cutTracks[0].tpcNSigmaPi(), cutTracks[1].tpcNSigmaPi()); + if (cutTracks.size() != cutTracks4Vecs.size()) { + LOG(error); + return; + } + + if (cutTracks.size() != 2) + return; + for (int i = 0; i < static_cast(cutTracks.size()); i++) + registry.fill(HIST("QC/tracks/hSelectionCounter"), 14); + + registry.fill(HIST("QC/tracks/cut/hTpcNSigmaPi2D"), cutTracks[0].tpcNSigmaPi(), cutTracks[1].tpcNSigmaPi()); + for (int i = 0; i <= 1; i++) + trackTree(collision.runNumber(), nClass, cutTracks[i].udCollisionId(), cutTracks[i].pt(), eta(cutTracks[i].px(), cutTracks[i].py(), cutTracks[i].pz()), cutTracks[i].sign(), cutTracks[i].dcaZ(), cutTracks[i].dcaXY(), cutTracks[i].tpcNSigmaPi(), cutTracks[i].tpcNSigmaEl()); if (!tracksPassPiPID(cutTracks)) return; - // reonstruct system and calculate total charge - auto system = reconstructSystem(cutTracks4Vecs); + for (int i = 0; i < static_cast(cutTracks.size()); i++) + registry.fill(HIST("QC/tracks/hSelectionCounter"), 15); + registry.fill(HIST("QC/tracks/cut/hTpcNSigmaEl2D"), cutTracks[0].tpcNSigmaEl(), cutTracks[1].tpcNSigmaEl()); + + // reonstruct system and calculate total charge, save commonly used values into variables + TLorentzVector system = reconstructSystem(cutTracks4Vecs); int totalCharge = tracksTotalCharge(cutTracks); - int nTracks = cutTracks.size(); - - if (nTracks == 2) { - // fill raw histograms according to the total charge - if (totalCharge == 0) { - registry.fill(HIST("reco/pions/unlike-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("reco/pions/unlike-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("reco/pions/unlike-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - registry.fill(HIST("reco/system/2pi/raw/unlike-sign/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/raw/unlike-sign/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/raw/unlike-sign/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/raw/unlike-sign/hY"), system.Rapidity()); - } else { - registry.fill(HIST("reco/pions/like-sign/hPt"), cutTracks4Vecs[0].Pt(), cutTracks4Vecs[1].Pt()); - registry.fill(HIST("reco/pions/like-sign/hEta"), cutTracks4Vecs[0].Eta(), cutTracks4Vecs[1].Eta()); - registry.fill(HIST("reco/pions/like-sign/hPhi"), cutTracks4Vecs[0].Phi() + o2::constants::math::PI, cutTracks4Vecs[1].Phi() + o2::constants::math::PI); - if (totalCharge == 2) { - registry.fill(HIST("reco/system/2pi/raw/like-sign/positive/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/raw/like-sign/positive/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/raw/like-sign/positive/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/raw/like-sign/positive/hY"), system.Rapidity()); - } else if (totalCharge == -2) { - registry.fill(HIST("reco/system/2pi/raw/like-sign/negative/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/raw/like-sign/negative/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/raw/like-sign/negative/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/raw/like-sign/negative/hY"), system.Rapidity()); + double mass = system.M(); + double pT = system.Pt(); + double pTsquare = pT * pT; + double rapidity = system.Rapidity(); + 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 + registry.fill(HIST("QC/tracks/hTofHitCheck"), leadingMomentumTrack.hasTOF(), subleadingMomentumTrack.hasTOF()); + int tofClass = -1; + if (!leadingMomentumTrack.hasTOF() && !subleadingMomentumTrack.hasTOF()) + tofClass = 0; + else if (leadingMomentumTrack.hasTOF() && !subleadingMomentumTrack.hasTOF()) + tofClass = 1; + else if (!leadingMomentumTrack.hasTOF() && subleadingMomentumTrack.hasTOF()) + tofClass = 2; + else if (leadingMomentumTrack.hasTOF() && subleadingMomentumTrack.hasTOF()) + tofClass = 3; + // fill 2D track QC histograms + // mass + registry.fill(HIST("QC/tracks/2D/mass/leading/hItsNClsVsM"), mass, leadingMomentumTrack.itsNCls()); + registry.fill(HIST("QC/tracks/2D/mass/leading/hItsChi2NClVsM"), mass, leadingMomentumTrack.itsChi2NCl()); + registry.fill(HIST("QC/tracks/2D/mass/leading/hTpcChi2NClVsM"), mass, leadingMomentumTrack.tpcChi2NCl()); + registry.fill(HIST("QC/tracks/2D/mass/leading/hTpcNClsVsM"), mass, leadingMomentumTrack.tpcNClsFindable() - leadingMomentumTrack.tpcNClsFindableMinusFound()); + registry.fill(HIST("QC/tracks/2D/mass/leading/hTpcNClsCrossedRowsVsM"), mass, leadingMomentumTrack.tpcNClsCrossedRows()); + registry.fill(HIST("QC/tracks/2D/mass/leading/hTpcNClsCrossedRowsOverTpcNClsFindableVsM"), mass, (static_cast(leadingMomentumTrack.tpcNClsCrossedRows()) / static_cast(leadingMomentumTrack.tpcNClsFindable()))); + registry.fill(HIST("QC/tracks/2D/mass/subleading/hItsNClsVsM"), mass, subleadingMomentumTrack.itsNCls()); + registry.fill(HIST("QC/tracks/2D/mass/subleading/hItsChi2NClVsM"), mass, subleadingMomentumTrack.itsChi2NCl()); + registry.fill(HIST("QC/tracks/2D/mass/subleading/hTpcChi2NClVsM"), mass, subleadingMomentumTrack.tpcChi2NCl()); + registry.fill(HIST("QC/tracks/2D/mass/subleading/hTpcNClsVsM"), mass, subleadingMomentumTrack.tpcNClsFindable() - subleadingMomentumTrack.tpcNClsFindableMinusFound()); + registry.fill(HIST("QC/tracks/2D/mass/subleading/hTpcNClsCrossedRowsVsM"), mass, subleadingMomentumTrack.tpcNClsCrossedRows()); + registry.fill(HIST("QC/tracks/2D/mass/subleading/hTpcNClsCrossedRowsOverTpcNClsFindableVsM"), mass, (static_cast(subleadingMomentumTrack.tpcNClsCrossedRows()) / static_cast(subleadingMomentumTrack.tpcNClsFindable()))); + // rapidity + registry.fill(HIST("QC/tracks/2D/rapidity/leading/hItsNClsVsY"), rapidity, leadingMomentumTrack.itsNCls()); + registry.fill(HIST("QC/tracks/2D/rapidity/leading/hItsChi2NClVsY"), rapidity, leadingMomentumTrack.itsChi2NCl()); + registry.fill(HIST("QC/tracks/2D/rapidity/leading/hTpcChi2NClVsY"), rapidity, leadingMomentumTrack.tpcChi2NCl()); + registry.fill(HIST("QC/tracks/2D/rapidity/leading/hTpcNClsVsY"), rapidity, leadingMomentumTrack.tpcNClsFindable() - leadingMomentumTrack.tpcNClsFindableMinusFound()); + registry.fill(HIST("QC/tracks/2D/rapidity/leading/hTpcNClsCrossedRowsVsY"), rapidity, leadingMomentumTrack.tpcNClsCrossedRows()); + registry.fill(HIST("QC/tracks/2D/rapidity/leading/hTpcNClsCrossedRowsOverTpcNClsFindableVsY"), rapidity, (static_cast(leadingMomentumTrack.tpcNClsCrossedRows()) / static_cast(leadingMomentumTrack.tpcNClsFindable()))); + registry.fill(HIST("QC/tracks/2D/rapidity/subleading/hItsNClsVsY"), rapidity, subleadingMomentumTrack.itsNCls()); + registry.fill(HIST("QC/tracks/2D/rapidity/subleading/hItsChi2NClVsY"), rapidity, subleadingMomentumTrack.itsChi2NCl()); + registry.fill(HIST("QC/tracks/2D/rapidity/subleading/hTpcChi2NClVsY"), rapidity, subleadingMomentumTrack.tpcChi2NCl()); + registry.fill(HIST("QC/tracks/2D/rapidity/subleading/hTpcNClsVsY"), rapidity, subleadingMomentumTrack.tpcNClsFindable() - subleadingMomentumTrack.tpcNClsFindableMinusFound()); + registry.fill(HIST("QC/tracks/2D/rapidity/subleading/hTpcNClsCrossedRowsVsY"), rapidity, subleadingMomentumTrack.tpcNClsCrossedRows()); + registry.fill(HIST("QC/tracks/2D/rapidity/subleading/hTpcNClsCrossedRowsOverTpcNClsFindableVsY"), rapidity, (static_cast(subleadingMomentumTrack.tpcNClsCrossedRows()) / static_cast(subleadingMomentumTrack.tpcNClsFindable()))); + // pT + registry.fill(HIST("QC/tracks/2D/pT/leading/hItsNClsVsPt"), pT, leadingMomentumTrack.itsNCls()); + registry.fill(HIST("QC/tracks/2D/pT/leading/hItsChi2NClVsPt"), pT, leadingMomentumTrack.itsChi2NCl()); + registry.fill(HIST("QC/tracks/2D/pT/leading/hTpcChi2NClVsPt"), pT, leadingMomentumTrack.tpcChi2NCl()); + registry.fill(HIST("QC/tracks/2D/pT/leading/hTpcNClsVsPt"), pT, leadingMomentumTrack.tpcNClsFindable() - leadingMomentumTrack.tpcNClsFindableMinusFound()); + registry.fill(HIST("QC/tracks/2D/pT/leading/hTpcNClsCrossedRowsVsPt"), pT, leadingMomentumTrack.tpcNClsCrossedRows()); + registry.fill(HIST("QC/tracks/2D/pT/leading/hTpcNClsCrossedRowsOverTpcNClsFindableVsPt"), pT, (static_cast(leadingMomentumTrack.tpcNClsCrossedRows()) / static_cast(leadingMomentumTrack.tpcNClsFindable()))); + registry.fill(HIST("QC/tracks/2D/pT/subleading/hItsNClsVsPt"), pT, subleadingMomentumTrack.itsNCls()); + registry.fill(HIST("QC/tracks/2D/pT/subleading/hItsChi2NClVsPt"), pT, subleadingMomentumTrack.itsChi2NCl()); + registry.fill(HIST("QC/tracks/2D/pT/subleading/hTpcChi2NClVsPt"), pT, subleadingMomentumTrack.tpcChi2NCl()); + registry.fill(HIST("QC/tracks/2D/pT/subleading/hTpcNClsVsPt"), pT, subleadingMomentumTrack.tpcNClsFindable() - subleadingMomentumTrack.tpcNClsFindableMinusFound()); + registry.fill(HIST("QC/tracks/2D/pT/subleading/hTpcNClsCrossedRowsVsPt"), pT, subleadingMomentumTrack.tpcNClsCrossedRows()); + registry.fill(HIST("QC/tracks/2D/pT/subleading/hTpcNClsCrossedRowsOverTpcNClsFindableVsPt"), pT, (static_cast(subleadingMomentumTrack.tpcNClsCrossedRows()) / static_cast(subleadingMomentumTrack.tpcNClsFindable()))); + // fill tree + systemTree(collision.runNumber(), nClass, totalCharge, mass, pT, rapidity, phiRandom, phiCharge); + // fill raw histograms according to the total charge + switch (totalCharge) { + case 0: + registry.fill(HIST("pions/no-selection/unlike-sign/hPt"), leadingPt, subleadingPt); + registry.fill(HIST("pions/no-selection/unlike-sign/hEta"), leadingEta, subleadingEta); + registry.fill(HIST("pions/no-selection/unlike-sign/hPhi"), leadingPhi, subleadingPhi); + registry.fill(HIST("system/raw/unlike-sign/hM"), mass); + registry.fill(HIST("system/raw/unlike-sign/hPt"), pT); + registry.fill(HIST("system/raw/unlike-sign/hPtVsM"), mass, pT); + registry.fill(HIST("system/raw/unlike-sign/hY"), rapidity); + break; + + case 2: + registry.fill(HIST("pions/no-selection/like-sign/hPt"), leadingPt, subleadingPt); + registry.fill(HIST("pions/no-selection/like-sign/hEta"), leadingEta, subleadingEta); + registry.fill(HIST("pions/no-selection/like-sign/hPhi"), leadingPhi, subleadingPhi); + registry.fill(HIST("system/raw/like-sign/positive/hM"), mass); + registry.fill(HIST("system/raw/like-sign/positive/hPt"), pT); + registry.fill(HIST("system/raw/like-sign/positive/hPtVsM"), mass, pT); + registry.fill(HIST("system/raw/like-sign/positive/hY"), rapidity); + break; + + case -2: + registry.fill(HIST("pions/no-selection/like-sign/hPt"), leadingPt, subleadingPt); + registry.fill(HIST("pions/no-selection/like-sign/hEta"), leadingEta, subleadingEta); + registry.fill(HIST("pions/no-selection/like-sign/hPhi"), leadingPhi, subleadingPhi); + registry.fill(HIST("system/raw/like-sign/negative/hM"), mass); + registry.fill(HIST("system/raw/like-sign/negative/hPt"), pT); + registry.fill(HIST("system/raw/like-sign/negative/hPtVsM"), mass, pT); + registry.fill(HIST("system/raw/like-sign/negative/hY"), rapidity); + break; + + default: + break; + } + + // 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"), leadingPt, subleadingPt); + registry.fill(HIST("pions/selected/unlike-sign/hEta"), leadingEta, subleadingEta); + registry.fill(HIST("pions/selected/unlike-sign/hPhi"), leadingPhi, subleadingPhi); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hM"), mass); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPt"), pT); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPt2"), pTsquare); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hY"), rapidity); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hTofClassVsM"), mass, tofClass); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hTofClassVsPt"), pT, tofClass); + registry.fill(HIST("system/cut/no-selection/unlike-sign/hTofClassVsY"), rapidity, tofClass); + if (OnOn) { + registry.fill(HIST("system/cut/0n0n/unlike-sign/hM"), mass); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPt"), pT); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPt2"), pTsquare); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hY"), rapidity); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/0n0n/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnOn) { + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hM"), mass); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPt"), pT); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPt2"), pTsquare); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hY"), rapidity); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/Xn0n/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (OnXn) { + registry.fill(HIST("system/cut/0nXn/unlike-sign/hM"), mass); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPt"), pT); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPt2"), pTsquare); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hY"), rapidity); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/0nXn/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnXn) { + registry.fill(HIST("system/cut/XnXn/unlike-sign/hM"), mass); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPt"), pT); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPt2"), pTsquare); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hY"), rapidity); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/XnXn/unlike-sign/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } + break; + + case 2: + registry.fill(HIST("pions/selected/like-sign/hPt"), leadingPt, subleadingPt); + registry.fill(HIST("pions/selected/like-sign/hEta"), leadingEta, subleadingEta); + registry.fill(HIST("pions/selected/like-sign/hPhi"), leadingPhi, subleadingPhi); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hM"), mass); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPt"), pT); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPt2"), pTsquare); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hY"), rapidity); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hTofClassVsM"), mass, tofClass); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hTofClassVsPt"), pT, tofClass); + registry.fill(HIST("system/cut/no-selection/like-sign/positive/hTofClassVsY"), rapidity, tofClass); + if (OnOn) { + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hM"), mass); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPt"), pT); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPt2"), pTsquare); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hY"), rapidity); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/0n0n/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnOn) { + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hM"), mass); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPt"), pT); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPt2"), pTsquare); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hY"), rapidity); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/Xn0n/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (OnXn) { + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hM"), mass); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPt"), pT); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPt2"), pTsquare); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hY"), rapidity); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/0nXn/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnXn) { + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hM"), mass); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPt"), pT); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPt2"), pTsquare); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hY"), rapidity); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/XnXn/like-sign/positive/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); } - } - // apply cuts to system - if (!systemPassCuts(system)) - return; - // fill histograms for system passing cuts - switch (totalCharge) { - case 0: - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/unlike-sign/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - if (OnOn) { - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/unlike-sign/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (XnOn) { - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/unlike-sign/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (OnXn) { - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/unlike-sign/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (XnXn) { - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/unlike-sign/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } - break; - - case 2: - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/positive/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - if (OnOn) { - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/positive/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (XnOn) { - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/positive/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (OnXn) { - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/positive/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (XnXn) { - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/positive/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } - break; - - case -2: - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/no-selection/like-sign/negative/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - if (OnOn) { - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0n0n/like-sign/negative/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (XnOn) { - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/Xn0n/like-sign/negative/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (OnXn) { - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/0nXn/like-sign/negative/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } else if (XnXn) { - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hM"), system.M()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hPt"), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hPt2"), system.Pt() * system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hY"), system.Rapidity()); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiRandom"), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiCharge"), getPhiCharge(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiRandomVsM"), system.M(), getPhiRandom(cutTracks)); - registry.fill(HIST("reco/system/2pi/cut/XnXn/like-sign/negative/hPhiChargeVsM"), system.M(), getPhiCharge(cutTracks)); - } - break; - - default: - break; - } - } else if (nTracks == 4 && tracksTotalCharge(cutTracks) == 0) { // 4pi system - registry.fill(HIST("reco/system/4pi/hM"), system.M()); - registry.fill(HIST("reco/system/4pi/hPt"), system.Pt()); - registry.fill(HIST("reco/system/4pi/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/4pi/hY"), system.Rapidity()); - } else if (nTracks == 6 && tracksTotalCharge(cutTracks) == 0) { // 6pi system - registry.fill(HIST("reco/system/6pi/hM"), system.M()); - registry.fill(HIST("reco/system/6pi/hPt"), system.Pt()); - registry.fill(HIST("reco/system/6pi/hPtVsM"), system.M(), system.Pt()); - registry.fill(HIST("reco/system/6pi/hY"), system.Rapidity()); + break; + + case -2: + registry.fill(HIST("pions/selected/like-sign/hPt"), leadingPt, subleadingPt); + registry.fill(HIST("pions/selected/like-sign/hEta"), leadingEta, subleadingEta); + registry.fill(HIST("pions/selected/like-sign/hPhi"), leadingPhi, subleadingPhi); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hM"), mass); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPt"), pT); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPt2"), pTsquare); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hY"), rapidity); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hTofClassVsM"), mass, tofClass); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hTofClassVsPt"), pT, tofClass); + registry.fill(HIST("system/cut/no-selection/like-sign/negative/hTofClassVsY"), rapidity, tofClass); + if (OnOn) { + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hM"), mass); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPt"), pT); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPt2"), pTsquare); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hY"), rapidity); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/0n0n/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnOn) { + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hM"), mass); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPt"), pT); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPt2"), pTsquare); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hY"), rapidity); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/Xn0n/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (OnXn) { + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hM"), mass); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPt"), pT); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPt2"), pTsquare); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hY"), rapidity); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/0nXn/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } else if (XnXn) { + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hM"), mass); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPt"), pT); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPt2"), pTsquare); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPtVsM"), mass, pT); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hY"), rapidity); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiRandom"), phiRandom); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiCharge"), phiCharge); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiRandomVsM"), mass, phiRandom); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPhiChargeVsM"), mass, phiCharge); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPyVsPxRandom"), pT * std::cos(phiRandom), pT * std::sin(phiRandom)); + registry.fill(HIST("system/cut/XnXn/like-sign/negative/hPyVsPxCharge"), pT * std::cos(phiCharge), pT * std::sin(phiCharge)); + } + break; + + default: + break; } } 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); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGUD/Tasks/upcTauCentralBarrelRL.cxx b/PWGUD/Tasks/upcTauCentralBarrelRL.cxx index 965bfb6f327..8753acf8c96 100644 --- a/PWGUD/Tasks/upcTauCentralBarrelRL.cxx +++ b/PWGUD/Tasks/upcTauCentralBarrelRL.cxx @@ -19,6 +19,7 @@ // O2 headers #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" +#include "Framework/HistogramRegistry.h" #include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" @@ -87,6 +88,7 @@ struct UpcTauCentralBarrelRL { 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"}}; @@ -97,6 +99,30 @@ struct UpcTauCentralBarrelRL { 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"}; + using FullUDTracks = soa::Join; using FullUDCollision = soa::Join::iterator; using FullSGUDCollision = soa::Join::iterator; @@ -114,30 +140,6 @@ struct UpcTauCentralBarrelRL { countCollisions = 0; isFirstReconstructedCollisions = true; - const AxisSpec axisNtracks{30, -0.5, 29.5}; - const AxisSpec axisZvtx{40, -20., 20.}; - const AxisSpec axisInvMass{400, 1., 5.}; - const AxisSpec axisInvMassWide{1000, 0., 10.}; - const AxisSpec axisMom{400, 0., 2.}; - const AxisSpec axisMomSigned{800, -2., 2.}; - const AxisSpec axisMomWide{1000, 0., 10.}; - const AxisSpec axisPt{400, 0., 2.}; - const AxisSpec axisPhi{64, -2 * o2::constants::math::PI, 2 * o2::constants::math::PI}; - const AxisSpec axisModPhi{400, 0., .4}; - const AxisSpec axisEta{50, -1.2, 1.2}; - const AxisSpec axisRap{50, -1.2, 1.2}; - const AxisSpec axisAcoplanarity{32, 0.0, o2::constants::math::PI}; - const AxisSpec axisDCA{100, -0.5, 0.5}; - const AxisSpec axisAvgITSclsSizes{500, 0., 10.}; - const AxisSpec axisTPCdEdx{2000, 0., 200.}; - const AxisSpec axisTOFsignal{2500, -10000., 40000.}; - const AxisSpec axisNsigma{200, -10., 10.}; - const AxisSpec axisITSnCls{8, -0.5, 7.5}; - const AxisSpec axisITSchi2{100, 0, 50}; - const AxisSpec axisTPCnCls{165, -0.5, 164.5}; - const AxisSpec axisTPCxRwsFrac{200, 0.0, 2.0}; - const AxisSpec axisTPCchi2{100, 0, 10}; - 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}}); @@ -445,6 +447,7 @@ struct UpcTauCentralBarrelRL { 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}); @@ -481,6 +484,7 @@ struct UpcTauCentralBarrelRL { 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}); @@ -1171,6 +1175,15 @@ struct UpcTauCentralBarrelRL { 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; + } histos.get(HIST("EventTwoTracks/hInvariantMass"))->Fill(mother.M()); histos.get(HIST("EventTwoTracks/hInvariantMassWide"))->Fill(mother.M()); @@ -1376,6 +1389,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronMuPi/hMotherPhi"))->Fill(mother.Phi()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hMotherRapidity"))->Fill(mother.Rapidity()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); + histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPt"))->Fill(electronPt); histos.get(HIST("EventTwoTracks/ElectronMuPi/hElectronPtWide"))->Fill(electronPt); histos.get(HIST("EventTwoTracks/ElectronMuPi/hDaughtersP"))->Fill(daug[0].P(), daug[1].P()); histos.get(HIST("EventTwoTracks/ElectronMuPi/hDaughtersPwide"))->Fill(daug[0].P(), daug[1].P()); @@ -1426,6 +1440,7 @@ struct UpcTauCentralBarrelRL { histos.get(HIST("EventTwoTracks/ElectronOther/hMotherPhi"))->Fill(mother.Phi()); histos.get(HIST("EventTwoTracks/ElectronOther/hMotherRapidity"))->Fill(mother.Rapidity()); histos.get(HIST("EventTwoTracks/ElectronOther/hMotherMassVsPt"))->Fill(mother.M(), mother.Pt()); + histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPt"))->Fill(electronPt); histos.get(HIST("EventTwoTracks/ElectronOther/hElectronPtWide"))->Fill(electronPt); histos.get(HIST("EventTwoTracks/ElectronOther/hDaughtersP"))->Fill(daug[0].P(), daug[1].P()); histos.get(HIST("EventTwoTracks/ElectronOther/hDaughtersPwide"))->Fill(daug[0].P(), daug[1].P()); 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/Tutorials/CMakeLists.txt b/Tutorials/CMakeLists.txt index 8a77f3dead9..d99c71adc88 100644 --- a/Tutorials/CMakeLists.txt +++ b/Tutorials/CMakeLists.txt @@ -29,7 +29,7 @@ o2physics_add_dpl_workflow(track-iteration COMPONENT_NAME AnalysisTutorial) o2physics_add_dpl_workflow(pid - SOURCES src/pid.cxx + SOURCES src/pidTpcTof.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) diff --git a/Tutorials/ML/applyMlSelection.cxx b/Tutorials/ML/applyMlSelection.cxx index d33427e3c2a..bf2e69fc5ce 100644 --- a/Tutorials/ML/applyMlSelection.cxx +++ b/Tutorials/ML/applyMlSelection.cxx @@ -11,7 +11,7 @@ /// \file applyMlSelection.cxx /// \brief Showcase usage of trained ML model exported to ONNX format for candidate selection in analysis -/// \brief This is only the starting point for the tutorial. The complete task is available at https://github.com/AliceO2Group/analysis-tutorials/tree/master/o2at-3/machineLearning/MlInference +/// \brief This is only the starting point for the tutorial. The complete task is available at https://github.com/AliceO2Group/analysis-tutorials/tree/master/o2at-4/machineLearning/MlInference /// /// \author Fabio Catalano , CERN @@ -45,7 +45,7 @@ struct applyMlSelection { // Bonus: CCDB configuration (needed for ML application on the GRID) Configurable loadModelsFromCCDB{"loadModelsFromCCDB", false, "Flag to enable or disable the loading of models from CCDB"}; Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable modelPathsCCDB{"modelPathsCCDB", "Users/f/fcatalan/O2AT3/MlInference", "Path on CCDB"}; + Configurable> modelPathsCCDB{"modelPathsCCDB", std::vector{"Users/c/ciacco/O2AT4/MlInference"}, "Path on CCDB"}; Configurable timestampCCDB{"timestampCCDB", -1, "timestamp of the ONNX file for ML model used to query in CCDB"}; Filter filterDsFlag = (o2::aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_3prong::DecayType::DsToKKPi))) != static_cast(0); diff --git a/Tutorials/ML/dpl-config_applyMlSelection.json b/Tutorials/ML/dpl-config_applyMlSelection.json index ddb5a42d329..592d2973bf0 100644 --- a/Tutorials/ML/dpl-config_applyMlSelection.json +++ b/Tutorials/ML/dpl-config_applyMlSelection.json @@ -41,124 +41,37 @@ }, "loadModelsFromCCDB": "false", "ccdbUrl": "http://alice-ccdb.cern.ch", - "modelPathsCCDB": "Users/f/fcatalan/O2AT3/MlInference", + "modelPathsCCDB": { + "values": [ + "Users\/c\/ciacco\/O2AT4\/MlInference" + ] + }, "timestampCCDB": "-1" }, - "internal-dpl-aod-reader": { + "aod-file-private": "AO2D_MC_Ds.root", "time-limit": "0", "orbit-offset-enumeration": "0", "orbit-multiplier-enumeration": "0", "start-value-enumeration": "0", "end-value-enumeration": "-1", "step-value-enumeration": "1", - "aod-file": "AO2D.root" - }, - "hf-track-index-skim-creator-cascades": { - "maxDZIni": "4", - "tpcRefitV0Daugh": "1", - "ccdbPathGrpMag": "GLO/Config/GRPMagField", - "processCascades": "0", - "propagateToPCA": "1", - "cutInvMassCascLc": "1", - "ccdbPathGrp": "GLO/GRP/GRP", - "processNoCascades": "1", - "ccdbUrl": "http://alice-ccdb.cern.ch", - "doCutQuality": "1", - "nCrossedRowsMinBach": "50", - "etaMaxV0Daugh": "1.1", - "dcaXYNegToPvMin": "0.1", - "maxR": "200", - "nCrossedRowsMinV0Daugh": "50", - "useAbsDCA": "1", - "minRelChi2Change": "0.9", - "cpaV0Min": "0.995", - "useWeightedFinalPCA": "1", - "cutInvMassV0": "0.05", - "dcaXYPosToPvMin": "0.1", - "minParamChange": "0.001", - "etaMinV0Daugh": "-99999", - "fillHistograms": "1", - "isRun2": "0", - "ptCascCandMin": "-1", - "ccdbPathLut": "GLO/Param/MatLUT", - "tpcRefitBach": "1", - "ptMinV0Daugh": "0.05" - }, - "track-to-collision-association": { - "timeMargin": "500", - "bcWindowForOneSigma": "60", - "usePVAssociation": "1", - "processStandardAssoc": "0", - "processAssocWithTime": "1", - "nSigmaForTimeCompat": "4", - "includeUnassigned": "1", - "fillTableOfCollIdsPerTrack": "0", - "setTrackSelections": "1" - }, - "hf-track-index-skim-creator-lf-cascades": { - "maxDZIni": "4", - "dcaBachToPv": "0.05", - "dcaV0ToPv": "0.05", - "ccdbPathGrpMag": "GLO/Config/GRPMagField", - "v0Radius": "0.9", - "tpcNsigmaBachelor": "4", - "dcaV0Dau": "2", - "processNoLfCascades": "1", - "propagateToPCA": "1", - "ccdbPathGrp": "GLO/GRP/GRP", - "do3Prong": "0", - "v0MassWindow": "0.008", - "ccdbUrl": "http://alice-ccdb.cern.ch", - "rejDiffCollTrack": "1", - "doCutQuality": "1", - "tpcNsigmaPion": "4", - "cascRadius": "0.5", - "tpcNsigmaProton": "4", - "maxR": "200", - "useAbsDCA": "1", - "minRelChi2Change": "0.9", - "dcaPosToPv": "0.05", - "cascCosPA": "0.95", - "dcaNegToPv": "0.05", - "useWeightedFinalPCA": "1", - "dcaCascDau": "1", - "processLfCascades": "0", - "minParamChange": "0.001", - "v0CosPA": "0.95", - "fillHistograms": "1", - "isRun2": "0", - "ccdbPathLut": "GLO/Param/MatLUT" + "aod-parent-access-level": "1" }, "hf-track-index-skim-creator": { - "maxDZIni": "4", - "cutsDplusToPiKPi": { + "thresholdMlScoreDsToPiKK": { "values": [ [ - 1.75, - 2.05, - 0.7, - 0.02 - ], - [ - 1.75, - 2.05, + 0.1, 0.5, - 0.02 + 0.5 ] ] }, - "ccdbPathGrpMag": "GLO/Config/GRPMagField", - "axisNumTracks": { - "values": [ - 250, - -0.5, - 249.5 - ] - }, + "applyProtonPidForXicToPKPi": "1", "binsPtDsToKKPi": { "values": [ - 1, + 0, 5, 1000 ] @@ -167,23 +80,23 @@ "binsPtJpsiToEE": { "values": [ 0, - 0, - 0 + 5, + 1000 ] }, "cutsLcToPKPi": { "values": [ [ - 1.75, - 2.05, + 2.1, + 2.55, 0.7, - 0.02 + 0 ], [ - 1.75, - 2.05, - 0.5, - 0.02 + 2, + 2.6, + 0.85, + 0.01 ] ] }, @@ -191,11 +104,11 @@ "binsPtLcToPKPi": { "values": [ 0, - 0, - 0 + 5, + 1000 ] }, - "process2And3ProngsWithPvRefit": "0", + "minTwoTrackDecayLengthFor3Prongs": "0", "axisPvRefitDeltaY": { "values": [ 1000, @@ -207,16 +120,16 @@ "cutsJpsiToEE": { "values": [ [ - 1.65, - 2.15, - 0.5, - 100 + 0, + 0, + 2, + 0 ], [ - 1.65, - 2.15, - 0.5, - 100 + 0, + 0, + 2, + 0 ] ] }, @@ -227,25 +140,27 @@ 0.5 ] }, - "cutsD0ToPiK": { + "ccdbUrl": "http://alice-ccdb.cern.ch", + "onnxFileNames": { "values": [ [ - 1.65, - 2.15, - 0.5, - 100 + "ModelHandler_onnx_D0ToKPi.onnx" ], [ - 1.65, - 2.15, - 0.5, - 100 + "ModelHandler_onnx_DplusToPiKPi.onnx" + ], + [ + "ModelHandler_onnx_LcToPKPi.onnx" + ], + [ + "ModelHandler_onnx_DsToKKPi.onnx" + ], + [ + "" ] ] }, - "ccdbUrl": "http://alice-ccdb.cern.ch", - "debugPvRefit": "0", - "maxR": "200", + "maxTwoTrackChi2PcaFor3Prongs": "1e+10", "axisPvRefitDeltaX": { "values": [ 1000, @@ -259,372 +174,254 @@ "cutsJpsiToMuMu": { "values": [ [ - 1.65, - 2.15, - 0.5, - 100 + 0, + 0, + 2, + 0 ], [ - 1.65, - 2.15, - 0.5, - 100 + 0, + 0, + 2, + 0 ] ] }, - "debug": "0", "binsPtXicToPKPi": { "values": [ 0, - 0, - 0 - ] - }, - "cutsDsToKKPi": { - "values": [ - [ - 1.78, - 2.18, - 0.95, - 0.01 - ], - [ - 1.78, - 2.18, - 0.98, - 0.02 - ] + 5, + 1000 ] }, - "doDstar": "0", + "doDstar": "1", "binsPtDstarToD0Pi": { "values": [ 0, - 0, - 0 + 5, + 1000 ] }, "binsPtDplusToPiKPi": { "values": [ 0, - 0, - 0 + 5, + 1000 ] }, "useWeightedFinalPCA": "0", - "axisNumCands": { - "values": [ - 200, - -0.5, - 199.5 - ] - }, "cutsDstarToD0Pi": { "values": [ [ 0.17, - 0.05 + 0.12 ], [ 0.17, - 0.08 + 0.4 ] ] }, "binsPtJpsiToMuMu": { "values": [ 0, - 0, - 0 - ] - }, - "binsPtD0ToPiK": { - "values": [ - 0, - 0, - 0 + 5, + 1000 ] }, - "cutsXicToPKPi": { + "loadMlModelsFromCCDB": "1", + "minParamChange": "0.001", + "ptTolerance": "0.1", + "ccdbPathLut": "GLO/Param/MatLUT", + "applyMlForHfFilters": "0", + "maxDZIni": "4", + "cutsDplusToPiKPi": { "values": [ [ - 1.75, + 1.7, 2.05, - 0.7, - 0.02 + 0.85, + 0.01 ], [ - 1.75, - 2.05, - 0.5, + 1.6, + 2.5, + 0.9, 0.02 ] ] }, - "minParamChange": "0.001", - "processNo2And3Prongs": "0", - "ptTolerance": "0.1", - "fillHistograms": "1", - "isRun2": "0", - "ccdbPathLut": "GLO/Param/MatLUT" - }, - "ft0-corrected-table": {}, - "hf-candidate-creator-3prong-expressions": { - "processMc": "1" - }, - "hf-track-index-skim-creator-tag-sel-collisions": { - "zVertexMin": "-10", - "xVertexMax": "1", - "useSel8Trigger": "1", - "axisNumContributors": { + "ccdbPathGrpMag": "GLO/Config/GRPMagField", + "thresholdMlScoreLcToPiKP": { "values": [ - 200, - -0.5, - 199.5 + [ + 0.1, + 0.5, + 0.5 + ] ] }, - "triggerClassName": "kINT7", - "processTrigSel": "1", - "yVertexMax": "1", - "fillHistograms": "1", - "zVertexMax": "10", - "xVertexMin": "-1", - "chi2Max": "0", - "processNoTrigSel": "0", - "nContribMin": "0", - "yVertexMin": "-1" - }, - "hf-track-index-skim-creator-tag-sel-tracks": { - "etaMaxTrack2Prong": "0.8", - "useIsGlobalTrackForSoftPion": "0", - "ccdbPathGrpMag": "GLO/Config/GRPMagField", - "useIsGlobalTrackWoDCAForSoftPion": "0", - "ptMaxSoftPionForDstar": "2", - "ptMinSoftPionForDstar": "0.05", - "cutsTrack3Prong": { + "process2And3ProngsWithPvRefit": "0", + "cutsD0ToPiK": { "values": [ [ - 0, - 10 - ], - [ - 0, - 10 - ], - [ - 0, - 10 + 1.65, + 2.1, + 0.8, + 0.01 ], [ - 0, - 10 - ], + 1.6, + 5, + 0.85, + 0.01 + ] + ] + }, + "debugPvRefit": "0", + "maxR": "200", + "debug": "0", + "cutsDsToKKPi": { + "values": [ [ - 0, - 10 + 1.7, + 2.15, + 0.8, + 0.01, + 0.02 ], [ - 0, - 10 + 1.7, + 2.25, + 0.85, + 0.01, + 0.02 ] ] }, - "binsPtTrack": { + "applyProtonPidForLcToPKPi": "1", + "applyKaonPidIn3Prongs": "0", + "binsPtD0ToPiK": { "values": [ 0, - 0.5, - 1, - 1.5, - 2, - 3, + 5, 1000 ] }, - "ccdbPathGrp": "GLO/GRP/GRP", - "doPvRefit": "0", - "useIsGlobalTrackWoDCA": "1", - "axisPvRefitDeltaY": { - "values": [ - 1000, - -0.5, - 0.5 - ] - }, - "axisPvRefitDeltaZ": { - "values": [ - 1000, - -0.5, - 0.5 - ] - }, - "ptMinTrack3Prong": "0.3", - "etaMinTrack3Prong": "-99999", - "useIsQualityTrackITSForSoftPion": "1", - "ccdbUrl": "http://alice-ccdb.cern.ch", - "doCutQuality": "1", - "debugPvRefit": "0", - "ptMinTrackBach": "0.3", - "useIsGlobalTrack": "0", - "axisPvRefitDeltaX": { - "values": [ - 1000, - -0.5, - 0.5 - ] - }, - "etaMaxTrackBach": "0.8", - "cutsTrack2Prong": { + "mlModelPathCCDB": "EventFiltering/PWGHF/BDTSmeared", + "cutsXicToPKPi": { "values": [ [ - 0, - 10 - ], - [ - 0, - 10 - ], - [ - 0, - 10 - ], - [ - 0, - 10 - ], - [ - 0, - 10 + 2.1, + 2.65, + 0.8, + 0.01 ], [ - 0, - 10 + 2, + 2.7, + 0.85, + 0.01 ] ] }, - "ptMinTrack2Prong": "0.3", - "etaMinTrackBach": "-99999", - "cutsTrackDstar": { + "processNo2And3Prongs": "0", + "fillHistograms": "1", + "isRun2": "0", + "thresholdMlScoreXicToPiKP": { "values": [ [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 0 + 0.1, + 0.5, + 0.5 ] ] }, - "etaMaxSoftPionForDstar": "0.8", - "etaMinTrack2Prong": "-99999", - "tpcNClsFoundMin": "70", - "etaMaxTrack3Prong": "0.8", - "fillHistograms": "1", - "isRun2": "0", - "cutsTrackBach": { + "timestampCcdbForHfFilters": "1657032422771", + "thresholdMlScoreDplusToPiKPi": { "values": [ [ - 10, - 10 - ], - [ - 10, - 10 - ], - [ - 10, - 10 - ], - [ - 10, - 10 - ], - [ - 10, - 10 - ], - [ - 10, - 10 + 0.1, + 0.5, + 0.5 ] ] }, - "etaMinSoftPionForDstar": "-99999", - "ccdbPathLut": "GLO/Param/MatLUT" + "thresholdMlScoreD0ToKPi": { + "values": [ + [ + 0.1, + 0.5, + 0.5 + ] + ] + } }, - "track-selection": { - "ptMax": "1e+10", - "produceTable": "1", - "etaMin": "-0.8", - "isRun3": "1", - "itsMatching": "1", - "etaMax": "0.8", - "compatibilityIU": "0", - "dcaSetup": "0", - "ptMin": "0.1", - "produceFBextendedTable": "-1" + "timestamp-task": { + "fatalOnInvalidTimestamp": "false", + "verbose": "false", + "rct-path": "RCT\/Info\/RunInformation", + "orbit-reset-path": "CTP\/Calib\/OrbitReset", + "ccdb-url": "http:\/\/alice-ccdb.cern.ch", + "isRun2MC": "-1" + }, + "track-propagation": { + "ccdb-url": "http:\/\/alice-ccdb.cern.ch", + "lutPath": "GLO\/Param\/MatLUT", + "geoPath": "GLO\/Config\/GeometryAligned", + "grpmagPath": "GLO\/Config\/GRPMagField", + "mVtxPath": "GLO\/Calib\/MeanVertex", + "minPropagationDistance": "5", + "trackTunerParams": "debugInfo=0|updateTrackDCAs=1|updateTrackCovMat=1|updateCurvature=0|updateCurvatureIU=1|updatePulls=1|isInputFileFromCCDB=1|pathInputFile=Users\/m\/mfaggin\/test\/inputsTrackTuner\/pp2023\/smoothHighPtMC|nameInputFile=trackTuner_DataLHC23fPass1_McLHC23k4b_run535085.root|pathFileQoverPt=Users\/h\/hsharma\/qOverPtGraphs|nameFileQoverPt=D0sigma_Data_removal_itstps_MC_LHC22b1b.root|usePvRefitCorrections=0|qOverPtMC=1|qOverPtData=1.5", + "processStandard": "false", + "processStandardWithPID": "false", + "processCovarianceMc": "false", + "processCovariance": "true", + "processCovarianceWithPID": "false" }, "bc-selection-task": { "triggerBcShift": "999", - "processRun3": "1", - "processRun2": "0" + "processRun2": "false", + "processRun3": "true" }, "event-selection-task": { "syst": "pp", - "isMC": "1", - "processRun3": "1", - "processRun2": "0", "muonSelection": "0", - "customDeltaBC": "-1" + "maxDiffZvtxFT0vsPV": "1", + "isMC": "1", + "processRun2": "false", + "processRun3": "true" }, "hf-candidate-creator-3prong": { + "propagateToPCA": "true", + "useAbsDCA": "false", + "useWeightedFinalPCA": "false", + "maxR": "200", "maxDZIni": "4", - "minRelChi2Change": "0.9", - "processNoPvRefit": "1", - "ccdbPathGrpMag": "GLO/Config/GRPMagField", - "useWeightedFinalPCA": "0", - "propagateToPCA": "1", "minParamChange": "0.001", - "ccdbPathGrp": "GLO/GRP/GRP", - "processPvRefit": "0", - "fillHistograms": "1", - "ccdbUrl": "http://alice-ccdb.cern.ch", - "isRun2": "0", - "ccdbPathLut": "GLO/Param/MatLUT", - "maxR": "200", - "useAbsDCA": "0" - }, - "track-propagation": { - "lutPath": "GLO/Param/MatLUT", - "mVtxPath": "GLO/Calib/MeanVertex", - "geoPath": "GLO/Config/GeometryAligned", - "grpmagPath": "GLO/Config/GRPMagField", - "ccdb-url": "http://alice-ccdb.cern.ch", - "minPropagationDistance": "5", - "processStandard": "0", - "processCovariance": "1" + "minRelChi2Change": "0.9", + "fillHistograms": "true", + "isRun2": "false", + "ccdbUrl": "http:\/\/alice-ccdb.cern.ch", + "ccdbPathLut": "GLO\/Param\/MatLUT", + "ccdbPathGrp": "GLO\/GRP\/GRP", + "ccdbPathGrpMag": "GLO\/Config\/GRPMagField", + "createDplus": "true", + "createDs": "true", + "createLc": "false", + "createXic": "false", + "processNoPvRefit": "true" }, - "timestamp-task": { - "rct-path": "RCT/Info/RunInformation", - "orbit-reset-path": "CTP/Calib/OrbitReset", - "ccdb-url": "http://alice-ccdb.cern.ch", - "verbose": "0", - "isRun2MC": "0" + "track-selection": { + "ptMax": "1e+10", + "produceTable": "1", + "etaMin": "-0.8", + "isRun3": "1", + "itsMatching": "1", + "etaMax": "0.8", + "compatibilityIU": "0", + "dcaSetup": "0", + "ptMin": "0.1", + "produceFBextendedTable": "-1" } -} \ No newline at end of file +} diff --git a/Tutorials/PWGCF/CMakeLists.txt b/Tutorials/PWGCF/CMakeLists.txt index 9bf7685cfeb..ad718c5289f 100644 --- a/Tutorials/PWGCF/CMakeLists.txt +++ b/Tutorials/PWGCF/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(EventPlane) add_subdirectory(FemtoFramework) add_subdirectory(FlowGenericFramework) add_subdirectory(TwoParticleCorrelations) diff --git a/Tutorials/PWGCF/EventPlane/CMakeLists.txt b/Tutorials/PWGCF/EventPlane/CMakeLists.txt new file mode 100644 index 00000000000..4e0a34d9971 --- /dev/null +++ b/Tutorials/PWGCF/EventPlane/CMakeLists.txt @@ -0,0 +1,12 @@ +# 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(src) diff --git a/Tutorials/PWGCF/EventPlane/README.md b/Tutorials/PWGCF/EventPlane/README.md new file mode 100644 index 00000000000..c9610b0b45c --- /dev/null +++ b/Tutorials/PWGCF/EventPlane/README.md @@ -0,0 +1,3 @@ +# O2AT - Second edition - PWG-CF + +## Event Plane hands-on session diff --git a/Tutorials/PWGCF/EventPlane/doc/README.md b/Tutorials/PWGCF/EventPlane/doc/README.md new file mode 100644 index 00000000000..c9610b0b45c --- /dev/null +++ b/Tutorials/PWGCF/EventPlane/doc/README.md @@ -0,0 +1,3 @@ +# O2AT - Second edition - PWG-CF + +## Event Plane hands-on session diff --git a/Tutorials/PWGCF/EventPlane/src/CMakeLists.txt b/Tutorials/PWGCF/EventPlane/src/CMakeLists.txt new file mode 100644 index 00000000000..86e39d138cf --- /dev/null +++ b/Tutorials/PWGCF/EventPlane/src/CMakeLists.txt @@ -0,0 +1,15 @@ +# 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(qvectors-tutorial + SOURCES qVectorstutorial.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx b/Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx new file mode 100644 index 00000000000..b5b01185a49 --- /dev/null +++ b/Tutorials/PWGCF/EventPlane/src/qVectorstutorial.cxx @@ -0,0 +1,175 @@ +// 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/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 "CommonConstants/PhysicsConstants.h" + +// o2 includes. + +using namespace o2; +using namespace o2::framework; + +using MyCollisions = soa::Join; +using MyTracks = soa::Join; + +struct qVectorstutorial { + HistogramRegistry histosQA{"histosQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, false}; + + 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 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}, ""}; + + EventPlaneHelper helperEP; + + void init(InitContext const&) + { + 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"}; + + histosQA.add(Form("histQvecV2"), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}}); + histosQA.add(Form("histEvtPlV2"), "", {HistType::kTH2F, {axisEvtPl, axisCent}}); + histosQA.add(Form("histQvecRes_SigRefAV2"), "", {HistType::kTH2F, {axisQvecF, axisCent}}); + histosQA.add(Form("histCosDetV2"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}}); + } + + template + bool SelEvent(const CollType& collision) + { + if (!collision.sel8()) { + return 0; + } + 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.pt() < cfgMinPt) + return false; + if (std::abs(track.eta()) > cfgMaxEta) + 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 + void fillHistosQvec(const CollType& collision, int nmode) + { + if (nmode == 2) { + histosQA.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], collision.centFT0C()); + histosQA.fill(HIST("histEvtPlV2"), helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), collision.centFT0C()); + histosQA.fill(HIST("histQvecRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode), collision.centFT0C()); + } + } + + template + void fillHistosFlow(const CollType& collision, const TrackType& track, int nmode) + { + if (collision.sumAmplFT0C() < 1e-4) { + return; + } + for (auto& trk : track) { + if (!SelTrack(trk)) { + continue; + } + if (nmode == 2) { + histosQA.fill(HIST("histCosDetV2"), collision.centFT0C(), trk.pt(), + std::cos(static_cast(nmode) * (trk.phi() - helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode)))); + } + } + } + + void process(MyCollisions::iterator const& collision, MyTracks const& tracks) + { + if (!SelEvent(collision)) { + return; + } + for (std::size_t i = 0; i < cfgnMods->size(); i++) { + fillHistosQvec(collision, cfgnMods->at(i)); + fillHistosFlow(collision, tracks, cfgnMods->at(i)); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask1.cxx b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask1.cxx index acb7f799a7c..369e63cbdf6 100644 --- a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask1.cxx +++ b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask1.cxx @@ -37,7 +37,7 @@ struct CFTutorialTask1 { // TODO : // Defining filters for analysis level selections on events and tracks - // on Femto tables defined FemtoDerived.h + // on Femto tables defined in FemtoDerived.h // Filter collisionFilter = ... // Filter trackFilter = ... @@ -50,7 +50,6 @@ struct CFTutorialTask1 { // create analysis objects like histograms void init(o2::framework::InitContext&) { - // Add histograms to histogram registry HistRegistry.add("Event/hZvtx", ";Z (cm)", kTH1F, {{240, -12, 12}}); diff --git a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask2.cxx b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask2.cxx index 8c3adcfd542..ff5fa93aa5b 100644 --- a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask2.cxx +++ b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask2.cxx @@ -92,7 +92,7 @@ struct CFTutorialTask2 { HistRegistry.fill(HIST("Event/hZvtx"), col.posZ()); // TODO - // generate partition of particles 1&2 with sliceByCached method + // generate partition of particles 1 & 2 with sliceByCached method /// TODO: /// loop over particle group 1 diff --git a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask3.cxx b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask3.cxx index 02e7b9d9e14..ca200fd3937 100644 --- a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask3.cxx +++ b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask3.cxx @@ -57,13 +57,11 @@ struct CFTutorialTask3 { // ... Configurable ConfCutPartTwo{"ConfCutPartTwo", 3191978, "Particle 2 - Selection bit"}; - // additional configurables for particle 1 - // ... - - // more configurables for PID selection + // additional configurables for particle 2 // ... - /// Partitions for particle 1 and particle 2 + // Partitions for particle 1 and particle 2 + // add PID selection to partition definition Partition PartsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne); Partition PartsTwo = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartTwo) == ConfCutPartTwo); @@ -96,40 +94,27 @@ struct CFTutorialTask3 { void process(FilteredFDCollision const& col, FilteredFDParts const& /*parts*/) { - /// event QA + // event QA HistRegistry.fill(HIST("Event/hZvtx"), col.posZ()); // generate partition of particels auto GroupPartsOne = PartsOne->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); auto GroupPartsTwo = PartsTwo->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); - /// QA for particle 1 + // QA for particle 1 for (auto& part : GroupPartsOne) { - - // TODO: - // add function for PID selection from FemtoUtils - // if (PID cut) { - HistRegistry.fill(HIST("Particle1/hPt"), part.pt()); HistRegistry.fill(HIST("Particle1/hEta"), part.eta()); HistRegistry.fill(HIST("Particle1/hPhi"), part.phi()); - - // } } - /// QA for particle 2 - /// skip QA if particle 1 & 2 are the same + // QA for particle 2 + // skip QA if particle 1 & 2 are the same if (ConfIsSame.value == false) { for (auto& part : GroupPartsTwo) { - // TODO: - // add function for PID selection from FemtoUtils - // if (PID cut) { - HistRegistry.fill(HIST("Particle2/hPt"), part.pt()); HistRegistry.fill(HIST("Particle2/hEta"), part.eta()); HistRegistry.fill(HIST("Particle2/hPhi"), part.phi()); - - // } } } } diff --git a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask4.cxx b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask4.cxx index 943f1e5bc12..90ae5168a78 100644 --- a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask4.cxx +++ b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask4.cxx @@ -50,18 +50,16 @@ struct CFTutorialTask4 { Configurable ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"}; Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 2212, "Particle 1 - PDG code"}; - Configurable ConfCutPartOne{"ConfCutPartOne", 3191978, "Particle 1 - Selection bit from cutCulator"}; - Configurable ConfPIDPartOne{"ConfPIDPartOne", 0, "Particle 1 - Index in ConfTrkPIDspecies of producer task"}; - Configurable ConfPIDValuePartOne{"ConfPIDValuePartOne", 3, "Particle 1 - Read from cutCulator"}; + Configurable ConfCutPartOne{"ConfCutPartOne", 3191978, "Particle 1 - Selection bit"}; + Configurable ConfPIDTPCPartOne{"ConfPIDTPCPartOne", 2, "Particle 1 - TPC PID Selection bit"}; + Configurable ConfPIDTPCTOFPartOne{"ConfPIDTPCTOFPartOne", 4, "Particle 1 - TPCTOF PID Selection bit"}; + Configurable ConfPIDThresholdPartOne{"ConfPIDThresholdPartOne", 0.75, "Particle 1 - Momentum threshold for TPC to TPCTOF PID"}; Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 2212, "Particle 2 - PDG code"}; Configurable ConfCutPartTwo{"ConfCutPartTwo", 3191978, "Particle 2 - Selection bit"}; - Configurable ConfPIDPartTwo{"ConfPIDPartTwo", 0, "Particle 2 - Index in ConfTrkPIDspecies of producer task"}; - Configurable ConfPIDValuePartTwo{"ConfPIDValuePartTwo", 3, "Particle 1 - Read from cutCulator"}; - - Configurable ConfPIDThreshold{"ConfPIDThreshold", 0.75, "Momentum threshold for TPC to TPCTOF PID"}; - Configurable ConfNspecies{"ConfNspecies", 2, "Number of particle spieces with PID info"}; - Configurable> ConfTrkPIDnSigmaMax{"ConfTrkPIDnSigmaMax", std::vector{3.f, 3.5f, 2.5f}, "This configurable needs to be the same as the one used in the producer task"}; + Configurable ConfPIDTPCPartTwo{"ConfPIDTPCPartTwo", 0, "Particle 2 - TPC PID Selection bit"}; + Configurable ConfPIDTPCTOFPartTwo{"ConfPIDTPCTOFPartTwo", 0, "Particle 2 - TPCTOF PID Selection bit"}; + Configurable ConfPIDThresholdPartTwo{"ConfPIDThresholdPartTwo", 0.75, "Particle 2 - Momentum threshold for TPC to TPCTOF PID"}; /// Partitions for particle 1 and particle 2 Partition PartsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne); @@ -105,38 +103,18 @@ struct CFTutorialTask4 { /// QA for particle 1 for (auto& part : GroupPartsOne) { - /// check PID of particle 1 using function from FemtoUtils using PID bit - if (isFullPIDSelected(part.pidcut(), - part.p(), - ConfPIDThreshold.value, - ConfPIDPartOne.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartOne.value, - ConfPIDValuePartOne.value)) { - HistRegistry.fill(HIST("Particle1/hPt"), part.pt()); - HistRegistry.fill(HIST("Particle1/hEta"), part.eta()); - HistRegistry.fill(HIST("Particle1/hPhi"), part.phi()); - } + HistRegistry.fill(HIST("Particle1/hPt"), part.pt()); + HistRegistry.fill(HIST("Particle1/hEta"), part.eta()); + HistRegistry.fill(HIST("Particle1/hPhi"), part.phi()); } /// QA for particle 2 /// skip QA if particle 1 & 2 are the same if (ConfIsSame.value == false) { for (auto& part : GroupPartsTwo) { - /// check PID of particle 1 using function from FemtoUtils using PID bit - if (isFullPIDSelected(part.pidcut(), - part.p(), - ConfPIDThreshold.value, - ConfPIDPartTwo.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartTwo.value, - ConfPIDValuePartTwo.value)) { - HistRegistry.fill(HIST("Particle2/hPt"), part.pt()); - HistRegistry.fill(HIST("Particle2/hEta"), part.eta()); - HistRegistry.fill(HIST("Particle2/hPhi"), part.phi()); - } + HistRegistry.fill(HIST("Particle2/hPt"), part.pt()); + HistRegistry.fill(HIST("Particle2/hEta"), part.eta()); + HistRegistry.fill(HIST("Particle2/hPhi"), part.phi()); } } diff --git a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask5.cxx b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask5.cxx index f7c0c4a815a..d9159c2e3cc 100644 --- a/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask5.cxx +++ b/Tutorials/PWGCF/FemtoFramework/src/CFTutorialTask5.cxx @@ -51,22 +51,21 @@ struct CFTutorialTask5 { Configurable ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"}; Configurable ConfPDGCodePartOne{"ConfPDGCodePartOne", 2212, "Particle 1 - PDG code"}; - Configurable ConfCutPartOne{"ConfCutPartOne", 3191978, "Particle 1 - Selection bit from cutCulator"}; - Configurable ConfPIDPartOne{"ConfPIDPartOne", 0, "Particle 1 - Index in ConfTrkPIDspecies of producer task"}; - Configurable ConfPIDValuePartOne{"ConfPIDValuePartOne", 3, "Particle 1 - Read from cutCulator"}; + Configurable ConfCutPartOne{"ConfCutPartOne", 3191978, "Particle 1 - Selection bit"}; + Configurable ConfPIDTPCPartOne{"ConfPIDTPCPartOne", 2, "Particle 1 - TPC PID Selection bit"}; + Configurable ConfPIDTPCTOFPartOne{"ConfPIDTPCTOFPartOne", 4, "Particle 1 - TPCTOF PID Selection bit"}; + Configurable ConfPIDThresholdPartOne{"ConfPIDThresholdPartOne", 0.75, "Particle 1 - Momentum threshold for TPC to TPCTOF PID"}; Configurable ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 2212, "Particle 2 - PDG code"}; Configurable ConfCutPartTwo{"ConfCutPartTwo", 3191978, "Particle 2 - Selection bit"}; - Configurable ConfPIDPartTwo{"ConfPIDPartTwo", 0, "Particle 2 - Index in ConfTrkPIDspecies of producer task"}; - Configurable ConfPIDValuePartTwo{"ConfPIDValuePartTwo", 3, "Particle 1 - Read from cutCulator"}; - - Configurable ConfPIDThreshold{"ConfPIDThreshold", 0.75, "Momentum threshold for TPC to TPCTOF PID"}; - Configurable ConfNspecies{"ConfNspecies", 2, "Number of particle spieces with PID info"}; - Configurable> ConfTrkPIDnSigmaMax{"ConfTrkPIDnSigmaMax", std::vector{3.f, 3.5f, 2.5f}, "This configurable needs to be the same as the one used in the producer task"}; + Configurable ConfPIDTPCPartTwo{"ConfPIDTPCPartTwo", 0, "Particle 2 - TPC PID Selection bit"}; + Configurable ConfPIDTPCTOFPartTwo{"ConfPIDTPCTOFPartTwo", 0, "Particle 2 - TPCTOF PID Selection bit"}; + Configurable ConfPIDThresholdPartTwo{"ConfPIDThresholdPartTwo", 0.75, "Particle 2 - Momentum threshold for TPC to TPCTOF PID"}; /// Partitions for particle 1 and particle 2 - Partition PartsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne); - Partition PartsTwo = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartTwo) == ConfCutPartTwo); + Partition PartsOne = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartOne) == ConfCutPartOne) && ifnode(aod::femtodreamparticle::pt < ConfPIDThresholdPartOne, ncheckbit(aod::femtodreamparticle::pidcut, ConfPIDTPCPartOne), ncheckbit(aod::femtodreamparticle::pidcut, ConfPIDTPCTOFPartOne)); + + Partition PartsTwo = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kTrack)) && ((aod::femtodreamparticle::cut & ConfCutPartTwo) == ConfCutPartTwo) && ifnode(aod::femtodreamparticle::pt < ConfPIDThresholdPartTwo, ncheckbit(aod::femtodreamparticle::pidcut, ConfPIDTPCPartTwo), ncheckbit(aod::femtodreamparticle::pidcut, ConfPIDTPCTOFPartTwo)); HistogramRegistry HistRegistry{"FemtoTutorial", {}, OutputObjHandlingPolicy::AnalysisObject}; @@ -104,7 +103,6 @@ struct CFTutorialTask5 { // process same event void process(FilteredFDCollision const& col, FilteredFDParts const& /*parts*/) { - /// event QA HistRegistry.fill(HIST("Event/hZvtx"), col.posZ()); @@ -114,94 +112,36 @@ struct CFTutorialTask5 { /// QA for particle 1 for (auto& part : GroupPartsOne) { - /// check PID of particle 1 using function from FemtoUtils using PID bit - if (isFullPIDSelected(part.pidcut(), - part.p(), - ConfPIDThreshold.value, - ConfPIDPartOne.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartOne.value, - ConfPIDValuePartOne.value)) { - HistRegistry.fill(HIST("Particle1/hPt"), part.pt()); - HistRegistry.fill(HIST("Particle1/hEta"), part.eta()); - HistRegistry.fill(HIST("Particle1/hPhi"), part.phi()); - } + HistRegistry.fill(HIST("Particle1/hPt"), part.pt()); + HistRegistry.fill(HIST("Particle1/hEta"), part.eta()); + HistRegistry.fill(HIST("Particle1/hPhi"), part.phi()); } /// QA for particle 2 /// skip QA if particle 1 & 2 are the same if (ConfIsSame.value == false) { for (auto& part : GroupPartsTwo) { - /// check PID of particle 1 using function from FemtoUtils using PID bit - if (isFullPIDSelected(part.pidcut(), - part.p(), - ConfPIDThreshold.value, - ConfPIDPartTwo.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartTwo.value, - ConfPIDValuePartTwo.value)) { - HistRegistry.fill(HIST("Particle2/hPt"), part.pt()); - HistRegistry.fill(HIST("Particle2/hEta"), part.eta()); - HistRegistry.fill(HIST("Particle2/hPhi"), part.phi()); - } + HistRegistry.fill(HIST("Particle2/hPt"), part.pt()); + HistRegistry.fill(HIST("Particle2/hEta"), part.eta()); + HistRegistry.fill(HIST("Particle2/hPhi"), part.phi()); } } float kstar = 0.; - float m0 = TDatabasePDG::Instance()->GetParticle(ConfPDGCodePartOne.value)->Mass(); - float m1 = TDatabasePDG::Instance()->GetParticle(ConfPDGCodePartTwo.value)->Mass(); + float m0 = o2::analysis::femtoDream::getMass(ConfPDGCodePartOne); + float m1 = o2::analysis::femtoDream::getMass(ConfPDGCodePartTwo); /// particle combinations /// if particles are the same or not determines the combination stratety if (ConfIsSame) { for (auto& [p0, p1] : combinations(soa::CombinationsStrictlyUpperIndexPolicy(GroupPartsOne, GroupPartsTwo))) { - if (isFullPIDSelected(p0.pidcut(), - p0.p(), - ConfPIDThreshold.value, - ConfPIDPartOne.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartOne.value, - ConfPIDValuePartOne.value) && - isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - ConfPIDPartOne.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartOne.value, - ConfPIDValuePartOne.value) - - ) { - kstar = FemtoDreamMath::getkstar(p0, m0, p1, m1); - HistRegistry.fill(HIST("Pair/hSE"), kstar); - } + kstar = FemtoDreamMath::getkstar(p0, m0, p1, m1); + HistRegistry.fill(HIST("Pair/hSE"), kstar); } } else { for (auto& [p0, p1] : combinations(soa::CombinationsFullIndexPolicy(GroupPartsOne, GroupPartsTwo))) { - if (isFullPIDSelected(p0.pidcut(), - p0.p(), - ConfPIDThreshold.value, - ConfPIDPartOne.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartOne.value, - ConfPIDValuePartOne.value) && - isFullPIDSelected(p1.pidcut(), - p1.p(), - ConfPIDThreshold.value, - ConfPIDPartOne.value, - ConfNspecies.value, - ConfTrkPIDnSigmaMax.value, - ConfPIDValuePartOne.value, - ConfPIDValuePartOne.value) - - ) { - kstar = FemtoDreamMath::getkstar(p0, m0, p1, m1); - HistRegistry.fill(HIST("Pair/hSE"), kstar); - } + kstar = FemtoDreamMath::getkstar(p0, m0, p1, m1); + HistRegistry.fill(HIST("Pair/hSE"), kstar); } } } diff --git a/Tutorials/PWGHF/DataModelMini.h b/Tutorials/PWGHF/DataModelMini.h index 40a430a4813..7a03f1462b7 100644 --- a/Tutorials/PWGHF/DataModelMini.h +++ b/Tutorials/PWGHF/DataModelMini.h @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file task-mini.cxx +/// \file DataModelMini.h /// \brief Mini version of the HF analysis chain /// /// \author Vít Kučera , Inha University @@ -28,7 +28,7 @@ DECLARE_SOA_COLUMN(IsSelProng, isSelProng, bool); //! prong selection flag } // namespace hf_seltrack // Track selection table -DECLARE_SOA_TABLE(HfSelTrack, "AOD", "HFSELTRACK", //! track selection table +DECLARE_SOA_TABLE(HfTSelTrack, "AOD", "HFTSELTRACK", //! track selection table hf_seltrack::IsSelProng); namespace hf_track_index @@ -39,7 +39,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, Tracks, "_1"); //! prong 1 } // namespace hf_track_index // Track index skim table -DECLARE_SOA_TABLE(HfTrackIndexProng2, "AOD", "HFTRACKIDXP2", //! table with prongs indices +DECLARE_SOA_TABLE(HfT2Prongs, "AOD", "HFT2PRONG", //! table with prongs indices hf_track_index::Prong0Id, hf_track_index::Prong1Id); @@ -79,12 +79,12 @@ DECLARE_SOA_EXPRESSION_COLUMN(Pz, pz, //! pz of candidate float, 1.f * pzProng0 + 1.f * pzProng1); DECLARE_SOA_DYNAMIC_COLUMN(M, m, //! invariant mass of candidate [](float px0, float py0, float pz0, float px1, float py1, float pz1, const std::array& m) -> float { return RecoDecay::m(std::array{std::array{px0, py0, pz0}, std::array{px1, py1, pz1}}, m); }); -DECLARE_SOA_DYNAMIC_COLUMN(CPA, cpa, //! cosine of pointing angle of candidate +DECLARE_SOA_DYNAMIC_COLUMN(Cpa, cpa, //! cosine of pointing angle of candidate [](float xVtxP, float yVtxP, float zVtxP, float xVtxS, float yVtxS, float zVtxS, float px, float py, float pz) -> float { return RecoDecay::cpa(std::array{xVtxP, yVtxP, zVtxP}, std::array{xVtxS, yVtxS, zVtxS}, std::array{px, py, pz}); }); } // namespace hf_cand_prong2 // Candidate table -DECLARE_SOA_TABLE(HfCandProng2Base, "AOD", "HFCANDP2BASE", //! 2-prong candidate table +DECLARE_SOA_TABLE(HfTCand2ProngBase, "AOD", "HFTCAND2PBASE", //! 2-prong candidate table hf_cand_prong2::CollisionId, collision::PosX, collision::PosY, collision::PosZ, hf_cand_prong2::XSecondaryVertex, hf_cand_prong2::YSecondaryVertex, hf_cand_prong2::ZSecondaryVertex, @@ -98,14 +98,14 @@ DECLARE_SOA_TABLE(HfCandProng2Base, "AOD", "HFCANDP2BASE", //! 2-prong candidate /* dynamic columns */ hf_cand_prong2::M, /* dynamic columns that use candidate momentum components */ - hf_cand_prong2::CPA, + hf_cand_prong2::Cpa, hf_cand_prong2::Pt); // Extended table with expression columns that can be used as arguments of dynamic columns -DECLARE_SOA_EXTENDED_TABLE_USER(HfCandProng2Ext, HfCandProng2Base, "HFCANDP2EXT", //! extension table for the 2-prong candidate table +DECLARE_SOA_EXTENDED_TABLE_USER(HfTCand2ProngExt, HfTCand2ProngBase, "HFTCAND2PEXT", //! extension table for the 2-prong candidate table hf_cand_prong2::Px, hf_cand_prong2::Py, hf_cand_prong2::Pz); -using HfCandProng2 = HfCandProng2Ext; +using HfTCand2Prong = HfTCand2ProngExt; namespace hf_selcandidate_d0 { @@ -115,7 +115,7 @@ DECLARE_SOA_COLUMN(IsSelD0bar, isSelD0bar, int); //! selection flag for D0 bar } // namespace hf_selcandidate_d0 // Candidate selection table -DECLARE_SOA_TABLE(HfSelCandidateD0, "AOD", "HFSELCANDD0", //! table with D0 selection flags +DECLARE_SOA_TABLE(HfTSelD0, "AOD", "HFTSELD0", //! table with D0 selection flags hf_selcandidate_d0::IsSelD0, hf_selcandidate_d0::IsSelD0bar); } // namespace o2::aod diff --git a/Tutorials/PWGHF/dpl-config_skim.json b/Tutorials/PWGHF/dpl-config_skim.json index 07d172b2c9d..3d78778042e 100644 --- a/Tutorials/PWGHF/dpl-config_skim.json +++ b/Tutorials/PWGHF/dpl-config_skim.json @@ -1,25 +1,27 @@ { "internal-dpl-clock": "", "internal-dpl-aod-reader": { + "aod-file-private": "AO2D.root", + "aod-max-io-rate": "0", "time-limit": "0", "orbit-offset-enumeration": "0", "orbit-multiplier-enumeration": "0", "start-value-enumeration": "0", "end-value-enumeration": "-1", - "step-value-enumeration": "1", - "aod-file": "AO2D.root" + "step-value-enumeration": "1" }, "internal-dpl-aod-spawner": "", "bc-converter": "", "timestamp-task": { + "fatalOnInvalidTimestamp": "false", "verbose": "false", "rct-path": "RCT/Info/RunInformation", "orbit-reset-path": "CTP/Calib/OrbitReset", "ccdb-url": "http://alice-ccdb.cern.ch", - "isRun2MC": "false" + "isRun2MC": "-1" }, "tracks-extra-converter": "", - "zdc-converter": "", + "tracks-extra-spawner": "", "track-propagation": { "ccdb-url": "http://alice-ccdb.cern.ch", "lutPath": "GLO/Param/MatLUT", @@ -27,8 +29,75 @@ "grpmagPath": "GLO/Config/GRPMagField", "mVtxPath": "GLO/Calib/MeanVertex", "minPropagationDistance": "83.0999985", + "useTrackTuner": "false", + "fillTrackTunerTable": "false", + "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.", + "axisPtQA": { + "values": [ + "0", + "0", + "0.1", + "0.2", + "0.3", + "0.4", + "0.5", + "0.6", + "0.7", + "0.8", + "0.9", + "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.2", + "3.4", + "3.6", + "3.8", + "4", + "4.4", + "4.8", + "5.2", + "5.6", + "6", + "6.5", + "7", + "7.5", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "17", + "19", + "21", + "23", + "25", + "30", + "35", + "40", + "50" + ] + }, "processStandard": "false", - "processCovariance": "true" + "processStandardWithPID": "false", + "processCovarianceMc": "false", + "processCovariance": "true", + "processCovarianceWithPID": "false" }, "track-selection": { "isRun3": "true", @@ -42,12 +111,12 @@ "etaMin": "-0.8", "etaMax": "0.8" }, - "hf-track-index-skim-creator-tag-sel-tracks": { + "hf-skim-creator-mini-tag-sel-tracks": { "ptTrackMin": "0.3", "etaTrackMax": "0.8", "dcaTrackMin": "0.0025" }, - "hf-track-index-skim-creator": { + "hf-skim-creator-mini": { "magneticField": "5", "propagateToPCA": "true", "useAbsDCA": "false", diff --git a/Tutorials/PWGHF/dpl-config_task.json b/Tutorials/PWGHF/dpl-config_task.json index 719c8acd000..6418d9b7fc0 100644 --- a/Tutorials/PWGHF/dpl-config_task.json +++ b/Tutorials/PWGHF/dpl-config_task.json @@ -1,13 +1,14 @@ { "internal-dpl-clock": "", "internal-dpl-aod-reader": { + "aod-file-private": "AnalysisResults_trees.root", + "aod-max-io-rate": "0", "time-limit": "0", "orbit-offset-enumeration": "0", "orbit-multiplier-enumeration": "0", "start-value-enumeration": "0", "end-value-enumeration": "-1", "step-value-enumeration": "1", - "aod-file": "AnalysisResults_trees.root", "aod-parent-access-level": "1", "aod-parent-base-path-replacement": "old-path-to-parent;new-path-to-parent" }, @@ -15,38 +16,147 @@ "bc-converter": "", "internal-dpl-aod-index-builder": "", "timestamp-task": { + "fatalOnInvalidTimestamp": "false", "verbose": "false", "rct-path": "RCT/Info/RunInformation", "orbit-reset-path": "CTP/Calib/OrbitReset", "ccdb-url": "http://alice-ccdb.cern.ch", - "isRun2MC": "false" + "isRun2MC": "-1" }, "tracks-extra-converter": "", - "zdc-converter": "", + "bc-selection-task": { + "triggerBcShift": "0", + "ITSROFrameStartBorderMargin": "-1", + "ITSROFrameEndBorderMargin": "-1", + "TimeFrameStartBorderMargin": "-1", + "TimeFrameEndBorderMargin": "-1", + "checkRunDurationLimits": "false", + "processRun2": "false", + "processRun3": "true" + }, + "tracks-extra-spawner": "", "track-propagation": { "ccdb-url": "http://alice-ccdb.cern.ch", "lutPath": "GLO/Param/MatLUT", "geoPath": "GLO/Config/GeometryAligned", "grpmagPath": "GLO/Config/GRPMagField", "mVtxPath": "GLO/Calib/MeanVertex", - "minPropagationDistance": "83.0999985", + "minPropagationDistance": "5", + "useTrackTuner": "true", + "fillTrackTunerTable": "false", + "trackTunerParams": "debugInfo=0|updateTrackDCAs=1|updateTrackCovMat=1|updateCurvature=0|updateCurvatureIU=1|updatePulls=1|isInputFileFromCCDB=1|pathInputFile=Users/m/mfaggin/test/inputsTrackTuner/pp2023/smoothHighPtMC|nameInputFile=trackTuner_DataLHC23fPass1_McLHC23k4b_run535085.root|pathFileQoverPt=Users/h/hsharma/qOverPtGraphs|nameFileQoverPt=D0sigma_Data_removal_itstps_MC_LHC22b1b.root|usePvRefitCorrections=0|qOverPtMC=1|qOverPtData=2", + "axisPtQA": { + "values": [ + "0", + "0", + "0.1", + "0.2", + "0.3", + "0.4", + "0.5", + "0.6", + "0.7", + "0.8", + "0.9", + "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.2", + "3.4", + "3.6", + "3.8", + "4", + "4.4", + "4.8", + "5.2", + "5.6", + "6", + "6.5", + "7", + "7.5", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "15", + "17", + "19", + "21", + "23", + "25", + "30", + "35", + "40", + "50" + ] + }, "processStandard": "false", - "processCovariance": "true" + "processStandardWithPID": "false", + "processCovarianceMc": "false", + "processCovariance": "true", + "processCovarianceWithPID": "false" }, - "bc-selection-task": { - "triggerBcShift": "999", - "processRun2": "false", - "processRun3": "true" + "tof-signal": { + "ccdb-url": "http://alice-ccdb.cern.ch", + "ccdb-timestamp": "-1", + "timeShiftCCDBPath": "", + "distanceForGoodMatch": "999", + "distanceForGoodMatchLowMult": "999", + "multThreshold": "0", + "enableQaHistograms": "false", + "processRun3": "true", + "processRun2": "false" }, "event-selection-task": { - "syst": "pp", "muonSelection": "0", - "customDeltaBC": "300", - "isMC": "false", + "maxDiffZvtxFT0vsPV": "1", + "isMC": "0", + "TimeIntervalForOccupancyCalculationMin": "-40", + "TimeIntervalForOccupancyCalculationMax": "100", + "TimeBinsForOccupancyCalculation": { + "values": [ + "-40", + "-20", + "0", + "25", + "50", + "75", + "100" + ] + }, + "ReferenceOccupanciesInTimeBins": { + "values": [ + "3000", + "1400", + "750", + "1000", + "1750", + "4000" + ] + }, + "TimeRangeVetoOnCollStandard": "10", + "TimeRangeVetoOnCollNarrow": "4", + "UseWeightsForOccupancyEstimator": "true", "processRun2": "false", "processRun3": "true" }, - "hf-candidate-creator2-prong": { + "hf-task-mini-candidate-creator-2prong": { "magneticField": "5", "propagateToPCA": "true", "useAbsDCA": "false", @@ -56,14 +166,10 @@ "minRelChi2Change": "0.9" }, "pid-multiplicity": { - "processIU": "false", - "processStandard": "true" + "processIU": "true", + "processStandard": "false" }, - "tof-signal": { - "processRun3": "true", - "processRun2": "false" - }, - "tpc-pid-full": { + "tpc-pid": { "param-file": "", "ccdb-url": "http://alice-ccdb.cern.ch", "ccdbPath": "Analysis/PID/TPC/Response", @@ -71,47 +177,155 @@ "ccdb-timestamp": "0", "useNetworkCorrection": "false", "autofetchNetworks": "true", - "skipTPCOnly": "false", + "skipTPCOnly": "true", "networkPathLocally": "network.onnx", "networkPathCCDB": "Analysis/PID/TPC/ML", "enableNetworkOptimizations": "true", "networkSetNumThreads": "0", - "pid-el": "-1", - "pid-mu": "-1", - "pid-pi": "-1", - "pid-ka": "-1", - "pid-pr": "-1", - "pid-de": "-1", - "pid-tr": "-1", - "pid-he": "-1", - "pid-al": "-1" + "pid-full-el": "-1", + "pid-full-mu": "-1", + "pid-full-pi": "-1", + "pid-full-ka": "-1", + "pid-full-pr": "-1", + "pid-full-de": "-1", + "pid-full-tr": "-1", + "pid-full-he": "-1", + "pid-full-al": "-1", + "pid-tiny-el": "-1", + "pid-tiny-mu": "-1", + "pid-tiny-pi": "-1", + "pid-tiny-ka": "-1", + "pid-tiny-pr": "-1", + "pid-tiny-de": "-1", + "pid-tiny-tr": "-1", + "pid-tiny-he": "-1", + "pid-tiny-al": "-1", + "enableTuneOnDataTable": "-1", + "useNetworkEl": "1", + "useNetworkMu": "1", + "useNetworkPi": "1", + "useNetworkKa": "1", + "useNetworkPr": "1", + "useNetworkDe": "1", + "useNetworkTr": "1", + "useNetworkHe": "1", + "useNetworkAl": "1", + "networkBetaGammaCutoff": "0.45", + "processStandard": "true", + "processMcTuneOnData": "false" }, + "multiplicity-table": { + "doVertexZeq": "1", + "fractionOfEvents": "2", + "enabledTables": { + "labels_rows": [ + "FV0Mults", + "FT0Mults", + "FDDMults", + "ZDCMults", + "TrackletMults", + "TPCMults", + "PVMults", + "MultsExtra", + "MultSelections", + "FV0MultZeqs", + "FT0MultZeqs", + "FDDMultZeqs", + "PVMultZeqs", + "MultMCExtras" + ], + "labels_cols": [ + "Enable" + ], + "values": [ + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ], + [ + "-1" + ] + ] + }, + "ccdburl": "http://alice-ccdb.cern.ch", + "ccdbpath": "Centrality/Calibration", + "reconstructionPass": "", + "produceHistograms": "false", + "min_pt_globaltrack": "0.15", + "max_pt_globaltrack": "1e+10", + "min_ncluster_its_globaltrack": "5", + "min_ncluster_itsib_globaltrack": "1", + "processRun2": "false", + "processRun3": "true", + "processGlobalTrackingCounters": "false", + "processMC": "false", + "processMC2Mults": "false" + }, + "ft0-corrected-table": "", + "hf-task-mini-candidate-creator-2prong-expressions": "", "tof-event-time": { + "inheritFromBaseTask": "true", + "ccdb-url": "", + "ccdb-timestamp": "-1", "minMomentum": "0.5", "maxMomentum": "2", "maxEvTimeTOF": "100000", + "sel8TOFEvTime": "false", + "maxNtracksInSet": "10", "paramFileName": "", - "ccdb-url": "http://alice-ccdb.cern.ch", "parametrizationPath": "TOF/Calib/Params", "passName": "", - "ccdb-timestamp": "-1", "loadResponseFromCCDB": "false", + "enableTimeDependentResponse": "false", "fatalOnPassNotAvailable": "true", - "sel8TOFEvTime": "false", - "maxNtracksInSet": "10", "processRun2": "false", - "processNoFT0": "true", - "processFT0": "false", + "processNoFT0": "false", + "processFT0": "true", "processOnlyFT0": "false" }, - "hf-candidate-creator2-prong-expressions": "", "tof-pid-full": { + "inheritFromBaseTask": "true", + "ccdb-url": "", + "ccdb-timestamp": "-1", "paramFileName": "", - "ccdb-url": "http://alice-ccdb.cern.ch", - "parametrizationPath": "TOF/Calib/Params", - "timeShiftCCDBPath": "", + "parametrizationPath": "", "passName": "", - "ccdb-timestamp": "-1", + "timeShiftCCDBPath": "", "loadResponseFromCCDB": "false", "enableTimeDependentResponse": "false", "fatalOnPassNotAvailable": "true", @@ -163,7 +377,7 @@ "processWSlice": "true", "processWoSlice": "false" }, - "hf-candidate-selector-d0": { + "hf-task-mini-candidate-selector-d0": { "ptCandMin": "0", "ptCandMax": "50", "ptPidTpcMin": "0.15", @@ -172,7 +386,7 @@ "cpaMin": "0.98", "massWindow": "0.4" }, - "hf-task-d0": { + "hf-task-mini-d0": { "selectionFlagD0": "1", "selectionFlagD0bar": "1" }, diff --git a/Tutorials/PWGHF/run_skim.sh b/Tutorials/PWGHF/run_skim.sh index 788a2ffd460..fbd33e2b443 100644 --- a/Tutorials/PWGHF/run_skim.sh +++ b/Tutorials/PWGHF/run_skim.sh @@ -28,7 +28,7 @@ DIR_THIS="$(dirname "$(realpath "$0")")" JSON="$DIR_THIS/dpl-config_skim.json" # command line options of O2 workflows -OPTIONS="-b --configuration json://$JSON --aod-memory-rate-limit 2000000000 --shm-segment-size 16000000000 --resources-monitoring 2 --min-failure-level error --aod-writer-keep AOD/HFTRACKIDXP2/0" +OPTIONS="-b --configuration json://$JSON --aod-memory-rate-limit 2000000000 --shm-segment-size 16000000000 --resources-monitoring 2 --aod-writer-keep AOD/HFT2PRONG/0" # execute the mini task workflow and its dependencies # shellcheck disable=SC2086 # Ignore unquoted options. @@ -37,8 +37,7 @@ o2-analysis-timestamp $OPTIONS | \ o2-analysis-trackselection $OPTIONS | \ o2-analysis-track-propagation $OPTIONS | \ o2-analysis-bc-converter $OPTIONS | \ -o2-analysis-tracks-extra-converter $OPTIONS | \ -o2-analysis-zdc-converter $OPTIONS \ +o2-analysis-tracks-extra-converter $OPTIONS \ > "$LOGFILE" 2>&1 # report status diff --git a/Tutorials/PWGHF/run_task.sh b/Tutorials/PWGHF/run_task.sh index 096ee292150..73c1c014930 100644 --- a/Tutorials/PWGHF/run_task.sh +++ b/Tutorials/PWGHF/run_task.sh @@ -28,7 +28,7 @@ DIR_THIS="$(dirname "$(realpath "$0")")" JSON="$DIR_THIS/dpl-config_task.json" # command line options of O2 workflows -OPTIONS="-b --configuration json://$JSON --aod-memory-rate-limit 2000000000 --shm-segment-size 16000000000 --resources-monitoring 2 --min-failure-level error" +OPTIONS="-b --configuration json://$JSON --aod-memory-rate-limit 2000000000 --shm-segment-size 16000000000 --resources-monitoring 2" # execute the mini task workflow and its dependencies # shellcheck disable=SC2086 # Ignore unquoted options. @@ -37,9 +37,10 @@ o2-analysis-timestamp $OPTIONS | \ o2-analysis-track-propagation $OPTIONS | \ o2-analysis-event-selection $OPTIONS | \ o2-analysis-pid-tpc-base $OPTIONS | \ -o2-analysis-pid-tpc-full $OPTIONS | \ +o2-analysis-pid-tpc $OPTIONS | \ o2-analysis-pid-tof-base $OPTIONS | \ o2-analysis-pid-tof-full $OPTIONS | \ +o2-analysis-ft0-corrected-table $OPTIONS | \ o2-analysis-bc-converter $OPTIONS | \ o2-analysis-tracks-extra-converter $OPTIONS | \ o2-analysis-zdc-converter $OPTIONS \ diff --git a/Tutorials/PWGHF/skimCreatorMini.cxx b/Tutorials/PWGHF/skimCreatorMini.cxx index 6f20d6ac6fb..ac6b12e2004 100644 --- a/Tutorials/PWGHF/skimCreatorMini.cxx +++ b/Tutorials/PWGHF/skimCreatorMini.cxx @@ -38,13 +38,13 @@ using namespace o2::framework::expressions; // Track selection ===================================================================== /// Track selection -struct HfTrackIndexSkimCreatorTagSelTracks { - Produces rowSelectedTrack; +struct HfSkimCreatorMiniTagSelTracks { + Produces rowSelectedTrack; // 2-prong cuts - Configurable ptTrackMin{"ptTrackMin", 0.3, "min. track pT for 2 prong candidate"}; - Configurable etaTrackMax{"etaTrackMax", 0.8, "max. pseudorapidity for 2 prong candidate"}; - Configurable dcaTrackMin{"dcaTrackMin", 0.0025, "min. DCA for 2 prong candidate"}; + Configurable ptTrackMin{"ptTrackMin", 0.3, "min. track pT for 2 prong candidate"}; + Configurable etaTrackMax{"etaTrackMax", 0.8, "max. pseudorapidity for 2 prong candidate"}; + Configurable dcaTrackMin{"dcaTrackMin", 0.0025, "min. DCA for 2 prong candidate"}; using TracksWDcaSel = soa::Join; @@ -110,21 +110,21 @@ struct HfTrackIndexSkimCreatorTagSelTracks { /// Track index skim creator /// Pre-selection of 2-prong secondary vertices -struct HfTrackIndexSkimCreator { - Produces rowTrackIndexProng2; +struct HfSkimCreatorMini { + Produces rowTrackIndexProng2; // vertexing parameters - Configurable magneticField{"magneticField", 5., "magnetic field [kG]"}; + Configurable magneticField{"magneticField", 5., "magnetic field [kG]"}; Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; Configurable useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"}; - Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; - Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; - Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"}; - Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations if chi2/chi2old > this"}; + Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; + Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; + Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"}; + Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations if chi2/chi2old > this"}; o2::vertexing::DCAFitterN<2> fitter; // 2-prong vertex fitter - using SelectedTracks = soa::Filtered>; + using SelectedTracks = soa::Filtered>; Filter filterSelectTracks = aod::hf_seltrack::isSelProng == true; @@ -166,7 +166,12 @@ struct HfTrackIndexSkimCreator { auto trackParVarNeg1 = getTrackParCov(trackNeg1); // secondary vertex reconstruction and further 2-prong selections - if (fitter.process(trackParVarPos1, trackParVarNeg1) == 0) { + int nVtxFromFitter = 0; + try { + nVtxFromFitter = fitter.process(trackParVarPos1, trackParVarNeg1); + } catch (...) { + } + if (nVtxFromFitter == 0) { continue; } // get secondary vertex @@ -197,6 +202,6 @@ struct HfTrackIndexSkimCreator { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; } diff --git a/Tutorials/PWGHF/taskMini.cxx b/Tutorials/PWGHF/taskMini.cxx index 800153a4fb9..871fe710581 100644 --- a/Tutorials/PWGHF/taskMini.cxx +++ b/Tutorials/PWGHF/taskMini.cxx @@ -41,17 +41,17 @@ using namespace o2::framework::expressions; /// Candidate creator /// Reconstruction of heavy-flavour 2-prong decay candidates -struct HfCandidateCreator2Prong { - Produces rowCandidateBase; +struct HfTaskMiniCandidateCreator2Prong { + Produces rowCandidateBase; // vertexing parameters - Configurable magneticField{"magneticField", 5., "magnetic field [kG]"}; + Configurable magneticField{"magneticField", 5., "magnetic field [kG]"}; Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; Configurable useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"}; - Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; - Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; - Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"}; - Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations if chi2/chi2old > this"}; + Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; + Configurable maxDZIni{"maxDZIni", 4., "reject (if>0) PCA candidate if tracks DZ exceeds threshold"}; + Configurable minParamChange{"minParamChange", 1.e-3, "stop iterations if largest change of any X is smaller than this"}; + Configurable minRelChi2Change{"minRelChi2Change", 0.9, "stop iterations if chi2/chi2old > this"}; o2::vertexing::DCAFitterN<2> fitter; // 2-prong vertex fitter double massPiK{0.}; @@ -74,7 +74,7 @@ struct HfCandidateCreator2Prong { } void process(aod::Collisions const&, - aod::HfTrackIndexProng2 const& rowsTrackIndexProng2, + aod::HfT2Prongs const& rowsTrackIndexProng2, TracksWithCov const&) { // loop over pairs of track indices @@ -119,27 +119,27 @@ struct HfCandidateCreator2Prong { }; /// Helper extension task -/// Extends the base table with expression columns (see the HfCandProng2Ext table). -struct HfCandidateCreator2ProngExpressions { - Spawns rowCandidateProng2; +/// Extends the base table with expression columns (see the HfTCand2ProngExt table). +struct HfTaskMiniCandidateCreator2ProngExpressions { + Spawns rowCandidateProng2; void init(InitContext const&) {} }; // Candidate selection ===================================================================== /// D0 candidate selector -struct HfCandidateSelectorD0 { - Produces hfSelD0Candidate; +struct HfTaskMiniCandidateSelectorD0 { + Produces hfSelD0Candidate; - 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"}; // TPC - Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; - Configurable ptPidTpcMax{"ptPidTpcMax", 5., "Upper bound of track pT for TPC PID"}; - Configurable nSigmaTpc{"nSigmaTpc", 3., "Nsigma cut on TPC only"}; + Configurable ptPidTpcMin{"ptPidTpcMin", 0.15, "Lower bound of track pT for TPC PID"}; + Configurable ptPidTpcMax{"ptPidTpcMax", 5., "Upper bound of track pT for TPC PID"}; + Configurable nSigmaTpc{"nSigmaTpc", 3., "Nsigma cut on TPC only"}; // topological cuts - Configurable cpaMin{"cpaMin", 0.98, "Min. cosine of pointing angle"}; - Configurable massWindow{"massWindow", 0.4, "Half-width of the invariant-mass window"}; + Configurable cpaMin{"cpaMin", 0.98, "Min. cosine of pointing angle"}; + Configurable massWindow{"massWindow", 0.4, "Half-width of the invariant-mass window"}; HfHelper hfHelper; TrackSelectorPi selectorPion; @@ -195,7 +195,7 @@ struct HfCandidateSelectorD0 { return true; } - void process(aod::HfCandProng2 const& candidates, + void process(aod::HfTCand2Prong const& candidates, TracksWithPid const&) { // looping over 2-prong candidates @@ -273,13 +273,13 @@ struct HfCandidateSelectorD0 { // Analysis task ===================================================================== /// D0 analysis task -struct HfTaskD0 { +struct HfTaskMiniD0 { Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection flag for D0"}; Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection flag for D0 bar"}; HfHelper hfHelper; - Partition> selectedD0Candidates = aod::hf_selcandidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= selectionFlagD0bar; + Partition> selectedD0Candidates = aod::hf_selcandidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= selectionFlagD0bar; HistogramRegistry registry{ "registry", @@ -295,7 +295,7 @@ struct HfTaskD0 { registry.add("hCpaVsPtCand", strTitle + ";" + "cosine of pointing angle" + ";" + strPt + ";" + strEntries, {HistType::kTH2F, {{110, -1.1, 1.1}, {100, 0., 10.}}}); } - void process(soa::Join const& /*candidates*/) + void process(soa::Join const& /*candidates*/) { for (const auto& candidate : selectedD0Candidates) { if (candidate.isSelD0() >= selectionFlagD0) { @@ -314,8 +314,8 @@ struct HfTaskD0 { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc), - adaptAnalysisTask(cfgc)}; + adaptAnalysisTask(cfgc, TaskName{"hf-task-mini-candidate-creator-2prong"}), // o2-linter: disable=name/o2-task + adaptAnalysisTask(cfgc, TaskName{"hf-task-mini-candidate-creator-2prong-expressions"}), // o2-linter: disable=name/o2-task + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; } diff --git a/Tutorials/PWGLF/Resonance/CMakeLists.txt b/Tutorials/PWGLF/Resonance/CMakeLists.txt index 36c4b84bf28..6adf9fb3247 100644 --- a/Tutorials/PWGLF/Resonance/CMakeLists.txt +++ b/Tutorials/PWGLF/Resonance/CMakeLists.txt @@ -24,3 +24,23 @@ o2physics_add_dpl_workflow(resonances-step2 SOURCES resonances_step2.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(resonances-step3 + SOURCES resonances_step3.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(resonances-step4 + SOURCES resonances_step4.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(resonances-step5 + SOURCES resonances_step5.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(resonances-step6 + SOURCES resonances_step6.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) diff --git a/Tutorials/PWGLF/Resonance/README.md b/Tutorials/PWGLF/Resonance/README.md index 7e1433bb8bb..19d51c0eced 100644 --- a/Tutorials/PWGLF/Resonance/README.md +++ b/Tutorials/PWGLF/Resonance/README.md @@ -1,6 +1,6 @@ # This is the base for the PWGLF tutorials for the O2AT -The tutorial (6-10 Nov 2023) can be still used and is a reference for the LF analyses. +The tutorial can be still used and is a reference for the LF Resonance analyses. It is built as a set of steps. Each step adds a level of complexity and is built in a separate executable. The executables are defined in the `CMakeLists.txt`. @@ -8,3 +8,9 @@ The executables are defined in the `CMakeLists.txt`. * `README.md` this readme * `CMakeLists.txt` here are defined the source files to compile * `resonance_step0.cxx` Read the resonance table and run basic track loop +* `resonance_step1.cxx` Producing same event invariant mass distribution +* `resonance_step2.cxx` Producing Mixed event invariant mass distribution +* `resonance_step3.cxx` Starting point for MC: loop over all Generated MC particles +* `resonance_step4.cxx` Producing histograms (pt distributions etc.) for Generated MCs +* `resonance_step5.cxx` Loop over all MC Tracks and produce basic QA histograms +* `resonance_step6.cxx` Resonance reconstruction diff --git a/Tutorials/PWGLF/Resonance/resonances_step3.cxx b/Tutorials/PWGLF/Resonance/resonances_step3.cxx new file mode 100644 index 00000000000..f2ef8dbbe67 --- /dev/null +++ b/Tutorials/PWGLF/Resonance/resonances_step3.cxx @@ -0,0 +1,77 @@ +// 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 starting point for the Resonances tutorial for MC part +/// \author Hirak Kumar Koley +/// \since 11/10/2024 + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/runDataProcessing.h" +#include "PWGLF/DataModel/LFResonanceTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 3 +// Starting point for MC: loop over all Generated MC particles +struct resonances_tutorial { + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Configurable for number of bins + Configurable nBins{"nBins", 100, "N bins in all histos"}; + // Configurable for min pT cut + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minimum pt cut"}; + + // Initialize the ananlysis task + void init(o2::framework::InitContext&) + { + // register histograms + histos.add("hVertexZ", "hVertexZ", HistType::kTH1F, {{nBins, -15., 15.}}); + histos.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); + } + + // MC particle selection + template + bool ptCut(const ParticleType resoParents) + { + // basic pt cuts + if (std::abs(resoParents.pt()) < cMinPtcut) + return false; + + return true; + } + + // Fill histograms (main function) + template + void fillHistograms(const CollisionType& /*collision*/, const ParticleType& resoParents) + { + for (auto part : resoParents) { // loop over all resoParents + if (!ptCut(part)) + continue; // pt selection + + // QA plots + histos.fill(HIST("hEta"), part.eta()); + } + } + + // Process the MC + void process(aod::ResoCollision& collision, aod::ResoMCParents& resoParents) + { + // Fill the event counter + histos.fill(HIST("hVertexZ"), collision.posZ()); + fillHistograms(collision, resoParents); // Fill histograms, MC + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/Tutorials/PWGLF/Resonance/resonances_step4.cxx b/Tutorials/PWGLF/Resonance/resonances_step4.cxx new file mode 100644 index 00000000000..05f7b35f7cf --- /dev/null +++ b/Tutorials/PWGLF/Resonance/resonances_step4.cxx @@ -0,0 +1,109 @@ +// 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 starting point for the Resonances tutorial for MC +/// \author Hirak Kumar Koley +/// \since 11/10/2024 + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/runDataProcessing.h" +#include "PWGLF/DataModel/LFResonanceTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 4 +// Producing histograms for Generated MCs +struct resonances_tutorial { + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Configurable for number of bins + Configurable nBins{"nBins", 100, "N bins in all histos"}; + // Configurable for min pT cut + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; + + /// 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 binsCent{"binsCent", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Binning of the centrality axis"}; + + // Initialize the ananlysis task + void init(o2::framework::InitContext&) + { + AxisSpec centAxis = {binsCent, "V0M (%)"}; + AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + + // register histograms + histos.add("hVertexZ", "hVertexZ", HistType::kTH1F, {{nBins, -15., 15.}}); + histos.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); + histos.add("hMultiplicityPercent", "Multiplicity Percentile", kTH1F, {{120, 0.0f, 120.0f}}); + + // MC QA + histos.add("hphipt", "pT distribution of True MC phi", kTH1F, {ptAxis}); + histos.add("phiGen", "pT distribution of True MC phi", kTH2F, {ptAxis, centAxis}); + + // Print output histograms statistics + LOG(info) << "Size of the histograms in resonance tutorial step1:"; + histos.print(); + } + + // MC particle selection + template + bool ptCut(const ParticleType resoParents) + { + // basic pt cuts + if (std::abs(resoParents.pt()) < cMinPtcut) + return false; + + return true; + } + + // Fill histograms (main function) + template + void fillHistograms(const CollisionType& collision, const ParticleType& resoParents) + { + auto multiplicity = collision.cent(); + for (auto& part : resoParents) { // loop over all pre-filtered MC particles + if (!ptCut(part)) + continue; // pt selection + + // QA plots + histos.fill(HIST("hEta"), part.eta()); + + if (abs(part.pdgCode()) != 333) // phi(0) + continue; + if (abs(part.y()) > 0.5) { // rapidity cut + continue; + } + if (abs(part.daughterPDG1()) != 321 || abs(part.daughterPDG2()) != 321) { // At least one decay to Kaon + continue; + } + histos.fill(HIST("phiGen"), part.pt(), multiplicity); + histos.fill(HIST("hphipt"), part.pt()); + } + } + + // Process the MC + void process(aod::ResoCollision& collision, aod::ResoMCParents& resoParents) + { + auto multiplicity = collision.cent(); + + // Fill the event counter + histos.fill(HIST("hVertexZ"), collision.posZ()); + histos.fill(HIST("hMultiplicityPercent"), multiplicity); + + fillHistograms(collision, resoParents); // Fill histograms, MC + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/Tutorials/PWGLF/Resonance/resonances_step5.cxx b/Tutorials/PWGLF/Resonance/resonances_step5.cxx new file mode 100644 index 00000000000..7d8463b9236 --- /dev/null +++ b/Tutorials/PWGLF/Resonance/resonances_step5.cxx @@ -0,0 +1,136 @@ +// 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 starting point for the Resonances tutorial +/// \author Hirak Kumar Koley +/// \since 11/10/2024 + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/runDataProcessing.h" +#include "PWGLF/DataModel/LFResonanceTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 5 +// loop over all MC Tracks and produce basic QA histograms +struct resonances_tutorial { + // Define slice per Resocollision + SliceCache cache; + Preslice perResoCollision = aod::resodaughter::resoCollisionId; + Preslice perCollision = aod::track::collisionId; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + // Configurable for number of bins + Configurable nBins{"nBins", 100, "N bins in all histos"}; + // Configurable for min pT cut + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; + + // Track selection + // primary track condition + 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 cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; // PV Contriuibutor + + // DCA Selections + // DCAr to PV + Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + + // PID selection + Configurable nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; + Configurable nsigmacutTOF{"nsigmacutTOF", 3.0, "Value /home/hirak/Desktop/LstarTaskTest/run/dpl-config.jsonof the TOF Nsigma cut"}; + + // Initialize the ananlysis task + void init(o2::framework::InitContext&) + { + // register histograms + histos.add("hVertexZ", "hVertexZ", HistType::kTH1F, {{nBins, -15., 15.}}); + histos.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); + histos.add("hMultiplicityPercent", "Multiplicity Percentile", kTH1F, {{120, 0.0f, 120.0f}}); + histos.add("hDcaxy", "Dcaxy distribution", kTH1F, {{100, -0.5f, 0.5f}}); + histos.add("hDcaz", "Dcaz distribution", kTH1F, {{100, -0.5f, 0.5f}}); + histos.add("hNsigmaKaonTPC", "NsigmaKaon TPC distribution", kTH1F, {{100, -10.0f, 10.0f}}); + histos.add("hNsigmaKaonTOF", "NsigmaKaon TOF distribution", kTH1F, {{100, -10.0f, 10.0f}}); + + // Print output histograms statistics + LOG(info) << "Size of the histograms in resonance tutorial step2:"; + histos.print(); + } + + // Track selection + template + bool trackCut(const TrackType track) + { + // basic track cuts + 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 (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + return true; + } + + // PID selection TPC +TOF Veto + template + bool selectionPID(const T& candidate) + { + bool tpcPass = std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC; + bool tofPass = (candidate.hasTOF()) ? std::abs(candidate.tofNSigmaKa()) < nsigmacutTOF : true; + if (tpcPass && tofPass) { + return true; + } + return false; + } + + template + void fillHistograms(const CollisionType& /* collision */, const TracksType& dTracks) + { + for (auto track : dTracks) { // loop over all dTracks + if (!trackCut(track) || !selectionPID(track)) { + continue; // track selection and PID selection + } + // QA plots + histos.fill(HIST("hEta"), track.eta()); + histos.fill(HIST("hDcaxy"), track.dcaXY()); + histos.fill(HIST("hDcaz"), track.dcaZ()); + histos.fill(HIST("hNsigmaKaonTPC"), track.tpcNSigmaKa()); + if (track.hasTOF()) { + histos.fill(HIST("hNsigmaKaonTOF"), track.tofNSigmaKa()); + } + } + } + + // Process the data + void process(aod::ResoCollision& collision, + soa::Join const& resotracks) + { + // Fill the event counter + histos.fill(HIST("hVertexZ"), collision.posZ()); + histos.fill(HIST("hMultiplicityPercent"), collision.cent()); + + fillHistograms(collision, resotracks); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/Tutorials/PWGLF/Resonance/resonances_step6.cxx b/Tutorials/PWGLF/Resonance/resonances_step6.cxx new file mode 100644 index 00000000000..23ccac6dfd2 --- /dev/null +++ b/Tutorials/PWGLF/Resonance/resonances_step6.cxx @@ -0,0 +1,188 @@ +// 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 starting point for the Resonances tutorial +/// \author Hirak Kumar Koley +/// \since 11/10/2024 + +#include + +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/AnalysisTask.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/runDataProcessing.h" +#include "PWGLF/DataModel/LFResonanceTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 6 +// Resonance reconstruction +struct resonances_tutorial { + // Define slice per Resocollision + SliceCache cache; + Preslice perResoCollision = aod::resodaughter::resoCollisionId; + Preslice perCollision = aod::track::collisionId; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + ///// Configurables + /// 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 binsCent{"binsCent", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "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 for number of bins + Configurable nBins{"nBins", 100, "N bins in all histos"}; + // Configurable for min pT cut + Configurable cMinPtcut{"cMinPtcut", 0.15, "Track minium pt cut"}; + + // Track selection + // primary track condition + 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 cfgPVContributor{"cfgPVContributor", true, "PV contributor track selection"}; // PV Contriuibutor + + // DCA Selections + // DCAr to PV + Configurable cMaxDCArToPVcut{"cMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; + // DCAz to PV + Configurable cMaxDCAzToPVcut{"cMaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + + // PID selection + Configurable nsigmaCutTPC{"nsigmacutTPC", 3.0, "Value of the TPC Nsigma cut"}; + Configurable nsigmacutTOF{"nsigmacutTOF", 3.0, "Value of the TOF Nsigma cut"}; + + // variables + double massKa = o2::constants::physics::MassKPlus; + + // Initialize the ananlysis task + void init(o2::framework::InitContext&) + { + AxisSpec centAxis = {binsCent, "V0M (%)"}; + AxisSpec ptAxis = {binsPt, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec invMassAxis = {cInvMassBins, cInvMassStart, cInvMassEnd, "Invariant Mass (GeV/#it{c}^2)"}; + + // register histograms + histos.add("hVertexZ", "hVertexZ", HistType::kTH1F, {{nBins, -15., 15.}}); + histos.add("hEta", "Eta distribution", kTH1F, {{200, -1.0f, 1.0f}}); + histos.add("hMultiplicityPercent", "Multiplicity Percentile", kTH1F, {{120, 0.0f, 120.0f}}); + histos.add("hDcaxy", "Dcaxy distribution", kTH1F, {{100, -0.5f, 0.5f}}); + histos.add("hDcaz", "Dcaz distribution", kTH1F, {{100, -0.5f, 0.5f}}); + histos.add("hNsigmaKaonTPC", "NsigmaKaon TPC distribution", kTH1F, {{100, -10.0f, 10.0f}}); + histos.add("hNsigmaKaonTOF", "NsigmaKaon TOF distribution", kTH1F, {{100, -10.0f, 10.0f}}); + + // MC QA + histos.add("h3Recphiinvmass", "Invariant mass of Reconstructed MC phi", kTH3F, {centAxis, ptAxis, invMassAxis}); + histos.add("phiRec", "pT distribution of Reconstructed MC phi", kTH2F, {ptAxis, centAxis}); + histos.add("phiRecinvmass", "Inv mass distribution of Reconstructed MC Phi", kTH1F, {invMassAxis}); + + // Print output histograms statistics + LOG(info) << "Size of the histograms in resonance tutorial step2:"; + histos.print(); + } + + // Track selection + template + bool trackCut(const TrackType track) + { + // basic track cuts + 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 (cfgPrimaryTrack && !track.isPrimaryTrack()) + return false; + if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) + return false; + if (cfgPVContributor && !track.isPVContributor()) + return false; + return true; + } + + // PID selection TPC +TOF Veto + template + bool selectionPID(const T& candidate) + { + bool tpcPass = std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC; + bool tofPass = (candidate.hasTOF()) ? std::abs(candidate.tofNSigmaKa()) < nsigmacutTOF : true; + if (tpcPass && tofPass) { + return true; + } + return false; + } + + // Fill histograms (main function) + double rapidity, mass, pT, paircharge; + TLorentzVector daughter1, daughter2, lResonance; + template + void fillHistograms(const CollisionType& collision, const TracksType& dTracks1, const TracksType& dTracks2) + { + auto multiplicity = collision.cent(); + for (auto track1 : dTracks1) { // loop over all dTracks1 + if (!trackCut(track1) || !selectionPID(track1)) { + continue; // track selection and PID selection + } + // QA plots + histos.fill(HIST("hEta"), track1.eta()); + histos.fill(HIST("hDcaxy"), track1.dcaXY()); + histos.fill(HIST("hDcaz"), track1.dcaZ()); + histos.fill(HIST("hNsigmaKaonTPC"), track1.tpcNSigmaKa()); + if (track1.hasTOF()) { + histos.fill(HIST("hNsigmaKaonTOF"), track1.tofNSigmaKa()); + } + for (auto track2 : dTracks2) { // loop over all dTracks2 + if (!trackCut(track2) || !selectionPID(track2)) { + continue; // track selection and PID selection + } + if (track2.index() <= track1.index()) { + continue; // condition to avoid double counting of pair + } + daughter1.SetXYZM(track1.px(), track1.py(), track1.pz(), massKa); // set the daughter1 4-momentum + daughter2.SetXYZM(track2.px(), track2.py(), track2.pz(), massKa); // set the daughter2 4-momentum + lResonance = daughter1 + daughter2; // calculate the lResonance 4-momentum + mass = lResonance.M(); + pT = lResonance.Pt(); + rapidity = lResonance.Rapidity(); + + if (abs(track1.pdgCode()) != 321 || abs(track2.pdgCode()) != 321) + continue; + if (track1.motherId() != track2.motherId()) // Same mother + continue; + if (abs(track1.motherPDG()) != 333) + continue; + + // MC histograms + histos.fill(HIST("phiRec"), lResonance.Pt(), multiplicity); + histos.fill(HIST("phiRecinvmass"), lResonance.M()); + histos.fill(HIST("h3Recphiinvmass"), multiplicity, lResonance.Pt(), lResonance.M()); + } + } + } + + // Process the data + void process(aod::ResoCollision& collision, + soa::Join const& resotracks) + { + // Fill the event counter + histos.fill(HIST("hVertexZ"), collision.posZ()); + histos.fill(HIST("hMultiplicityPercent"), collision.cent()); + + fillHistograms(collision, resotracks, resotracks); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } diff --git a/Tutorials/PWGLF/Strangeness/CMakeLists.txt b/Tutorials/PWGLF/Strangeness/CMakeLists.txt index ede23b4c734..39734cb836a 100644 --- a/Tutorials/PWGLF/Strangeness/CMakeLists.txt +++ b/Tutorials/PWGLF/Strangeness/CMakeLists.txt @@ -9,28 +9,6 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -# Strangeness analysis tutorial -o2physics_add_dpl_workflow(strangeness-step0 - SOURCES strangeness_step0.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME AnalysisTutorial) +add_subdirectory(pp) +add_subdirectory(PbPb) -o2physics_add_dpl_workflow(strangeness-step1 - SOURCES strangeness_step1.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME AnalysisTutorial) - -o2physics_add_dpl_workflow(strangeness-step2 - SOURCES strangeness_step2.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME AnalysisTutorial) - -o2physics_add_dpl_workflow(strangeness-step3 - SOURCES strangeness_step3.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME AnalysisTutorial) - -o2physics_add_dpl_workflow(strangeness-step4 - SOURCES strangeness_step4.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore - COMPONENT_NAME AnalysisTutorial) diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/CMakeLists.txt b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/CMakeLists.txt new file mode 100644 index 00000000000..d050dc59b47 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/CMakeLists.txt @@ -0,0 +1,41 @@ +# 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(strangeness-pbpb-skeleton + SOURCES strangeness_pbpb_skeleton.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-pbpb-step0 + SOURCES strangeness_pbpb_step0.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-pbpb-step1 + SOURCES strangeness_pbpb_step1.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-pbpb-step2 + SOURCES strangeness_pbpb_step2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-pbpb-step3 + SOURCES strangeness_pbpb_step3.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-pbpb-step4 + SOURCES strangeness_pbpb_step4.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_skeleton.sh b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_skeleton.sh new file mode 100644 index 00000000000..9327402771f --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_skeleton.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="skeleton" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configuration_skeleton.json" + +o2-analysistutorial-lf-strangeness-pbpb-skeleton "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/${STEP}/AnalysisResults.root" + mv dpl-config.json "${DIR_THIS}/results/${STEP}/${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step0.sh b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step0.sh new file mode 100644 index 00000000000..bcfeb9ab890 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step0.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="0" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configuration_step0.json" + +o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step0 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/step${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root" + mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step1.sh b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step1.sh new file mode 100644 index 00000000000..826f0ea1421 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step1.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="1" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configuration_step1.json" + +o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step1 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/step${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root" + mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step2.sh b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step2.sh new file mode 100644 index 00000000000..aca62bad45e --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step2.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="2" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configuration_step2.json" + +o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step2 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/step${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root" + mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step3.sh b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step3.sh new file mode 100644 index 00000000000..580b3c0c17f --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step3.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="3" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configuration_step3.json" + +o2-analysis-lf-cascadepid "${OPTION}" | o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step3 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/step${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root" + mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step4.sh b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step4.sh new file mode 100644 index 00000000000..08f929b3fa8 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/run_step4.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="4" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configuration_step4.json" + +o2-analysis-lf-cascadepid "${OPTION}" | o2-analysis-lf-cascadespawner "${OPTION}" | o2-analysistutorial-lf-strangeness-pbpb-step4 "${OPTION}" --aod-file @input_data.txt > "$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/step${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/step${STEP}/AnalysisResults.root" + mv dpl-config.json "${DIR_THIS}/results/step${STEP}/step${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_skeleton.cxx b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_skeleton.cxx new file mode 100644 index 00000000000..788aaead7ae --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_skeleton.cxx @@ -0,0 +1,67 @@ +// 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 Step4 of the Strangeness tutorial +/// \author Romain Schotter +/// based on the original codes from: +/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch) +/// \author Chiara De Martin (chiara.de.martin@cern.ch) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/O2DatabasePDGPlugin.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct strangeness_pbpb_tutorial { + // Histograms are defined with HistogramRegistry + HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // Configurable for histograms + Configurable nBins{"nBins", 100, "N bins in all histos"}; + + // Configurable for event selection + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + + // PDG data base + Service pdgDB; + + void init(InitContext const&) + { + // Axes + AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"}; + + // Histograms + // Event selection + rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); + } + + // 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); + + void process(soa::Filtered>::iterator const& collision) + { + // Fill the event counter + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step0.cxx b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step0.cxx new file mode 100644 index 00000000000..b0e595246d7 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step0.cxx @@ -0,0 +1,86 @@ +// 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 Step4 of the Strangeness tutorial +/// \author Romain Schotter +/// based on the original codes from: +/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch) +/// \author Chiara De Martin (chiara.de.martin@cern.ch) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/O2DatabasePDGPlugin.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 0 +// Starting point: loop over all cascades and fill invariant mass histogram + +struct strangeness_pbpb_tutorial { + // Histograms are defined with HistogramRegistry + HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rXi{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rOmega{"omega", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // Configurable for histograms + Configurable nBins{"nBins", 100, "N bins in all histos"}; + + // Configurable for event selection + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + + // PDG data base + Service pdgDB; + + void init(InitContext const&) + { + // Axes + AxisSpec XiMassAxis = {100, 1.28f, 1.36f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec OmegaMassAxis = {100, 1.63f, 1.7f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"}; + + // Histograms + // Event selection + rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); + + // Xi/Omega reconstruction + rXi.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}}); + + rOmega.add("hMassOmega", "hMassOmega", {HistType::kTH1F, {OmegaMassAxis}}); + } + + // 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); + + void process(soa::Filtered>::iterator const& collision, + aod::CascCores const& Cascades) + { + // Fill the event counter + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + + // Cascades + for (const auto& casc : Cascades) { + rXi.fill(HIST("hMassXi"), casc.mXi()); + rOmega.fill(HIST("hMassOmega"), casc.mOmega()); + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step1.cxx b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step1.cxx new file mode 100644 index 00000000000..836be98b240 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step1.cxx @@ -0,0 +1,146 @@ +// 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 Step4 of the Strangeness tutorial +/// \author Romain Schotter +/// based on the original codes from: +/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch) +/// \author Chiara De Martin (chiara.de.martin@cern.ch) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/O2DatabasePDGPlugin.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 0 +// Starting point: loop over all cascades and fill invariant mass histogram +// STEP 1 +// Apply selections on topological variables of Cascades + +struct strangeness_pbpb_tutorial { + // Histograms are defined with HistogramRegistry + HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rXi{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rOmega{"omega", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // Configurable for histograms + Configurable nBins{"nBins", 100, "N bins in all histos"}; + + // Configurable for event selection + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + + // Configurable parameters for cascade selection + Configurable cascadesetting_cospa{"cascadesetting_cospa", 0.98, "Casc CosPA"}; + Configurable cascadesetting_v0cospa{"cascadesetting_v0cospa", 0.97, "V0 CosPA"}; + Configurable cascadesetting_dcacascdau{"cascadesetting_dcacascdau", 1.0, "DCA cascade daughters"}; + Configurable cascadesetting_dcav0dau{"cascadesetting_dcav0dau", 1.0, "DCA v0 daughters"}; + Configurable cascadesetting_dcabachtopv{"cascadesetting_dcabachtopv", 0.06, "DCA bachelor to PV"}; + Configurable cascadesetting_dcapostopv{"cascadesetting_dcapostopv", 0.06, "DCA positive to PV"}; + Configurable cascadesetting_dcanegtopv{"cascadesetting_dcanegtopv", 0.06, "DCA negative to PV"}; + Configurable cascadesetting_mindcav0topv{"cascadesetting_mindcav0topv", 0.01, "minimum V0 DCA to PV"}; + Configurable cascadesetting_cascradius{"cascadesetting_cascradius", 0.5, "cascradius"}; + Configurable cascadesetting_v0radius{"cascadesetting_v0radius", 1.2, "v0radius"}; + Configurable cascadesetting_v0masswindow{"cascadesetting_v0masswindow", 0.01, "v0 mass window"}; + Configurable cascadesetting_competingmassrej{"cascadesetting_competingmassrej", 0.008, "Competing mass rejection"}; + + // PDG data base + Service pdgDB; + + void init(InitContext const&) + { + // Axes + AxisSpec XiMassAxis = {100, 1.28f, 1.36f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec OmegaMassAxis = {100, 1.63f, 1.7f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"}; + + // Histograms + // Event selection + rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); + + // Xi/Omega reconstruction + rXi.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hMassXiSelected", "hMassXiSelected", {HistType::kTH1F, {XiMassAxis}}); + + rOmega.add("hMassOmega", "hMassOmega", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hMassOmegaSelected", "hMassOmegaSelected", {HistType::kTH1F, {OmegaMassAxis}}); + + // Xi/Omega topological cuts + rXi.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rXi.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + + rOmega.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rOmega.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + } + + // 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 Cascades + // Cannot filter on dynamic columns + Filter preFilterCascades = (aod::cascdata::dcaV0daughters < cascadesetting_dcav0dau && + nabs(aod::cascdata::dcapostopv) > cascadesetting_dcapostopv && + nabs(aod::cascdata::dcanegtopv) > cascadesetting_dcanegtopv && + nabs(aod::cascdata::dcabachtopv) > cascadesetting_dcabachtopv && + aod::cascdata::dcacascdaughters < cascadesetting_dcacascdau); + + void process(soa::Filtered>::iterator const& collision, + soa::Filtered> const& Cascades) + { + // Fill the event counter + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + + // Cascades + for (const auto& casc : Cascades) { + rXi.fill(HIST("hMassXi"), casc.mXi()); + rOmega.fill(HIST("hMassOmega"), casc.mOmega()); + + // Cut on dynamic columns + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_cospa) + continue; + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_v0cospa) + continue; + if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > cascadesetting_v0masswindow) + continue; + if (casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_mindcav0topv) + continue; + if (casc.cascradius() < cascadesetting_cascradius) + continue; + if (casc.v0radius() < cascadesetting_v0radius) + continue; + + // Fill histograms! (if possible) + rXi.fill(HIST("hMassXiSelected"), casc.mXi()); + + rXi.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rXi.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > cascadesetting_competingmassrej) { // competing mass rejection, only in case of Omega + rOmega.fill(HIST("hMassOmegaSelected"), casc.mOmega()); + + rOmega.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rOmega.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step2.cxx b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step2.cxx new file mode 100644 index 00000000000..1558bb78052 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step2.cxx @@ -0,0 +1,182 @@ +// 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 Step4 of the Strangeness tutorial +/// \author Romain Schotter +/// based on the original codes from: +/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch) +/// \author Chiara De Martin (chiara.de.martin@cern.ch) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/O2DatabasePDGPlugin.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 0 +// Starting point: loop over all cascades and fill invariant mass histogram +// STEP 1 +// Apply selections on topological variables of Cascades +// STEP 2 +// Apply TPC PID selections on cascade daughter tracks + +struct strangeness_pbpb_tutorial { + // Histograms are defined with HistogramRegistry + HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rXi{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rOmega{"omega", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // Configurable for histograms + Configurable nBins{"nBins", 100, "N bins in all histos"}; + + // Configurable for event selection + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + + // Configurable parameters for cascade selection + Configurable cascadesetting_cospa{"cascadesetting_cospa", 0.98, "Casc CosPA"}; + Configurable cascadesetting_v0cospa{"cascadesetting_v0cospa", 0.97, "V0 CosPA"}; + Configurable cascadesetting_dcacascdau{"cascadesetting_dcacascdau", 1.0, "DCA cascade daughters"}; + Configurable cascadesetting_dcav0dau{"cascadesetting_dcav0dau", 1.0, "DCA v0 daughters"}; + Configurable cascadesetting_dcabachtopv{"cascadesetting_dcabachtopv", 0.06, "DCA bachelor to PV"}; + Configurable cascadesetting_dcapostopv{"cascadesetting_dcapostopv", 0.06, "DCA positive to PV"}; + Configurable cascadesetting_dcanegtopv{"cascadesetting_dcanegtopv", 0.06, "DCA negative to PV"}; + Configurable cascadesetting_mindcav0topv{"cascadesetting_mindcav0topv", 0.01, "minimum V0 DCA to PV"}; + Configurable cascadesetting_cascradius{"cascadesetting_cascradius", 0.5, "cascradius"}; + Configurable cascadesetting_v0radius{"cascadesetting_v0radius", 1.2, "v0radius"}; + Configurable cascadesetting_v0masswindow{"cascadesetting_v0masswindow", 0.01, "v0 mass window"}; + Configurable cascadesetting_competingmassrej{"cascadesetting_competingmassrej", 0.008, "Competing mass rejection"}; + + // Configurable parameters for PID selection + Configurable NSigmaTPCPion{"NSigmaTPCPion", 4, "NSigmaTPCPion"}; + Configurable NSigmaTPCKaon{"NSigmaTPCKaon", 4, "NSigmaTPCKaon"}; + Configurable NSigmaTPCProton{"NSigmaTPCProton", 4, "NSigmaTPCProton"}; + + // PDG data base + Service pdgDB; + + void init(InitContext const&) + { + // Axes + AxisSpec XiMassAxis = {100, 1.28f, 1.36f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec OmegaMassAxis = {100, 1.63f, 1.7f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"}; + + // Histograms + // Event selection + rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); + + // Xi/Omega reconstruction + rXi.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hMassXiSelected", "hMassXiSelected", {HistType::kTH1F, {XiMassAxis}}); + + rOmega.add("hMassOmega", "hMassOmega", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hMassOmegaSelected", "hMassOmegaSelected", {HistType::kTH1F, {OmegaMassAxis}}); + + // Xi/Omega topological cuts + rXi.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rXi.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + + rOmega.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rOmega.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + } + + // 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 Cascades + // Cannot filter on dynamic columns + Filter preFilterCascades = (aod::cascdata::dcaV0daughters < cascadesetting_dcav0dau && + nabs(aod::cascdata::dcapostopv) > cascadesetting_dcapostopv && + nabs(aod::cascdata::dcanegtopv) > cascadesetting_dcanegtopv && + nabs(aod::cascdata::dcabachtopv) > cascadesetting_dcabachtopv && + aod::cascdata::dcacascdaughters < cascadesetting_dcacascdau); + + // Defining the type of the daughter tracks + using dauTracks = soa::Join; + + void process(soa::Filtered>::iterator const& collision, + soa::Filtered> const& Cascades, + dauTracks const&) + { + // Fill the event counter + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + + // Cascades + for (const auto& casc : Cascades) { + const auto& bachDaughterTrackCasc = casc.bachTrackExtra_as(); + const auto& posDaughterTrackCasc = casc.posTrackExtra_as(); + const auto& negDaughterTrackCasc = casc.negTrackExtra_as(); + + rXi.fill(HIST("hMassXi"), casc.mXi()); + rOmega.fill(HIST("hMassOmega"), casc.mOmega()); + + // Cut on dynamic columns + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_cospa) + continue; + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_v0cospa) + continue; + if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > cascadesetting_v0masswindow) + continue; + if (casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_mindcav0topv) + continue; + if (casc.cascradius() < cascadesetting_cascradius) + continue; + if (casc.v0radius() < cascadesetting_v0radius) + continue; + + // PID selection + if (casc.sign() < 0) { + if (TMath::Abs(posDaughterTrackCasc.tpcNSigmaPr()) > NSigmaTPCProton) { + continue; + } + if (TMath::Abs(negDaughterTrackCasc.tpcNSigmaPi()) > NSigmaTPCPion) { + continue; + } + } else { + if (TMath::Abs(negDaughterTrackCasc.tpcNSigmaPr()) > NSigmaTPCProton) { + continue; + } + if (TMath::Abs(posDaughterTrackCasc.tpcNSigmaPi()) > NSigmaTPCPion) { + continue; + } + } + + // Fill histograms! (if possible) + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaPi()) < NSigmaTPCPion) { // Xi case + rXi.fill(HIST("hMassXiSelected"), casc.mXi()); + + rXi.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rXi.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaKa()) < NSigmaTPCKaon) { // Omega case + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > cascadesetting_competingmassrej) { // competing mass rejection, only in case of Omega + rOmega.fill(HIST("hMassOmegaSelected"), casc.mOmega()); + + rOmega.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rOmega.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step3.cxx b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step3.cxx new file mode 100644 index 00000000000..f12a4f02560 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step3.cxx @@ -0,0 +1,243 @@ +// 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 Step4 of the Strangeness tutorial +/// \author Romain Schotter +/// based on the original codes from: +/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch) +/// \author Chiara De Martin (chiara.de.martin@cern.ch) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/O2DatabasePDGPlugin.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 0 +// Starting point: loop over all cascades and fill invariant mass histogram +// STEP 1 +// Apply selections on topological variables of Cascades +// STEP 2 +// Apply TPC PID selections on cascade daughter tracks +// STEP 3 +// Apply TOF PID selections on cascade daugther tracks (if info is available) + +struct strangeness_pbpb_tutorial { + // Histograms are defined with HistogramRegistry + HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rXi{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rOmega{"omega", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // Configurable for histograms + Configurable nBins{"nBins", 100, "N bins in all histos"}; + + // Configurable for event selection + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + + // Configurable parameters for cascade selection + Configurable cascadesetting_cospa{"cascadesetting_cospa", 0.98, "Casc CosPA"}; + Configurable cascadesetting_v0cospa{"cascadesetting_v0cospa", 0.97, "V0 CosPA"}; + Configurable cascadesetting_dcacascdau{"cascadesetting_dcacascdau", 1.0, "DCA cascade daughters"}; + Configurable cascadesetting_dcav0dau{"cascadesetting_dcav0dau", 1.0, "DCA v0 daughters"}; + Configurable cascadesetting_dcabachtopv{"cascadesetting_dcabachtopv", 0.06, "DCA bachelor to PV"}; + Configurable cascadesetting_dcapostopv{"cascadesetting_dcapostopv", 0.06, "DCA positive to PV"}; + Configurable cascadesetting_dcanegtopv{"cascadesetting_dcanegtopv", 0.06, "DCA negative to PV"}; + Configurable cascadesetting_mindcav0topv{"cascadesetting_mindcav0topv", 0.01, "minimum V0 DCA to PV"}; + Configurable cascadesetting_cascradius{"cascadesetting_cascradius", 0.5, "cascradius"}; + Configurable cascadesetting_v0radius{"cascadesetting_v0radius", 1.2, "v0radius"}; + Configurable cascadesetting_v0masswindow{"cascadesetting_v0masswindow", 0.01, "v0 mass window"}; + Configurable cascadesetting_competingmassrej{"cascadesetting_competingmassrej", 0.008, "Competing mass rejection"}; + + // Configurable parameters for PID selection + Configurable NSigmaTPCPion{"NSigmaTPCPion", 4, "NSigmaTPCPion"}; + Configurable NSigmaTPCKaon{"NSigmaTPCKaon", 4, "NSigmaTPCKaon"}; + Configurable NSigmaTPCProton{"NSigmaTPCProton", 4, "NSigmaTPCProton"}; + + // Configurable parameters for TOF PID selection + Configurable NSigmaTOFPion{"NSigmaTOFPion", 3, "NSigmaTOFPion"}; + Configurable NSigmaTOFKaon{"NSigmaTOFKaon", 3, "NSigmaTOFKaon"}; + Configurable NSigmaTOFProton{"NSigmaTOFProton", 3, "NSigmaTOFProton"}; + + // PDG data base + Service pdgDB; + + void init(InitContext const&) + { + // Axes + AxisSpec XiMassAxis = {100, 1.28f, 1.36f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec OmegaMassAxis = {100, 1.63f, 1.7f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"}; + + // Histograms + // Event selection + rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); + + // Xi/Omega reconstruction + rXi.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hMassXiSelected", "hMassXiSelected", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hMassXiSelectedWithTOF", "hMassXiSelectedWithTOF", {HistType::kTH1F, {XiMassAxis}}); + + rOmega.add("hMassOmega", "hMassOmega", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hMassOmegaSelected", "hMassOmegaSelected", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hMassOmegaSelectedWithTOF", "hMassOmegaSelectedWithTOF", {HistType::kTH1F, {OmegaMassAxis}}); + + // Xi/Omega topological cuts + rXi.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rXi.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + + rOmega.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rOmega.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + } + + // 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 Cascades + // Cannot filter on dynamic columns + Filter preFilterCascades = (aod::cascdata::dcaV0daughters < cascadesetting_dcav0dau && + nabs(aod::cascdata::dcapostopv) > cascadesetting_dcapostopv && + nabs(aod::cascdata::dcanegtopv) > cascadesetting_dcanegtopv && + nabs(aod::cascdata::dcabachtopv) > cascadesetting_dcabachtopv && + aod::cascdata::dcacascdaughters < cascadesetting_dcacascdau); + + // Defining the type of the daughter tracks + using dauTracks = soa::Join; + + void process(soa::Filtered>::iterator const& collision, + soa::Filtered> const& Cascades, + dauTracks const&) + { + // Fill the event counter + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + + // Cascades + for (const auto& casc : Cascades) { + const auto& bachDaughterTrackCasc = casc.bachTrackExtra_as(); + const auto& posDaughterTrackCasc = casc.posTrackExtra_as(); + const auto& negDaughterTrackCasc = casc.negTrackExtra_as(); + + rXi.fill(HIST("hMassXi"), casc.mXi()); + rOmega.fill(HIST("hMassOmega"), casc.mOmega()); + + // Cut on dynamic columns + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_cospa) + continue; + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_v0cospa) + continue; + if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > cascadesetting_v0masswindow) + continue; + if (casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_mindcav0topv) + continue; + if (casc.cascradius() < cascadesetting_cascradius) + continue; + if (casc.v0radius() < cascadesetting_v0radius) + continue; + + // PID selection + if (casc.sign() < 0) { + if (TMath::Abs(posDaughterTrackCasc.tpcNSigmaPr()) > NSigmaTPCProton) { + continue; + } + if (TMath::Abs(negDaughterTrackCasc.tpcNSigmaPi()) > NSigmaTPCPion) { + continue; + } + } else { + if (TMath::Abs(negDaughterTrackCasc.tpcNSigmaPr()) > NSigmaTPCProton) { + continue; + } + if (TMath::Abs(posDaughterTrackCasc.tpcNSigmaPi()) > NSigmaTPCPion) { + continue; + } + } + + // TOF PID check + bool xiPassTOFSelection = true; + bool omegaPassTOFSelection = true; + if (casc.sign() < 0) { + if (posDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > NSigmaTOFProton) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPr()) > NSigmaTOFProton) { + omegaPassTOFSelection &= false; + } + } + if (negDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > NSigmaTOFPion) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPi()) > NSigmaTOFPion) { + omegaPassTOFSelection &= false; + } + } + } else { + if (posDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > NSigmaTOFPion) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPi()) > NSigmaTOFPion) { + omegaPassTOFSelection &= false; + } + } + if (negDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > NSigmaTOFProton) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPr()) > NSigmaTOFProton) { + omegaPassTOFSelection &= false; + } + } + } + + if (bachDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiPi()) > NSigmaTOFPion) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmKa()) > NSigmaTOFKaon) { + omegaPassTOFSelection &= false; + } + } + + // Fill histograms! (if possible) + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaPi()) < NSigmaTPCPion) { // Xi case + rXi.fill(HIST("hMassXiSelected"), casc.mXi()); + if (xiPassTOFSelection) + rXi.fill(HIST("hMassXiSelectedWithTOF"), casc.mXi()); + + rXi.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rXi.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaKa()) < NSigmaTPCKaon) { // Omega case + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > cascadesetting_competingmassrej) { // competing mass rejection, only in case of Omega + rOmega.fill(HIST("hMassOmegaSelected"), casc.mOmega()); + if (omegaPassTOFSelection) + rOmega.fill(HIST("hMassOmegaSelectedWithTOF"), casc.mOmega()); + + rOmega.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rOmega.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step4.cxx b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step4.cxx new file mode 100644 index 00000000000..d45ef3c26a1 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/Analysis/strangeness_pbpb_step4.cxx @@ -0,0 +1,324 @@ +// 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 Step4 of the Strangeness tutorial +/// \author Romain Schotter +/// based on the original codes from: +/// \author Nepeivoda Roman (roman.nepeivoda@cern.ch) +/// \author Chiara De Martin (chiara.de.martin@cern.ch) + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Common/DataModel/EventSelection.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "Framework/O2DatabasePDGPlugin.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +// STEP 0 +// Starting point: loop over all cascades and fill invariant mass histogram +// STEP 1 +// Apply selections on topological variables of Cascades +// STEP 2 +// Apply TPC PID selections on cascade daughter tracks +// STEP 3 +// Apply TOF PID selections on cascade daugther tracks (if info is available) +// STEP 4 +// Check the MC information of the cascades + +struct strangeness_pbpb_tutorial { + // Histograms are defined with HistogramRegistry + HistogramRegistry rEventSelection{"eventSelection", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rXi{"xi", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rOmega{"omega", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + HistogramRegistry rGenParticles{"genParticles", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; + + // Configurable for histograms + Configurable nBins{"nBins", 100, "N bins in all histos"}; + + // Configurable for event selection + Configurable cutzvertex{"cutzvertex", 10.0f, "Accepted z-vertex range (cm)"}; + + // Configurable parameters for cascade selection + Configurable cascadesetting_cospa{"cascadesetting_cospa", 0.98, "Casc CosPA"}; + Configurable cascadesetting_v0cospa{"cascadesetting_v0cospa", 0.97, "V0 CosPA"}; + Configurable cascadesetting_dcacascdau{"cascadesetting_dcacascdau", 1.0, "DCA cascade daughters"}; + Configurable cascadesetting_dcav0dau{"cascadesetting_dcav0dau", 1.0, "DCA v0 daughters"}; + Configurable cascadesetting_dcabachtopv{"cascadesetting_dcabachtopv", 0.06, "DCA bachelor to PV"}; + Configurable cascadesetting_dcapostopv{"cascadesetting_dcapostopv", 0.06, "DCA positive to PV"}; + Configurable cascadesetting_dcanegtopv{"cascadesetting_dcanegtopv", 0.06, "DCA negative to PV"}; + Configurable cascadesetting_mindcav0topv{"cascadesetting_mindcav0topv", 0.01, "minimum V0 DCA to PV"}; + Configurable cascadesetting_cascradius{"cascadesetting_cascradius", 0.5, "cascradius"}; + Configurable cascadesetting_v0radius{"cascadesetting_v0radius", 1.2, "v0radius"}; + Configurable cascadesetting_v0masswindow{"cascadesetting_v0masswindow", 0.01, "v0 mass window"}; + Configurable cascadesetting_competingmassrej{"cascadesetting_competingmassrej", 0.008, "Competing mass rejection"}; + + // Configurable parameters for PID selection + Configurable NSigmaTPCPion{"NSigmaTPCPion", 4, "NSigmaTPCPion"}; + Configurable NSigmaTPCKaon{"NSigmaTPCKaon", 4, "NSigmaTPCKaon"}; + Configurable NSigmaTPCProton{"NSigmaTPCProton", 4, "NSigmaTPCProton"}; + + // Configurable parameters for TOF PID selection + Configurable NSigmaTOFPion{"NSigmaTOFPion", 3, "NSigmaTOFPion"}; + Configurable NSigmaTOFKaon{"NSigmaTOFKaon", 3, "NSigmaTOFKaon"}; + Configurable NSigmaTOFProton{"NSigmaTOFProton", 3, "NSigmaTOFProton"}; + + // PDG data base + Service pdgDB; + + void init(InitContext const&) + { + // Axes + AxisSpec XiMassAxis = {100, 1.28f, 1.36f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec OmegaMassAxis = {100, 1.63f, 1.7f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; + AxisSpec vertexZAxis = {nBins, -15., 15., "vrtx_{Z} [cm]"}; + AxisSpec ptAxis = {100, 0.0f, 10.0f, "#it{p}_{T} (GeV/#it{c})"}; + + // Histograms + // Event selection + rEventSelection.add("hVertexZRec", "hVertexZRec", {HistType::kTH1F, {vertexZAxis}}); + + // Xi/Omega reconstruction + rXi.add("hMassXi", "hMassXi", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hMassXiSelected", "hMassXiSelected", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hMassXiSelectedWithTOF", "hMassXiSelectedWithTOF", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hMassXiTrueRec", "hMassXiTrueRec", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hPtXiTrueRec", "hPtXiTrueRec", {HistType::kTH1F, {ptAxis}}); + rXi.add("hMassXiTrueRecWithTOF", "hMassXiTrueRecWithTOF", {HistType::kTH1F, {XiMassAxis}}); + rXi.add("hPtXiTrueRecWithTOF", "hPtXiTrueRecWithTOF", {HistType::kTH1F, {ptAxis}}); + + rOmega.add("hMassOmega", "hMassOmega", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hMassOmegaSelected", "hMassOmegaSelected", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hMassOmegaSelectedWithTOF", "hMassOmegaSelectedWithTOF", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hMassOmegaTrueRec", "hMassOmegaTrueRec", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hPtOmegaTrueRec", "hPtOmegaTrueRec", {HistType::kTH1F, {ptAxis}}); + rOmega.add("hMassOmegaTrueRecWithTOF", "hMassOmegaTrueRecWithTOF", {HistType::kTH1F, {OmegaMassAxis}}); + rOmega.add("hPtOmegaTrueRecWithTOF", "hPtOmegaTrueRecWithTOF", {HistType::kTH1F, {ptAxis}}); + + // Xi/Omega topological cuts + rXi.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rXi.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + + rOmega.add("hCascDCAV0Daughters", "hCascDCAV0Daughters", {HistType::kTH1F, {{55, 0.0f, 2.2f}}}); + rOmega.add("hCascCosPA", "hCascCosPA", {HistType::kTH1F, {{100, 0.95f, 1.f}}}); + + // Generated level histograms + rEventSelection.add("hVertexZGen", "hVertexZGen", {HistType::kTH1F, {vertexZAxis}}); + rGenParticles.add("hPtXiGen", "hPtXiGen", {HistType::kTH1F, {{ptAxis}}}); + rGenParticles.add("hPtOmegaGen", "hPtOmegaGen", {HistType::kTH1F, {{ptAxis}}}); + } + + // 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 posZFilterMC = (nabs(o2::aod::mccollision::posZ) < cutzvertex); + + // Filters on Cascades + // Cannot filter on dynamic columns + Filter preFilterCascades = (aod::cascdata::dcaV0daughters < cascadesetting_dcav0dau && + nabs(aod::cascdata::dcapostopv) > cascadesetting_dcapostopv && + nabs(aod::cascdata::dcanegtopv) > cascadesetting_dcanegtopv && + nabs(aod::cascdata::dcabachtopv) > cascadesetting_dcabachtopv && + aod::cascdata::dcacascdaughters < cascadesetting_dcacascdau); + + // Defining the type of the daughter tracks + using dauTracks = soa::Join; + + void processRecMC(soa::Filtered>::iterator const& collision, + soa::Filtered> const& Cascades, + dauTracks const&, + aod::CascMCCores const& /*cascmccores*/) + { + // Fill the event counter + rEventSelection.fill(HIST("hVertexZRec"), collision.posZ()); + + // Cascades + for (const auto& casc : Cascades) { + const auto& bachDaughterTrackCasc = casc.bachTrackExtra_as(); + const auto& posDaughterTrackCasc = casc.posTrackExtra_as(); + const auto& negDaughterTrackCasc = casc.negTrackExtra_as(); + + rXi.fill(HIST("hMassXi"), casc.mXi()); + rOmega.fill(HIST("hMassOmega"), casc.mOmega()); + + // Cut on dynamic columns + if (casc.casccosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_cospa) + continue; + if (casc.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_v0cospa) + continue; + if (TMath::Abs(casc.mLambda() - pdgDB->Mass(3122)) > cascadesetting_v0masswindow) + continue; + if (casc.dcav0topv(collision.posX(), collision.posY(), collision.posZ()) < cascadesetting_mindcav0topv) + continue; + if (casc.cascradius() < cascadesetting_cascradius) + continue; + if (casc.v0radius() < cascadesetting_v0radius) + continue; + + // PID selection + if (casc.sign() < 0) { + if (TMath::Abs(posDaughterTrackCasc.tpcNSigmaPr()) > NSigmaTPCProton) { + continue; + } + if (TMath::Abs(negDaughterTrackCasc.tpcNSigmaPi()) > NSigmaTPCPion) { + continue; + } + } else { + if (TMath::Abs(negDaughterTrackCasc.tpcNSigmaPr()) > NSigmaTPCProton) { + continue; + } + if (TMath::Abs(posDaughterTrackCasc.tpcNSigmaPi()) > NSigmaTPCPion) { + continue; + } + } + + // TOF PID check + bool xiPassTOFSelection = true; + bool omegaPassTOFSelection = true; + if (casc.sign() < 0) { + if (posDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > NSigmaTOFProton) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPr()) > NSigmaTOFProton) { + omegaPassTOFSelection &= false; + } + } + if (negDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > NSigmaTOFPion) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPi()) > NSigmaTOFPion) { + omegaPassTOFSelection &= false; + } + } + } else { + if (posDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPi()) > NSigmaTOFPion) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPi()) > NSigmaTOFPion) { + omegaPassTOFSelection &= false; + } + } + if (negDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiLaPr()) > NSigmaTOFProton) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmLaPr()) > NSigmaTOFProton) { + omegaPassTOFSelection &= false; + } + } + } + + if (bachDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiPi()) > NSigmaTOFPion) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmKa()) > NSigmaTOFKaon) { + omegaPassTOFSelection &= false; + } + } + + if (bachDaughterTrackCasc.hasTOF()) { + if (TMath::Abs(casc.tofNSigmaXiPi()) > NSigmaTOFPion) { + xiPassTOFSelection &= false; + } + if (TMath::Abs(casc.tofNSigmaOmKa()) > NSigmaTOFKaon) { + omegaPassTOFSelection &= false; + } + } + + // Fill histograms! (if possible) + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaPi()) < NSigmaTPCPion) { // Xi case + rXi.fill(HIST("hMassXiSelected"), casc.mXi()); + if (xiPassTOFSelection) { + rXi.fill(HIST("hMassXiSelectedWithTOF"), casc.mXi()); + } + + rXi.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rXi.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaKa()) < NSigmaTPCKaon) { // Omega case + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > cascadesetting_competingmassrej) { // competing mass rejection, only in case of Omega + rOmega.fill(HIST("hMassOmegaSelected"), casc.mOmega()); + if (omegaPassTOFSelection) { + rOmega.fill(HIST("hMassOmegaSelectedWithTOF"), casc.mOmega()); + } + + rOmega.fill(HIST("hCascDCAV0Daughters"), casc.dcaV0daughters()); + rOmega.fill(HIST("hCascCosPA"), casc.casccosPA(collision.posX(), collision.posY(), collision.posZ())); + } + } + + // MC truth info + if (!casc.has_cascMCCore()) { + continue; + } + auto cascmccore = casc.cascMCCore_as(); + + // Checking that the cascade is a true Xi + if (TMath::Abs(cascmccore.pdgCode()) == 3312) { + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaPi()) < NSigmaTPCPion) { // Xi case + rXi.fill(HIST("hMassXiTrueRec"), casc.mXi()); + rXi.fill(HIST("hPtXiTrueRec"), casc.pt()); + if (xiPassTOFSelection) { + rXi.fill(HIST("hMassXiTrueRecWithTOF"), casc.mXi()); + rXi.fill(HIST("hPtXiTrueRecWithTOF"), casc.pt()); + } + } + } + if (TMath::Abs(cascmccore.pdgCode()) == 3334) { + if (TMath::Abs(bachDaughterTrackCasc.tpcNSigmaKa()) < NSigmaTPCKaon) { // Omega case + if (TMath::Abs(casc.mXi() - pdgDB->Mass(3312)) > cascadesetting_competingmassrej) { // competing mass rejection, only in case of Omega + rOmega.fill(HIST("hMassOmegaTrueRec"), casc.mOmega()); + rOmega.fill(HIST("hPtOmegaTrueRec"), casc.pt()); + if (omegaPassTOFSelection) { + rOmega.fill(HIST("hMassOmegaTrueRecWithTOF"), casc.mOmega()); + rOmega.fill(HIST("hPtOmegaTrueRecWithTOF"), casc.pt()); + } + } + } + } + } + } + + void processGenMC(soa::Filtered::iterator const& mcCollision, + const soa::SmallGroups>& collisions, + const soa::SmallGroups>& cascMC) + { + if (collisions.size() < 1) // to process generated collisions that've been reconstructed at least once + return; + rEventSelection.fill(HIST("hVertexZGen"), mcCollision.posZ()); + + for (const auto& cascmc : cascMC) { + if (TMath::Abs(cascmc.pdgCode()) == 3312) { + rGenParticles.fill(HIST("hPtXiGen"), cascmc.ptMC()); + } + if (TMath::Abs(cascmc.pdgCode()) == 3334) { + rGenParticles.fill(HIST("hPtOmegaGen"), cascmc.ptMC()); + } + } + } + + PROCESS_SWITCH(strangeness_pbpb_tutorial, processRecMC, "Process Run 3 mc, reconstructed", true); + PROCESS_SWITCH(strangeness_pbpb_tutorial, processGenMC, "Process Run 3 mc, generated", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc)}; +} diff --git a/Tutorials/PWGLF/Strangeness/PbPb/CMakeLists.txt b/Tutorials/PWGLF/Strangeness/PbPb/CMakeLists.txt new file mode 100644 index 00000000000..f593f821726 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/CMakeLists.txt @@ -0,0 +1,13 @@ +# 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(Analysis) +# add_subdirectory(DerivedDataProduction) \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/PbPb/DerivedDataProduction/Data/run.sh b/Tutorials/PWGLF/Strangeness/PbPb/DerivedDataProduction/Data/run.sh new file mode 100644 index 00000000000..632f8375470 --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/DerivedDataProduction/Data/run.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="deriveddata" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configuration.json" + +o2-analysis-pid-tof-base "${OPTION}" | + o2-analysis-event-selection "${OPTION}" | + o2-analysis-lf-lambdakzerobuilder "${OPTION}" | + o2-analysis-lf-cascadebuilder "${OPTION}" | + o2-analysis-multiplicity-table "${OPTION}" | + o2-analysis-centrality-table "${OPTION}" | + o2-analysis-lf-epvector "${OPTION}" | + o2-analysis-centrality-qa "${OPTION}" | + o2-analysis-ud-sgcand-producer "${OPTION}" | + o2-analysis-timestamp "${OPTION}" | + o2-analysis-ft0-corrected-table "${OPTION}" | + o2-analysis-track-propagation "${OPTION}" | + o2-analysis-pid-tpc-base "${OPTION}" | + o2-analysis-pid-tpc "${OPTION}" | + o2-analysis-trackselection "${OPTION}" | + o2-analysis-pid-tof-full "${OPTION}" | + o2-analysis-pid-tof-beta "${OPTION}" | + o2-analysis-lf-strangederivedbuilder "${OPTION}" --aod-file @input_data.txt --aod-writer-json OutputDirector.json >"$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/${STEP}/AnalysisResults.root" + mv AO2D.root "${DIR_THIS}/results/${STEP}/AO2D.root" + mv dpl-config.json "${DIR_THIS}/results/${STEP}/${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi diff --git a/Tutorials/PWGLF/Strangeness/PbPb/DerivedDataProduction/MC/runMC.sh b/Tutorials/PWGLF/Strangeness/PbPb/DerivedDataProduction/MC/runMC.sh new file mode 100644 index 00000000000..e9e086e4f4e --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/PbPb/DerivedDataProduction/MC/runMC.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# log file where the terminal output will be saved +STEP="deriveddata" +LOGFILE="log-${STEP}.txt" + +#directory of this script +DIR_THIS=$PWD + +OPTION="-b --configuration json://configurationMC.json" + +o2-analysis-pid-tof-base "${OPTION}" | + o2-analysis-mccollisionextra "${OPTION}" | + o2-analysis-lf-lambdakzerobuilder "${OPTION}" | + o2-analysis-lf-cascadebuilder "${OPTION}" | + o2-analysis-lf-cascademcbuilder "${OPTION}" | + o2-analysis-centrality-table "${OPTION}" | + o2-analysis-lf-lambdakzeromcbuilder "${OPTION}" | + o2-analysis-mccollision-converter "${OPTION}" | + o2-analysis-ud-sgcand-producer "${OPTION}" | + o2-analysis-timestamp "${OPTION}" | + o2-analysis-ft0-corrected-table "${OPTION}" | + o2-analysis-track-propagation "${OPTION}" | + o2-analysis-pid-tpc-base "${OPTION}" | + o2-analysis-pid-tpc "${OPTION}" | + o2-analysis-multiplicity-table "${OPTION}" | + o2-analysis-trackselection "${OPTION}" | + o2-analysis-pid-tof-full "${OPTION}" | + o2-analysis-pid-tof-beta "${OPTION}" | + o2-analysis-event-selection "${OPTION}" | + o2-analysis-lf-strangederivedbuilder "${OPTION}" --aod-file @input_dataMC.txt --aod-writer-json OutputDirectorMC.json >"$LOGFILE" 2>&1 + +# report status +rc=$? +if [ $rc -eq 0 ]; then + echo "No problems!" + mkdir -p "${DIR_THIS}/results/${STEP}" + mv AnalysisResults.root "${DIR_THIS}/results/${STEP}/AnalysisResults.root" + mv AO2D.root "${DIR_THIS}/results/${STEP}/AO2D.root" + mv dpl-config.json "${DIR_THIS}/results/${STEP}/${STEP}.json" +else + echo "Error: Exit code ${rc}" + echo "Check the log file ${LOGFILE}" + exit ${rc} +fi diff --git a/Tutorials/PWGLF/Strangeness/README.md b/Tutorials/PWGLF/Strangeness/README.md index ee28059d0f8..1976051fe3b 100644 --- a/Tutorials/PWGLF/Strangeness/README.md +++ b/Tutorials/PWGLF/Strangeness/README.md @@ -1,13 +1,29 @@ # This is the base for the PWGLF tutorials for the O2AT -The tutorial (17-28 Apr 2023) can be still used and is a reference for the LF analyses. +The tutorial (14-18 Oct 2024) can be used as a reference for the LF analysis. It is built as a set of steps. Each step adds a level of complexity and is built in a separate executable. -The executables are defined in the `CMakeLists.txt`. -## Files -* `README.md` this readme +The tutorial is divided into two directories depending on the collision system: +## pp +This repository contains the codes to analyse V0 and cascade particles in proton-proton collisions: * `CMakeLists.txt` here are defined the source files to compile * `strangeness_step0.cxx` Starting point: loop over all V0s and fill invariant mass histogram * `strangeness_step1.cxx` Apply selections on topological variables of V0s * `strangeness_step2.cxx` Apply PID selections on V0 daughter tracks * `strangeness_step3.cxx` Check the MC information of the V0s and verify with the PID information of daughter tracks + +The introduction and hands-on sessions can be found here: https://indico.cern.ch/event/1326201/ + +## PbPb +This repository contains the code to analyse cascade particles in Pb-Pb collisions. +The tutorial revolves around two aspects: +i) the derived data production in the directory DerivedDataProduction, +ii) the analysis of the derived data in the directory Analysis, containing: +* `CMakeLists.txt` here are defined the source files to compile +* `strangeness_pbpb_step0.cxx` Starting point: loop over all cascades and fill invariant mass histogram +* `strangeness_pbpb_step1.cxx` Apply selections on topological variables of cascades +* `strangeness_pbpb_step2.cxx` Apply TPC PID selections on cascade daughter tracks +* `strangeness_pbpb_step3.cxx` Apply TOF PID selections on cascade daughter tracks (if available) +* `strangeness_pbpb_step4.cxx` Check the MC information of the cascade + +The introduction and hands-on sessions can be found here: https://indico.cern.ch/event/1425820/ \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/pp/CMakeLists.txt b/Tutorials/PWGLF/Strangeness/pp/CMakeLists.txt new file mode 100644 index 00000000000..f46ac1f9e0b --- /dev/null +++ b/Tutorials/PWGLF/Strangeness/pp/CMakeLists.txt @@ -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. + +# Strangeness analysis tutorial +o2physics_add_dpl_workflow(strangeness-step0 + SOURCES strangeness_step0.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-step1 + SOURCES strangeness_step1.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-step2 + SOURCES strangeness_step2.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-step3 + SOURCES strangeness_step3.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) + +o2physics_add_dpl_workflow(strangeness-step4 + SOURCES strangeness_step4.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME AnalysisTutorial) \ No newline at end of file diff --git a/Tutorials/PWGLF/Strangeness/strangeness_step0.cxx b/Tutorials/PWGLF/Strangeness/pp/strangeness_step0.cxx similarity index 100% rename from Tutorials/PWGLF/Strangeness/strangeness_step0.cxx rename to Tutorials/PWGLF/Strangeness/pp/strangeness_step0.cxx diff --git a/Tutorials/PWGLF/Strangeness/strangeness_step1.cxx b/Tutorials/PWGLF/Strangeness/pp/strangeness_step1.cxx similarity index 100% rename from Tutorials/PWGLF/Strangeness/strangeness_step1.cxx rename to Tutorials/PWGLF/Strangeness/pp/strangeness_step1.cxx diff --git a/Tutorials/PWGLF/Strangeness/strangeness_step2.cxx b/Tutorials/PWGLF/Strangeness/pp/strangeness_step2.cxx similarity index 100% rename from Tutorials/PWGLF/Strangeness/strangeness_step2.cxx rename to Tutorials/PWGLF/Strangeness/pp/strangeness_step2.cxx diff --git a/Tutorials/PWGLF/Strangeness/strangeness_step3.cxx b/Tutorials/PWGLF/Strangeness/pp/strangeness_step3.cxx similarity index 100% rename from Tutorials/PWGLF/Strangeness/strangeness_step3.cxx rename to Tutorials/PWGLF/Strangeness/pp/strangeness_step3.cxx diff --git a/Tutorials/PWGLF/Strangeness/strangeness_step4.cxx b/Tutorials/PWGLF/Strangeness/pp/strangeness_step4.cxx similarity index 100% rename from Tutorials/PWGLF/Strangeness/strangeness_step4.cxx rename to Tutorials/PWGLF/Strangeness/pp/strangeness_step4.cxx diff --git a/Tutorials/PWGUD/CMakeLists.txt b/Tutorials/PWGUD/CMakeLists.txt index da52aa07b26..de978b518dc 100644 --- a/Tutorials/PWGUD/CMakeLists.txt +++ b/Tutorials/PWGUD/CMakeLists.txt @@ -39,3 +39,21 @@ o2physics_add_dpl_workflow(udtutorial-04 PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore COMPONENT_NAME Analysis) +o2physics_add_dpl_workflow(udtutorial-05 + SOURCES UDTutorial_05.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(udtutorial-06 + SOURCES UDTutorial_06.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(udtutorial-07 + SOURCES UDTutorial_07.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + + + + diff --git a/Tutorials/PWGUD/UDTutorial_05.cxx b/Tutorials/PWGUD/UDTutorial_05.cxx new file mode 100644 index 00000000000..3a9bfb79605 --- /dev/null +++ b/Tutorials/PWGUD/UDTutorial_05.cxx @@ -0,0 +1,318 @@ +// 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 "iostream" +#include "TLorentzVector.h" +#include "TDatabasePDG.h" + +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "PWGUD/DataModel/UDTables.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" + +// using namespace std; +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +/// \brief Example task to study two pions candidates using SG derive data +/// \author Anisa Khatun +/// \date 10.10.2024 + +// Struct to define the analysis task +struct UDTutorial05 { + // SGSelector object to manage track and collision selections + SGSelector sgSelector; + + Configurable FV0_cut{"FV0", 100., "FV0A 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 ZDC_cut{"ZDC", 10., "ZDC threshold"}; + Configurable gap_Side{"gap", 2, "gap selection"}; + + // 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.01, "Track Pt"}; + Configurable TPC_cluster{"TPC_cluster", 50, "No.of TPC cluster"}; + + // Kinmatic cuts + Configurable PID_cut{"PID_cut", 5, "TPC PID"}; + Configurable Rap_cut{"Rap_cut", 0.9, "Track rapidity"}; + Configurable Mass_Max{"Mass_Max", 10, "Invariant Mass range high"}; + Configurable Mass_Min{"Mass_Min", 0, "Invariant Mass range low"}; + Configurable Pt_coherent{"Pt_coherent", 0.15, "Coherent selection"}; + + // defining histograms using histogram registry + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + //----------------------------------------------------------------------------------------------------------------------- + void init(o2::framework::InitContext&) + { + + registry.add("GapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); + registry.add("TrueGapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); + + // Fill counter to see effect of each selection criteria + auto hSelectionCounter = registry.add("hSelectionCounter", "hSelectionCounter;;NEvents", HistType::kTH1I, {{20, 0., 20.}}); + + TString SelectionCuts[16] = {"NoSelection", "gapside", "goodtracks", "truegap", "2collcontrib", "2goodtrk", "TPCPID", "Rap_cut", "unlikesign", "mass_cut", "coherent", "incoherent", "likesign", "mass_cut", "coherent", "incoherent"}; + + for (int i = 0; i < 16; i++) { + hSelectionCounter->GetXaxis()->SetBinLabel(i + 1, SelectionCuts[i].Data()); + } + // tracks + registry.add("hTracks", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + registry.add("hTracksPions", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + registry.add("TwoPion/h2TracksPions", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + + registry.add("hdEdx", "p vs dE/dx Signal", kTH2F, {{100, 0.0, 3.0}, {100, 0.0, 200.0}}); + registry.add("hdEdxPion", "p_{#pi} vs dE/dx Signal", kTH2F, {{100, 0.0, 3.0}, {100, 0.0, 200.0}}); + + registry.add("TwoPion/hNsigPi1vsPi2", "NSigmaPi(t1) vs NSigmapi (t2);n#sigma_{1};n#sigma_{2}", kTH2F, {{100, -15., 15.}, {100, -15., 15}}); + registry.add("TwoPion/hNsigEl1vsEl2", "NSigmaEl(t1) vs NSigmaEl (t2);n#sigma_{1};n#sigma_{2}", kTH2F, {{100, -15., 15.}, {100, -15., 15}}); + registry.add("TwoPion/hNsigPivsPt1", "Pt vs NSigmaPi (t1);#it{p_{t}}, GeV/c;n#sigma_{#pi}", kTH2F, {{100, 0., 2.5}, {100, -15., 15}}); + registry.add("TwoPion/hNsigPivsPt2", "Pt vs NSigmaPi (t2);#it{p_{t}}, GeV/c;n#sigma_{#pi}", kTH2F, {{100, 0., 2.5}, {100, -15., 15}}); + registry.add("TwoPion/hNsigElvsPt1", "Pt vs NSigmaEl (t1);#it{p_{t}}, GeV/c;n#sigma_{#e}", kTH2F, {{100, 0., 2.5}, {100, -15., 15}}); + registry.add("TwoPion/hNsigElvsPt2", "Pt vs NSigmaEl (t2);#it{p_{t}}, GeV/c;n#sigma_{#e}", kTH2F, {{100, 0., 2.5}, {100, -15., 15}}); + registry.add("TwoPion/hNsigMuvsPt1", "Pt vs NSigmaMu (t1);#it{p_{t}}, GeV/c;n#sigma_{#pi}", kTH2F, {{100, 0., 2.5}, {100, -15., 15}}); + registry.add("TwoPion/hNsigMuvsPt2", "Pt vs NSigmaMu (t2);#it{p_{t}}, GeV/c;n#sigma_{#pi}", kTH2F, {{100, 0., 2.5}, {100, -15., 15}}); + + registry.add("TwoPion/hPtsingle_track1", "Pt t1;#it{p_{t}}, GeV/c;", kTH1F, {{600, 0., 3.}}); + registry.add("TwoPion/hPtsingle_track2", "Pt t2;#it{p_{t}}, GeV/c;", kTH1F, {{600, 0., 3.}}); + registry.add("TwoPion/hEta_t1", "Eta of t1;#it{#eta};", kTH1F, {{100, -5., 5.}}); + registry.add("TwoPion/hEta_t2", "Eta of t2;#it{#eta};", kTH1F, {{100, -5., 5.}}); + registry.add("TwoPion/hP1", "P vs TPC signal;#it{P_{track}}, GeV/c; signal_{TPC} t1", kTH2F, {{100, 0., 2.}, {300, 0, 150}}); + registry.add("TwoPion/hTPCsig", "TPC signal;signal_{TPC} t2; signal_{TPC} t2", kTH2F, {{300, 0., 150.}, {300, 0, 150}}); + registry.add("TwoPion/hP2", "P vs TPC signal;#it{P_{track}}, GeV/c; signal_{TPC} t1", kTH2F, {{100, 0., 2.}, {300, 0, 150}}); + registry.add("TwoPion/hTPCsig1", "TPC signal;signal_{TPC} t2; signal_{TPC} t2", kTH2F, {{300, 0., 150.}, {300, 0, 150}}); + + registry.add("TwoPion/hMassLike", "m_{#pi#pi} [GeV/#it{c}^{2}]", kTH1F, {{20000, 0., 20.}}); + registry.add("TwoPion/hMassUnlike", "m_{#pi#pi} [GeV/#it{c}^{2}]", kTH1F, {{20000, 0., 20.}}); + registry.add("TwoPion/Coherent/hMassUnlikeCoherent", "m_{#pi#pi} [GeV/#it{c}^{2}]", kTH1F, {{20000, 0., 20.}}); + registry.add("TwoPion/Coherent/hMassLikeCoherent", "m_{#pi#pi} [GeV/#it{c}^{2}]", kTH1F, {{20000, 0., 20.}}); + registry.add("TwoPion/Incoherent/hMassUnlikeInCoherent", "m_{#pi#pi} [GeV/#it{c}^{2}]", kTH1F, {{20000, 0., 20.}}); + registry.add("TwoPion/Incoherent/hMassLikeInCoherent", "m_{#pi#pi} [GeV/#it{c}^{2}]", kTH1F, {{20000, 0., 20.}}); + + registry.add("TwoPion/hPt", "Pt;#it{p_{t}}, GeV/c;", kTH1D, {{1000, 0., 10.}}); + registry.add("TwoPion/hPtLike", "Pt;#it{p_{t}}, GeV/c;", kTH1D, {{1000, 0., 10.}}); + registry.add("TwoPion/hEta", "Eta;#it{#eta};", kTH1F, {{500, -10., 10.}}); + registry.add("TwoPion/hRap", "Rapidity;#it{y};", kTH1F, {{500, -10., 10.}}); + registry.add("TwoPion/hPhiSystem", "Phi;#it{#Phi};", kTH1F, {{250, 0. * TMath::Pi(), 2. * TMath::Pi()}}); + registry.add("TwoPion/hMPt", "Inv.M vs Pt;M, GeV/c^{2};#it{P_{t}}, GeV/c;", kTH2F, {{100, 0., 10.}, {100, 0., 10.}}); + } + + using udtracks = soa::Join; + using udtracksfull = soa::Join; + + using UDCollisionsFull = soa::Join; + + //__________________________________________________________________________ + // Main process + void process(UDCollisionsFull::iterator const& collision, udtracksfull const& tracks) + { + // No selection criteria + registry.fill(HIST("hSelectionCounter"), 0); + + // Accessing gap sides + int gapSide = collision.gapSide(); + if (gapSide < 0 || gapSide > 2) + return; + + registry.fill(HIST("hSelectionCounter"), 1); + + // Accessing FIT information for further exclusivity and/or inclusivity + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); + + // Intiating track parameters to select good tracks, values to be optimized in the configurables, parameters will be taken from SGtrackselector.h task included in the header + std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut, pt_cut}; + + registry.fill(HIST("GapSide"), gapSide); + registry.fill(HIST("TrueGapSide"), truegapSide); + + // Gap side to be selected in the configuables + gapSide = truegapSide; + + if (gapSide == gap_Side) { + + registry.fill(HIST("hSelectionCounter"), 2); + + //____________________________________________________________________________________ + + // Create LorentzVector to store all tracks, Pion tracks and TPC Pion PID + std::vector allTracks; + std::vector onlyPionTracks; + std::vector onlyPionSigma; + std::vector rawPionTracks; + TLorentzVector p; + + registry.fill(HIST("hTracks"), tracks.size()); + + for (auto t : tracks) { + // Apply good track selection criteria + if (!trackselector(t, parameters)) + continue; + + double dEdx = t.tpcSignal(); + + registry.fill(HIST("hdEdx"), t.tpcInnerParam() / t.sign(), dEdx); + + // Creating Lorenz vector to store raw tracks and piontracks + TLorentzVector a; + a.SetXYZM(t.px(), t.py(), t.pz(), o2::constants::physics::MassPionCharged); + allTracks.push_back(a); + + // Apply TPC pion sigma + auto nSigmaPi = t.tpcNSigmaPi(); + if (fabs(nSigmaPi) < PID_cut) { + onlyPionTracks.push_back(a); + onlyPionSigma.push_back(nSigmaPi); + rawPionTracks.push_back(t); + registry.fill(HIST("hdEdxPion"), t.tpcInnerParam() / t.sign(), dEdx); + } + } + + registry.fill(HIST("hTracksPions"), onlyPionTracks.size()); + //_____________________________________ + // Adding all onlypiontracks + for (auto pion : onlyPionTracks) { + p += pion; + } + + //_____________________________________ + // Selecting collisions with Two PV contributors + if (collision.numContrib() == 2) { + + registry.fill(HIST("hSelectionCounter"), 3); + + // Selecting only Two good tracks + if ((rawPionTracks.size() == 2) && (onlyPionTracks.size() == 2)) { + + registry.fill(HIST("hSelectionCounter"), 4); + + registry.fill(HIST("TwoPion/h2TracksPions"), onlyPionTracks.size()); + + registry.fill(HIST("TwoPion/hNsigPivsPt1"), onlyPionTracks[0].Pt(), rawPionTracks[0].tpcNSigmaPi()); + registry.fill(HIST("TwoPion/hNsigPivsPt2"), onlyPionTracks[1].Pt(), rawPionTracks[1].tpcNSigmaPi()); + registry.fill(HIST("TwoPion/hTPCsig"), rawPionTracks[0].tpcSignal(), rawPionTracks[1].tpcSignal()); + registry.fill(HIST("TwoPion/hNsigPi1vsPi2"), rawPionTracks[0].tpcNSigmaPi(), rawPionTracks[1].tpcNSigmaPi()); + + // Make sure two good tracks are with TPC pion sigma limit + if ((onlyPionSigma[0] * onlyPionSigma[0] + onlyPionSigma[1] * onlyPionSigma[1]) > (PID_cut * PID_cut)) { + return; + } + + registry.fill(HIST("hSelectionCounter"), 5); + + // Rapidity of midrapidity acceptance + if ((p.Rapidity() < -Rap_cut) || (p.Rapidity() > Rap_cut)) { + return; + } + + registry.fill(HIST("hSelectionCounter"), 6); + + // Two oppsotite sign tracks + if (rawPionTracks[0].sign() != rawPionTracks[1].sign()) { + + registry.fill(HIST("hSelectionCounter"), 7); + registry.fill(HIST("TwoPion/hMassUnlike"), p.M()); + + // Flexible mass limits, can be selected in the configurable + if ((p.M() > Mass_Min) && (p.M() < Mass_Max)) { + + registry.fill(HIST("hSelectionCounter"), 8); + + registry.fill(HIST("TwoPion/hPt"), p.Pt()); + registry.fill(HIST("TwoPion/hEta"), p.Eta()); + registry.fill(HIST("TwoPion/hRap"), p.Rapidity()); + registry.fill(HIST("TwoPion/hPhiSystem"), p.Phi()); + registry.fill(HIST("TwoPion/hMPt"), p.M(), p.Pt()); + + // flexible pt limit for selecting coherent Rho(0) + if (p.Pt() < Pt_coherent) { + + registry.fill(HIST("hSelectionCounter"), 9); + + // Quality Control plots after coherent Rho(0) selection + registry.fill(HIST("TwoPion/hEta_t1"), onlyPionTracks[0].Eta()); + registry.fill(HIST("TwoPion/hEta_t2"), onlyPionTracks[1].Eta()); + registry.fill(HIST("TwoPion/hPtsingle_track1"), onlyPionTracks[0].Pt()); + registry.fill(HIST("TwoPion/hPtsingle_track2"), onlyPionTracks[1].Pt()); + + registry.fill(HIST("TwoPion/hNsigMuvsPt1"), onlyPionTracks[0].Pt(), rawPionTracks[0].tpcNSigmaPi()); + registry.fill(HIST("TwoPion/hNsigMuvsPt2"), onlyPionTracks[1].Pt(), rawPionTracks[1].tpcNSigmaPi()); + registry.fill(HIST("TwoPion/hNsigElvsPt1"), onlyPionTracks[0].Pt(), rawPionTracks[0].tpcNSigmaEl()); + registry.fill(HIST("TwoPion/hNsigElvsPt2"), onlyPionTracks[1].Pt(), rawPionTracks[1].tpcNSigmaEl()); + registry.fill(HIST("TwoPion/hNsigEl1vsEl2"), rawPionTracks[0].tpcNSigmaPi(), rawPionTracks[1].tpcNSigmaPi()); + + registry.fill(HIST("TwoPion/hP1"), onlyPionTracks[0].P(), rawPionTracks[0].tpcSignal()); + registry.fill(HIST("TwoPion/hP2"), onlyPionTracks[1].P(), rawPionTracks[1].tpcSignal()); + registry.fill(HIST("TwoPion/hTPCsig1"), rawPionTracks[0].tpcSignal(), rawPionTracks[1].tpcSignal()); + + registry.fill(HIST("TwoPion/Coherent/hMassUnlikeCoherent"), p.M()); + } + // Incoherent Rho(0) selection + if (p.Pt() > Pt_coherent) { + registry.fill(HIST("hSelectionCounter"), 10); + registry.fill(HIST("TwoPion/Incoherent/hMassUnlikeInCoherent"), p.M()); + } + } + } + + // Same charge particles + if (rawPionTracks[0].sign() == rawPionTracks[1].sign()) { + + registry.fill(HIST("hSelectionCounter"), 11); + registry.fill(HIST("TwoPion/hMassLike"), p.M()); + + // Mass limit + if ((p.M() > Mass_Min) && (p.M() < Mass_Max)) { + + registry.fill(HIST("hSelectionCounter"), 12); + registry.fill(HIST("TwoPion/hPtLike"), p.Pt()); + + // Coherent Rho(0) selection + if (p.Pt() < Pt_coherent) { + + registry.fill(HIST("hSelectionCounter"), 13); + registry.fill(HIST("TwoPion/Coherent/hMassLikeCoherent"), p.M()); + } + // Incoherent Rho(0) selection + if (p.Pt() > Pt_coherent) { + + registry.fill(HIST("hSelectionCounter"), 14); + registry.fill(HIST("TwoPion/Incoherent/hMassLikeInCoherent"), p.M()); + } + } + } + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"udtutorial05"})}; +} diff --git a/Tutorials/PWGUD/UDTutorial_06.cxx b/Tutorials/PWGUD/UDTutorial_06.cxx new file mode 100644 index 00000000000..9b1d1f55895 --- /dev/null +++ b/Tutorials/PWGUD/UDTutorial_06.cxx @@ -0,0 +1,232 @@ +// 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 task is to compute invariant mass of dimuon at forward rapidity for UPC events. +/// \author Anisa Khatun +/// \date 10.10.2024 + +// O2 headers +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" + +// O2Physics headers +#include "PWGUD/DataModel/UDTables.h" +#include "PWGUD/Core/UDHelpers.h" +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsParameters/GRPLHCIFData.h" +#include "DataFormatsParameters/GRPECSObject.h" + +// ROOT headers +#include "TSystem.h" +#include "TDatabasePDG.h" +#include "TLorentzVector.h" +#include "TLorentzVector.h" +#include "TMath.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using namespace std; + +struct UDTutorial06 { + + // Histogram registry: an object to hold your histograms + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + Configurable nBinsPt{"nBinsPt", 500, "N bins in pT histo"}; + Configurable nBinsMass{"nBinsMass", 500, "N bins in InvMass histo"}; + + using UDCollisionsFwd = soa::Join; + using fwdtraks = soa::Join; + + void init(InitContext const&) + { + // define axes you want to use + const AxisSpec axisCounter{1, 0, +1, ""}; + const AxisSpec axisEta{80, -5.0, -2.0, "#eta"}; + const AxisSpec axisPt{nBinsPt, 0.0, 10.0, "p_{T}"}; + const AxisSpec axisM{nBinsMass, 0.0, 10.0, "M_{#pi#pi}"}; + const AxisSpec axisPhi{120, -TMath::Pi(), -TMath::Pi(), "#phi"}; + const AxisSpec axisRapidity{80, -5.0, -2.0, "#it{y}"}; + + // create histograms + // Fill counter to see effect of each selection criteria + auto hSelectionCounter = registry.add("hSelectionCounter", "hSelectionCounter;;NEvents", HistType::kTH1I, {{15, 0., 15.}}); + TString SelectionCuts[13] = {"NoSelection", "V0A", "rAbs1", "rAbs2", "trackmatch", "eta1", "eta2", "trackpt", "pair rapidity", "mass_cut", "unlikesign", "likesign"}; + + for (int i = 0; i < 12; i++) { + hSelectionCounter->GetXaxis()->SetBinLabel(i + 1, SelectionCuts[i].Data()); + } + + registry.add("eventCounter", "eventCounter", kTH1F, {axisCounter}); + registry.add("hnumContrib", "hnumContrib;;#counts", kTH1D, {{100, -0.5, 99.5}}); + registry.add("hTracks1", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + registry.add("hTracks2", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + registry.add("hTracksMuons", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + + registry.add("etaMuon1", "etaMuon1", kTH1F, {axisEta}); + registry.add("ptMuon1", "ptMuon1", kTH1F, {axisPt}); + registry.add("phiMuon1", "phiMuon1", kTH1F, {axisPhi}); + + registry.add("etaMuon2", "etaMuon2", kTH1F, {axisEta}); + registry.add("ptMuon2", "ptMuon2", kTH1F, {axisPt}); + registry.add("phiMuon2", "phiMuon2", kTH1F, {axisPhi}); + + registry.add("YJpsi", "YJpsi", kTH1F, {axisRapidity}); + registry.add("PhiJpsi", "PhiJpsi", kTH1F, {axisPhi}); + + registry.add("MJpsiUnlike", "MJpsi", kTH1F, {axisM}); + registry.add("PtJpsiUnlike", "PtJpsi", kTH1F, {axisPt}); + registry.add("MJpsiLike", "MJpsi", kTH1F, {axisM}); + registry.add("PtJpsiLike", "PtJpsi", kTH1F, {axisPt}); + } + + //____________________________________________________________________________________________ + + template + void processCandidate(UDCollisionsFwd::iterator const& collision, TTrack1& tr1, TTrack2& tr2) + { + registry.fill(HIST("eventCounter"), 0.5); + registry.fill(HIST("hnumContrib"), collision.numContrib()); + registry.fill(HIST("hTracks1"), tr1.size()); + registry.fill(HIST("hTracks2"), tr2.size()); + registry.fill(HIST("hSelectionCounter"), 0); + + // V0A selection + const auto& ampsV0A = collision.amplitudesV0A(); + const auto& ampsRelBCsV0A = collision.ampRelBCsV0A(); + for (unsigned int i = 0; i < ampsV0A.size(); ++i) { + if (std::abs(ampsRelBCsV0A[i]) <= 1) { + if (ampsV0A[i] > 100.) + return; + } + } + + // T0A selection + const auto& ampsT0A = collision.amplitudesT0A(); + const auto& ampsRelBCsT0A = collision.ampRelBCsT0A(); + for (unsigned int i = 0; i < ampsT0A.size(); ++i) { + if (std::abs(ampsRelBCsT0A[i]) <= 1) { + if (ampsT0A[i] > 100.) + return; + } + } + + registry.fill(HIST("hSelectionCounter"), 1); + + // absorber end selection + if (tr1.rAtAbsorberEnd() < 17.6 || tr1.rAtAbsorberEnd() > 89.5) + return; + registry.fill(HIST("hSelectionCounter"), 2); + if (tr2.rAtAbsorberEnd() < 17.6 || tr2.rAtAbsorberEnd() > 89.5) + return; + registry.fill(HIST("hSelectionCounter"), 3); + + // MCH-MID match selection + if ((tr1.chi2MatchMCHMID() < 0) || (tr2.chi2MatchMCHMID() < 0)) + return; + registry.fill(HIST("hSelectionCounter"), 4); + + bool isUnlikeSign = (tr1.sign() + tr2.sign()) == 0; + bool isLikeSign = ((tr1.sign() + tr2.sign()) != 0); + + // track selection + TLorentzVector p1, p2; + p1.SetXYZM(tr1.px(), tr1.py(), tr1.pz(), o2::constants::physics::MassMuon); + p2.SetXYZM(tr2.px(), tr2.py(), tr2.pz(), o2::constants::physics::MassMuon); + TLorentzVector p = p1 + p2; + + // eta cut on each track + if (p1.Eta() < -4.0 || p1.Eta() > -2.5) + return; + registry.fill(HIST("hSelectionCounter"), 5); + if (p2.Eta() < -4.0 || p2.Eta() > -2.5) + return; + registry.fill(HIST("hSelectionCounter"), 6); + + // pt cut on track + if ((p1.Pt() < 0.0) || (p2.Pt() < 0.0)) + return; + registry.fill(HIST("hSelectionCounter"), 7); + + if ((p.Rapidity() < -4.0) || (p.Rapidity() > -2.5)) + return; + registry.fill(HIST("hSelectionCounter"), 8); + + // cuts on pair kinematics + if (!(p.M() > 2.5 && p.M() < 5.0)) + return; + registry.fill(HIST("hSelectionCounter"), 9); + + registry.fill(HIST("hTracksMuons"), collision.numContrib()); + registry.fill(HIST("ptMuon1"), p1.Pt()); + registry.fill(HIST("ptMuon2"), p2.Pt()); + registry.fill(HIST("etaMuon1"), p1.Eta()); + registry.fill(HIST("etaMuon2"), p2.Eta()); + registry.fill(HIST("phiMuon1"), p1.Phi()); + registry.fill(HIST("phiMuon2"), p2.Phi()); + registry.fill(HIST("YJpsi"), p.Rapidity()); + registry.fill(HIST("PhiJpsi"), p.Phi()); + + if (isUnlikeSign) { + registry.fill(HIST("hSelectionCounter"), 10); + registry.fill(HIST("MJpsiUnlike"), p.M()); + registry.fill(HIST("PtJpsiUnlike"), p.Pt()); + } + + if (isLikeSign) { + registry.fill(HIST("hSelectionCounter"), 11); + registry.fill(HIST("MJpsiLike"), p.M()); + registry.fill(HIST("PtJpsiLike"), p.Pt()); + } + } + + //____________________________________________________________________________________________ + + // Template that collects all collision IDs and track per collision + template + void collectCandIDs(std::unordered_map>& tracksPerCand, TTracks& tracks) + { + for (const auto& tr : tracks) { + int32_t candId = tr.udCollisionId(); + if (candId < 0) { + continue; + } + tracksPerCand[candId].push_back(tr.globalIndex()); + } + } + + //____________________________________________________________________________________________ + + // process candidates with 2 forward tracks + void process(UDCollisionsFwd const& eventCandidates, + fwdtraks const& fwdTracks) + { + std::unordered_map> tracksPerCand; + collectCandIDs(tracksPerCand, fwdTracks); + + // assuming that candidates have exatly 2 forward tracks + for (const auto& item : tracksPerCand) { + int32_t trId1 = item.second[0]; + int32_t trId2 = item.second[1]; + int32_t candID = item.first; + const auto& collision = eventCandidates.iteratorAt(candID); + const auto& tr1 = fwdTracks.iteratorAt(trId1); + const auto& tr2 = fwdTracks.iteratorAt(trId2); + processCandidate(collision, tr1, tr2); + } + } +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"udtutorial06"})}; +} diff --git a/Tutorials/PWGUD/UDTutorial_07.cxx b/Tutorials/PWGUD/UDTutorial_07.cxx new file mode 100644 index 00000000000..f2a5616f00d --- /dev/null +++ b/Tutorials/PWGUD/UDTutorial_07.cxx @@ -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. +// +#include "iostream" +#include +#include +#include "Framework/runDataProcessing.h" +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "PWGUD/DataModel/UDTables.h" +#include "TLorentzVector.h" +#include "PWGUD/Core/SGSelector.h" +#include "PWGUD/Core/SGTrackSelector.h" + +using namespace std; +using namespace o2; +using namespace o2::aod; +using namespace o2::framework; +using namespace o2::framework::expressions; + +/// \brief This is an example to fill outputs in a tree, useful for post processing analysis +/// \author Amrit Gautam +/// \author Anisa Khatun +/// \date 10.10.2024 + +namespace o2::aod +{ +namespace tree +{ +// track tables +DECLARE_SOA_COLUMN(SIGMAPI, sigmapi, std::vector); +DECLARE_SOA_COLUMN(PT, Pt, float); +DECLARE_SOA_COLUMN(RAP, rap, float); +DECLARE_SOA_COLUMN(PHI, Phi, float); +DECLARE_SOA_COLUMN(TOTSIGN, totsign, int); +DECLARE_SOA_COLUMN(MASS, mass, float); +DECLARE_SOA_COLUMN(NPVTRACK, npvtrack, int); +DECLARE_SOA_COLUMN(PTS, Pts, std::vector); +DECLARE_SOA_COLUMN(ETAS, etas, std::vector); +DECLARE_SOA_COLUMN(PHIS, Phis, std::vector); +DECLARE_SOA_COLUMN(SIGNS, Signs, std::vector); +} // namespace tree + +DECLARE_SOA_TABLE(TREE, "AOD", "Tree", + tree::PT, + tree::RAP, + tree::PHI, + tree::MASS, + tree::TOTSIGN, + tree::NPVTRACK, + tree::SIGMAPI, + tree::PTS, + tree::ETAS, + tree::PHIS, + tree::SIGNS); + +} // namespace o2::aod + +struct UDTutorial07 { + SGSelector sgSelector; + Produces tree; + + Configurable FV0_cut{"FV0", 100., "FV0A threshold"}; + Configurable FT0A_cut{"FT0A", 200., "FT0A threshold"}; + Configurable FT0C_cut{"FT0C", 100., "FT0C threshold"}; + Configurable FDDA_cut{"FDDA", 10000., "FDDA threshold"}; + Configurable FDDC_cut{"FDDC", 10000., "FDDC threshold"}; + Configurable ZDC_cut{"ZDC", 10., "ZDC threshold"}; + Configurable gap_Side{"gap", 2, "gap selection"}; + + // 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"}; + Configurable TPC_cluster{"TPC_cluster", 50, "No.of TPC cluster"}; + + // Kinmatic cuts + Configurable PID_cut{"PID_cut", 5, "TPC PID"}; + Configurable Rap_cut{"Rap_cut", 0.9, "Track rapidity"}; + Configurable Mass_Max{"Mass_Max", 10, "Invariant Mass range high"}; + Configurable Mass_Min{"Mass_Min", 0, "Invariant Mass range low"}; + Configurable Pt_coherent{"Pt_coherent", 0.15, "Coherent selection"}; + + // defining histograms using histogram registry + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; + + //----------------------------------------------------------------------------------------------------------------------- + void init(o2::framework::InitContext&) + { + + registry.add("GapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); + registry.add("TrueGapSide", "Gap Side; Entries", kTH1F, {{4, -1.5, 2.5}}); + + // Fill counter to see effect of each selection criteria + auto hSelectionCounter = registry.add("hSelectionCounter", "hSelectionCounter;;NEvents", HistType::kTH1I, {{10, 0., 10.}}); + TString SelectionCuts[7] = {"NoSelection", "gapside", "goodtracks", "truegap", "2collcontrib", "2goodtrk"}; + for (int i = 0; i < 7; i++) { + hSelectionCounter->GetXaxis()->SetBinLabel(i + 1, SelectionCuts[i].Data()); + } + + // Fill histograms to cross-check the selected numbers + registry.add("hTracks", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + registry.add("hTracksPions", "N_{tracks}", kTH1F, {{100, -0.5, 99.5}}); + } + + using udtracks = soa::Join; + using udtracksfull = soa::Join; + using UDCollisionsFull = soa::Join; + //__________________________________________________________________________ + // Main process + void process(UDCollisionsFull::iterator const& collision, udtracksfull const& tracks) + { + registry.fill(HIST("hSelectionCounter"), 0); + + // Accessing gap sides + int gapSide = collision.gapSide(); + if (gapSide < 0 || gapSide > 2) + return; + + registry.fill(HIST("hSelectionCounter"), 1); + + // Accessing FIT information for further exclusivity and/or inclusivity + float FIT_cut[5] = {FV0_cut, FT0A_cut, FT0C_cut, FDDA_cut, FDDC_cut}; + int truegapSide = sgSelector.trueGap(collision, FIT_cut[0], FIT_cut[1], FIT_cut[2], ZDC_cut); + + // Intiating track parameters to select good tracks, values to be optimized in the configurables, parameters will be taken from SGtrackselector.h task included in the header + std::vector parameters = {PV_cut, dcaZ_cut, dcaXY_cut, tpcChi2_cut, tpcNClsFindable_cut, itsChi2_cut, eta_cut, pt_cut}; + + registry.fill(HIST("GapSide"), gapSide); + registry.fill(HIST("TrueGapSide"), truegapSide); + + // Gap side to be selected in the configuables + gapSide = truegapSide; + + registry.fill(HIST("hSelectionCounter"), 2); + //_____________________________________ + // Create LorentzVector to store track information + std::vector allTracks; + std::vector onlyPionTracks; + std::vector onlyPionSigma; + std::vector rawPionTracks; + std::vector trackpt; + std::vector tracketa; + std::vector trackphi; + std::vector tracksign; + std::vector pitpcpid; + + TLorentzVector p; + + if (gapSide == gap_Side) { + + registry.fill(HIST("hSelectionCounter"), 3); + + for (auto t : tracks) { + + // Apply good track selection criteria + if (!trackselector(t, parameters)) + continue; + + // Creating Lorenz vector to store raw tracks and piontracks + TLorentzVector a; + a.SetXYZM(t.px(), t.py(), t.pz(), o2::constants::physics::MassPionCharged); + allTracks.push_back(a); + + // Apply TPC pion sigma + auto nSigmaPi = t.tpcNSigmaPi(); + if (fabs(nSigmaPi) < PID_cut) { + onlyPionTracks.push_back(a); + onlyPionSigma.push_back(nSigmaPi); + rawPionTracks.push_back(t); + } + } + registry.fill(HIST("hTracksPions"), onlyPionTracks.size()); + + //_____________________________________ + // Selecting collisions with Two PV contributors + if (collision.numContrib() == 2) { + + registry.fill(HIST("hSelectionCounter"), 4); + + // Selecting only Two good tracks + if ((rawPionTracks.size() == 2) && (allTracks.size() == 2)) { + + registry.fill(HIST("hSelectionCounter"), 4); + + // Creating rhos + for (auto pion : onlyPionTracks) { + p += pion; + } + + for (auto rtrk : rawPionTracks) { + TLorentzVector itrk; + itrk.SetXYZM(rtrk.px(), rtrk.py(), rtrk.pz(), o2::constants::physics::MassPionCharged); + trackpt.push_back(itrk.Pt()); + tracketa.push_back(itrk.Eta()); + trackphi.push_back(itrk.Phi()); + tracksign.push_back(rtrk.sign()); + pitpcpid.push_back(rtrk.tpcNSigmaPi()); + } + + int sign = 0; + for (auto rawPion : rawPionTracks) { + sign += rawPion.sign(); + } + // Filling tree, make to be consistent with the declared tables + tree(p.Pt(), p.Y(), p.Phi(), p.M(), sign, collision.numContrib(), pitpcpid, trackpt, tracketa, trackphi, tracksign); + } + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"udtutorial07"})}; +} 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/pid.cxx b/Tutorials/src/pidTpcTof.cxx similarity index 96% rename from Tutorials/src/pid.cxx rename to Tutorials/src/pidTpcTof.cxx index bc51f07ab4c..777c09c1920 100644 --- a/Tutorials/src/pid.cxx +++ b/Tutorials/src/pidTpcTof.cxx @@ -10,7 +10,7 @@ // or submit itself to any jurisdiction. /// -/// \file pid.cxx +/// \file pidTpcTof.cxx /// \author Nicolò Jacazio nicolo.jacazio@cern.ch /// \brief Task to test the PID features and utilities /// @@ -30,7 +30,7 @@ using namespace o2::framework::expressions; using namespace o2::track; /// Task to produce the response table -struct pid { +struct pidTpcTof { void init(o2::framework::InitContext&) { } @@ -75,5 +75,5 @@ struct pid { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - return WorkflowSpec{adaptAnalysisTask(cfgc)}; + return WorkflowSpec{adaptAnalysisTask(cfgc)}; } 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