Skip to content

Commit ba1b721

Browse files
authored
Strangeness tables + strangeness producer, consumer tasks (first commit) (#4316)
1 parent 55142b8 commit ba1b721

File tree

7 files changed

+335
-4
lines changed

7 files changed

+335
-4
lines changed

Analysis/DataModel/include/Analysis/Multiplicity.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ DECLARE_SOA_COLUMN(MultV0C, multV0C, float);
2121
DECLARE_SOA_COLUMN(MultZNA, multZNA, float);
2222
DECLARE_SOA_COLUMN(MultZNC, multZNC, float);
2323
DECLARE_SOA_DYNAMIC_COLUMN(MultV0M, multV0M, [](float multV0A, float multV0C) -> float { return multV0A + multV0C; });
24+
DECLARE_SOA_COLUMN(MultTracklets, multTracklets, int);
25+
2426
} // namespace mult
25-
DECLARE_SOA_TABLE(Mults, "AOD", "MULT", mult::MultV0A, mult::MultV0C, mult::MultZNA, mult::MultZNC, mult::MultV0M<mult::MultV0A, mult::MultV0C>);
27+
DECLARE_SOA_TABLE(Mults, "AOD", "MULT", mult::MultV0A, mult::MultV0C, mult::MultZNA, mult::MultZNC, mult::MultV0M<mult::MultV0A, mult::MultV0C>, mult::MultTracklets);
2628
using Mult = Mults::iterator;
2729
} // namespace o2::aod
2830

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
#ifndef O2_ANALYSIS_STRANGENESSTABLES_H_
11+
#define O2_ANALYSIS_STRANGENESSTABLES_H_
12+
13+
#include "Framework/AnalysisDataModel.h"
14+
#include "Analysis/RecoDecay.h"
15+
16+
namespace o2::aod
17+
{
18+
namespace v0data
19+
{
20+
//General V0 properties: position, momentum
21+
DECLARE_SOA_COLUMN(PxPos, pxpos, float);
22+
DECLARE_SOA_COLUMN(PyPos, pypos, float);
23+
DECLARE_SOA_COLUMN(PzPos, pzpos, float);
24+
DECLARE_SOA_COLUMN(PxNeg, pxneg, float);
25+
DECLARE_SOA_COLUMN(PyNeg, pyneg, float);
26+
DECLARE_SOA_COLUMN(PzNeg, pzneg, float);
27+
DECLARE_SOA_COLUMN(X, x, float);
28+
DECLARE_SOA_COLUMN(Y, y, float);
29+
DECLARE_SOA_COLUMN(Z, z, float);
30+
31+
//Saved from finding: DCAs
32+
DECLARE_SOA_COLUMN(DCAV0Daughters, dcaV0daughters, float);
33+
DECLARE_SOA_COLUMN(DCAPosToPV, dcapostopv, float);
34+
DECLARE_SOA_COLUMN(DCANegToPV, dcanegtopv, float);
35+
36+
//Derived expressions
37+
//Momenta
38+
DECLARE_SOA_DYNAMIC_COLUMN(Pt, pt, [](float pxpos, float pypos, float pxneg, float pyneg) { return RecoDecay::sqrtSumOfSquares(pxpos + pxneg, pypos + pyneg); });
39+
40+
//Length quantities
41+
DECLARE_SOA_DYNAMIC_COLUMN(V0Radius, v0radius, [](float x, float y) { return RecoDecay::sqrtSumOfSquares(x, y); });
42+
43+
//CosPA
44+
DECLARE_SOA_DYNAMIC_COLUMN(V0CosPA, v0cosPA, [](float X, float Y, float Z, float Px, float Py, float Pz, float pvX, float pvY, float pvZ) { return RecoDecay::CPA(array{pvX, pvY, pvZ}, array{X, Y, Z}, array{Px, Py, Pz}); });
45+
46+
//Calculated on the fly with mass assumption + dynamic tables
47+
DECLARE_SOA_DYNAMIC_COLUMN(MLambda, mLambda, [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) { return RecoDecay::M(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{RecoDecay::getMassPDG(kProton), RecoDecay::getMassPDG(kPiPlus)}); });
48+
DECLARE_SOA_DYNAMIC_COLUMN(MAntiLambda, mAntiLambda, [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) { return RecoDecay::M(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kProton)}); });
49+
DECLARE_SOA_DYNAMIC_COLUMN(MK0Short, mK0Short, [](float pxpos, float pypos, float pzpos, float pxneg, float pyneg, float pzneg) { return RecoDecay::M(array{array{pxpos, pypos, pzpos}, array{pxneg, pyneg, pzneg}}, array{RecoDecay::getMassPDG(kPiPlus), RecoDecay::getMassPDG(kPiPlus)}); });
50+
} // namespace v0data
51+
52+
namespace v0dataext
53+
{
54+
DECLARE_SOA_EXPRESSION_COLUMN(Px, px, float, 1.f * aod::v0data::pxpos + 1.f * aod::v0data::pxneg);
55+
DECLARE_SOA_EXPRESSION_COLUMN(Py, py, float, 1.f * aod::v0data::pypos + 1.f * aod::v0data::pyneg);
56+
DECLARE_SOA_EXPRESSION_COLUMN(Pz, pz, float, 1.f * aod::v0data::pzpos + 1.f * aod::v0data::pzneg);
57+
} // namespace v0dataext
58+
59+
DECLARE_SOA_TABLE(V0Data, "AOD", "V0DATA",
60+
v0data::X, v0data::Y, v0data::Z,
61+
v0data::PxPos, v0data::PyPos, v0data::PzPos,
62+
v0data::PxNeg, v0data::PyNeg, v0data::PzNeg,
63+
v0data::DCAV0Daughters, v0data::DCAPosToPV, v0data::DCANegToPV,
64+
65+
//Dynamic columns
66+
v0data::Pt<v0data::PxPos, v0data::PyPos, v0data::PxNeg, v0data::PyNeg>,
67+
v0data::V0Radius<v0data::X, v0data::Y>,
68+
v0data::V0CosPA<v0data::X, v0data::Y, v0data::Z, v0dataext::Px, v0dataext::Py, v0dataext::Pz>,
69+
70+
//Invariant masses
71+
v0data::MLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
72+
v0data::MAntiLambda<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>,
73+
v0data::MK0Short<v0data::PxPos, v0data::PyPos, v0data::PzPos, v0data::PxNeg, v0data::PyNeg, v0data::PzNeg>);
74+
75+
using V0DataOrigin = V0Data;
76+
77+
// extended table with expression columns that can be used as arguments of dynamic columns
78+
DECLARE_SOA_EXTENDED_TABLE_USER(V0DataExt, V0DataOrigin, "V0DATAEXT",
79+
v0dataext::Px, v0dataext::Py, v0dataext::Pz);
80+
81+
using V0DataFull = V0DataExt;
82+
83+
} // namespace o2::aod
84+
85+
#endif // O2_ANALYSIS_STRANGENESSTABLES_H_

Analysis/Tasks/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,13 @@ o2_add_dpl_workflow(run3-matcher
110110
SOURCES run3Matcher.cxx
111111
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::AnalysisDataModel
112112
COMPONENT_NAME Analysis)
113+
114+
o2_add_dpl_workflow(lambdakzeroproducer
115+
SOURCES lambdakzeroproducer
116+
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing
117+
COMPONENT_NAME Analysis)
118+
119+
o2_add_dpl_workflow(lambdakzeroconsumer
120+
SOURCES lambdakzeroconsumer
121+
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2::AnalysisDataModel O2::AnalysisCore O2::DetectorsVertexing
122+
COMPONENT_NAME Analysis)
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
#include "Framework/runDataProcessing.h"
11+
#include "Framework/AnalysisTask.h"
12+
#include "Framework/AnalysisDataModel.h"
13+
#include "Framework/ASoAHelpers.h"
14+
#include "ReconstructionDataFormats/Track.h"
15+
#include "Analysis/RecoDecay.h"
16+
#include "Analysis/trackUtilities.h"
17+
#include "Analysis/StrangenessTables.h"
18+
#include "Analysis/TrackSelection.h"
19+
#include "Analysis/TrackSelectionTables.h"
20+
21+
#include <TFile.h>
22+
#include <TH2F.h>
23+
#include <TProfile.h>
24+
#include <TLorentzVector.h>
25+
#include <Math/Vector4D.h>
26+
#include <TPDGCode.h>
27+
#include <TDatabasePDG.h>
28+
#include <cmath>
29+
#include <array>
30+
#include <cstdlib>
31+
#include "PID/PIDResponse.h"
32+
#include "Framework/ASoAHelpers.h"
33+
34+
using namespace o2;
35+
using namespace o2::framework;
36+
using namespace o2::framework::expressions;
37+
using std::array;
38+
39+
struct lambdakzeroQA {
40+
//Basic checks
41+
OutputObj<TH1F> hMassK0Short{TH1F("hMassK0Short", "", 3000, 0.0, 3.0)};
42+
OutputObj<TH1F> hMassLambda{TH1F("hMassLambda", "", 3000, 0.0, 3.0)};
43+
OutputObj<TH1F> hMassAntiLambda{TH1F("hMassAntiLambda", "", 3000, 0.0, 3.0)};
44+
45+
OutputObj<TH1F> hV0Radius{TH1F("hV0Radius", "", 1000, 0.0, 100)};
46+
OutputObj<TH1F> hV0CosPA{TH1F("hV0CosPA", "", 1000, 0.95, 1.0)};
47+
OutputObj<TH1F> hDCAPosToPV{TH1F("hDCAPosToPV", "", 1000, 0.0, 10.0)};
48+
OutputObj<TH1F> hDCANegToPV{TH1F("hDCANegToPV", "", 1000, 0.0, 10.0)};
49+
OutputObj<TH1F> hDCAV0Dau{TH1F("hDCAV0Dau", "", 1000, 0.0, 10.0)};
50+
51+
void process(aod::Collision const& collision, soa::Join<aod::V0s, aod::V0DataExt> const& fullV0s)
52+
{
53+
for (auto& v0 : fullV0s) {
54+
hMassLambda->Fill(v0.mLambda());
55+
hMassAntiLambda->Fill(v0.mAntiLambda());
56+
hMassK0Short->Fill(v0.mK0Short());
57+
58+
hV0Radius->Fill(v0.v0radius());
59+
hV0CosPA->Fill(v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()));
60+
61+
hDCAPosToPV->Fill(v0.dcapostopv());
62+
hDCANegToPV->Fill(v0.dcanegtopv());
63+
hDCAV0Dau->Fill(v0.dcaV0daughters());
64+
}
65+
}
66+
};
67+
68+
struct lambdakzeroconsumer {
69+
OutputObj<TH2F> h2dMassK0Short{TH2F("h2dMassK0Short", "", 200, 0, 10, 200, 0.450, 0.550)};
70+
OutputObj<TH2F> h2dMassLambda{TH2F("h2dMassLambda", "", 200, 0, 10, 200, 1.115 - 0.100, 1.115 + 0.100)};
71+
OutputObj<TH2F> h2dMassAntiLambda{TH2F("h2dMassAntiLambda", "", 200, 0, 10, 200, 1.115 - 0.100, 1.115 + 0.100)};
72+
73+
//Selection criteria
74+
Configurable<double> v0cospa{"v0cospa", 0.995, "V0 CosPA"}; //double -> N.B. dcos(x)/dx = 0 at x=0)
75+
Configurable<float> dcav0dau{"dcav0dau", 1.0, "DCA V0 Daughters"};
76+
Configurable<float> dcanegtopv{"dcanegtopv", .1, "DCA Neg To PV"};
77+
Configurable<float> dcapostopv{"dcapostopv", .1, "DCA Pos To PV"};
78+
Configurable<float> v0radius{"v0radius", 5.0, "v0radius"};
79+
80+
Filter preFilterV0 = aod::v0data::dcapostopv > dcapostopv&&
81+
aod::v0data::dcanegtopv > dcanegtopv&& aod::v0data::dcaV0daughters < dcav0dau;
82+
83+
void process(aod::Collision const& collision, soa::Filtered<soa::Join<aod::V0s, aod::V0DataExt>> const& fullV0s)
84+
{
85+
for (auto& v0 : fullV0s) {
86+
//FIXME: could not find out how to filter cosPA and radius variables (dynamic columns)
87+
if (v0.v0radius() > v0radius && v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) > v0cospa) {
88+
h2dMassLambda->Fill(v0.pt(), v0.mLambda());
89+
h2dMassAntiLambda->Fill(v0.pt(), v0.mAntiLambda());
90+
h2dMassK0Short->Fill(v0.pt(), v0.mK0Short());
91+
}
92+
}
93+
}
94+
};
95+
96+
/// Extends the v0data table with expression columns
97+
struct lambdakzeroinitializer {
98+
Spawns<aod::V0DataExt> v0dataext;
99+
void init(InitContext const&) {}
100+
};
101+
102+
WorkflowSpec defineDataProcessing(ConfigContext const&)
103+
{
104+
return WorkflowSpec{
105+
adaptAnalysisTask<lambdakzeroconsumer>("lf-lambdakzeroconsumer"),
106+
adaptAnalysisTask<lambdakzeroQA>("lf-lambdakzeroQA"),
107+
adaptAnalysisTask<lambdakzeroinitializer>("lf-lambdakzeroinitializer")};
108+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
#include "Framework/runDataProcessing.h"
11+
#include "Framework/AnalysisTask.h"
12+
#include "Framework/AnalysisDataModel.h"
13+
#include "Framework/ASoAHelpers.h"
14+
#include "Analysis/SecondaryVertexHF.h"
15+
#include "DetectorsVertexing/DCAFitterN.h"
16+
#include "ReconstructionDataFormats/Track.h"
17+
#include "Analysis/RecoDecay.h"
18+
#include "Analysis/trackUtilities.h"
19+
#include "Analysis/StrangenessTables.h"
20+
21+
#include <TFile.h>
22+
#include <TH2F.h>
23+
#include <TProfile.h>
24+
#include <TLorentzVector.h>
25+
#include <Math/Vector4D.h>
26+
#include <TPDGCode.h>
27+
#include <TDatabasePDG.h>
28+
#include <cmath>
29+
#include <array>
30+
#include <cstdlib>
31+
#include "PID/PIDResponse.h"
32+
#include "Framework/ASoAHelpers.h"
33+
34+
using namespace o2;
35+
using namespace o2::framework;
36+
using namespace o2::framework::expressions;
37+
using std::array;
38+
39+
/// Cascade builder task: rebuilds cascades
40+
struct lambdakzeroproducer {
41+
42+
Produces<aod::V0Data> v0data;
43+
44+
OutputObj<TH1F> hEventCounter{TH1F("hEventCounter", "", 1, 0, 1)};
45+
OutputObj<TH1F> hCascCandidate{TH1F("hCascCandidate", "", 10, 0, 10)};
46+
47+
//Configurables
48+
Configurable<double> d_bz{"d_bz", -5.0, "bz field"};
49+
Configurable<double> d_UseAbsDCA{"d_UseAbsDCA", kTRUE, "Use Abs DCAs"};
50+
51+
double massPi = TDatabasePDG::Instance()->GetParticle(kPiPlus)->Mass();
52+
double massKa = TDatabasePDG::Instance()->GetParticle(kKPlus)->Mass();
53+
double massPr = TDatabasePDG::Instance()->GetParticle(kProton)->Mass();
54+
55+
/// Extracts dca in the XY plane
56+
/// \return dcaXY
57+
template <typename T, typename U>
58+
auto getdcaXY(const T& track, const U& coll)
59+
{
60+
//Calculate DCAs
61+
auto sinAlpha = sin(track.alpha());
62+
auto cosAlpha = cos(track.alpha());
63+
auto globalX = track.x() * cosAlpha - track.y() * sinAlpha;
64+
auto globalY = track.x() * sinAlpha + track.y() * cosAlpha;
65+
return sqrt(pow((globalX - coll[0]), 2) +
66+
pow((globalY - coll[1]), 2));
67+
}
68+
69+
void process(aod::Collision const& collision, aod::V0s const& V0s, aod::FullTracks const& tracks)
70+
{
71+
//Define o2 fitter, 2-prong
72+
o2::vertexing::DCAFitterN<2> fitter;
73+
fitter.setBz(d_bz);
74+
fitter.setPropagateToPCA(true);
75+
fitter.setMaxR(200.);
76+
fitter.setMinParamChange(1e-3);
77+
fitter.setMinRelChi2Change(0.9);
78+
fitter.setMaxDZIni(1e9);
79+
fitter.setMaxChi2(1e9);
80+
fitter.setUseAbsDCA(d_UseAbsDCA);
81+
82+
hEventCounter->Fill(0.5);
83+
std::array<float, 3> pVtx = {collision.posX(), collision.posY(), collision.posZ()};
84+
85+
for (auto& V0 : V0s) {
86+
std::array<float, 3> pos = {0.};
87+
std::array<float, 3> pvec0 = {0.};
88+
std::array<float, 3> pvec1 = {0.};
89+
90+
hCascCandidate->Fill(0.5);
91+
auto pTrack = getTrackParCov(V0.posTrack());
92+
auto nTrack = getTrackParCov(V0.negTrack());
93+
int nCand = fitter.process(pTrack, nTrack);
94+
if (nCand != 0) {
95+
fitter.propagateTracksToVertex();
96+
hCascCandidate->Fill(2.5);
97+
const auto& vtx = fitter.getPCACandidate();
98+
for (int i = 0; i < 3; i++)
99+
pos[i] = vtx[i];
100+
fitter.getTrack(0).getPxPyPzGlo(pvec0);
101+
fitter.getTrack(1).getPxPyPzGlo(pvec1);
102+
}
103+
104+
v0data(pos[0], pos[1], pos[2],
105+
pvec0[0], pvec0[1], pvec0[2],
106+
pvec1[0], pvec1[1], pvec1[2],
107+
fitter.getChi2AtPCACandidate(),
108+
getdcaXY(V0.posTrack(), pVtx),
109+
getdcaXY(V0.negTrack(), pVtx));
110+
}
111+
}
112+
};
113+
114+
WorkflowSpec defineDataProcessing(ConfigContext const&)
115+
{
116+
return WorkflowSpec{
117+
adaptAnalysisTask<lambdakzeroproducer>("lf-lambdakzeroproducer")};
118+
}

Analysis/Tasks/multiplicityQa.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ struct MultiplicityQaTask {
2222
OutputObj<TH1F> hMultZNA{TH1F("hMultZNA", "", 600, 0., 240000.)};
2323
OutputObj<TH1F> hMultZNC{TH1F("hMultZNC", "", 600, 0., 240000.)};
2424

25+
OutputObj<TProfile> hMultNtrackletsVsV0M{TProfile("hMultNtrackletsVsV0M", "", 50000, 0., 50000.)};
26+
2527
void process(soa::Join<aod::Collisions, aod::EvSels, aod::Mults>::iterator const& col)
2628
{
2729
if (!col.alias()[kINT7])
@@ -34,6 +36,7 @@ struct MultiplicityQaTask {
3436
hMultV0M->Fill(col.multV0M());
3537
hMultZNA->Fill(col.multZNA());
3638
hMultZNC->Fill(col.multZNC());
39+
hMultNtrackletsVsV0M->Fill(col.multV0M(), col.multTracklets());
3740
}
3841
};
3942

Analysis/Tasks/multiplicityTable.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct MultiplicityTableTask {
3737
return dummy;
3838
}
3939

40-
void process(aod::Collision const& collision, aod::BCs const& bcs, aod::Zdcs const& zdcs, aod::Run2V0s const& vzeros)
40+
void process(aod::Collision const& collision, aod::BCs const& bcs, aod::Zdcs const& zdcs, aod::Run2V0s const& vzeros, aod::Tracks const& tracks)
4141
{
4242
auto zdc = getZdc(collision.bc(), zdcs);
4343
auto vzero = getVZero(collision.bc(), vzeros);
@@ -46,9 +46,14 @@ struct MultiplicityTableTask {
4646
float multZNA = zdc.energyCommonZNA();
4747
float multZNC = zdc.energyCommonZNC();
4848

49-
LOGF(debug, "multV0A=%5.0f multV0C=%5.0f multZNA=%6.0f multZNC=%6.0f", multV0A, multV0C, multZNA, multZNC);
49+
int multTracklets = 0;
50+
for (auto& tr : tracks)
51+
if (tr.trackType() == o2::aod::track::TrackTypeEnum::Run2Tracklet)
52+
multTracklets++;
53+
54+
LOGF(debug, "multV0A=%5.0f multV0C=%5.0f multZNA=%6.0f multZNC=%6.0f multTracklets=%i", multV0A, multV0C, multZNA, multZNC, multTracklets);
5055
// fill multiplicity columns
51-
mult(multV0A, multV0C, multZNA, multZNC);
56+
mult(multV0A, multV0C, multZNA, multZNC, multTracklets);
5257
}
5358
};
5459

0 commit comments

Comments
 (0)