Skip to content

Commit 56a11c2

Browse files
authored
Merge branch 'dev' into tpccf-mclabels
2 parents d13d179 + f189c01 commit 56a11c2

153 files changed

Lines changed: 2788 additions & 1198 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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_INDEX_COLUMN(Collision, collision);
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_INDEX_COLUMN_FULL(Index0, index0, int, Tracks, "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_INDEX_COLUMN_FULL(Index1, index1, int, Tracks, "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_INDEX_COLUMN(Collision, collision);
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::Index0Id, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0,
53+
secvtx2prong::Index1Id, 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: 3 additions & 81 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
@@ -208,7 +129,8 @@ struct CandidateBuildingDzero {
208129

209130
for (auto& secVtx2prong : secVtx2Prongs) {
210131
//example to access the track at the index saved in the secVtx2Prongs
211-
LOGF(INFO, " I am now accessing track information looping over secondary vertices %f", (tracks.begin() + secVtx2prong.index0()).y());
132+
LOGF(INFO, " I am now accessing track information looping over secondary vertices %d", secVtx2prong.index0Id());
133+
LOGF(INFO, " I am now accessing track information looping over secondary vertices %f", secVtx2prong.index0().y());
212134
float masspion = 0.140;
213135
float masskaon = 0.494;
214136
float mass_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), secVtx2prong.pz0(), masspion,

Analysis/Tutorials/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ o2_add_executable(aodwriter
6464
SOURCES src/aodwriter.cxx
6565
PUBLIC_LINK_LIBRARIES O2::Framework
6666
COMPONENT_NAME AnalysisTutorial)
67+
68+
o2_add_executable(aodreader
69+
SOURCES src/aodreader.cxx
70+
PUBLIC_LINK_LIBRARIES O2::Framework
71+
COMPONENT_NAME AnalysisTutorial)
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
14+
namespace o2::aod
15+
{
16+
namespace uno
17+
{
18+
DECLARE_SOA_COLUMN(Eta, eta, float, "fEta1");
19+
DECLARE_SOA_COLUMN(Phi, phi, int, "fPhi1");
20+
DECLARE_SOA_COLUMN(Mom, mom, double, "fMom1");
21+
} // namespace uno
22+
23+
DECLARE_SOA_TABLE(Uno, "AOD", "UNO",
24+
uno::Eta, uno::Phi, uno::Mom);
25+
26+
namespace due
27+
{
28+
DECLARE_SOA_COLUMN(Eta, eta, double, "fEta2");
29+
DECLARE_SOA_COLUMN(Phi, phi, double, "fPhi2");
30+
} // namespace due
31+
32+
DECLARE_SOA_TABLE(Due, "AOD", "DUE",
33+
due::Eta, due::Phi);
34+
35+
} // namespace o2::aod
36+
37+
using namespace o2;
38+
using namespace o2::framework;
39+
40+
// This task is related to the ATask in aodwriter.cxx
41+
// It reads and processes data which was created and saved by aodwriter
42+
//
43+
// To test use:
44+
// o2-analysistutorial-aodwriter --aod-file AO2D.root --res-file tabletotree > log
45+
// o2-analysistutorial-aodreader --aod-file tabletotree_0.root > log
46+
47+
//
48+
struct ATask {
49+
void process(aod::Uno const& unos, aod::Due const& dues)
50+
{
51+
int cnt = 0;
52+
for (auto& uno : unos) {
53+
auto eta = uno.eta();
54+
auto phi = uno.phi();
55+
auto mom = uno.mom();
56+
57+
//LOGF(INFO, "(%f, %f, %f)", eta, phi, mom);
58+
cnt++;
59+
}
60+
LOGF(INFO, "ATask Processed %i data points from Uno", cnt);
61+
62+
cnt = 0;
63+
for (auto& due : dues) {
64+
auto eta = due.eta();
65+
auto phi = due.phi();
66+
67+
//LOGF(INFO, "(%f, %f)", eta, phi);
68+
cnt++;
69+
}
70+
LOGF(INFO, "ATask Processed %i data points from Due", cnt);
71+
}
72+
};
73+
74+
struct BTask {
75+
void process(aod::Due const& dues)
76+
{
77+
int cnt = 0;
78+
for (auto& etaPhi : dues) {
79+
auto eta = etaPhi.eta();
80+
auto phi = etaPhi.phi();
81+
82+
//LOGF(INFO, "(%f, %f)", eta, phi);
83+
cnt++;
84+
}
85+
LOGF(INFO, "BTask Processed %i data points from Due", cnt);
86+
}
87+
};
88+
89+
WorkflowSpec defineDataProcessing(ConfigContext const&)
90+
{
91+
return WorkflowSpec{
92+
adaptAnalysisTask<ATask>("process-unodue"),
93+
adaptAnalysisTask<BTask>("process-due")};
94+
}

0 commit comments

Comments
 (0)