Skip to content

Commit a50cd6b

Browse files
[PWGLF] NucleiTask - Add skimming histo (#10192)
1 parent 9b3976a commit a50cd6b

File tree

2 files changed

+108
-39
lines changed

2 files changed

+108
-39
lines changed

PWGLF/Tasks/Nuspex/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
o2physics_add_dpl_workflow(nuclei-batask
1313
SOURCES LFNucleiBATask.cxx
14-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
14+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::EventFilteringUtils
1515
COMPONENT_NAME Analysis)
1616

1717
o2physics_add_dpl_workflow(hypertritonanalysis

PWGLF/Tasks/Nuspex/LFNucleiBATask.cxx

Lines changed: 107 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
///
1717
/// \author Giovanni Malfattore <giovanni.malfattore@cern.ch> and Rutuparna Rath <rutuparna.rath@cern.ch>
1818
///
19+
#include "EventFiltering/Zorro.h"
20+
#include "EventFiltering/ZorroSummary.h"
21+
22+
#include "CCDB/BasicCCDBManager.h"
23+
#include <string>
24+
1925
#include "PWGLF/DataModel/LFNucleiTables.h"
2026
#include <TLorentzVector.h>
2127
#include <TF1.h>
@@ -42,6 +48,11 @@ using namespace o2::framework;
4248
using namespace o2::framework::expressions;
4349

4450
struct LFNucleiBATask {
51+
Service<o2::ccdb::BasicCCDBManager> ccdb;
52+
53+
Zorro zorro;
54+
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
55+
4556
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
4657
HistogramRegistry spectraGen{"spectraGen", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
4758
HistogramRegistry debugHistos{"debugHistos", {}, OutputObjHandlingPolicy::AnalysisObject};
@@ -55,6 +66,13 @@ struct LFNucleiBATask {
5566
Configurable<bool> enableAl{"enableAl", true, "Flag to enable alpha analysis."};
5667

5768
Configurable<bool> enableTrackingEff{"enableTrackingEff", 0, "Flag to enable tracking efficiency hitos."};
69+
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
70+
71+
// Set the triggered events skimming scheme
72+
struct : ConfigurableGroup {
73+
Configurable<bool> applySkimming{"applySkimming", false, "Skimmed dataset processing"};
74+
Configurable<std::string> cfgSkimming{"cfgSkimming", "fHe", "Configurable for skimming"};
75+
} skimmingOptions;
5876

5977
// Set the event selection cuts
6078
struct : ConfigurableGroup {
@@ -206,8 +224,20 @@ struct LFNucleiBATask {
206224
return averageClusterSizePerCoslInv(track.itsClusterSizes(), track.eta());
207225
}
208226

227+
void initCCDB(o2::aod::BCsWithTimestamps::iterator const& bc)
228+
{
229+
if (skimmingOptions.applySkimming) {
230+
zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), skimmingOptions.cfgSkimming.value);
231+
zorro.populateHistRegistry(histos, bc.runNumber());
232+
}
233+
}
234+
209235
void init(o2::framework::InitContext&)
210236
{
237+
if (skimmingOptions.applySkimming) {
238+
zorroSummary.setObject(zorro.getZorroSummary());
239+
}
240+
211241
const AxisSpec pAxis{binsPt, "#it{p} (GeV/#it{c})"};
212242
const AxisSpec ptAxis{binsPt, "#it{p}_{T} (GeV/#it{c})"};
213243
const AxisSpec ptHeAxis{binsPtHe, "#it{p}_{T} (GeV/#it{c})"};
@@ -267,6 +297,11 @@ struct LFNucleiBATask {
267297
}
268298
}
269299

300+
histos.add<TH1>("event/eventSkimming", "eventSkimming", HistType::kTH1D, {{2, 0.0, 2.0}});
301+
auto hSkim = histos.get<TH1>(HIST("event/eventSkimming"));
302+
hSkim->GetXaxis()->SetBinLabel(1, "Total");
303+
hSkim->GetXaxis()->SetBinLabel(2, "Skimmed events");
304+
270305
histos.add<TH1>("event/eventSelection", "eventSelection", HistType::kTH1D, {{7, -0.5, 6.5}});
271306
auto h = histos.get<TH1>(HIST("event/eventSelection"));
272307
h->GetXaxis()->SetBinLabel(1, "Total");
@@ -278,8 +313,10 @@ struct LFNucleiBATask {
278313
h->GetXaxis()->SetBinLabel(7, "Z-vert Cut");
279314
histos.add<TH1>("event/h1VtxZ", "V_{z};V_{z} (in cm); counts", HistType::kTH1F, {{1500, -15, 15}});
280315

281-
histos.add<TH1>("tracks/h1pT", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{500, 0., 10.}});
282-
histos.add<TH1>("tracks/h1p", "Track momentum; p (GeV/#it{c}); counts", HistType::kTH1F, {{500, 0., 10.}});
316+
if (enablePIDplot) {
317+
histos.add<TH1>("tracks/h1pT", "Track #it{p}_{T}; #it{p}_{T} (GeV/#it{c}); counts", HistType::kTH1F, {{500, 0., 10.}});
318+
histos.add<TH1>("tracks/h1p", "Track momentum; p (GeV/#it{c}); counts", HistType::kTH1F, {{500, 0., 10.}});
319+
}
283320

284321
histos.add<TH1>("qa/h1ITSncr", "number of crossed rows in ITS; ITSncr; counts", HistType::kTH1F, {{12, 0, 12}});
285322
histos.add<TH1>("qa/h1TPCncr", "number of crossed rows in TPC; TPCncr; counts", HistType::kTH1F, {{150, 60, 170}});
@@ -1442,8 +1479,7 @@ struct LFNucleiBATask {
14421479
}
14431480

14441481
// Bethe-Bloch TPC distribution and Beta vs pT TOF distribution
1445-
histos.add<TH2>("tracks/h2TPCsignVsTPCmomentum", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, -8.f, 8.f}, {dedxAxis}});
1446-
if (nsigmaITSvar.showAverageClusterSize) {
1482+
if (nsigmaITSvar.showAverageClusterSize && enablePIDplot) {
14471483
histos.add<TH2>("tracks/averageClusterSize", "", HistType::kTH2F, {{pZAxis}, {avClsAxis}});
14481484
histos.add<TH2>("tracks/averageClusterSizePerCoslInv", "", HistType::kTH2F, {{pZAxis}, {avClsEffAxis}});
14491485
}
@@ -1452,6 +1488,7 @@ struct LFNucleiBATask {
14521488
debugHistos.add<TH2>("debug/h2TPCsignVsTPCmomentum_FakeHits", "TPC <-dE/dX> vs #it{p}/Z (Fake hits); Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, -8.f, 8.f}, {dedxAxis}});
14531489
}
14541490
if (enablePIDplot) {
1491+
histos.add<TH2>("tracks/h2TPCsignVsTPCmomentum", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, -8.f, 8.f}, {dedxAxis}});
14551492
if (enablePr) {
14561493
histos.add<TH2>("tracks/proton/h2TPCsignVsTPCmomentumProton", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, 0.f, 8.f}, {dedxAxis}});
14571494
histos.add<TH2>("tracks/proton/h2TPCsignVsTPCmomentumantiProton", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, 0.f, 8.f}, {dedxAxis}});
@@ -1467,18 +1504,21 @@ struct LFNucleiBATask {
14671504
if (enableHe) {
14681505
histos.add<TH2>("tracks/helium/h2TPCsignVsTPCmomentumHelium", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, 0.f, 8.f}, {dedxAxis}});
14691506
histos.add<TH2>("tracks/helium/h2TPCsignVsTPCmomentumantiHelium", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, 0.f, 8.f}, {dedxAxis}});
1470-
if (nsigmaITSvar.showAverageClusterSize) {
1471-
histos.add<TH2>("tracks/helium/averageClusterSize", "", HistType::kTH2F, {{pZAxis}, {avClsAxis}});
1472-
histos.add<TH2>("tracks/helium/averageClusterSizePerCoslInv", "", HistType::kTH2F, {{pZAxis}, {avClsEffAxis}});
1473-
}
14741507
}
14751508
if (enableAl) {
14761509
histos.add<TH2>("tracks/alpha/h2TPCsignVsTPCmomentumAlpha", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, 0.f, 8.f}, {dedxAxis}});
14771510
histos.add<TH2>("tracks/alpha/h2TPCsignVsTPCmomentumantiAlpha", "TPC <-dE/dX> vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{400, 0.f, 8.f}, {dedxAxis}});
14781511
}
14791512
}
14801513

1481-
if (outFlagOptions.doTOFplots) {
1514+
if (enableHe) {
1515+
if (nsigmaITSvar.showAverageClusterSize) {
1516+
histos.add<TH2>("tracks/helium/averageClusterSize", "", HistType::kTH2F, {{pZAxis}, {avClsAxis}});
1517+
histos.add<TH2>("tracks/helium/averageClusterSizePerCoslInv", "", HistType::kTH2F, {{pZAxis}, {avClsEffAxis}});
1518+
}
1519+
}
1520+
1521+
if (outFlagOptions.doTOFplots && enablePIDplot) {
14821522
histos.add<TH2>("tracks/h2TPCsignVsBetaGamma", "TPC <-dE/dX> vs #beta#gamma/Z; Signed #beta#gamma; TPC <-dE/dx> (a.u.)", HistType::kTH2F, {{250, -5.f, 5.f}, {dedxAxis}});
14831523
histos.add<TH2>("tracks/h2TOFbetaVsP", "TOF #beta vs #it{p}/Z; Signed #it{p} (GeV/#it{c}); TOF #beta", HistType::kTH2F, {{250, -5.f, 5.f}, {betaAxis}});
14841524
if (outFlagOptions.enableBetaCut)
@@ -1609,7 +1649,8 @@ struct LFNucleiBATask {
16091649
histos.add<TH2>("tracks/helium/h2antiHeliumVspTNSigmaTOF", "NSigmaTOF(#bar{He}) vs #it{p}_{T}/z; #it{p}_{T}/z (GeV/#it{c}); NSigmaTOF", HistType::kTH2F, {{ptZHeAxis}, {sigmaTOFAxis}});
16101650
}
16111651
// TOF mass histograms
1612-
histos.add<TH2>("tracks/h2TOFmassVsPt", "h2TOFmassVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{180, 0.4, 4.}, {250, 0., 5.}});
1652+
if (enablePIDplot)
1653+
histos.add<TH2>("tracks/h2TOFmassVsPt", "h2TOFmassVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{180, 0.4, 4.}, {250, 0., 5.}});
16131654
if (enablePr) {
16141655
histos.add<TH2>("tracks/proton/h2TOFmassProtonVsPt", "h2TOFmassProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{180, 0.4, 4.}, {250, 0., 5.}});
16151656
histos.add<TH2>("tracks/proton/h2TOFmassantiProtonVsPt", "h2TOFmassantiProtonVsPt; TOFmass; #it{p}_{T} (GeV)", HistType::kTH2F, {{180, 0.4, 4.}, {250, 0., 5.}});
@@ -2007,6 +2048,19 @@ struct LFNucleiBATask {
20072048
const TracksType& tracks,
20082049
const ParticleType& /*particles*/)
20092050
{
2051+
histos.fill(HIST("event/eventSkimming"), 0.5);
2052+
// Apply skimming
2053+
if constexpr (!IsFilteredData) {
2054+
const auto& bc = event.template bc_as<o2::aod::BCsWithTimestamps>();
2055+
initCCDB(bc);
2056+
if (skimmingOptions.applySkimming) {
2057+
if (!zorro.isSelected(bc.globalBC())) {
2058+
return;
2059+
}
2060+
}
2061+
histos.fill(HIST("event/eventSkimming"), 1.5);
2062+
}
2063+
20102064
// Event histos fill
20112065
histos.fill(HIST("event/eventSelection"), 0);
20122066
if (enableDebug)
@@ -2097,8 +2151,10 @@ struct LFNucleiBATask {
20972151
}
20982152

20992153
for (auto& track : tracksWithITS) {
2100-
histos.fill(HIST("tracks/h1pT"), track.pt());
2101-
histos.fill(HIST("tracks/h1p"), track.p());
2154+
if (enablePIDplot) {
2155+
histos.fill(HIST("tracks/h1pT"), track.pt());
2156+
histos.fill(HIST("tracks/h1p"), track.p());
2157+
}
21022158

21032159
if constexpr (!IsFilteredData) {
21042160
if (!track.isGlobalTrackWoDCA()) {
@@ -3655,9 +3711,11 @@ struct LFNucleiBATask {
36553711
continue;
36563712
}
36573713

3658-
histos.fill(HIST("tracks/h2TPCsignVsTPCmomentum"), track.tpcInnerParam() / (1.f * track.sign()), track.tpcSignal());
3714+
if (enablePIDplot)
3715+
histos.fill(HIST("tracks/h2TPCsignVsTPCmomentum"), track.tpcInnerParam() / (1.f * track.sign()), track.tpcSignal());
3716+
36593717
if constexpr (!IsFilteredData) {
3660-
if (nsigmaITSvar.showAverageClusterSize) {
3718+
if (nsigmaITSvar.showAverageClusterSize && enablePIDplot) {
36613719
histos.fill(HIST("tracks/averageClusterSize"), track.p(), averageClusterSizeTrk(track));
36623720
histos.fill(HIST("tracks/averageClusterSizePerCoslInv"), track.p(), averageClusterSizePerCoslInv(track));
36633721
}
@@ -4249,22 +4307,24 @@ struct LFNucleiBATask {
42494307
}
42504308
}
42514309

4252-
if (outFlagOptions.enableBetaCut && (track.beta() > betaCut))
4310+
if (outFlagOptions.enableBetaCut && (track.beta() > betaCut) && enablePIDplot)
42534311
histos.fill(HIST("tracks/h2TOFbetaVsP_BetaCut"), track.p() / (1.f * track.sign()), track.beta());
4254-
switch (useHasTRDConfig) {
4255-
case 0:
4256-
histos.fill(HIST("tracks/h2TOFbetaVsP"), track.p() / (1.f * track.sign()), track.beta());
4257-
break;
4258-
case 1:
4259-
if (track.hasTRD()) {
4260-
histos.fill(HIST("tracks/h2TOFbetaVsP"), track.p() / (1.f * track.sign()), track.beta());
4261-
}
4262-
break;
4263-
case 2:
4264-
if (!track.hasTRD()) {
4312+
if (enablePIDplot) {
4313+
switch (useHasTRDConfig) {
4314+
case 0:
42654315
histos.fill(HIST("tracks/h2TOFbetaVsP"), track.p() / (1.f * track.sign()), track.beta());
4266-
}
4267-
break;
4316+
break;
4317+
case 1:
4318+
if (track.hasTRD()) {
4319+
histos.fill(HIST("tracks/h2TOFbetaVsP"), track.p() / (1.f * track.sign()), track.beta());
4320+
}
4321+
break;
4322+
case 2:
4323+
if (!track.hasTRD()) {
4324+
histos.fill(HIST("tracks/h2TOFbetaVsP"), track.p() / (1.f * track.sign()), track.beta());
4325+
}
4326+
break;
4327+
}
42684328
}
42694329

42704330
if (enablePtSpectra)
@@ -4419,7 +4479,7 @@ struct LFNucleiBATask {
44194479
massTOFantihe = antiheP * std::sqrt(1.f / (track.beta() * track.beta()) - 1.f);
44204480
break;
44214481
}
4422-
if (passDCAxyzCut)
4482+
if (passDCAxyzCut && outFlagOptions.doTOFplots && enablePIDplot)
44234483
histos.fill(HIST("tracks/h2TPCsignVsBetaGamma"), (track.beta() * gamma) / (1.f * track.sign()), track.tpcSignal());
44244484
} else {
44254485
massTOF = -99.f;
@@ -4428,7 +4488,8 @@ struct LFNucleiBATask {
44284488
}
44294489

44304490
if (passDCAxyzCut) {
4431-
histos.fill(HIST("tracks/h2TOFmassVsPt"), massTOF, track.pt());
4491+
if (enablePIDplot)
4492+
histos.fill(HIST("tracks/h2TOFmassVsPt"), massTOF, track.pt());
44324493
if (enableEvTimeSplitting) {
44334494
if (track.isEvTimeTOF() && track.isEvTimeT0AC()) {
44344495
evtimeHistos.fill(HIST("tracks/evtime/ft0tof/h2TOFmassVsPt"), massTOF, track.pt());
@@ -5560,23 +5621,26 @@ struct LFNucleiBATask {
55605621

55615622
// Process function that runs on the original AO2D
55625623
void processData(EventCandidates::iterator const& event,
5563-
TrackCandidates const& tracks)
5624+
TrackCandidates const& tracks,
5625+
o2::aod::BCsWithTimestamps const&)
55645626
{
55655627
fillHistograms<false /*MC*/, false /*Filtered*/>(event, tracks, true /*dummy*/);
55665628
}
55675629
PROCESS_SWITCH(LFNucleiBATask, processData, "process data", true);
55685630

55695631
// Process function that runs on the original AO2D
55705632
void processDataLfPid(EventCandidates::iterator const& event,
5571-
TrackCandidatesLfPid const& tracks)
5633+
TrackCandidatesLfPid const& tracks,
5634+
o2::aod::BCsWithTimestamps const&)
55725635
{
55735636
fillHistograms<false /*MC*/, false /*Filtered*/>(event, tracks, true /*dummy*/);
55745637
}
55755638
PROCESS_SWITCH(LFNucleiBATask, processDataLfPid, "process data with LF PID", false);
55765639

55775640
// Process function that runs on the filtered data
55785641
void processDataFiltered(o2::aod::LfNuclEvents::iterator const& event,
5579-
o2::aod::LfCandNucleusFull const& tracks)
5642+
o2::aod::LfCandNucleusFull const& tracks,
5643+
o2::aod::BCsWithTimestamps const&)
55805644
{
55815645
// Runs on data filtered on the fly with LF Tree creator nuclei task
55825646
// Takes as input full AO2Ds
@@ -5585,7 +5649,8 @@ struct LFNucleiBATask {
55855649
PROCESS_SWITCH(LFNucleiBATask, processDataFiltered, "process data on the filtered data", false);
55865650

55875651
void processDataLight(o2::aod::LfNuclEvents::iterator const& event,
5588-
o2::aod::LfCandNucleusDummy const& tracks)
5652+
o2::aod::LfCandNucleusDummy const& tracks,
5653+
o2::aod::BCsWithTimestamps const&)
55895654
{
55905655
// Runs on derived tables produced with LF Tree creator nuclei task
55915656
// Takes as input derived trees
@@ -5600,7 +5665,8 @@ struct LFNucleiBATask {
56005665
// Process function that runs on the original AO2D (for the MC)
56015666
void processMCReco(EventCandidatesMC::iterator const& event,
56025667
soa::Join<TrackCandidates, aod::McTrackLabels> const& tracks,
5603-
aod::McParticles const& mcParticles)
5668+
aod::McParticles const& mcParticles,
5669+
o2::aod::BCsWithTimestamps const&)
56045670
{
56055671
fillHistograms<true /*MC*/, false /*Filtered*/>(event, tracks, mcParticles);
56065672
} // CLOSING PROCESS MC RECO
@@ -5609,7 +5675,8 @@ struct LFNucleiBATask {
56095675
// Process function that runs on the original AO2D (for the MC) with the LfPIDcalibration
56105676
void processMCRecoLfPid(EventCandidatesMC::iterator const& event,
56115677
soa::Join<TrackCandidatesLfPid, aod::McTrackLabels> const& tracks,
5612-
aod::McParticles const& mcParticles)
5678+
aod::McParticles const& mcParticles,
5679+
o2::aod::BCsWithTimestamps const&)
56135680
{
56145681
fillHistograms<true /*MC*/, false /*Filtered*/>(event, tracks, mcParticles);
56155682
} // CLOSING PROCESS MC RECO
@@ -5730,14 +5797,16 @@ struct LFNucleiBATask {
57305797

57315798
// Process function that runs on the filtered AO2D (for the MC)
57325799
void processMCRecoFiltered(o2::aod::LfNuclEvents::iterator const& event,
5733-
soa::Join<o2::aod::LfCandNucleusFull, o2::aod::LfCandNucleusMC> const& tracks)
5800+
soa::Join<o2::aod::LfCandNucleusFull, o2::aod::LfCandNucleusMC> const& tracks,
5801+
o2::aod::BCsWithTimestamps const&)
57345802
{
57355803
fillHistograms<true /*MC*/, true /*Filtered*/>(event, tracks, true /*dummy*/);
57365804
} // CLOSING PROCESS MC RECO ON FILTERED DATA
57375805
PROCESS_SWITCH(LFNucleiBATask, processMCRecoFiltered, "process mc reco on the filtered data", false);
57385806

57395807
void processMCRecoFilteredLight(o2::aod::LfNuclEvents::iterator const& event,
5740-
soa::Join<o2::aod::LfCandNucleusDummy, o2::aod::LfCandNucleusMC> const& tracks)
5808+
soa::Join<o2::aod::LfCandNucleusDummy, o2::aod::LfCandNucleusMC> const& tracks,
5809+
o2::aod::BCsWithTimestamps const&)
57415810
{
57425811
fillHistograms<true /*MC*/, true /*Filtered*/>(event, tracks, true /*dummy*/);
57435812
} // CLOSING PROCESS MC RECO ON FILTERED DATA

0 commit comments

Comments
 (0)