From bc465462f0fe982706d9466b33486f712bda719a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Sat, 29 Feb 2020 00:44:41 +0100 Subject: [PATCH 01/12] DPL Analysis: add test with bindings and joins --- Framework/Core/test/test_ASoA.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Framework/Core/test/test_ASoA.cxx b/Framework/Core/test/test_ASoA.cxx index e628962e7768b..33bf32f7bbe65 100644 --- a/Framework/Core/test/test_ASoA.cxx +++ b/Framework/Core/test/test_ASoA.cxx @@ -47,9 +47,11 @@ DECLARE_SOA_COLUMN(N, n, int, "fN"); DECLARE_SOA_INDEX_COLUMN_FULL(Info, info, int, Infos, "fInfosID"); DECLARE_SOA_INDEX_COLUMN_FULL(PointA, pointA, int, Points, "fPointAID"); DECLARE_SOA_INDEX_COLUMN_FULL(PointB, pointB, int, Points, "fPointBID"); +DECLARE_SOA_COLUMN(Thickness, thickness, int, "thickness"); } // namespace test DECLARE_SOA_TABLE(Segments, "TST", "SEGMENTS", test::N, test::PointAId, test::PointBId, test::InfoId); +DECLARE_SOA_TABLE(SegmentsExtras, "TST", "SEGMENTSEX", test::Thickness); BOOST_AUTO_TEST_CASE(TestTableIteration) { @@ -468,6 +470,13 @@ BOOST_AUTO_TEST_CASE(TestDereference) Segments segments{segmentsT}; BOOST_REQUIRE_EQUAL(segmentsT->num_rows(), 1); + TableBuilder builderC; + auto segmentsExtraWriter = builderC.cursor(); + segmentsExtraWriter(0, 1); + auto segmentsExtraT = builderC.finalize(); + SegmentsExtras segmentsExtras{segmentsExtraT}; + BOOST_REQUIRE_EQUAL(segmentsExtraT->num_rows(), 1); + BOOST_CHECK_EQUAL(segments.begin().pointAId(), 0); BOOST_CHECK_EQUAL(segments.begin().pointBId(), 1); static_assert(std::is_same_v); @@ -489,4 +498,15 @@ BOOST_AUTO_TEST_CASE(TestDereference) BOOST_CHECK_EQUAL(j.pointA().y(), 0); BOOST_CHECK_EQUAL(j.pointB().x(), 3); BOOST_CHECK_EQUAL(j.pointB().y(), 4); + + auto joined = join(segments, segmentsExtras); + joined.bindExternalIndices(&points, &infos); + auto se = joined.begin(); + BOOST_CHECK_EQUAL(se.n(), 10); + BOOST_CHECK_EQUAL(se.info().color(), 4); + BOOST_CHECK_EQUAL(se.pointA().x(), 0); + BOOST_CHECK_EQUAL(se.pointA().y(), 0); + BOOST_CHECK_EQUAL(se.pointB().x(), 3); + BOOST_CHECK_EQUAL(se.pointB().y(), 4); + BOOST_CHECK_EQUAL(se.thickness(), 1); } From 5a1b27f6ad1a4d1746afb63114e115f6006d61cf Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 28 Feb 2020 23:17:48 +0100 Subject: [PATCH 02/12] DPL Analysis: rework static assertion It now handles the case for Join, Concat, Filtered. --- Framework/Core/include/Framework/AnalysisTask.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Framework/Core/include/Framework/AnalysisTask.h b/Framework/Core/include/Framework/AnalysisTask.h index fd476fa7cd31a..4d28f36c4a472 100644 --- a/Framework/Core/include/Framework/AnalysisTask.h +++ b/Framework/Core/include/Framework/AnalysisTask.h @@ -368,7 +368,7 @@ struct AnalysisDataProcessorBuilder { // // Will iterate on all the tracks for the provided collision. if constexpr (is_specialization, o2::soa::Table>::value) { - static_assert((is_specialization, o2::soa::Table>::value && ...), + static_assert(((is_specialization, o2::soa::RowViewBase>::value == false) && ...), "You cannot have a soa::RowView iterator as an argument after the " " first argument of type soa::Table which is found as in the " " prototype of the task process method."); From ec66d4077eb07ebe3ce40c522109618864affe2c Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 28 Feb 2020 23:20:13 +0100 Subject: [PATCH 03/12] DPL Analysis: workaround to get the index column to work Joins --- Analysis/DataModel/include/Analysis/SecondaryVertex.h | 7 +++++-- Analysis/DataModel/src/dumpDataModel.cxx | 2 +- Analysis/Tasks/vertexerhf.cxx | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Analysis/DataModel/include/Analysis/SecondaryVertex.h b/Analysis/DataModel/include/Analysis/SecondaryVertex.h index ed873e4e4bf97..23463ae23aeec 100644 --- a/Analysis/DataModel/include/Analysis/SecondaryVertex.h +++ b/Analysis/DataModel/include/Analysis/SecondaryVertex.h @@ -16,15 +16,18 @@ namespace o2::aod { namespace secvtx2prong { +// FIXME: this is a workaround until we get the index columns to work with joins. +using BigTracks = soa::Join; + DECLARE_SOA_INDEX_COLUMN(Collision, collision); DECLARE_SOA_COLUMN(Posdecayx, posdecayx, float, "fPosdecayx"); DECLARE_SOA_COLUMN(Posdecayy, posdecayy, float, "fPosdecayy"); DECLARE_SOA_COLUMN(Posdecayz, posdecayz, float, "fPosdecayz"); -DECLARE_SOA_INDEX_COLUMN_FULL(Index0, index0, int, Tracks, "fIndex0"); +DECLARE_SOA_INDEX_COLUMN_FULL(Index0, index0, int, BigTracks, "fIndex0"); DECLARE_SOA_COLUMN(Px0, px0, float, "fPx0"); DECLARE_SOA_COLUMN(Py0, py0, float, "fPy0"); DECLARE_SOA_COLUMN(Pz0, pz0, float, "fPz0"); -DECLARE_SOA_INDEX_COLUMN_FULL(Index1, index1, int, Tracks, "fIndex1"); +DECLARE_SOA_INDEX_COLUMN_FULL(Index1, index1, int, BigTracks, "fIndex1"); DECLARE_SOA_COLUMN(Px1, px1, float, "fPx1"); DECLARE_SOA_COLUMN(Py1, py1, float, "fPy1"); DECLARE_SOA_COLUMN(Pz1, pz1, float, "fPz1"); diff --git a/Analysis/DataModel/src/dumpDataModel.cxx b/Analysis/DataModel/src/dumpDataModel.cxx index 639c2e63b6560..5609e712a5604 100644 --- a/Analysis/DataModel/src/dumpDataModel.cxx +++ b/Analysis/DataModel/src/dumpDataModel.cxx @@ -115,7 +115,7 @@ edge[dir=back, arrowtail=empty] dumpTable(); dumpTable(); dumpTable(); - dumpTable(); +// dumpTable(); dumpTable(); fmt::printf("%s\n", R"(})"); } diff --git a/Analysis/Tasks/vertexerhf.cxx b/Analysis/Tasks/vertexerhf.cxx index 6d76c02ed9121..f17e16fbed210 100644 --- a/Analysis/Tasks/vertexerhf.cxx +++ b/Analysis/Tasks/vertexerhf.cxx @@ -119,7 +119,7 @@ struct CandidateBuilding2Prong { struct CandidateBuildingDzero { Produces cand2prong; - void process(aod::SecVtx2Prong const& secVtx2Prongs, aod::Tracks const& tracks) // HERE IT WHAT WORKS + void process(aod::SecVtx2Prong const& secVtx2Prongs, soa::Join const& tracks) // HERE IT WHAT WORKS //void process(aod::SecVtx2Prong const& secVtx2Prongs) //THE SIMPLE LOOP WORKS AS WELL OF COURSE //BELOW IS WHAT I WOULD LIKE TO BE ABLE TO DO AND THAT IS STILL NOT WORKING From 43606245eb7f823459b9937bbbbac3e929320706 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 10:35:46 +0100 Subject: [PATCH 04/12] Add consistency check on track information --- Analysis/DataModel/include/Analysis/SecondaryVertex.h | 6 ++++-- Analysis/Tasks/vertexerhf.cxx | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Analysis/DataModel/include/Analysis/SecondaryVertex.h b/Analysis/DataModel/include/Analysis/SecondaryVertex.h index 23463ae23aeec..bd4ae0f4f54d3 100644 --- a/Analysis/DataModel/include/Analysis/SecondaryVertex.h +++ b/Analysis/DataModel/include/Analysis/SecondaryVertex.h @@ -27,10 +27,12 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Index0, index0, int, BigTracks, "fIndex0"); DECLARE_SOA_COLUMN(Px0, px0, float, "fPx0"); DECLARE_SOA_COLUMN(Py0, py0, float, "fPy0"); DECLARE_SOA_COLUMN(Pz0, pz0, float, "fPz0"); +DECLARE_SOA_COLUMN(Y0, y0, float, "fY0"); DECLARE_SOA_INDEX_COLUMN_FULL(Index1, index1, int, BigTracks, "fIndex1"); DECLARE_SOA_COLUMN(Px1, px1, float, "fPx1"); DECLARE_SOA_COLUMN(Py1, py1, float, "fPy1"); DECLARE_SOA_COLUMN(Pz1, pz1, float, "fPz1"); +DECLARE_SOA_COLUMN(Y1, y1, float, "fY1"); DECLARE_SOA_COLUMN(IndexDCApair, indexDCApair, int, "fIndexDCApair"); DECLARE_SOA_COLUMN(Mass, mass, float, "fMass"); DECLARE_SOA_COLUMN(Massbar, massbar, float, "fMassbar"); @@ -52,8 +54,8 @@ DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar"); DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG", secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ, secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, - secvtx2prong::Index0Id, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, - secvtx2prong::Index1Id, secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, + secvtx2prong::Index0Id, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, secvtx2prong::Y0, + secvtx2prong::Index1Id, secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, secvtx2prong::Y1, secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, secvtx2prong::DecaylengthXY, secvtx2prong::Decaylength); diff --git a/Analysis/Tasks/vertexerhf.cxx b/Analysis/Tasks/vertexerhf.cxx index f17e16fbed210..a21785818d185 100644 --- a/Analysis/Tasks/vertexerhf.cxx +++ b/Analysis/Tasks/vertexerhf.cxx @@ -105,7 +105,7 @@ struct CandidateBuilding2Prong { float mass_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masspion, pvec1[0], pvec1[1], pvec1[2], masskaon); float masssw_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masskaon, pvec1[0], pvec1[1], pvec1[2], masspion); secvtx2prong(track_0.collisionId(), collision.posX(), collision.posY(), collision.posZ(), vtx.x, vtx.y, vtx.z, track_0.globalIndex(), - pvec0[0], pvec0[1], pvec0[2], track_1.globalIndex(), pvec1[0], pvec1[1], pvec1[2], ic, mass_, masssw_); + pvec0[0], pvec0[1], pvec0[2], track_0.y(), track_1.globalIndex(), pvec1[0], pvec1[1], pvec1[2], track_1.y(), ic, mass_, masssw_); hchi2dca->Fill(df.getChi2AtPCACandidate(ic)); //float declengxy = decaylengthXY(secVtx2prong.posX(), secVtx2prong.posY(), secVtx2prong.posdecayx(), secVtx2prong.posdecayy()); @@ -119,7 +119,7 @@ struct CandidateBuilding2Prong { struct CandidateBuildingDzero { Produces cand2prong; - void process(aod::SecVtx2Prong const& secVtx2Prongs, soa::Join const& tracks) // HERE IT WHAT WORKS + void process(aod::SecVtx2Prong const& secVtx2Prongs, soa::Join const& tracks) // HERE IT WHAT WORKS //void process(aod::SecVtx2Prong const& secVtx2Prongs) //THE SIMPLE LOOP WORKS AS WELL OF COURSE //BELOW IS WHAT I WOULD LIKE TO BE ABLE TO DO AND THAT IS STILL NOT WORKING @@ -129,8 +129,11 @@ struct CandidateBuildingDzero { for (auto& secVtx2prong : secVtx2Prongs) { //example to access the track at the index saved in the secVtx2Prongs - LOGF(INFO, " I am now accessing track information looping over secondary vertices %d", secVtx2prong.index0Id()); - LOGF(INFO, " I am now accessing track information looping over secondary vertices %f", secVtx2prong.index0().y()); + LOGF(INFO, " ------- new event ---------"); + LOGF(INFO, " I am now accessing track0 y from the secvtx table %f", secVtx2prong.y0()); + LOGF(INFO, " I am now accessing track0 y from the corresponding track %f", secVtx2prong.index0().y()); + LOGF(INFO, " I am now accessing track1 y from the secvtx table %f", secVtx2prong.y1()); + LOGF(INFO, " I am now accessing track1 y from the corresponding track %f", secVtx2prong.index1().y()); float masspion = 0.140; float masskaon = 0.494; float mass_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), secVtx2prong.pz0(), masspion, From 26ea26add118f623089695eeb841f6815987e8dc Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 10:54:58 +0100 Subject: [PATCH 05/12] Add TracksCov in the track join --- Analysis/DataModel/include/Analysis/SecondaryVertex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/DataModel/include/Analysis/SecondaryVertex.h b/Analysis/DataModel/include/Analysis/SecondaryVertex.h index bd4ae0f4f54d3..2666d0c4dcd1a 100644 --- a/Analysis/DataModel/include/Analysis/SecondaryVertex.h +++ b/Analysis/DataModel/include/Analysis/SecondaryVertex.h @@ -17,7 +17,7 @@ namespace o2::aod namespace secvtx2prong { // FIXME: this is a workaround until we get the index columns to work with joins. -using BigTracks = soa::Join; +using BigTracks = soa::Join; DECLARE_SOA_INDEX_COLUMN(Collision, collision); DECLARE_SOA_COLUMN(Posdecayx, posdecayx, float, "fPosdecayx"); From 14c22ed07f89bdfb4c9e613fc314c32f5f61f521 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 11:18:57 +0100 Subject: [PATCH 06/12] Max Line 100 for SecondaryVertex.h --- .../include/Analysis/SecondaryVertex.h | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/Analysis/DataModel/include/Analysis/SecondaryVertex.h b/Analysis/DataModel/include/Analysis/SecondaryVertex.h index 2666d0c4dcd1a..122d832521ea8 100644 --- a/Analysis/DataModel/include/Analysis/SecondaryVertex.h +++ b/Analysis/DataModel/include/Analysis/SecondaryVertex.h @@ -36,9 +36,16 @@ DECLARE_SOA_COLUMN(Y1, y1, float, "fY1"); DECLARE_SOA_COLUMN(IndexDCApair, indexDCApair, int, "fIndexDCApair"); DECLARE_SOA_COLUMN(Mass, mass, float, "fMass"); DECLARE_SOA_COLUMN(Massbar, massbar, float, "fMassbar"); -DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); }); -DECLARE_SOA_DYNAMIC_COLUMN(Decaylength, decaylength, [](float xvtxd, float yvtxd, float zvtxd, float xvtxp, float yvtxp, float zvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp)); }); - +DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, + [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) + { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + + (xvtxd - xvtxp) * (xvtxd - xvtxp)); }); +DECLARE_SOA_DYNAMIC_COLUMN(Decaylength, decaylength, + [](float xvtxd, float yvtxd, float zvtxd, float xvtxp, + float yvtxp, float zvtxp) + { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + + (xvtxd - xvtxp) * (xvtxd - xvtxp) + + (zvtxd - zvtxp) * (zvtxd - zvtxp)); }); //old way of doing it //DECLARE_SOA_COLUMN(Decaylength, decaylength, float, "fDecaylength"); //DECLARE_SOA_COLUMN(DecaylengthXY, decaylengthXY, float, "fDecaylengthXY"); @@ -52,13 +59,18 @@ DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar"); } // namespace cand2prong DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG", - secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ, - secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, - secvtx2prong::Index0Id, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, secvtx2prong::Y0, - secvtx2prong::Index1Id, secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, secvtx2prong::Y1, - secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, - secvtx2prong::DecaylengthXY, - secvtx2prong::Decaylength); + secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ, + secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, + secvtx2prong::Index0Id, secvtx2prong::Px0, secvtx2prong::Py0, + secvtx2prong::Pz0, secvtx2prong::Y0, + secvtx2prong::Index1Id, secvtx2prong::Px1, secvtx2prong::Py1, + secvtx2prong::Pz1, secvtx2prong::Y1, + secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, + secvtx2prong::DecaylengthXY, + secvtx2prong::Decaylength); DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO", cand2prong::CollisionId, cand2prong::MassD0, cand2prong::MassD0bar); @@ -67,18 +79,6 @@ DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO", using namespace o2; using namespace o2::framework; -float decaylengthXY(float xvtxp, float yvtxp, float xvtxd, float yvtxd) -{ - float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); - return decl_; -}; - -float decaylength(float xvtxp, float yvtxp, float zvtxp, float xvtxd, float yvtxd, float zvtxd) -{ - float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp)); - return decl_; -}; - float energy(float px, float py, float pz, float mass) { float en_ = sqrtf(mass * mass + px * px + py * py + pz * pz); @@ -93,7 +93,9 @@ float invmass2prongs(float px0, float py0, float pz0, float mass0, float energy1_ = energy(px1, py1, pz1, mass1); float energytot = energy0_ + energy1_; - float psum2 = (px0 + px1) * (px0 + px1) + (py0 + py1) * (py0 + py1) + (pz0 + pz1) * (pz0 + pz1); + float psum2 = (px0 + px1) * (px0 + px1) + + (py0 + py1) * (py0 + py1) + + (pz0 + pz1) * (pz0 + pz1); float mass = sqrtf(energytot * energytot - psum2); return mass; }; From d41a3c9e7b84f431c3f37a58c6d411d607462322 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 11:48:23 +0100 Subject: [PATCH 07/12] Code cleaning vertexinghf --- .../include/Analysis/SecondaryVertex.h | 13 +-- Analysis/Tasks/vertexerhf.cxx | 81 +++++++++++-------- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/Analysis/DataModel/include/Analysis/SecondaryVertex.h b/Analysis/DataModel/include/Analysis/SecondaryVertex.h index 122d832521ea8..40a90cf6866f1 100644 --- a/Analysis/DataModel/include/Analysis/SecondaryVertex.h +++ b/Analysis/DataModel/include/Analysis/SecondaryVertex.h @@ -42,7 +42,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, (xvtxd - xvtxp) * (xvtxd - xvtxp)); }); DECLARE_SOA_DYNAMIC_COLUMN(Decaylength, decaylength, [](float xvtxd, float yvtxd, float zvtxd, float xvtxp, - float yvtxp, float zvtxp) + float yvtxp, float zvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp)); }); @@ -59,12 +59,13 @@ DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar"); } // namespace cand2prong DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG", - secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ, + secvtx2prong::CollisionId, + collision::PosX, collision::PosY, collision::PosZ, secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, - secvtx2prong::Index0Id, secvtx2prong::Px0, secvtx2prong::Py0, - secvtx2prong::Pz0, secvtx2prong::Y0, - secvtx2prong::Index1Id, secvtx2prong::Px1, secvtx2prong::Py1, - secvtx2prong::Pz1, secvtx2prong::Y1, + secvtx2prong::Index0Id, + secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, secvtx2prong::Y0, + secvtx2prong::Index1Id, + secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, secvtx2prong::Y1, secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, secvtx2prong::DecaylengthXY, diff --git a/Analysis/Tasks/vertexerhf.cxx b/Analysis/Tasks/vertexerhf.cxx index a21785818d185..5673d91d20595 100644 --- a/Analysis/Tasks/vertexerhf.cxx +++ b/Analysis/Tasks/vertexerhf.cxx @@ -40,7 +40,8 @@ struct CandidateBuilding2Prong { Produces secvtx2prong; - void process(aod::Collision const& collision, soa::Join const& tracks) + void process(aod::Collision const& collision, soa::Join const& tracks) { LOGF(info, "Tracks for collision: %d", tracks.size()); o2::base::DCAFitter df(5.0, 10.); @@ -54,7 +55,8 @@ struct CandidateBuilding2Prong { hitsmap_nocuts->Fill(clustermap_0); hpt_nocuts->Fill(track_0.pt()); htgl_nocuts->Fill(track_0.tgl()); - bool isselected_0 = track_0.tpcNCls() > 70 && track_0.flags() & 0x4 && (TESTBIT(clustermap_0, 0) || TESTBIT(clustermap_0, 1)); + bool isselected_0 = track_0.tpcNCls() > 70 && track_0.flags() \ + & 0x4 && (TESTBIT(clustermap_0, 0) || TESTBIT(clustermap_0, 1)); if (!isselected_0) continue; //fill track distribution after selection @@ -64,26 +66,35 @@ struct CandidateBuilding2Prong { float x0_ = track_0.x(); float alpha0_ = track_0.alpha(); - std::array arraypar0 = {track_0.y(), track_0.z(), track_0.snp(), track_0.tgl(), track_0.signed1Pt()}; - std::array covpar0 = {track_0.cYY(), track_0.cZY(), track_0.cZZ(), track_0.cSnpY(), track_0.cSnpZ(), - track_0.cSnpSnp(), track_0.cTglY(), track_0.cTglZ(), track_0.cTglSnp(), track_0.cTglTgl(), - track_0.c1PtY(), track_0.c1PtZ(), track_0.c1PtSnp(), track_0.c1PtTgl(), track_0.c1Pt21Pt2()}; + std::array arraypar0 = {track_0.y(), track_0.z(), track_0.snp(), + track_0.tgl(), track_0.signed1Pt()}; + std::array covpar0 = {track_0.cYY(), track_0.cZY(), track_0.cZZ(), + track_0.cSnpY(), track_0.cSnpZ(), + track_0.cSnpSnp(), track_0.cTglY(), track_0.cTglZ(), + track_0.cTglSnp(), track_0.cTglTgl(), + track_0.c1PtY(), track_0.c1PtZ(), track_0.c1PtSnp(), + track_0.c1PtTgl(), track_0.c1Pt21Pt2()}; o2::track::TrackParCov trackparvar0(x0_, alpha0_, arraypar0, covpar0); for (auto it_1 = it_0 + 1; it_1 != tracks.end(); ++it_1) { auto& track_1 = *it_1; UChar_t clustermap_1 = track_1.itsClusterMap(); - bool isselected_1 = track_1.tpcNCls() > 70 && track_1.flags() & 0x4 && (TESTBIT(clustermap_1, 0) || TESTBIT(clustermap_1, 1)); + bool isselected_1 = track_1.tpcNCls() > 70 && track_1.flags() \ + & 0x4 && (TESTBIT(clustermap_1, 0) || TESTBIT(clustermap_1, 1)); if (!isselected_1) continue; if (track_0.signed1Pt() * track_1.signed1Pt() > 0) continue; float x1_ = track_1.x(); float alpha1_ = track_1.alpha(); - std::array arraypar1 = {track_1.y(), track_1.z(), track_1.snp(), track_1.tgl(), track_1.signed1Pt()}; - std::array covpar1 = {track_1.cYY(), track_1.cZY(), track_1.cZZ(), track_1.cSnpY(), track_1.cSnpZ(), - track_1.cSnpSnp(), track_1.cTglY(), track_1.cTglZ(), track_1.cTglSnp(), track_1.cTglTgl(), - track_1.c1PtY(), track_1.c1PtZ(), track_1.c1PtSnp(), track_1.c1PtTgl(), track_1.c1Pt21Pt2()}; + std::array arraypar1 = {track_1.y(), track_1.z(), track_1.snp(), + track_1.tgl(), track_1.signed1Pt()}; + std::array covpar1 = {track_1.cYY(), track_1.cZY(), track_1.cZZ(), + track_1.cSnpY(), track_1.cSnpZ(), + track_1.cSnpSnp(), track_1.cTglY(), track_1.cTglZ(), + track_1.cTglSnp(), track_1.cTglTgl(), + track_1.c1PtY(), track_1.c1PtZ(), track_1.c1PtSnp(), + track_1.c1PtTgl(), track_1.c1Pt21Pt2()}; o2::track::TrackParCov trackparvar1(x1_, alpha1_, arraypar1, covpar1); df.setUseAbsDCA(true); @@ -102,15 +113,17 @@ struct CandidateBuilding2Prong { trackdec1.getPxPyPzGlo(pvec1); float masspion = 0.140; float masskaon = 0.494; - float mass_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masspion, pvec1[0], pvec1[1], pvec1[2], masskaon); - float masssw_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masskaon, pvec1[0], pvec1[1], pvec1[2], masspion); - secvtx2prong(track_0.collisionId(), collision.posX(), collision.posY(), collision.posZ(), vtx.x, vtx.y, vtx.z, track_0.globalIndex(), - pvec0[0], pvec0[1], pvec0[2], track_0.y(), track_1.globalIndex(), pvec1[0], pvec1[1], pvec1[2], track_1.y(), ic, mass_, masssw_); + float mass_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masspion, + pvec1[0], pvec1[1], pvec1[2], masskaon); + float masssw_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masskaon, + pvec1[0], pvec1[1], pvec1[2], masspion); + secvtx2prong(track_0.collisionId(), + collision.posX(), collision.posY(), collision.posZ(), + vtx.x, vtx.y, vtx.z, track_0.globalIndex(), + pvec0[0], pvec0[1], pvec0[2], track_0.y(), + track_1.globalIndex(), pvec1[0], pvec1[1], pvec1[2], track_1.y(), + ic, mass_, masssw_); hchi2dca->Fill(df.getChi2AtPCACandidate(ic)); - - //float declengxy = decaylengthXY(secVtx2prong.posX(), secVtx2prong.posY(), secVtx2prong.posdecayx(), secVtx2prong.posdecayy()); - //float declengxyz = decaylength(secVtx2prong.posX(), secVtx2prong.posY(), secVtx2prong.posZ(), - // secVtx2prong.posdecayx(), secVtx2prong.posdecayy(), secVtx2prong.posdecayz()); } } } @@ -119,27 +132,27 @@ struct CandidateBuilding2Prong { struct CandidateBuildingDzero { Produces cand2prong; - void process(aod::SecVtx2Prong const& secVtx2Prongs, soa::Join const& tracks) // HERE IT WHAT WORKS - //void process(aod::SecVtx2Prong const& secVtx2Prongs) //THE SIMPLE LOOP WORKS AS WELL OF COURSE - - //BELOW IS WHAT I WOULD LIKE TO BE ABLE TO DO AND THAT IS STILL NOT WORKING - //void process(aod::SecVtx2Prong const& secVtx2Prongs, soa::Join const& tracks) - { + void process(aod::SecVtx2Prong const& secVtx2Prongs, + soa::Join const& tracks) { LOGF(info, "NEW EVENT"); for (auto& secVtx2prong : secVtx2Prongs) { - //example to access the track at the index saved in the secVtx2Prongs LOGF(INFO, " ------- new event ---------"); - LOGF(INFO, " I am now accessing track0 y from the secvtx table %f", secVtx2prong.y0()); - LOGF(INFO, " I am now accessing track0 y from the corresponding track %f", secVtx2prong.index0().y()); - LOGF(INFO, " I am now accessing track1 y from the secvtx table %f", secVtx2prong.y1()); - LOGF(INFO, " I am now accessing track1 y from the corresponding track %f", secVtx2prong.index1().y()); + LOGF(INFO, " track0 y from secvtx tab. %f",secVtx2prong.y0()); + LOGF(INFO, " track0 y from track %f", secVtx2prong.index0().y()); + LOGF(INFO, " track1 y from secvtx table %f", secVtx2prong.y1()); + LOGF(INFO, " track1 y from track %f", secVtx2prong.index1().y()); float masspion = 0.140; float masskaon = 0.494; - float mass_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), secVtx2prong.pz0(), masspion, - secVtx2prong.px1(), secVtx2prong.py1(), secVtx2prong.pz1(), masskaon); - float masssw_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), secVtx2prong.pz0(), masskaon, - secVtx2prong.px1(), secVtx2prong.py1(), secVtx2prong.pz1(), masspion); + float mass_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), + secVtx2prong.pz0(), masspion, + secVtx2prong.px1(), secVtx2prong.py1(), + secVtx2prong.pz1(), masskaon); + float masssw_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), + secVtx2prong.pz0(), masskaon, + secVtx2prong.px1(), secVtx2prong.py1(), + secVtx2prong.pz1(), masspion); cand2prong(secVtx2prong.collisionId(), mass_, masssw_); } } From 629c3bff65e7d173e5af7b7cf777f736cd563e35 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 12:05:07 +0100 Subject: [PATCH 08/12] renaming secondary vertex table --- Analysis/Tasks/vertexerhf.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Analysis/Tasks/vertexerhf.cxx b/Analysis/Tasks/vertexerhf.cxx index 5673d91d20595..aebc08fe34d88 100644 --- a/Analysis/Tasks/vertexerhf.cxx +++ b/Analysis/Tasks/vertexerhf.cxx @@ -19,7 +19,7 @@ #include #include -struct CandidateBuilding2Prong { +struct DecayVertexBuilder2Prong { // secondary vertex position OutputObj hvtx_x_out{TH1F("hvtx_x", "2-track vtx", 100, -0.1, 0.1)}; OutputObj hvtx_y_out{TH1F("hvtx_y", "2-track vtx", 100, -0.1, 0.1)}; @@ -179,7 +179,7 @@ struct DzeroHistoTask { WorkflowSpec defineDataProcessing(ConfigContext const&) { return WorkflowSpec{ - adaptAnalysisTask("vertexerhf-candidatebuilding2prong"), + adaptAnalysisTask("decayvertexbuilder2prong"), adaptAnalysisTask("vertexerhf-candidatebuildingDzero"), adaptAnalysisTask("vertexerhf-Dzerotask")}; } From 34e9aa588e1e3e3a1565aec70066be652190de8d Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 15:25:52 +0100 Subject: [PATCH 09/12] Fix Clang --- .../include/Analysis/SecondaryVertex.h | 48 +++++++------- Analysis/Tasks/vertexerhf.cxx | 64 ++++++++++--------- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/Analysis/DataModel/include/Analysis/SecondaryVertex.h b/Analysis/DataModel/include/Analysis/SecondaryVertex.h index 40a90cf6866f1..d05ed73edd0ab 100644 --- a/Analysis/DataModel/include/Analysis/SecondaryVertex.h +++ b/Analysis/DataModel/include/Analysis/SecondaryVertex.h @@ -17,7 +17,7 @@ namespace o2::aod namespace secvtx2prong { // FIXME: this is a workaround until we get the index columns to work with joins. -using BigTracks = soa::Join; +using BigTracks = soa::Join; DECLARE_SOA_INDEX_COLUMN(Collision, collision); DECLARE_SOA_COLUMN(Posdecayx, posdecayx, float, "fPosdecayx"); @@ -37,15 +37,10 @@ DECLARE_SOA_COLUMN(IndexDCApair, indexDCApair, int, "fIndexDCApair"); DECLARE_SOA_COLUMN(Mass, mass, float, "fMass"); DECLARE_SOA_COLUMN(Massbar, massbar, float, "fMassbar"); DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, - [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) - { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + - (xvtxd - xvtxp) * (xvtxd - xvtxp)); }); + [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); }); DECLARE_SOA_DYNAMIC_COLUMN(Decaylength, decaylength, - [](float xvtxd, float yvtxd, float zvtxd, float xvtxp, - float yvtxp, float zvtxp) - { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + - (xvtxd - xvtxp) * (xvtxd - xvtxp) + - (zvtxd - zvtxp) * (zvtxd - zvtxp)); }); + [](float xvtxd, float yvtxd, float zvtxd, float xvtxp, + float yvtxp, float zvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp)); }); //old way of doing it //DECLARE_SOA_COLUMN(Decaylength, decaylength, float, "fDecaylength"); //DECLARE_SOA_COLUMN(DecaylengthXY, decaylengthXY, float, "fDecaylengthXY"); @@ -58,23 +53,24 @@ DECLARE_SOA_COLUMN(MassD0, massD0, float, "fMassD0"); DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar"); } // namespace cand2prong -DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG", - secvtx2prong::CollisionId, - collision::PosX, collision::PosY, collision::PosZ, - secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, - secvtx2prong::Index0Id, - secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, secvtx2prong::Y0, - secvtx2prong::Index1Id, - secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, secvtx2prong::Y1, - secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, - secvtx2prong::DecaylengthXY, - secvtx2prong::Decaylength); +DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "VTX2PRONG", + secvtx2prong::CollisionId, + collision::PosX, collision::PosY, collision::PosZ, + secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, + secvtx2prong::Index0Id, + secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, secvtx2prong::Y0, + secvtx2prong::Index1Id, + secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, secvtx2prong::Y1, + secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, + secvtx2prong::DecaylengthXY, + secvtx2prong::Decaylength); DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO", - cand2prong::CollisionId, cand2prong::MassD0, cand2prong::MassD0bar); + //cand2prong::CollisionId, + cand2prong::MassD0, cand2prong::MassD0bar); } // namespace o2::aod using namespace o2; @@ -95,8 +91,8 @@ float invmass2prongs(float px0, float py0, float pz0, float mass0, float energytot = energy0_ + energy1_; float psum2 = (px0 + px1) * (px0 + px1) + - (py0 + py1) * (py0 + py1) + - (pz0 + pz1) * (pz0 + pz1); + (py0 + py1) * (py0 + py1) + + (pz0 + pz1) * (pz0 + pz1); float mass = sqrtf(energytot * energytot - psum2); return mass; }; diff --git a/Analysis/Tasks/vertexerhf.cxx b/Analysis/Tasks/vertexerhf.cxx index aebc08fe34d88..3d62020873382 100644 --- a/Analysis/Tasks/vertexerhf.cxx +++ b/Analysis/Tasks/vertexerhf.cxx @@ -41,7 +41,7 @@ struct DecayVertexBuilder2Prong { Produces secvtx2prong; void process(aod::Collision const& collision, soa::Join const& tracks) + aod::TracksCov, aod::TracksExtra> const& tracks) { LOGF(info, "Tracks for collision: %d", tracks.size()); o2::base::DCAFitter df(5.0, 10.); @@ -55,8 +55,8 @@ struct DecayVertexBuilder2Prong { hitsmap_nocuts->Fill(clustermap_0); hpt_nocuts->Fill(track_0.pt()); htgl_nocuts->Fill(track_0.tgl()); - bool isselected_0 = track_0.tpcNCls() > 70 && track_0.flags() \ - & 0x4 && (TESTBIT(clustermap_0, 0) || TESTBIT(clustermap_0, 1)); + bool isselected_0 = track_0.tpcNCls() > 70 && track_0.flags() & 0x4; + isselected_0 = isselected_0 && (TESTBIT(clustermap_0, 0) || TESTBIT(clustermap_0, 1)); if (!isselected_0) continue; //fill track distribution after selection @@ -67,20 +67,20 @@ struct DecayVertexBuilder2Prong { float x0_ = track_0.x(); float alpha0_ = track_0.alpha(); std::array arraypar0 = {track_0.y(), track_0.z(), track_0.snp(), - track_0.tgl(), track_0.signed1Pt()}; + track_0.tgl(), track_0.signed1Pt()}; std::array covpar0 = {track_0.cYY(), track_0.cZY(), track_0.cZZ(), - track_0.cSnpY(), track_0.cSnpZ(), + track_0.cSnpY(), track_0.cSnpZ(), track_0.cSnpSnp(), track_0.cTglY(), track_0.cTglZ(), - track_0.cTglSnp(), track_0.cTglTgl(), + track_0.cTglSnp(), track_0.cTglTgl(), track_0.c1PtY(), track_0.c1PtZ(), track_0.c1PtSnp(), - track_0.c1PtTgl(), track_0.c1Pt21Pt2()}; + track_0.c1PtTgl(), track_0.c1Pt21Pt2()}; o2::track::TrackParCov trackparvar0(x0_, alpha0_, arraypar0, covpar0); for (auto it_1 = it_0 + 1; it_1 != tracks.end(); ++it_1) { auto& track_1 = *it_1; UChar_t clustermap_1 = track_1.itsClusterMap(); - bool isselected_1 = track_1.tpcNCls() > 70 && track_1.flags() \ - & 0x4 && (TESTBIT(clustermap_1, 0) || TESTBIT(clustermap_1, 1)); + bool isselected_1 = track_1.tpcNCls() > 70 && track_1.flags() & 0x4; + isselected_1 = isselected_1 && (TESTBIT(clustermap_1, 0) || TESTBIT(clustermap_1, 1)); if (!isselected_1) continue; if (track_0.signed1Pt() * track_1.signed1Pt() > 0) @@ -88,13 +88,13 @@ struct DecayVertexBuilder2Prong { float x1_ = track_1.x(); float alpha1_ = track_1.alpha(); std::array arraypar1 = {track_1.y(), track_1.z(), track_1.snp(), - track_1.tgl(), track_1.signed1Pt()}; + track_1.tgl(), track_1.signed1Pt()}; std::array covpar1 = {track_1.cYY(), track_1.cZY(), track_1.cZZ(), - track_1.cSnpY(), track_1.cSnpZ(), + track_1.cSnpY(), track_1.cSnpZ(), track_1.cSnpSnp(), track_1.cTglY(), track_1.cTglZ(), - track_1.cTglSnp(), track_1.cTglTgl(), + track_1.cTglSnp(), track_1.cTglTgl(), track_1.c1PtY(), track_1.c1PtZ(), track_1.c1PtSnp(), - track_1.c1PtTgl(), track_1.c1Pt21Pt2()}; + track_1.c1PtTgl(), track_1.c1Pt21Pt2()}; o2::track::TrackParCov trackparvar1(x1_, alpha1_, arraypar1, covpar1); df.setUseAbsDCA(true); @@ -114,15 +114,15 @@ struct DecayVertexBuilder2Prong { float masspion = 0.140; float masskaon = 0.494; float mass_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masspion, - pvec1[0], pvec1[1], pvec1[2], masskaon); + pvec1[0], pvec1[1], pvec1[2], masskaon); float masssw_ = invmass2prongs(pvec0[0], pvec0[1], pvec0[2], masskaon, - pvec1[0], pvec1[1], pvec1[2], masspion); + pvec1[0], pvec1[1], pvec1[2], masspion); secvtx2prong(track_0.collisionId(), - collision.posX(), collision.posY(), collision.posZ(), - vtx.x, vtx.y, vtx.z, track_0.globalIndex(), + collision.posX(), collision.posY(), collision.posZ(), + vtx.x, vtx.y, vtx.z, track_0.globalIndex(), pvec0[0], pvec0[1], pvec0[2], track_0.y(), - track_1.globalIndex(), pvec1[0], pvec1[1], pvec1[2], track_1.y(), - ic, mass_, masssw_); + track_1.globalIndex(), pvec1[0], pvec1[1], pvec1[2], track_1.y(), + ic, mass_, masssw_); hchi2dca->Fill(df.getChi2AtPCACandidate(ic)); } } @@ -133,27 +133,30 @@ struct DecayVertexBuilder2Prong { struct CandidateBuildingDzero { Produces cand2prong; void process(aod::SecVtx2Prong const& secVtx2Prongs, - soa::Join const& tracks) { + soa::Join const& tracks) + { LOGF(info, "NEW EVENT"); for (auto& secVtx2prong : secVtx2Prongs) { LOGF(INFO, " ------- new event ---------"); - LOGF(INFO, " track0 y from secvtx tab. %f",secVtx2prong.y0()); + LOGF(INFO, " track0 y from secvtx tab. %f", secVtx2prong.y0()); LOGF(INFO, " track0 y from track %f", secVtx2prong.index0().y()); LOGF(INFO, " track1 y from secvtx table %f", secVtx2prong.y1()); LOGF(INFO, " track1 y from track %f", secVtx2prong.index1().y()); float masspion = 0.140; float masskaon = 0.494; float mass_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), - secVtx2prong.pz0(), masspion, + secVtx2prong.pz0(), masspion, secVtx2prong.px1(), secVtx2prong.py1(), - secVtx2prong.pz1(), masskaon); + secVtx2prong.pz1(), masskaon); float masssw_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), - secVtx2prong.pz0(), masskaon, + secVtx2prong.pz0(), masskaon, secVtx2prong.px1(), secVtx2prong.py1(), - secVtx2prong.pz1(), masspion); - cand2prong(secVtx2prong.collisionId(), mass_, masssw_); + secVtx2prong.pz1(), masspion); + cand2prong(mass_, masssw_); + //secVtx2prong.collisionId(), + //mass_, masssw_); } } }; @@ -163,7 +166,7 @@ struct DzeroHistoTask { OutputObj hdecayxy{TH1F("hdecayxy", "decay length xy", 100, 0., 1.0)}; OutputObj hdecayxyz{TH1F("hdecayxyz", "decay length", 100, 0., 1.0)}; - void process(aod::Cand2Prong const& cand2Prongs, aod::SecVtx2Prong const& secVtx2Prongs) + void process(soa::Join const& secVtx2Prongs) { LOGF(info, "NEW EVENT"); @@ -172,6 +175,9 @@ struct DzeroHistoTask { hdecayxyz->Fill(secVtx2prong.decaylength()); hmass_nocuts_out->Fill(secVtx2prong.mass()); hmass_nocuts_out->Fill(secVtx2prong.massbar()); + LOGF(info, "new event"); + LOGF(info, "mass %f", secVtx2prong.mass()); + LOGF(info, "mass from cand %f", secVtx2prong.massD0()); } } }; @@ -179,7 +185,7 @@ struct DzeroHistoTask { WorkflowSpec defineDataProcessing(ConfigContext const&) { return WorkflowSpec{ - adaptAnalysisTask("decayvertexbuilder2prong"), + adaptAnalysisTask("vertexerhf-decayvertexbuilder2prong"), adaptAnalysisTask("vertexerhf-candidatebuildingDzero"), adaptAnalysisTask("vertexerhf-Dzerotask")}; } From 330fc0484d82f71b9ff1378de3254287b88a6e8d Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 15:28:56 +0100 Subject: [PATCH 10/12] Fix Clang --- Analysis/DataModel/src/dumpDataModel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/DataModel/src/dumpDataModel.cxx b/Analysis/DataModel/src/dumpDataModel.cxx index 5609e712a5604..ca74653ec8e61 100644 --- a/Analysis/DataModel/src/dumpDataModel.cxx +++ b/Analysis/DataModel/src/dumpDataModel.cxx @@ -115,7 +115,7 @@ edge[dir=back, arrowtail=empty] dumpTable(); dumpTable(); dumpTable(); -// dumpTable(); + //dumpTable(); dumpTable(); fmt::printf("%s\n", R"(})"); } From 24bee942117a71f3bf0a5e280f12a365f73dec31 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 17:35:47 +0100 Subject: [PATCH 11/12] Add on-the-flight calculation of the secondary vertex --- .../include/Analysis/SecondaryVertex.h | 4 ++ Analysis/Tasks/vertexerhf.cxx | 72 ++++++++++++++++--- 2 files changed, 68 insertions(+), 8 deletions(-) diff --git a/Analysis/DataModel/include/Analysis/SecondaryVertex.h b/Analysis/DataModel/include/Analysis/SecondaryVertex.h index d05ed73edd0ab..6ff0ffe665bbe 100644 --- a/Analysis/DataModel/include/Analysis/SecondaryVertex.h +++ b/Analysis/DataModel/include/Analysis/SecondaryVertex.h @@ -76,6 +76,10 @@ DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO", using namespace o2; using namespace o2::framework; +//FIXME: this functions will need to become dynamic columns +//once we will be able to build dynamic columns starting from +//columns that belongs to different tables + float energy(float px, float py, float pz, float mass) { float en_ = sqrtf(mass * mass + px * px + py * py + pz * pz); diff --git a/Analysis/Tasks/vertexerhf.cxx b/Analysis/Tasks/vertexerhf.cxx index 3d62020873382..9ea2008f54a19 100644 --- a/Analysis/Tasks/vertexerhf.cxx +++ b/Analysis/Tasks/vertexerhf.cxx @@ -20,11 +20,6 @@ #include struct DecayVertexBuilder2Prong { - // secondary vertex position - OutputObj hvtx_x_out{TH1F("hvtx_x", "2-track vtx", 100, -0.1, 0.1)}; - OutputObj hvtx_y_out{TH1F("hvtx_y", "2-track vtx", 100, -0.1, 0.1)}; - OutputObj hvtx_z_out{TH1F("hvtx_z", "2-track vtx", 100, -0.1, 0.1)}; - OutputObj hchi2dca{TH1F("hchi2dca", "chi2 DCA decay", 1000, 0., 0.0002)}; // primary vertex position OutputObj hvtxp_x_out{TH1F("hvertexx", "x primary vtx", 100, -10., 10.)}; OutputObj hvtxp_y_out{TH1F("hvertexy", "y primary vtx", 100, -10., 10.)}; @@ -37,6 +32,11 @@ struct DecayVertexBuilder2Prong { OutputObj hpt_cuts{TH1F("hpt_cuts", "pt tracks (#GeV)", 100, 0., 10.)}; OutputObj htgl_cuts{TH1F("htgl_cuts", "tgl tracks (#GeV)", 100, 0., 10.)}; OutputObj hitsmap_cuts{TH1F("hitsmap_cuts", "hitsmap", 100, 0., 100.)}; + // secondary vertex position + OutputObj hvtx_x_out{TH1F("hvtx_x", "2-track vtx", 100, -0.1, 0.1)}; + OutputObj hvtx_y_out{TH1F("hvtx_y", "2-track vtx", 100, -0.1, 0.1)}; + OutputObj hvtx_z_out{TH1F("hvtx_z", "2-track vtx", 100, -0.1, 0.1)}; + OutputObj hchi2dca{TH1F("hchi2dca", "chi2 DCA decay", 1000, 0., 0.0002)}; Produces secvtx2prong; @@ -99,7 +99,8 @@ struct DecayVertexBuilder2Prong { df.setUseAbsDCA(true); int nCand = df.process(trackparvar0, trackparvar1); - for (int ic = 0; ic < nCand; ic++) { + //FIXME: currently filling the table for all dca candidates. + for (int ic = 0; ic < nCand; ic++) { const o2::base::DCAFitter::Triplet& vtx = df.getPCACandidate(ic); LOGF(info, "vertex x %f", vtx.x); hvtx_x_out->Fill(vtx.x); @@ -138,12 +139,51 @@ struct CandidateBuildingDzero { { LOGF(info, "NEW EVENT"); + o2::base::DCAFitter df(5.0, 10.); + for (auto& secVtx2prong : secVtx2Prongs) { LOGF(INFO, " ------- new event ---------"); LOGF(INFO, " track0 y from secvtx tab. %f", secVtx2prong.y0()); LOGF(INFO, " track0 y from track %f", secVtx2prong.index0().y()); LOGF(INFO, " track1 y from secvtx table %f", secVtx2prong.y1()); LOGF(INFO, " track1 y from track %f", secVtx2prong.index1().y()); + + float x0_ = secVtx2prong.index0().x(); + float alpha0_ = secVtx2prong.index0().alpha(); + std::array arraypar0 = {secVtx2prong.index0().y(), secVtx2prong.index0().z(), + secVtx2prong.index0().snp(), secVtx2prong.index0().tgl(), + secVtx2prong.index0().signed1Pt()}; + std::array covpar0 = {secVtx2prong.index0().cYY(), secVtx2prong.index0().cZY(), + secVtx2prong.index0().cZZ(), secVtx2prong.index0().cSnpY(), + secVtx2prong.index0().cSnpZ(), secVtx2prong.index0().cSnpSnp(), + secVtx2prong.index0().cTglY(), secVtx2prong.index0().cTglZ(), + secVtx2prong.index0().cTglSnp(), secVtx2prong.index0().cTglTgl(), + secVtx2prong.index0().c1PtY(), secVtx2prong.index0().c1PtZ(), + secVtx2prong.index0().c1PtSnp(), secVtx2prong.index0().c1PtTgl(), + secVtx2prong.index0().c1Pt21Pt2()}; + o2::track::TrackParCov trackparvar0(x0_, alpha0_, arraypar0, covpar0); + + float x1_ = secVtx2prong.index1().x(); + float alpha1_ = secVtx2prong.index1().alpha(); + std::array arraypar1 = {secVtx2prong.index1().y(), secVtx2prong.index1().z(), + secVtx2prong.index1().snp(), secVtx2prong.index1().tgl(), + secVtx2prong.index1().signed1Pt()}; + std::array covpar1 = {secVtx2prong.index1().cYY(), secVtx2prong.index1().cZY(), + secVtx2prong.index1().cZZ(), secVtx2prong.index1().cSnpY(), + secVtx2prong.index1().cSnpZ(), secVtx2prong.index1().cSnpSnp(), + secVtx2prong.index1().cTglY(), secVtx2prong.index1().cTglZ(), + secVtx2prong.index1().cTglSnp(), secVtx2prong.index1().cTglTgl(), + secVtx2prong.index1().c1PtY(), secVtx2prong.index1().c1PtZ(), + secVtx2prong.index1().c1PtSnp(), secVtx2prong.index1().c1PtTgl(), + secVtx2prong.index1().c1Pt21Pt2()}; + o2::track::TrackParCov trackparvar1(x1_, alpha1_, arraypar1, covpar1); + + df.setUseAbsDCA(true); + //FIXME: currently I rebuild the vertex for each track-track pair and + //select the candidate via its index. It is redundant cause the secondary + //vertex recostruction is performed more than once for each dca candidate + int nCand = df.process(trackparvar0, trackparvar1); + const o2::base::DCAFitter::Triplet& secvtx = df.getPCACandidate(secVtx2prong.indexDCApair()); float masspion = 0.140; float masskaon = 0.494; float mass_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), @@ -155,13 +195,24 @@ struct CandidateBuildingDzero { secVtx2prong.px1(), secVtx2prong.py1(), secVtx2prong.pz1(), masspion); cand2prong(mass_, masssw_); - //secVtx2prong.collisionId(), - //mass_, masssw_); + o2::track::TrackParCov trackdec0 = df.getTrack0(secVtx2prong.indexDCApair()); + o2::track::TrackParCov trackdec1 = df.getTrack1(secVtx2prong.indexDCApair()); + std::array pvec0; + std::array pvec1; + trackdec0.getPxPyPzGlo(pvec0); + trackdec1.getPxPyPzGlo(pvec1); + LOGF(info, "Pt track 0 from table %f and from calc %f", secVtx2prong.px0(), pvec0[0]); + if (abs(secVtx2prong.px0() - pvec0[0]) > 0.000000001) + LOGF(info, "BIG ERRROR"); } } }; struct DzeroHistoTask { + // secondary vertex position + OutputObj hvtx_x_outt{TH1F("hvtx_xt", "2-track vtx", 100, -0.1, 0.1)}; + OutputObj hvtx_y_outt{TH1F("hvtx_yt", "2-track vtx", 100, -0.1, 0.1)}; + OutputObj hvtx_z_outt{TH1F("hvtx_zt", "2-track vtx", 100, -0.1, 0.1)}; OutputObj hmass_nocuts_out{TH1F("hmass_nocuts", "2-track inv mass", 500, 0, 5.0)}; OutputObj hdecayxy{TH1F("hdecayxy", "decay length xy", 100, 0., 1.0)}; OutputObj hdecayxyz{TH1F("hdecayxyz", "decay length", 100, 0., 1.0)}; @@ -171,6 +222,11 @@ struct DzeroHistoTask { LOGF(info, "NEW EVENT"); for (auto& secVtx2prong : secVtx2Prongs) { + hvtx_y_outt->Fill(secVtx2prong.posdecayy()); + hvtx_z_outt->Fill(secVtx2prong.posdecayz()); + hvtx_x_outt->Fill(secVtx2prong.posdecayx()); + hvtx_y_outt->Fill(secVtx2prong.posdecayy()); + hvtx_z_outt->Fill(secVtx2prong.posdecayz()); hdecayxy->Fill(secVtx2prong.decaylengthXY()); hdecayxyz->Fill(secVtx2prong.decaylength()); hmass_nocuts_out->Fill(secVtx2prong.mass()); From b8c526cb438082f28dd5b98ab39f44c099803db0 Mon Sep 17 00:00:00 2001 From: Gian Michele Innocenti Date: Sat, 29 Feb 2020 17:38:18 +0100 Subject: [PATCH 12/12] Fix Clang --- Analysis/Tasks/vertexerhf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analysis/Tasks/vertexerhf.cxx b/Analysis/Tasks/vertexerhf.cxx index 9ea2008f54a19..608d6f8536f6f 100644 --- a/Analysis/Tasks/vertexerhf.cxx +++ b/Analysis/Tasks/vertexerhf.cxx @@ -100,7 +100,7 @@ struct DecayVertexBuilder2Prong { df.setUseAbsDCA(true); int nCand = df.process(trackparvar0, trackparvar1); //FIXME: currently filling the table for all dca candidates. - for (int ic = 0; ic < nCand; ic++) { + for (int ic = 0; ic < nCand; ic++) { const o2::base::DCAFitter::Triplet& vtx = df.getPCACandidate(ic); LOGF(info, "vertex x %f", vtx.x); hvtx_x_out->Fill(vtx.x);