Skip to content

Commit cd5a1c4

Browse files
authored
[PWGLF] Allow FT0A and FT0C in MCCentrality (#12785)
1 parent c21d0ce commit cd5a1c4

File tree

2 files changed

+68
-38
lines changed

2 files changed

+68
-38
lines changed

PWGLF/DataModel/mcCentrality.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
#define PWGLF_DATAMODEL_MCCENTRALITY_H_
2222

2323
// O2 includes
24+
#include "Common/DataModel/Centrality.h"
25+
2426
#include "Framework/ASoA.h"
2527
#include "Framework/AnalysisDataModel.h"
26-
#include "Common/DataModel/Centrality.h"
2728
#include "Framework/Logger.h"
2829

2930
namespace o2::aod

PWGLF/TableProducer/Common/mcCentrality.cxx

Lines changed: 66 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,35 @@
1717
/// \brief Task to produce the table for the equalized multiplicity into centrality bins
1818
///
1919

20-
// O2 includes
21-
#include "CCDB/BasicCCDBManager.h"
22-
#include "ReconstructionDataFormats/Track.h"
23-
#include "CCDB/CcdbApi.h"
24-
#include "Common/DataModel/TrackSelectionTables.h"
25-
#include "Framework/AnalysisTask.h"
26-
#include "Framework/AnalysisDataModel.h"
27-
#include "Framework/runDataProcessing.h"
28-
#include "Framework/HistogramRegistry.h"
29-
#include "Framework/RunningWorkflowInfo.h"
30-
#include "Framework/StaticFor.h"
31-
#include "TableHelper.h"
32-
#include "Framework/O2DatabasePDGPlugin.h"
33-
#include "Common/DataModel/Centrality.h"
3420
#include "PWGLF/DataModel/mcCentrality.h"
21+
22+
#include "TableHelper.h"
23+
3524
#include "PWGLF/Utils/inelGt.h"
3625

26+
#include "Common/DataModel/Centrality.h"
27+
#include "Common/DataModel/TrackSelectionTables.h"
28+
29+
#include <CCDB/BasicCCDBManager.h>
30+
#include <CCDB/CcdbApi.h>
31+
#include <Framework/AnalysisDataModel.h>
32+
#include <Framework/AnalysisTask.h>
33+
#include <Framework/HistogramRegistry.h>
34+
#include <Framework/O2DatabasePDGPlugin.h>
35+
#include <Framework/RunningWorkflowInfo.h>
36+
#include <Framework/StaticFor.h>
37+
#include <Framework/runDataProcessing.h>
38+
#include <ReconstructionDataFormats/Track.h>
39+
40+
#include <string>
41+
3742
using namespace o2;
3843
using namespace o2::framework;
3944
using namespace o2::framework::expressions;
4045
using namespace o2::track;
4146

4247
/// Task to produce the response table
43-
struct mcCentrality {
48+
struct McCentrality {
4449

4550
// Tables to produce
4651
Produces<aod::McCentFV0As> centFV0A;
@@ -52,27 +57,30 @@ struct mcCentrality {
5257

5358
// Input parameters
5459
Service<o2::ccdb::BasicCCDBManager> ccdb;
55-
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
56-
Configurable<int64_t> 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"};
60+
Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
61+
Configurable<int64_t> 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"};
5762
Configurable<std::string> path{"path", "/tmp/InputCalibMC.root", "path to calib file or ccdb path if begins with ccdb://"};
5863
Configurable<bool> selectPrimaries{"selectPrimaries", true, "Select only primary particles"};
5964
Service<o2::framework::O2DatabasePDG> pdgDB;
6065
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"};
66+
ConfigurableAxis binsMultiplicity{"binsMultiplicity", {1000, 0, 5000}, "Binning of the multiplicity axis"};
67+
Configurable<bool> fillFt0A{"fillFt0A", false, "Fills the FT0A histogram"};
68+
Configurable<bool> fillFt0C{"fillFt0C", false, "Fills the FT0C histogram"};
6169

6270
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
6371

6472
TH1F* h1dFT0M;
65-
/*TH1F* h1dFT0A;
73+
TH1F* h1dFT0A;
6674
TH1F* h1dFT0C;
67-
TH1F* h1dFDD;
68-
TH1F* h1dNTP;*/
75+
// TH1F* h1dFDD;
76+
// TH1F* h1dNTP;
6977

7078
o2::pwglf::ParticleCounter<o2::framework::O2DatabasePDG> mCounter;
7179

7280
void init(o2::framework::InitContext& /*initContext*/)
7381
{
7482
// Set up the CCDB
75-
ccdb->setURL(url.value);
83+
ccdb->setURL(ccdbUrl.value);
7684
ccdb->setCaching(true);
7785
ccdb->setLocalObjectValidityChecking();
7886
ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
@@ -81,7 +89,15 @@ struct mcCentrality {
8189
mCounter.mPdgDatabase = pdgDB.service;
8290
mCounter.mSelectPrimaries = selectPrimaries.value;
8391
histos.add("FT0M/percentile", "FT0M percentile.", HistType::kTH1D, {{binsPercentile, "FT0M percentile"}});
84-
histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {1000, 0, 5000, "FT0M mult."}});
92+
histos.add("FT0M/percentilevsMult", "FT0M percentile.", HistType::kTH2D, {{binsPercentile, "FT0M percentile"}, {binsMultiplicity, "FT0M mult."}});
93+
if (fillFt0A) {
94+
histos.add("FT0A/percentile", "FT0A percentile.", HistType::kTH1D, {{binsPercentile, "FT0A percentile"}});
95+
histos.add("FT0A/percentilevsMult", "FT0A percentile.", HistType::kTH2D, {{binsPercentile, "FT0A percentile"}, {binsMultiplicity, "FT0A mult."}});
96+
}
97+
if (fillFt0C) {
98+
histos.add("FT0C/percentile", "FT0C percentile.", HistType::kTH1D, {{binsPercentile, "FT0C percentile"}});
99+
histos.add("FT0C/percentilevsMult", "FT0C percentile.", HistType::kTH2D, {{binsPercentile, "FT0C percentile"}, {binsMultiplicity, "FT0C mult."}});
100+
}
85101

86102
TList* lOfInput;
87103
if (path.value.rfind("ccdb://", 0) == 0) { // Getting post calib. from CCDB
@@ -105,35 +121,48 @@ struct mcCentrality {
105121
LOG(fatal) << "The input file " << path.value << " does not contain the TList ccdb_object";
106122
}
107123
}
108-
h1dFT0M = static_cast<TH1F*>(lOfInput->FindObject("h1dFT0M"));
109-
if (!h1dFT0M) {
110-
lOfInput->ls();
111-
LOG(fatal) << "Could not open histogram h1dFT0M from TList";
112-
return;
124+
auto getHist = [lOfInput](const char* name) -> TH1F* {
125+
auto hist = static_cast<TH1F*>(lOfInput->FindObject(name));
126+
if (!hist) {
127+
lOfInput->ls();
128+
LOG(fatal) << "Could not open histogram " << name << " from TList";
129+
}
130+
return hist;
131+
};
132+
h1dFT0M = getHist("h1dFT0M");
133+
if (fillFt0A) {
134+
h1dFT0A = getHist("h1dFT0A");
135+
}
136+
if (fillFt0C) {
137+
h1dFT0C = getHist("h1dFT0C");
113138
}
114139
}
115140

116141
// Full tables (independent on central calibrations)
117142
void process(aod::McCollision const& /*mcCollision*/,
118143
aod::McParticles const& mcParticles)
119144
{
120-
const float nFT0M = mCounter.countFT0A(mcParticles) + mCounter.countFT0C(mcParticles);
121-
/*const float nFT0A = mCounter.countFT0A(mcParticles);
145+
const float nFT0A = mCounter.countFT0A(mcParticles);
122146
const float nFT0C = mCounter.countFT0C(mcParticles);
123-
const float nFV0A = mCounter.countFV0A(mcParticles);*/
147+
const float nFT0M = nFT0A + nFT0C;
148+
// const float nFV0A = mCounter.countFV0A(mcParticles);
124149

125150
const float valueCentFT0M = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0M));
126-
/*const float valueCentFT0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0A));
127-
const float valueCentFT0C = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0C));
128-
const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A));*/
151+
if (fillFt0A) {
152+
const float valueCentFT0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0A));
153+
centFT0A(valueCentFT0A);
154+
}
155+
if (fillFt0C) {
156+
const float valueCentFT0C = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFT0C));
157+
centFT0C(valueCentFT0C);
158+
}
159+
// const float valueCentFV0A = h1dFT0M->GetBinContent(h1dFT0M->FindBin(nFV0A));
129160

130161
centFT0M(valueCentFT0M);
131-
/*centFT0A(valueCentFT0A);
132-
centFT0C(valueCentFT0C);
133-
centFV0A(valueCentFV0A);*/
162+
// centFV0A(valueCentFV0A);
134163
histos.fill(HIST("FT0M/percentile"), valueCentFT0M);
135164
histos.fill(HIST("FT0M/percentilevsMult"), valueCentFT0M, nFT0M);
136165
}
137166
};
138167

139-
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<mcCentrality>(cfgc)}; }
168+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<McCentrality>(cfgc)}; }

0 commit comments

Comments
 (0)