Skip to content

Commit 48f3f6e

Browse files
sarjeeta gamisarjeeta gami
authored andcommitted
[PWGLF] Added mixed event v2 table for kstarpbpb task and optimize event selection in phyanalysisrun3pbpb task
1 parent e08d74f commit 48f3f6e

5 files changed

Lines changed: 433 additions & 154 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file LFKaonDaughterTables.h
13+
/// \brief DataModel for shared kaon/pion daughter derived data (K*(892), phi)
14+
///
15+
/// \author sarjeeta.gami@cern.ch
16+
17+
#ifndef PWGLF_DATAMODEL_LFKAONDAUGHTERTABLES_H_
18+
#define PWGLF_DATAMODEL_LFKAONDAUGHTERTABLES_H_
19+
20+
#include "Common/Core/RecoDecay.h"
21+
22+
#include <Framework/ASoA.h>
23+
#include <Framework/AnalysisDataModel.h>
24+
25+
#include <cmath>
26+
#include <cstdint>
27+
28+
namespace o2::aod
29+
{
30+
namespace kadaughterevent
31+
{
32+
DECLARE_SOA_COLUMN(Cent, cent, float);
33+
DECLARE_SOA_COLUMN(Posz, posz, float);
34+
DECLARE_SOA_COLUMN(Occupancy, occupancy, int);
35+
DECLARE_SOA_COLUMN(PsiFT0C, psiFT0C, float);
36+
DECLARE_SOA_COLUMN(QFT0C, qFT0C, float);
37+
DECLARE_SOA_COLUMN(PsiZDCC, psiZDCC, float); // reserved for a future phi/SP consumer; 0 for kstar
38+
DECLARE_SOA_COLUMN(BcId, bcId, int); // mirrors collision.bcId(), used to dedup mixed pairs sharing a BC
39+
DECLARE_SOA_COLUMN(RunNumber, runNumber, int);
40+
DECLARE_SOA_COLUMN(Timestamp, timestamp, int64_t); // for CCDB EP-weight fetch
41+
} // namespace kadaughterevent
42+
DECLARE_SOA_TABLE(KaDaughterEvents, "AOD", "KADEVENT", o2::soa::Index<>,
43+
kadaughterevent::Cent, kadaughterevent::Posz, kadaughterevent::Occupancy,
44+
kadaughterevent::PsiFT0C, kadaughterevent::QFT0C, kadaughterevent::PsiZDCC,
45+
kadaughterevent::BcId, kadaughterevent::RunNumber, kadaughterevent::Timestamp);
46+
using KaDaughterEvent = KaDaughterEvents::iterator;
47+
48+
namespace kadaughtertrack
49+
{
50+
DECLARE_SOA_INDEX_COLUMN(KaDaughterEvent, kaDaughterEvent);
51+
DECLARE_SOA_COLUMN(Px, px, float);
52+
DECLARE_SOA_COLUMN(Py, py, float);
53+
DECLARE_SOA_COLUMN(Pz, pz, float);
54+
DECLARE_SOA_COLUMN(Sign, sign, int8_t);
55+
DECLARE_SOA_COLUMN(TrackId, trackId, int64_t); // original AOD track global index, for bookkeeping only
56+
DECLARE_SOA_COLUMN(DcaXY, dcaXY, float);
57+
DECLARE_SOA_COLUMN(DcaZ, dcaZ, float);
58+
DECLARE_SOA_COLUMN(TpcNSigmaKa, tpcNSigmaKa, float);
59+
DECLARE_SOA_COLUMN(TofNSigmaKa, tofNSigmaKa, float);
60+
DECLARE_SOA_COLUMN(TpcNSigmaPi, tpcNSigmaPi, float);
61+
DECLARE_SOA_COLUMN(TofNSigmaPi, tofNSigmaPi, float);
62+
DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool);
63+
DECLARE_SOA_COLUMN(Beta, beta, float);
64+
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float px, float py) -> float { return std::hypot(px, py); });
65+
DECLARE_SOA_DYNAMIC_COLUMN(Phi, phi, [](float px, float py) -> float { return RecoDecay::constrainAngle(std::atan2(py, px)); });
66+
} // namespace kadaughtertrack
67+
DECLARE_SOA_TABLE(KaDaughterTracks, "AOD", "KADTRACK", o2::soa::Index<>,
68+
kadaughtertrack::KaDaughterEventId, kadaughtertrack::Px, kadaughtertrack::Py,
69+
kadaughtertrack::Pz, kadaughtertrack::Sign, kadaughtertrack::TrackId,
70+
kadaughtertrack::DcaXY, kadaughtertrack::DcaZ,
71+
kadaughtertrack::TpcNSigmaKa, kadaughtertrack::TofNSigmaKa,
72+
kadaughtertrack::TpcNSigmaPi, kadaughtertrack::TofNSigmaPi,
73+
kadaughtertrack::HasTOF, kadaughtertrack::Beta,
74+
kadaughtertrack::Pt<kadaughtertrack::Px, kadaughtertrack::Py>,
75+
kadaughtertrack::Phi<kadaughtertrack::Px, kadaughtertrack::Py>);
76+
using KaDaughterTrack = KaDaughterTracks::iterator;
77+
} // namespace o2::aod
78+
#endif // PWGLF_DATAMODEL_LFKAONDAUGHTERTABLES_H_

‎PWGLF/TableProducer/Resonances/CMakeLists.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ o2physics_add_dpl_workflow(resonance-tree-creator
6464
SOURCES resonanceTreeCreator.cxx
6565
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
6666
COMPONENT_NAME Analysis)
67+
68+
o2physics_add_dpl_workflow(ka-daughter-producer
69+
SOURCES kaDaughterProducer.cxx
70+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
71+
COMPONENT_NAME Analysis)
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file kaDaughterProducer.cxx
13+
/// \brief Table producer for shared kaon/pion daughter derived data (K*(892), phi)
14+
///
15+
/// \author sarjeeta.gami@cern.ch
16+
17+
#include "PWGLF/DataModel/EPCalibrationTables.h"
18+
#include "PWGLF/DataModel/LFKaonDaughterTables.h"
19+
20+
#include "Common/CCDB/EventSelectionParams.h"
21+
#include "Common/CCDB/RCTSelectionFlags.h"
22+
#include "Common/DataModel/Centrality.h"
23+
#include "Common/DataModel/EventSelection.h"
24+
#include "Common/DataModel/Multiplicity.h"
25+
#include "Common/DataModel/PIDResponseTOF.h"
26+
#include "Common/DataModel/PIDResponseTPC.h"
27+
#include "Common/DataModel/TrackSelectionTables.h"
28+
29+
#include <CommonConstants/MathConstants.h>
30+
#include <Framework/AnalysisDataModel.h>
31+
#include <Framework/AnalysisTask.h>
32+
#include <Framework/Configurable.h>
33+
#include <Framework/HistogramRegistry.h>
34+
#include <Framework/HistogramSpec.h>
35+
#include <Framework/InitContext.h>
36+
#include <Framework/runDataProcessing.h>
37+
38+
#include <cmath>
39+
#include <cstdint>
40+
#include <string>
41+
#include <vector>
42+
43+
using namespace o2;
44+
using namespace o2::framework;
45+
using namespace o2::framework::expressions;
46+
using namespace o2::aod::rctsel;
47+
48+
struct KaDaughterProducer {
49+
Produces<aod::KaDaughterEvents> kaEvent;
50+
Produces<aod::KaDaughterTracks> kaTrack;
51+
52+
struct RCTCut : ConfigurableGroup {
53+
Configurable<bool> requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"};
54+
Configurable<std::string> cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"};
55+
Configurable<bool> cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"};
56+
Configurable<bool> cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"};
57+
RCTFlagsChecker rctChecker;
58+
};
59+
RCTCut rctCut;
60+
61+
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
62+
Configurable<float> cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"};
63+
Configurable<float> cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"};
64+
Configurable<float> cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"};
65+
Configurable<float> cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"};
66+
Configurable<float> cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"};
67+
Configurable<bool> useGlobalTrack{"useGlobalTrack", true, "use Global track"};
68+
Configurable<int> cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"};
69+
Configurable<int> cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"};
70+
Configurable<bool> additionalEvSel1{"additionalEvSel1", true, "Additional evsel1"};
71+
Configurable<bool> additionalEvSel2{"additionalEvSel2", true, "Additional evsel2"};
72+
Configurable<bool> additionalEvSel3{"additionalEvSel3", true, "Additional evsel3"};
73+
Configurable<bool> additionalEvSel4{"additionalEvSel4", true, "Additional evsel4"};
74+
Configurable<bool> fillOccupancy{"fillOccupancy", false, "fill Occupancy"};
75+
Configurable<int> cfgOccupancyCut{"cfgOccupancyCut", 500, "Occupancy cut"};
76+
Configurable<bool> additionalQAplots1{"additionalQAplots1", true, "Additional QA plots (event-plane resolution etc.)"};
77+
78+
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
79+
Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality;
80+
Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT);
81+
Filter dcacutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
82+
83+
using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs,
84+
aod::EPCalibrationTables, aod::Mults>>;
85+
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA,
86+
aod::TrackSelection, aod::pidTOFbeta,
87+
aod::pidTPCFullKa, aod::pidTOFFullKa,
88+
aod::pidTPCFullPi, aod::pidTOFFullPi>>;
89+
90+
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
91+
92+
void init(InitContext&)
93+
{
94+
rctCut.rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, rctCut.cfgEvtRCTFlagCheckerZDCCheck, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad);
95+
96+
histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{10, 0, 10.0}});
97+
if (additionalQAplots1) {
98+
std::vector<double> occupancyBinning = {0.0, 500.0, 1000.0, 1500.0, 2000.0, 3000.0, 4000.0, 5000.0, 50000.0};
99+
AxisSpec phiAxis = {500, -6.28, 6.28, "phi"};
100+
AxisSpec resAxis = {6000, -30, 30, "Res"};
101+
AxisSpec centAxis = {8, 0, 80, "V0M (%)"};
102+
AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"};
103+
histos.add("hFTOCvsTPCSelected", "Mult correlation FT0C vs. TPC after selection", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}});
104+
histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}});
105+
histos.add("hOccupancy", "Occupancy distribution", kTH1F, {occupancyAxis});
106+
histos.add("hVtxZ", "Vertex distribution in Z;Z (cm)", kTH1F, {{400, -20.0, 20.0}});
107+
histos.add("hPsiFT0C", "PsiFT0C", kTH2F, {centAxis, phiAxis});
108+
histos.add("hPsiFT0A", "PsiFT0A", kTH2F, {centAxis, phiAxis});
109+
histos.add("hPsiTPC", "PsiTPC", kTH2F, {centAxis, phiAxis});
110+
histos.add("ResFT0CTPC", "ResFT0CTPC", kTH2F, {centAxis, resAxis});
111+
histos.add("ResFT0CFT0A", "ResFT0CFT0A", kTH2F, {centAxis, resAxis});
112+
histos.add("ResFT0ATPC", "ResFT0ATPC", kTH2F, {centAxis, resAxis});
113+
histos.add("ResFT0CTPCSP", "ResFT0CTPCSP", kTH2F, {centAxis, resAxis});
114+
histos.add("ResFT0CFT0ASP", "ResFT0CFT0ASP", kTH2F, {centAxis, resAxis});
115+
histos.add("ResFT0ATPCSP", "ResFT0ATPCSP", kTH2F, {centAxis, resAxis});
116+
histos.add("ResTrackSPFT0CTPC", "ResTrackSPFT0CTPC", kTH3F, {centAxis, occupancyAxis, resAxis});
117+
histos.add("ResTrackSPFT0CFT0A", "ResTrackSPFT0CFT0A", kTH3F, {centAxis, occupancyAxis, resAxis});
118+
histos.add("ResTrackSPFT0ATPC", "ResTrackSPFT0ATPC", kTH3F, {centAxis, occupancyAxis, resAxis});
119+
}
120+
}
121+
122+
template <typename T>
123+
bool selectionTrack(const T& candidate)
124+
{
125+
if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) {
126+
return false;
127+
}
128+
if (!useGlobalTrack && !(candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster)) {
129+
return false;
130+
}
131+
return true;
132+
}
133+
134+
void processData(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCsWithTimestamps const&)
135+
{
136+
histos.fill(HIST("hEvtSelInfo"), 0.5);
137+
if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker(collision)) return;
138+
histos.fill(HIST("hEvtSelInfo"), 1.5);
139+
if (!collision.sel8()) return;
140+
if (!collision.triggereventep()) return;
141+
if (additionalEvSel1 && !collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) return;
142+
if (additionalEvSel2 && !collision.selection_bit(aod::evsel::kNoITSROFrameBorder)) return;
143+
if (additionalEvSel3 && !collision.selection_bit(aod::evsel::kNoSameBunchPileup)) return;
144+
if (additionalEvSel4 && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) return;
145+
histos.fill(HIST("hEvtSelInfo"), 2.5);
146+
147+
auto centrality = collision.centFT0C();
148+
int occupancy = collision.trackOccupancyInTimeRange();
149+
auto psiFT0C = collision.psiFT0C();
150+
auto qFT0C = collision.qFT0C();
151+
152+
if (fillOccupancy && occupancy > cfgOccupancyCut) return;
153+
histos.fill(HIST("hEvtSelInfo"), 3.5);
154+
155+
if (additionalQAplots1) {
156+
auto multTPC = collision.multNTracksPV();
157+
auto psiFT0A = collision.psiFT0A();
158+
auto psiTPC = collision.psiTPC();
159+
auto qFT0A = collision.qFT0A();
160+
auto qTPC = collision.qTPC();
161+
histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC);
162+
histos.fill(HIST("hPsiFT0C"), centrality, psiFT0C);
163+
histos.fill(HIST("hPsiFT0A"), centrality, psiFT0A);
164+
histos.fill(HIST("hPsiTPC"), centrality, psiTPC);
165+
histos.fill(HIST("ResFT0CTPC"), centrality, std::cos(2.0 * (psiFT0C - psiTPC)));
166+
histos.fill(HIST("ResFT0CFT0A"), centrality, std::cos(2.0 * (psiFT0C - psiFT0A)));
167+
histos.fill(HIST("ResFT0ATPC"), centrality, std::cos(2.0 * (psiTPC - psiFT0A)));
168+
histos.fill(HIST("ResFT0CTPCSP"), centrality, qFT0C * qTPC * std::cos(2.0 * (psiFT0C - psiTPC)));
169+
histos.fill(HIST("ResFT0CFT0ASP"), centrality, qFT0C * qFT0A * std::cos(2.0 * (psiFT0C - psiFT0A)));
170+
histos.fill(HIST("ResFT0ATPCSP"), centrality, qTPC * qFT0A * std::cos(2.0 * (psiTPC - psiFT0A)));
171+
histos.fill(HIST("hCentrality"), centrality);
172+
histos.fill(HIST("hOccupancy"), occupancy);
173+
histos.fill(HIST("hVtxZ"), collision.posZ());
174+
// filled once per event now, instead of once per track-pair as in the original processSE
175+
histos.fill(HIST("ResTrackSPFT0CTPC"), centrality, occupancy, qFT0C * qTPC * std::cos(2.0 * (psiFT0C - psiTPC)));
176+
histos.fill(HIST("ResTrackSPFT0CFT0A"), centrality, occupancy, qFT0C * qFT0A * std::cos(2.0 * (psiFT0C - psiFT0A)));
177+
histos.fill(HIST("ResTrackSPFT0ATPC"), centrality, occupancy, qTPC * qFT0A * std::cos(2.0 * (psiTPC - psiFT0A)));
178+
}
179+
180+
struct Stored {
181+
float px, py, pz, dcaXY, dcaZ, tpcKa, tofKa, tpcPi, tofPi, beta;
182+
int8_t sign;
183+
int64_t id;
184+
bool hasTOF;
185+
};
186+
std::vector<Stored> sel;
187+
for (const auto& t : tracks) {
188+
if (!selectionTrack(t)) continue;
189+
sel.push_back({t.px(), t.py(), t.pz(), t.dcaXY(), t.dcaZ(),
190+
t.tpcNSigmaKa(), t.tofNSigmaKa(), t.tpcNSigmaPi(), t.tofNSigmaPi(),
191+
t.hasTOF() ? t.beta() : -999.f, static_cast<int8_t>(t.sign()), t.globalIndex(), t.hasTOF()});
192+
}
193+
if (sel.empty()) return;
194+
195+
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
196+
kaEvent(centrality, collision.posZ(), occupancy, psiFT0C, qFT0C, /*psiZDCC=*/0.f,
197+
collision.bcId(), bc.runNumber(), bc.timestamp());
198+
const int64_t idx = kaEvent.lastIndex();
199+
for (const auto& s : sel) {
200+
kaTrack(idx, s.px, s.py, s.pz, s.sign, s.id, s.dcaXY, s.dcaZ,
201+
s.tpcKa, s.tofKa, s.tpcPi, s.tofPi, s.hasTOF, s.beta);
202+
}
203+
}
204+
PROCESS_SWITCH(KaDaughterProducer, processData, "Produce shared kaon/pion daughter candidates", true);
205+
};
206+
207+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
208+
{
209+
return WorkflowSpec{adaptAnalysisTask<KaDaughterProducer>(cfgc)};
210+
}

0 commit comments

Comments
 (0)