Skip to content

Commit e9fd68e

Browse files
authored
DPL: introduce Analysis/DataModel (AliceO2Group#3034)
We should move here all the basic building blocks of our (ALICE) AOD schema. I also extracted Gian Michele SecondaryVertex schema from the task and put it here.
1 parent 5abb30e commit e9fd68e

8 files changed

Lines changed: 133 additions & 88 deletions

File tree

Analysis/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
# submit itself to any jurisdiction.
1010

1111
add_subdirectory(Core)
12-
#add_subdirectory(Tools)
12+
add_subdirectory(DataModel)
1313
add_subdirectory(Tasks)
1414
add_subdirectory(Tutorials)

Analysis/DataModel/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright CERN and copyright holders of ALICE O2. This software is distributed
2+
# under the terms of the GNU General Public License v3 (GPL Version 3), copied
3+
# 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 or
9+
# submit itself to any jurisdiction.
10+
11+
o2_add_library(AnalysisDataModel
12+
SOURCES src/dummy.cxx
13+
PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/src
14+
PUBLIC_LINK_LIBRARIES
15+
O2::Framework
16+
)
17+
18+
o2_add_executable(dump-aod-data-model
19+
SOURCES src/dumpDataModel.cxx
20+
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel
21+
)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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_SECONDARYVERTEX_H_
11+
#define O2_ANALYSIS_SECONDARYVERTEX_H_
12+
13+
#include "Framework/AnalysisDataModel.h"
14+
15+
namespace o2::aod
16+
{
17+
namespace secvtx2prong
18+
{
19+
DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID");
20+
DECLARE_SOA_COLUMN(Posdecayx, posdecayx, float, "fPosdecayx");
21+
DECLARE_SOA_COLUMN(Posdecayy, posdecayy, float, "fPosdecayy");
22+
DECLARE_SOA_COLUMN(Posdecayz, posdecayz, float, "fPosdecayz");
23+
DECLARE_SOA_COLUMN(Index0, index0, int, "fIndex0");
24+
DECLARE_SOA_COLUMN(Px0, px0, float, "fPx0");
25+
DECLARE_SOA_COLUMN(Py0, py0, float, "fPy0");
26+
DECLARE_SOA_COLUMN(Pz0, pz0, float, "fPz0");
27+
DECLARE_SOA_COLUMN(Index1, index1, int, "fIndex1");
28+
DECLARE_SOA_COLUMN(Px1, px1, float, "fPx1");
29+
DECLARE_SOA_COLUMN(Py1, py1, float, "fPy1");
30+
DECLARE_SOA_COLUMN(Pz1, pz1, float, "fPz1");
31+
DECLARE_SOA_COLUMN(IndexDCApair, indexDCApair, int, "fIndexDCApair");
32+
DECLARE_SOA_COLUMN(Mass, mass, float, "fMass");
33+
DECLARE_SOA_COLUMN(Massbar, massbar, float, "fMassbar");
34+
DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); });
35+
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)); });
36+
37+
//old way of doing it
38+
//DECLARE_SOA_COLUMN(Decaylength, decaylength, float, "fDecaylength");
39+
//DECLARE_SOA_COLUMN(DecaylengthXY, decaylengthXY, float, "fDecaylengthXY");
40+
41+
} // namespace secvtx2prong
42+
namespace cand2prong
43+
{
44+
DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID");
45+
DECLARE_SOA_COLUMN(MassD0, massD0, float, "fMassD0");
46+
DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar");
47+
} // namespace cand2prong
48+
49+
DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG",
50+
secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ,
51+
secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz,
52+
secvtx2prong::Index0, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0,
53+
secvtx2prong::Index1, secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1,
54+
secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar,
55+
secvtx2prong::DecaylengthXY<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, collision::PosX, collision::PosY>,
56+
secvtx2prong::Decaylength<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, collision::PosX, collision::PosY, collision::PosZ>);
57+
58+
DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO",
59+
cand2prong::CollisionId, cand2prong::MassD0, cand2prong::MassD0bar);
60+
} // namespace o2::aod
61+
62+
using namespace o2;
63+
using namespace o2::framework;
64+
65+
float decaylengthXY(float xvtxp, float yvtxp, float xvtxd, float yvtxd)
66+
{
67+
float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp));
68+
return decl_;
69+
};
70+
71+
float decaylength(float xvtxp, float yvtxp, float zvtxp, float xvtxd, float yvtxd, float zvtxd)
72+
{
73+
float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp));
74+
return decl_;
75+
};
76+
77+
float energy(float px, float py, float pz, float mass)
78+
{
79+
float en_ = sqrtf(mass * mass + px * px + py * py + pz * pz);
80+
return en_;
81+
};
82+
83+
float invmass2prongs(float px0, float py0, float pz0, float mass0,
84+
float px1, float py1, float pz1, float mass1)
85+
{
86+
87+
float energy0_ = energy(px0, py0, pz0, mass0);
88+
float energy1_ = energy(px1, py1, pz1, mass1);
89+
float energytot = energy0_ + energy1_;
90+
91+
float psum2 = (px0 + px1) * (px0 + px1) + (py0 + py1) * (py0 + py1) + (pz0 + pz1) * (pz0 + pz1);
92+
float mass = sqrtf(energytot * energytot - psum2);
93+
return mass;
94+
};
95+
96+
#endif // O2_ANALYSIS_SECONDARYVERTEX_H_

Analysis/DataModel/src/dummy.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 "Analysis/SecondaryVertex.h"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
1010
#include "Framework/AnalysisDataModel.h"
11+
#include "Analysis/SecondaryVertex.h"
1112
#include <fmt/printf.h>
1213
#include <map>
1314

@@ -114,5 +115,7 @@ edge[dir=back, arrowtail=empty]
114115
dumpTable<V0s>();
115116
dumpTable<Cascades>();
116117
dumpTable<Timeframes>();
118+
dumpTable<SecVtx2Prong>();
119+
dumpTable<Cand2Prong>();
117120
fmt::printf("%s\n", R"(})");
118121
}

Analysis/Tasks/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ o2_add_executable(correlations-collection
2020

2121
o2_add_executable(vertexing-hf
2222
SOURCES vertexerhf.cxx
23-
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase
23+
PUBLIC_LINK_LIBRARIES O2::Framework O2::AnalysisDataModel O2::DetectorsBase
2424
COMPONENT_NAME Analysis)
2525

2626
o2_add_executable(validation

Analysis/Tasks/vertexerhf.cxx

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -10,93 +10,14 @@
1010
#include "Framework/runDataProcessing.h"
1111
#include "Framework/AnalysisTask.h"
1212
#include "Framework/AnalysisDataModel.h"
13+
#include "Analysis/SecondaryVertex.h"
1314
#include "DetectorsBase/DCAFitter.h"
1415
#include "ReconstructionDataFormats/Track.h"
1516

1617
#include <TFile.h>
1718
#include <TH1F.h>
1819
#include <cmath>
1920
#include <array>
20-
namespace o2::aod
21-
{
22-
namespace secvtx2prong
23-
{
24-
DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID");
25-
DECLARE_SOA_COLUMN(Posdecayx, posdecayx, float, "fPosdecayx");
26-
DECLARE_SOA_COLUMN(Posdecayy, posdecayy, float, "fPosdecayy");
27-
DECLARE_SOA_COLUMN(Posdecayz, posdecayz, float, "fPosdecayz");
28-
DECLARE_SOA_COLUMN(Index0, index0, int, "fIndex0");
29-
DECLARE_SOA_COLUMN(Px0, px0, float, "fPx0");
30-
DECLARE_SOA_COLUMN(Py0, py0, float, "fPy0");
31-
DECLARE_SOA_COLUMN(Pz0, pz0, float, "fPz0");
32-
DECLARE_SOA_COLUMN(Index1, index1, int, "fIndex1");
33-
DECLARE_SOA_COLUMN(Px1, px1, float, "fPx1");
34-
DECLARE_SOA_COLUMN(Py1, py1, float, "fPy1");
35-
DECLARE_SOA_COLUMN(Pz1, pz1, float, "fPz1");
36-
DECLARE_SOA_COLUMN(IndexDCApair, indexDCApair, int, "fIndexDCApair");
37-
DECLARE_SOA_COLUMN(Mass, mass, float, "fMass");
38-
DECLARE_SOA_COLUMN(Massbar, massbar, float, "fMassbar");
39-
DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); });
40-
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)); });
41-
42-
//old way of doing it
43-
//DECLARE_SOA_COLUMN(Decaylength, decaylength, float, "fDecaylength");
44-
//DECLARE_SOA_COLUMN(DecaylengthXY, decaylengthXY, float, "fDecaylengthXY");
45-
46-
} // namespace secvtx2prong
47-
namespace cand2prong
48-
{
49-
DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID");
50-
DECLARE_SOA_COLUMN(MassD0, massD0, float, "fMassD0");
51-
DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar");
52-
} // namespace cand2prong
53-
54-
DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG",
55-
secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ,
56-
secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz,
57-
secvtx2prong::Index0, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0,
58-
secvtx2prong::Index1, secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1,
59-
secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar,
60-
secvtx2prong::DecaylengthXY<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, collision::PosX, collision::PosY>,
61-
secvtx2prong::Decaylength<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, collision::PosX, collision::PosY, collision::PosZ>);
62-
63-
DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO",
64-
cand2prong::CollisionId, cand2prong::MassD0, cand2prong::MassD0bar);
65-
} // namespace o2::aod
66-
67-
using namespace o2;
68-
using namespace o2::framework;
69-
70-
float decaylengthXY(float xvtxp, float yvtxp, float xvtxd, float yvtxd)
71-
{
72-
float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp));
73-
return decl_;
74-
};
75-
76-
float decaylength(float xvtxp, float yvtxp, float zvtxp, float xvtxd, float yvtxd, float zvtxd)
77-
{
78-
float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp));
79-
return decl_;
80-
};
81-
82-
float energy(float px, float py, float pz, float mass)
83-
{
84-
float en_ = sqrtf(mass * mass + px * px + py * py + pz * pz);
85-
return en_;
86-
};
87-
88-
float invmass2prongs(float px0, float py0, float pz0, float mass0,
89-
float px1, float py1, float pz1, float mass1)
90-
{
91-
92-
float energy0_ = energy(px0, py0, pz0, mass0);
93-
float energy1_ = energy(px1, py1, pz1, mass1);
94-
float energytot = energy0_ + energy1_;
95-
96-
float psum2 = (px0 + px1) * (px0 + px1) + (py0 + py1) * (py0 + py1) + (pz0 + pz1) * (pz0 + pz1);
97-
float mass = sqrtf(energytot * energytot - psum2);
98-
return mass;
99-
};
10021

10122
struct CandidateBuilding2Prong {
10223
// secondary vertex position

Framework/Core/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ o2_add_executable(verify-aod-file
190190
PUBLIC_LINK_LIBRARIES O2::Framework
191191
COMPONENT_NAME Framework)
192192

193-
o2_add_executable(dump-aod-data-model
194-
SOURCES src/dumpDataModel.cxx
195-
PUBLIC_LINK_LIBRARIES O2::Framework
196-
COMPONENT_NAME Framework
197-
)
198-
199193
# tests with input data
200194

201195
o2_data_file(COPY test/test_DataSampling.json DESTINATION tests)

0 commit comments

Comments
 (0)