-
Notifications
You must be signed in to change notification settings - Fork 634
[PWGEM] Add optional PCM material-budget weights in PCMPCM #15139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yelmardb
wants to merge
8
commits into
AliceO2Group:master
Choose a base branch
from
yelmardb:yelmard-pcmpcm-omega-mb-weights
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+186
−9
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
81cc8a7
Add optional PCM material-budget weights in PCMPCM
d6ddbb5
Apply formatting fixes
96aa676
Apply clang-format include ordering
8b00868
Apply clang-format
9a42fad
Resolve rebase conflict in Pi0EtaToGammaGamma.h
b264ddc
Resolve remaining rebase conflicts in Pi0EtaToGammaGamma headers
0b26ccb
Move MaterialBudgetWeights header to Core and update includes
145ad26
Keep o2::aod::V0PhotonsKFPrefilterBitDerived in Pi0EtaToGammaGammaMCP…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| // 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 materialBudgetWeights.cxx | ||
| /// | ||
| /// \brief This code produces a table to retrieve material budget weights. The table is to be join with V0PhotonKF | ||
| /// | ||
| /// \author Youssef El Mard (youssef.el.mard.bouziani@cern.ch) | ||
| /// | ||
|
|
||
| #ifndef PWGEM_PHOTONMESON_CORE_MATERIALBUDGETWEIGHTS_H_ | ||
| #define PWGEM_PHOTONMESON_CORE_MATERIALBUDGETWEIGHTS_H_ | ||
|
|
||
| #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" | ||
|
|
||
| #include "Framework/ASoAHelpers.h" | ||
| #include "Framework/AnalysisDataModel.h" | ||
| #include "Framework/AnalysisTask.h" | ||
| #include "Framework/Logger.h" | ||
| #include <CCDB/BasicCCDBManager.h> | ||
| #include <Framework/Configurable.h> | ||
| #include <Framework/InitContext.h> | ||
|
|
||
| #include <map> | ||
| #include <string> | ||
|
|
||
| using namespace o2; | ||
| using namespace o2::soa; | ||
| using namespace o2::framework; | ||
|
|
||
| using MyV0PhotonsMB = o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds>; | ||
| using MyV0PhotonMB = MyV0PhotonsMB::iterator; | ||
|
|
||
| struct MaterialBudgetWeights { | ||
| Produces<aod::V0PhotonOmegaMBWeights> omegaMBWeight; | ||
|
|
||
| Configurable<std::string> ccdbUrl{"ccdbUrl", "http://ccdb-test.cern.ch:8080", "CCDB url"}; | ||
| Configurable<std::string> mbWeightsPath{"mbWeightsPath", "Users/y/yelmard/MaterialBudget/OmegaMBWeights", "Path of the mb weights"}; | ||
|
|
||
| o2::ccdb::CcdbApi ccdbApi; | ||
| TH1F* hOmegaMBFromCCDB = nullptr; | ||
|
|
||
| void init(InitContext&) | ||
| { | ||
| // Load CCDB object only when the real process is enabled | ||
| if (!doprocessMC) { | ||
| LOG(info) << "MaterialBudgetWeights: dummy mode enabled -> no CCDB query, will write weight=1"; | ||
| return; | ||
| } | ||
|
|
||
| ccdbApi.init(ccdbUrl.value); | ||
| std::map<std::string, std::string> metadata; | ||
| LOG(info) << "MaterialBudgetWeights: loading Omega MB histogram from CCDB at path: " << mbWeightsPath.value; | ||
|
|
||
| hOmegaMBFromCCDB = ccdbApi.retrieveFromTFileAny<TH1F>(mbWeightsPath, metadata, -1); | ||
|
|
||
| if (!hOmegaMBFromCCDB) { | ||
| LOG(fatal) << "MaterialBudgetWeights: CCDB object is missing. Path=" << mbWeightsPath.value; | ||
| } | ||
| } | ||
|
|
||
| float computeMBWeight(float v0Rxy) | ||
| { | ||
| if (!hOmegaMBFromCCDB) { | ||
| return 1.f; | ||
| } | ||
|
|
||
| int binMBWeight = hOmegaMBFromCCDB->FindBin(v0Rxy); | ||
| if (binMBWeight < 1 || binMBWeight > hOmegaMBFromCCDB->GetNbinsX()) { | ||
| LOG(debug) << "MaterialBudgetWeights: v0Rxy out of histogram range, returning 1"; | ||
| return 1.f; | ||
| } | ||
|
|
||
| return hOmegaMBFromCCDB->GetBinContent(binMBWeight); | ||
| } | ||
|
|
||
| // real process (weights from CCDB) | ||
| void processMC(MyV0PhotonMB const& v0) | ||
| { | ||
| static bool once = false; | ||
| if (!once) { | ||
| LOG(info) << "MaterialBudgetWeights: standard process running"; | ||
| once = true; | ||
| } | ||
| if (!hOmegaMBFromCCDB) { // histogram not loaded => behave like dummy | ||
| omegaMBWeight(1.f); | ||
| return; | ||
| } | ||
| omegaMBWeight(computeMBWeight(v0.v0radius())); | ||
| } | ||
|
|
||
| // dummy process (always weight = 1) | ||
| void processDummy(MyV0PhotonMB const&) | ||
| { | ||
| static bool once = false; | ||
| if (!once) { | ||
| LOG(info) << "MaterialBudgetWeights: processDummy running"; | ||
| once = true; | ||
| } | ||
| omegaMBWeight(1.f); | ||
| } | ||
|
|
||
| PROCESS_SWITCH(MaterialBudgetWeights, processMC, "Fill MB weights from CCDB", false); | ||
| PROCESS_SWITCH(MaterialBudgetWeights, processDummy, "Fill dummy MB weights (=1)", true); | ||
| }; | ||
|
|
||
| #endif // PWGEM_PHOTONMESON_CORE_MATERIALBUDGETWEIGHTS_H_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| // All rights not expressly granted are reserved. | ||
| // | ||
| // This software is distributed under the terms of the GNU General Public | ||
| // License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
| /// | ||
| /// \file MaterialBudgetWeights.h | ||
| /// | ||
| /// \brief This code produces a table to retrieve material budget weights. The table is to be join with V0PhotonKF | ||
| /// | ||
| /// \author Youssef El Mard (youssef.el.mard.bouziani@cern.ch) | ||
|
|
||
| #include "PWGEM/PhotonMeson/Core/MaterialBudgetWeights.h" | ||
|
|
||
| #include "Framework/runDataProcessing.h" | ||
|
|
||
| using namespace o2::framework; | ||
|
|
||
| WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) | ||
| { | ||
| return WorkflowSpec{adaptAnalysisTask<MaterialBudgetWeights>(cfgc)}; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| /// \brief This code loops over photons and makes pairs for neutral mesons analyses in MC for PCM-PCM. | ||
| /// \author D. Sekihata, daiki.sekihata@cern.ch | ||
|
|
||
| #include "PWGEM/PhotonMeson/Core/MaterialBudgetWeights.h" | ||
| #include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h" | ||
| #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" | ||
| #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" | ||
|
|
@@ -26,12 +27,13 @@ using namespace o2::aod; | |
| using namespace o2::framework; | ||
| using namespace o2::aod::pwgem::photonmeson::photonpair; | ||
|
|
||
| using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived>>; | ||
| using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived, o2::aod::V0PhotonOmegaMBWeights>>; | ||
| using MyMCV0Legs = soa::Join<aod::V0Legs, aod::V0LegMCLabels>; | ||
|
|
||
| WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) | ||
| { | ||
| return WorkflowSpec{ | ||
| adaptAnalysisTask<MaterialBudgetWeights>(cfgc), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line should not be here |
||
| adaptAnalysisTask<Pi0EtaToGammaGammaMC<PairType::kPCMPCM, MyV0Photons, MyMCV0Legs>>(cfgc, TaskName{"pi0eta-to-gammagamma-mc-pcmpcm"}), | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| /// \brief This code loops over photons and makes pairs for neutral mesons analyses for PCM-PCM. | ||
| /// \author D. Sekihata, daiki.sekihata@cern.ch | ||
|
|
||
| #include "PWGEM/PhotonMeson/Core/MaterialBudgetWeights.h" | ||
| #include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" | ||
| #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" | ||
| #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" | ||
|
|
@@ -26,11 +27,12 @@ using namespace o2::aod; | |
| using namespace o2::framework; | ||
| using namespace o2::aod::pwgem::photonmeson::photonpair; | ||
|
|
||
| using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived>>; | ||
| using MyV0Photons = o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived, o2::aod::V0PhotonOmegaMBWeights>>; | ||
|
|
||
| WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) | ||
| { | ||
| return WorkflowSpec{ | ||
| adaptAnalysisTask<MaterialBudgetWeights>(cfgc), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
| adaptAnalysisTask<Pi0EtaToGammaGamma<PairType::kPCMPCM, MyV0Photons, aod::V0Legs>>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmpcm"}), | ||
| }; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.