-
Notifications
You must be signed in to change notification settings - Fork 632
[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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,11 +226,12 @@ struct Pi0EtaToGammaGamma { | |
| //--------------------------------------------------------------------------- | ||
| // Preslices and partitions | ||
| o2::framework::SliceCache cache; | ||
| o2::framework::PresliceOptional<o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived>>> perCollision_pcm = o2::aod::v0photonkf::emphotoneventId; | ||
| o2::framework::PresliceOptional<o2::soa::Join<o2::aod::EmEmcClusters, o2::aod::EMCEMEventIds>> perCollision_emc = o2::aod::emccluster::emphotoneventId; | ||
| o2::framework::PresliceOptional<o2::soa::Join<o2::aod::PHOSClusters, o2::aod::PHOSEMEventIds>> perCollision_phos = o2::aod::phoscluster::emphotoneventId; | ||
| o2::framework::PresliceOptional<o2::soa::Filtered<o2::soa::Join<o2::aod::EMPrimaryElectronsFromDalitz, o2::aod::EMPrimaryElectronDaEMEventIds, o2::aod::EMPrimaryElectronsPrefilterBitDerived>>> perCollision_electron = o2::aod::emprimaryelectronda::emphotoneventId; | ||
|
|
||
| o2::framework::PresliceOptional< | ||
| o2::soa::Filtered<o2::soa::Join<o2::aod::V0PhotonsKF, o2::aod::V0KFEMEventIds, o2::aod::V0PhotonsKFPrefilterBitDerived, o2::aod::V0PhotonOmegaMBWeights>>> | ||
| perCollision_pcm = o2::aod::v0photonkf::emeventId; | ||
| o2::framework::PresliceOptional<o2::soa::Join<o2::aod::EmEmcClusters, o2::aod::EMCEMEventIds>> perCollision_emc = o2::aod::emccluster::emeventId; | ||
| o2::framework::PresliceOptional<o2::soa::Join<o2::aod::PHOSClusters, o2::aod::PHOSEMEventIds>> perCollision_phos = o2::aod::phoscluster::emeventId; | ||
| o2::framework::PresliceOptional<o2::soa::Filtered<o2::soa::Join<o2::aod::EMPrimaryElectronsFromDalitz, o2::aod::EMPrimaryElectronEMEventIds, o2::aod::EMPrimaryElectronsPrefilterBitDerived>>> perCollision_electron = o2::aod::emprimaryelectron::emeventId; | ||
|
Comment on lines
-229
to
+234
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. Please make sure you are using the new |
||
| o2::framework::PresliceOptional<o2::aod::EmEmcMTracks> perEMCClusterMT = o2::aod::trackmatching::emEmcClusterId; | ||
| o2::framework::PresliceOptional<o2::aod::EmEmcMSTracks> perEMCClusterMS = o2::aod::trackmatching::emEmcClusterId; | ||
|
|
||
|
|
@@ -879,7 +880,16 @@ struct Pi0EtaToGammaGamma { | |
| continue; | ||
| } | ||
|
|
||
| fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), weight); | ||
| float wpair = weight; | ||
|
|
||
| if constexpr (requires { g1.omegaMBWeight(); }) { | ||
| wpair *= g1.omegaMBWeight(); | ||
| } | ||
| if constexpr (requires { g2.omegaMBWeight(); }) { | ||
| wpair *= g2.omegaMBWeight(); | ||
| } | ||
|
|
||
| fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), wpair); | ||
|
|
||
| if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) { | ||
| emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::dilepton::utils::EMTrack(g1.pt(), g1.eta(), g1.phi(), 0)); | ||
|
|
||
| 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/Utils/MaterialBudgetWeights.h" | ||
|
|
||
| #include "Framework/runDataProcessing.h" | ||
|
|
||
| using namespace o2::framework; | ||
|
|
||
| WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) | ||
| { | ||
| return WorkflowSpec{adaptAnalysisTask<MaterialBudgetWeights>(cfgc)}; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
|
|
||
| #include "PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h" | ||
| #include "PWGEM/PhotonMeson/DataModel/gammaTables.h" | ||
| #include "PWGEM/PhotonMeson/Utils/MaterialBudgetWeights.h" | ||
| #include "PWGEM/PhotonMeson/Utils/PairUtilities.h" | ||
|
|
||
| #include <Framework/AnalysisDataModel.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>>; | ||
|
Comment on lines
-29
to
+30
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. Wrong .cxx, this should be added in MC not in data. |
||
|
|
||
| WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) | ||
| { | ||
| return WorkflowSpec{ | ||
| adaptAnalysisTask<MaterialBudgetWeights>(cfgc), | ||
| adaptAnalysisTask<Pi0EtaToGammaGamma<PairType::kPCMPCM, MyV0Photons, aod::V0Legs>>(cfgc, TaskName{"pi0eta-to-gammagamma-pcmpcm"}), | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| // 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_UTILS_MATERIALBUDGETWEIGHTS_H_ | ||
| #define PWGEM_PHOTONMESON_UTILS_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"}; | ||
| Configurable<bool> runWithMBWeights{"runWithMBWeights", false, "Run task using material-budget weights for PCM photons"}; | ||
|
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.
if (doprocessName){
...
}inside the init function to only load the histogram if the non dummy process function is used. |
||
|
|
||
| o2::ccdb::CcdbApi ccdbApi; | ||
| TH1F* hOmegaMBFromCCDB = nullptr; | ||
|
|
||
| void init(InitContext&) | ||
| { | ||
| if (!runWithMBWeights) { | ||
| LOG(info) << "MaterialBudgetWeights: runWithMBWeights=false -> 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: runWithMBWeights=true but CCDB object is missing. Path=" << mbWeightsPath.value; | ||
| } | ||
| } | ||
|
|
||
| float computeMBWeight(float v0Rxy) | ||
| { | ||
| if (!hOmegaMBFromCCDB) { | ||
| LOG(fatal) << "MaterialBudgetWeights: internal error: histogram nullptr while runWithMBWeights=true"; | ||
| } | ||
|
|
||
| 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); | ||
| } | ||
|
|
||
| void process(MyV0PhotonMB const& v0) | ||
| { | ||
| if (!runWithMBWeights) { | ||
| omegaMBWeight(1.f); | ||
| return; | ||
| } | ||
|
|
||
| omegaMBWeight(computeMBWeight(v0.v0radius())); | ||
| } | ||
| }; | ||
|
|
||
|
Comment on lines
+85
to
+95
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. Having a dummyProcess function which fills the weights with 1 is needed, since the weights are now needed for all MC PCM Photon analysis technically. |
||
| #endif // PWGEM_PHOTONMESON_UTILS_MATERIALBUDGETWEIGHTS_H_ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong header, the weights should be used in MC not in data