diff --git a/PWGLF/DataModel/mcCentrality.h b/PWGLF/DataModel/mcCentrality.h index 86e97eb8c33..fdbe1426e52 100644 --- a/PWGLF/DataModel/mcCentrality.h +++ b/PWGLF/DataModel/mcCentrality.h @@ -21,9 +21,10 @@ #define PWGLF_DATAMODEL_MCCENTRALITY_H_ // O2 includes +#include "Common/DataModel/Centrality.h" + #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" -#include "Common/DataModel/Centrality.h" #include "Framework/Logger.h" namespace o2::aod diff --git a/PWGLF/TableProducer/Common/mcCentrality.cxx b/PWGLF/TableProducer/Common/mcCentrality.cxx index 690d049af4d..1dec9b7fb28 100644 --- a/PWGLF/TableProducer/Common/mcCentrality.cxx +++ b/PWGLF/TableProducer/Common/mcCentrality.cxx @@ -17,30 +17,35 @@ /// \brief Task to produce the table for the equalized multiplicity into centrality bins /// -// O2 includes -#include "CCDB/BasicCCDBManager.h" -#include "ReconstructionDataFormats/Track.h" -#include "CCDB/CcdbApi.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/runDataProcessing.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/RunningWorkflowInfo.h" -#include "Framework/StaticFor.h" -#include "TableHelper.h" -#include "Framework/O2DatabasePDGPlugin.h" -#include "Common/DataModel/Centrality.h" #include "PWGLF/DataModel/mcCentrality.h" + +#include "TableHelper.h" + #include "PWGLF/Utils/inelGt.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::track; /// Task to produce the response table -struct mcCentrality { +struct McCentrality { // Tables to produce Produces centFV0A; @@ -52,27 +57,30 @@ struct mcCentrality { // Input parameters Service ccdb; - Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; - Configurable ccdbTimestamp{"ccdb-timestamp", -1, "timestamp of the object used to query in CCDB the detector response. If 0 the object corresponding to the run number is used, if < 0 the latest object is used"}; + Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable ccdbTimestamp{"ccdbTimestamp", -1, "timestamp of the object used to query in CCDB the detector response. If 0 the object corresponding to the run number is used, if < 0 the latest object is used"}; Configurable path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"}; Configurable selectPrimaries{"selectPrimaries", true, "Select only primary particles"}; Service pdgDB; ConfigurableAxis binsPercentile{"binsPercentile", {VARIABLE_WIDTH, 0, 0.001, 0.01, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0}, "Binning of the percentile axis"}; + ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"}; + Configurable fillFt0A{"fillFt0A", false, "Fills the FT0A histogram"}; + Configurable fillFt0C{"fillFt0C", false, "Fills the FT0C histogram"}; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; TH1F* h1dFT0M; - /*TH1F* h1dFT0A; + TH1F* h1dFT0A; TH1F* h1dFT0C; - TH1F* h1dFDD; - TH1F* h1dNTP;*/ + // TH1F* h1dFDD; + // TH1F* h1dNTP; o2::pwglf::ParticleCounter mCounter; void init(o2::framework::InitContext& /*initContext*/) { // Set up the CCDB - ccdb->setURL(url.value); + ccdb->setURL(ccdbUrl.value); ccdb->setCaching(true); ccdb->setLocalObjectValidityChecking(); ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); @@ -81,7 +89,15 @@ struct mcCentrality { mCounter.mPdgDatabase = pdgDB.service; mCounter.mSelectPrimaries = selectPrimaries.value; histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{binsPercentile, "FT0M percentile"}}); - histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {1000, 0, 5000, "FT0M mult."}}); + histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {binsMultiplicity, "FT0M mult."}}); + if (fillFt0A) { + histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{binsPercentile, "FT0A percentile"}}); + histos.add("FT0A/percentilevsMult", "FT0A percentile.", HistType::kTH2D, {{binsPercentile, "FT0A percentile"}, {binsMultiplicity, "FT0A mult."}}); + } + if (fillFt0C) { + histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{binsPercentile, "FT0C percentile"}}); + histos.add("FT0C/percentilevsMult", "FT0C percentile.", HistType::kTH2D, {{binsPercentile, "FT0C percentile"}, {binsMultiplicity, "FT0C mult."}}); + } TList* lOfInput; if (path.value.rfind("ccdb://", 0) == 0) { // Getting post calib. from CCDB @@ -105,11 +121,20 @@ struct mcCentrality { LOG(fatal) << "The input file " << path.value << " does not contain the TList ccdb_object"; } } - h1dFT0M = static_cast(lOfInput->FindObject("h1dFT0M")); - if (!h1dFT0M) { - lOfInput->ls(); - LOG(fatal) << "Could not open histogram h1dFT0M from TList"; - return; + auto getHist = [lOfInput](const char* name) -> TH1F* { + auto hist = static_cast(lOfInput->FindObject(name)); + if (!hist) { + lOfInput->ls(); + LOG(fatal) << "Could not open histogram " << name << " from TList"; + } + return hist; + }; + h1dFT0M = getHist("h1dFT0M"); + if (fillFt0A) { + h1dFT0A = getHist("h1dFT0A"); + } + if (fillFt0C) { + h1dFT0C = getHist("h1dFT0C"); } } @@ -117,23 +142,27 @@ struct mcCentrality { void process(aod::McCollision const& /*mcCollision*/, aod::McParticles const& mcParticles) { - const float nFT0M = mCounter.countFT0A(mcParticles) + mCounter.countFT0C(mcParticles); - /*const float nFT0A = mCounter.countFT0A(mcParticles); + const float nFT0A = mCounter.countFT0A(mcParticles); const float nFT0C = mCounter.countFT0C(mcParticles); - const float nFV0A = mCounter.countFV0A(mcParticles);*/ + const float nFT0M = nFT0A + nFT0C; + // const float nFV0A = mCounter.countFV0A(mcParticles); const float valueCentFT0M = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0M)); - /*const float valueCentFT0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0A)); - const float valueCentFT0C = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0C)); - const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A));*/ + if (fillFt0A) { + const float valueCentFT0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0A)); + centFT0A(valueCentFT0A); + } + if (fillFt0C) { + const float valueCentFT0C = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0C)); + centFT0C(valueCentFT0C); + } + // const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A)); centFT0M(valueCentFT0M); - /*centFT0A(valueCentFT0A); - centFT0C(valueCentFT0C); - centFV0A(valueCentFV0A);*/ + // centFV0A(valueCentFV0A); histos.fill(HIST("FT0M/percentile"), valueCentFT0M); histos.fill(HIST("FT0M/percentilevsMult"), valueCentFT0M, nFT0M); } }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; }