Skip to content

Commit 2b7bcae

Browse files
jikim1290alibuild
andauthored
[PWGLF] initial commit of lambdalambda table producer (#10639)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent b160734 commit 2b7bcae

File tree

3 files changed

+385
-0
lines changed

3 files changed

+385
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
///
13+
/// \author Junlee Kim <junlee.kim@cern.ch>
14+
15+
#ifndef PWGLF_DATAMODEL_REDUCEDLAMBDALAMBDATABLES_H_
16+
#define PWGLF_DATAMODEL_REDUCEDLAMBDALAMBDATABLES_H_
17+
18+
#include <cmath>
19+
20+
#include "Common/DataModel/Centrality.h"
21+
#include "Common/DataModel/Multiplicity.h"
22+
#include "Common/DataModel/PIDResponse.h"
23+
#include "Common/Core/RecoDecay.h"
24+
#include "Common/DataModel/TrackSelectionTables.h"
25+
#include "Framework/AnalysisDataModel.h"
26+
#include "Framework/ASoA.h"
27+
28+
namespace o2::aod
29+
{
30+
namespace redllevent
31+
{
32+
DECLARE_SOA_COLUMN(NumLambda, numLambda, int); //! Number of lambda
33+
DECLARE_SOA_COLUMN(Centrality, centrality, float); //!
34+
} // namespace redllevent
35+
DECLARE_SOA_TABLE(RedLLEvents, "AOD", "REDLLEVENT",
36+
o2::soa::Index<>,
37+
bc::GlobalBC,
38+
bc::RunNumber,
39+
timestamp::Timestamp,
40+
collision::PosZ,
41+
collision::NumContrib,
42+
redllevent::Centrality,
43+
redllevent::NumLambda);
44+
using RedLLEvent = RedLLEvents::iterator;
45+
46+
namespace lltrack
47+
{
48+
DECLARE_SOA_INDEX_COLUMN(RedLLEvent, redLLEvent);
49+
DECLARE_SOA_COLUMN(LLdId, lldId, int); //! LL PID
50+
DECLARE_SOA_COLUMN(LLdPx, lldPx, float); //! LL d Px
51+
DECLARE_SOA_COLUMN(LLdPy, lldPy, float); //! LL d Py
52+
DECLARE_SOA_COLUMN(LLdPz, lldPz, float); //! LL d Pz
53+
DECLARE_SOA_COLUMN(LLdx, lldx, float); //! LL d x
54+
DECLARE_SOA_COLUMN(LLdy, lldy, float); //! LL d y
55+
DECLARE_SOA_COLUMN(LLdz, lldz, float); //! LL d z
56+
DECLARE_SOA_COLUMN(LLdMass, lldMass, float); //! LL d Mass
57+
DECLARE_SOA_COLUMN(LLdd1TPC, lldd1TPC, float); //! LL dd1 TPC nsigma
58+
DECLARE_SOA_COLUMN(LLdd2TPC, lldd2TPC, float); //! LL dd2 TPC nsigma
59+
DECLARE_SOA_COLUMN(LLdd1Index, lldd1Index, int64_t); //! LL dd1 global index
60+
DECLARE_SOA_COLUMN(LLdd2Index, lldd2Index, int64_t); //! LL dd2 global index
61+
62+
} // namespace lltrack
63+
DECLARE_SOA_TABLE(LLTracks, "AOD", "LLTRACK",
64+
o2::soa::Index<>,
65+
lltrack::RedLLEventId,
66+
lltrack::LLdId,
67+
lltrack::LLdPx,
68+
lltrack::LLdPy,
69+
lltrack::LLdPz,
70+
lltrack::LLdx,
71+
lltrack::LLdy,
72+
lltrack::LLdz,
73+
lltrack::LLdMass,
74+
lltrack::LLdd1TPC,
75+
lltrack::LLdd2TPC,
76+
lltrack::LLdd1Index,
77+
lltrack::LLdd2Index);
78+
79+
using LLTrack = LLTracks::iterator;
80+
} // namespace o2::aod
81+
#endif // PWGLF_DATAMODEL_REDUCEDLAMBDALAMBDATABLES_H_

PWGLF/TableProducer/Strangeness/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ o2physics_add_dpl_workflow(v0qaanalysis
121121
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
122122
COMPONENT_NAME Analysis)
123123

124+
o2physics_add_dpl_workflow(lambdalambdatable
125+
SOURCES LambdaLambdatable.cxx
126+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing
127+
COMPONENT_NAME Analysis)
128+
124129
# ML selection
125130
o2physics_add_dpl_workflow(lambdakzeromlselectiontreecreator
126131
SOURCES lambdakzeroMLSelectionTreeCreator.cxx
Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
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+
/// \author Junlee Kim, (junlee.kim@cern.ch)
13+
14+
#include <Framework/Configurable.h>
15+
#include <Math/GenVector/Boost.h>
16+
#include <Math/Vector4D.h>
17+
#include <TMath.h>
18+
#include <fairlogger/Logger.h>
19+
20+
#include <iostream>
21+
#include <iterator>
22+
#include <string>
23+
#include <vector>
24+
25+
#include "EventFiltering/Zorro.h"
26+
#include "EventFiltering/ZorroSummary.h"
27+
28+
#include "Framework/ASoAHelpers.h"
29+
#include "Framework/AnalysisDataModel.h"
30+
#include "Framework/AnalysisTask.h"
31+
#include "Framework/HistogramRegistry.h"
32+
#include "Framework/runDataProcessing.h"
33+
34+
#include "CommonConstants/MathConstants.h"
35+
#include "Common/Core/TrackSelection.h"
36+
#include "Common/DataModel/TrackSelectionTables.h"
37+
#include "Common/DataModel/EventSelection.h"
38+
#include "Common/DataModel/Multiplicity.h"
39+
#include "Common/DataModel/PIDResponse.h"
40+
41+
#include "CCDB/BasicCCDBManager.h"
42+
#include "CCDB/CcdbApi.h"
43+
44+
#include "PWGLF/DataModel/ReducedLambdaLambdaTables.h"
45+
#include "PWGLF/DataModel/LFStrangenessTables.h"
46+
47+
using namespace o2;
48+
using namespace o2::framework;
49+
using namespace o2::framework::expressions;
50+
51+
struct lambdalambdatable {
52+
53+
// Produce derived tables
54+
Produces<aod::RedLLEvents> redLLEvents;
55+
Produces<aod::LLTracks> llTrack;
56+
57+
// events
58+
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
59+
60+
Configurable<bool> cfgUseGlobalTrack{"cfgUseGlobalTrack", true, "use Global track"};
61+
Configurable<float> cfgCutPt{"cfgCutPt", 0.2, "PT cut on daughter track"};
62+
Configurable<float> cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"};
63+
Configurable<float> cfgCutDCAxy{"cfgCutDCAxy", 0.2f, "DCAxy range for tracks"};
64+
Configurable<float> cfgCutDCAz{"cfgCutDCAz", 0.2f, "DCAz range for tracks"};
65+
Configurable<int> cfgTPCcluster{"cfgTPCcluster", 50, "Number of TPC cluster"};
66+
67+
Configurable<float> cfgv0radiusMin{"cfgv0radiusMin", 1.2, "minimum decay radius"};
68+
Configurable<float> cfgDCAPosToPVMin{"cfgDCAPosToPVMin", 0.05, "minimum DCA to PV for positive track"};
69+
Configurable<float> cfgDCANegToPVMin{"cfgDCANegToPVMin", 0.2, "minimum DCA to PV for negative track"};
70+
Configurable<float> cfgv0CosPA{"cfgv0CosPA", 0.995, "minimum v0 cosine"};
71+
Configurable<float> cfgDCAV0Dau{"cfgDCAV0Dau", 1.0, "maximum DCA between daughters"};
72+
73+
Configurable<float> cfgV0PtMin{"cfgV0PtMin", 0, "minimum pT for lambda"};
74+
Configurable<float> cfgV0EtaMin{"cfgV0EtaMin", -0.5, "maximum rapidity"};
75+
Configurable<float> cfgV0EtaMax{"cfgV0EtaMax", 0.5, "maximum rapidity"};
76+
Configurable<float> cfgV0LifeTime{"cfgV0LifeTime", 30., "maximum lambda lifetime"};
77+
78+
Configurable<int> cfgDaughTPCnclsMin{"cfgDaughTPCnclsMin", 50, "minimum fired crossed rows"};
79+
Configurable<float> cfgDaughPIDCutsTPCPr{"cfgDaughPIDCutsTPCPr", 5, "proton nsigma for TPC"};
80+
Configurable<float> cfgDaughPIDCutsTPCPi{"cfgDaughPIDCutsTPCPi", 5, "pion nsigma for TPC"};
81+
Configurable<float> cfgDaughEtaMin{"cfgDaughEtaMin", -0.8, "minimum daughter eta"};
82+
Configurable<float> cfgDaughEtaMax{"cfgDaughEtaMax", 0.8, "maximum daughter eta"};
83+
Configurable<float> cfgDaughPrPt{"cfgDaughPrPt", 0.5, "minimum daughter proton pt"};
84+
Configurable<float> cfgDaughPiPt{"cfgDaughPiPt", 0.2, "minimum daughter pion pt"};
85+
86+
Configurable<float> cfgMinLambdaMass{"cfgMinLambdaMass", 1.105, "Minimum lambda mass"};
87+
Configurable<float> cfgMaxLambdaMass{"cfgMaxLambdaMass", 1.125, "Maximum lambda mass"};
88+
89+
ConfigurableAxis massAxis{"massAxis", {200, 2.1, 2.3}, "Invariant mass axis"};
90+
ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.0, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 100.0}, "Transverse momentum bins"};
91+
ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 20, 50, 100}, "Centrality interval"};
92+
ConfigurableAxis vertexAxis{"vertexAxis", {10, -10, 10}, "vertex axis for mixing"};
93+
94+
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
95+
Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPt);
96+
Filter DCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
97+
98+
using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Ms, aod::CentFT0Cs>>;
99+
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullKa, aod::pidTPCFullPi, aod::pidTPCFullPr>>;
100+
101+
HistogramRegistry histos{
102+
"histos",
103+
{},
104+
OutputObjHandlingPolicy::AnalysisObject};
105+
106+
SliceCache cache;
107+
108+
double massLambda = o2::constants::physics::MassLambda;
109+
double massPr = o2::constants::physics::MassProton;
110+
double massPi = o2::constants::physics::MassPionCharged;
111+
112+
float centrality;
113+
114+
void init(o2::framework::InitContext&)
115+
{
116+
histos.add("hEventstat", "", {HistType::kTH1F, {{3, 0, 3}}});
117+
}
118+
119+
template <typename T>
120+
bool selectionTrack(const T& candidate)
121+
{
122+
if (cfgUseGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.tpcNClsFound() > cfgTPCcluster)) {
123+
return false;
124+
}
125+
return true;
126+
}
127+
128+
template <typename T>
129+
bool selectionPID(const T& candidate, int pid)
130+
{
131+
if (pid == 0) {
132+
if (std::abs(candidate.tpcNSigmaPi()) > cfgDaughPIDCutsTPCPi) {
133+
return false;
134+
}
135+
} else if (pid == 2) {
136+
if (std::abs(candidate.tpcNSigmaPr()) > cfgDaughPIDCutsTPCPr) {
137+
return false;
138+
}
139+
}
140+
return true;
141+
}
142+
143+
template <typename TCollision, typename V0>
144+
bool selectionV0(TCollision const& collision, V0 const& candidate)
145+
{
146+
if (candidate.v0radius() < cfgv0radiusMin)
147+
return false;
148+
if (std::abs(candidate.dcapostopv()) < cfgDCAPosToPVMin)
149+
return false;
150+
if (std::abs(candidate.dcanegtopv()) < cfgDCANegToPVMin)
151+
return false;
152+
if (candidate.v0cosPA() < cfgv0CosPA)
153+
return false;
154+
if (std::abs(candidate.dcaV0daughters()) > cfgDCAV0Dau)
155+
return false;
156+
if (candidate.pt() < cfgV0PtMin)
157+
return false;
158+
if (candidate.yLambda() < cfgV0EtaMin)
159+
return false;
160+
if (candidate.yLambda() > cfgV0EtaMax)
161+
return false;
162+
if (candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * massLambda > cfgV0LifeTime)
163+
return false;
164+
165+
return true;
166+
}
167+
168+
template <typename T>
169+
bool selectionV0Daughter(T const& track, int pid) // pid 0: proton, pid 1: pion
170+
{
171+
if (track.tpcNClsFound() < cfgDaughTPCnclsMin)
172+
return false;
173+
if (pid == 0 && std::abs(track.tpcNSigmaPr()) > cfgDaughPIDCutsTPCPr)
174+
return false;
175+
if (pid == 1 && std::abs(track.tpcNSigmaPi()) > cfgDaughPIDCutsTPCPi)
176+
return false;
177+
if (track.eta() > cfgDaughEtaMax)
178+
return false;
179+
if (track.eta() < cfgDaughEtaMin)
180+
return false;
181+
if (pid == 0 && track.pt() < cfgDaughPrPt)
182+
return false;
183+
if (pid == 1 && track.pt() < cfgDaughPiPt)
184+
return false;
185+
186+
return true;
187+
}
188+
189+
ROOT::Math::PxPyPzMVector DauVec1, DauVec2, LLMesonMother, LLVectorDummy, LLd1dummy, LLd2dummy;
190+
191+
void processLLReducedTable(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks*/, aod::V0Datas const& V0s, aod::BCsWithTimestamps const&)
192+
{
193+
bool keepEventLL = false;
194+
int numberLambda = 0;
195+
auto currentRunNumber = collision.bc_as<aod::BCsWithTimestamps>().runNumber();
196+
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
197+
centrality = collision.centFT0M();
198+
199+
std::vector<int> LLdId = {};
200+
201+
std::vector<int64_t> LLdd1Index = {};
202+
std::vector<int64_t> LLdd2Index = {};
203+
204+
std::vector<float> LLdd1TPC = {};
205+
std::vector<float> LLdd2TPC = {};
206+
207+
std::vector<float> LLdx = {};
208+
std::vector<float> LLdy = {};
209+
std::vector<float> LLdz = {};
210+
211+
std::vector<ROOT::Math::PtEtaPhiMVector> llresonance;
212+
213+
histos.fill(HIST("hEventstat"), 0.5);
214+
if (!(collision.sel8() && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)))
215+
return;
216+
histos.fill(HIST("hEventstat"), 1.5);
217+
218+
for (auto& v0 : V0s) {
219+
auto postrack_v0 = v0.template posTrack_as<TrackCandidates>();
220+
auto negtrack_v0 = v0.template negTrack_as<TrackCandidates>();
221+
222+
int LambdaTag = 0;
223+
int aLambdaTag = 0;
224+
225+
if (selectionV0Daughter(postrack_v0, 0) && selectionV0Daughter(negtrack_v0, 1))
226+
LambdaTag = 1;
227+
228+
if (selectionV0Daughter(negtrack_v0, 0) && selectionV0Daughter(postrack_v0, 1))
229+
aLambdaTag = 1;
230+
231+
if (LambdaTag == aLambdaTag)
232+
continue;
233+
234+
if (!selectionV0(collision, v0))
235+
continue;
236+
237+
if (LambdaTag) {
238+
if (v0.mLambda() < cfgMinLambdaMass || v0.mLambda() > cfgMaxLambdaMass) {
239+
continue;
240+
}
241+
DauVec1 = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPr);
242+
DauVec2 = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPi);
243+
LLdId.push_back(3122);
244+
} else if (aLambdaTag) {
245+
if (v0.mAntiLambda() < cfgMinLambdaMass || v0.mAntiLambda() > cfgMaxLambdaMass) {
246+
continue;
247+
}
248+
DauVec1 = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), massPi);
249+
DauVec2 = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), massPr);
250+
LLdId.push_back(-3122);
251+
}
252+
numberLambda++;
253+
254+
LLdx.push_back(v0.x());
255+
LLdy.push_back(v0.y());
256+
LLdz.push_back(v0.z());
257+
258+
LLMesonMother = DauVec1 + DauVec2;
259+
260+
ROOT::Math::PtEtaPhiMVector temp3(LLMesonMother.Pt(), LLMesonMother.Eta(), LLMesonMother.Phi(), LLMesonMother.M());
261+
llresonance.push_back(temp3);
262+
263+
if (LambdaTag) {
264+
LLdd1TPC.push_back(postrack_v0.tpcNSigmaPr());
265+
LLdd2TPC.push_back(negtrack_v0.tpcNSigmaPi());
266+
} else if (aLambdaTag) {
267+
LLdd1TPC.push_back(postrack_v0.tpcNSigmaPi());
268+
LLdd2TPC.push_back(negtrack_v0.tpcNSigmaPr());
269+
}
270+
271+
LLdd1Index.push_back(postrack_v0.globalIndex());
272+
LLdd2Index.push_back(negtrack_v0.globalIndex());
273+
} // select collision
274+
275+
if (numberLambda < 2)
276+
return;
277+
278+
keepEventLL = true;
279+
280+
if (keepEventLL) {
281+
histos.fill(HIST("hEventstat"), 2.5);
282+
/////////// Fill collision table///////////////
283+
redLLEvents(bc.globalBC(), currentRunNumber, bc.timestamp(), collision.posZ(), collision.numContrib(), centrality, numberLambda);
284+
auto indexEvent = redLLEvents.lastIndex();
285+
//// Fill track table for LL//////////////////
286+
for (auto if1 = llresonance.begin(); if1 != llresonance.end(); ++if1) {
287+
auto i5 = std::distance(llresonance.begin(), if1);
288+
LLVectorDummy = llresonance.at(i5);
289+
llTrack(indexEvent, LLdId.at(i5), LLVectorDummy.Px(), LLVectorDummy.Py(), LLVectorDummy.Pz(), LLdx.at(i5), LLdy.at(i5), LLdz.at(i5), LLVectorDummy.M(), LLdd1TPC.at(i5), LLdd2TPC.at(i5), LLdd1Index.at(i5), LLdd2Index.at(i5));
290+
}
291+
}
292+
} // process
293+
PROCESS_SWITCH(lambdalambdatable, processLLReducedTable, "Process table creation for double ll", true);
294+
};
295+
296+
WorkflowSpec defineDataProcessing(ConfigContext const& cfg)
297+
{
298+
return WorkflowSpec{adaptAnalysisTask<lambdalambdatable>(cfg)};
299+
}

0 commit comments

Comments
 (0)