Skip to content

Commit 2b82f65

Browse files
committed
V0 finder + related workflows
1 parent 401ffcb commit 2b82f65

22 files changed

Lines changed: 1197 additions & 2 deletions

DataFormats/Reconstruction/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ o2_add_library(ReconstructionDataFormats
2020
src/TrackLTIntegral.cxx
2121
src/PID.cxx
2222
src/DCA.cxx
23+
src/V0.cxx
2324
src/VtxTrackIndex.cxx
2425
src/VtxTrackRef.cxx
2526
PUBLIC_LINK_LIBRARIES O2::GPUCommon
@@ -39,6 +40,7 @@ o2_target_root_dictionary(
3940
include/ReconstructionDataFormats/TrackLTIntegral.h
4041
include/ReconstructionDataFormats/PID.h
4142
include/ReconstructionDataFormats/DCA.h
43+
include/ReconstructionDataFormats/V0.h
4244
include/ReconstructionDataFormats/VtxTrackIndex.h
4345
include/ReconstructionDataFormats/VtxTrackRef.h)
4446

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
11+
#ifndef ALICEO2_V0_H
12+
#define ALICEO2_V0_H
13+
14+
#include "ReconstructionDataFormats/VtxTrackIndex.h"
15+
#include "ReconstructionDataFormats/Track.h"
16+
#include "ReconstructionDataFormats/PID.h"
17+
#include <array>
18+
#include <Math/SVector.h>
19+
20+
namespace o2
21+
{
22+
namespace dataformats
23+
{
24+
25+
class V0 : public o2::track::TrackParCov
26+
{
27+
public:
28+
using GIndex = o2::dataformats::VtxTrackIndex;
29+
using Track = o2::track::TrackParCov;
30+
using PID = o2::track::PID;
31+
32+
V0() = default;
33+
V0(const std::array<float, 3>& xyz, const std::array<float, 3>& pxyz,
34+
const o2::track::TrackParCov& trPos, const o2::track::TrackParCov& trNeg,
35+
GIndex trPosID, GIndex trNegID);
36+
37+
GIndex getProngID(int i) const { return mProngIDs[i]; }
38+
void setProngID(int i, GIndex gid) { mProngIDs[i] = gid; }
39+
40+
const Track& getProng(int i) const { return mProngs[i]; }
41+
Track& getProng(int i) { return mProngs[i]; }
42+
void setProng(int i, const Track& t) { mProngs[i] = t; }
43+
44+
float getCosPA() const { return mCosPA; }
45+
void setCosPA(float c) { mCosPA = c; }
46+
47+
float getDCA() const { return mDCA; }
48+
void setDCA(float d) { mDCA = d; }
49+
50+
int getVertexID() const { return mVertexID; }
51+
void setVertexID(int id) { mVertexID = id; }
52+
53+
float getMass2() const
54+
{
55+
return calcMass2(mProngs[0].getPID(), mProngs[1].getPID());
56+
}
57+
58+
float calcMass2(PID pidPos, PID pidNeg) const
59+
{
60+
return calcMass2(PID::getMass2(pidPos), PID::getMass2(pidNeg));
61+
}
62+
63+
float calcMass2(float massPos2, float massNeg2) const;
64+
65+
protected:
66+
std::array<GIndex, 2> mProngIDs; // global IDs of prongs
67+
std::array<Track, 2> mProngs; // prongs kinematics at vertex
68+
float mCosPA = 0; // cos of pointing angle
69+
float mDCA = 9990; // distance of closest approach of prongs
70+
int mVertexID = -1; // id of parent vertex
71+
72+
ClassDefNV(V0, 1);
73+
};
74+
75+
} // namespace dataformats
76+
} // namespace o2
77+
#endif

DataFormats/Reconstruction/include/ReconstructionDataFormats/VtxTrackIndex.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class VtxTrackIndex : public AbstractRef<26, 3, 3>
5555

5656
operator auto() const { return AbstractRef<26, 3, 3>(); }
5757

58+
bool isPVContributor() const { return testBit(Contributor); }
59+
void setPVContributor() { setBit(Contributor); }
60+
61+
bool isAmbiguous() const { return testBit(Ambiguous); }
62+
void setAmbiguous() { setBit(Ambiguous); }
63+
5864
ClassDefNV(VtxTrackIndex, 1);
5965
};
6066

DataFormats/Reconstruction/src/ReconstructionDataFormatsLinkDef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@
5353

5454
#pragma link C++ class o2::dataformats::DCA + ;
5555

56+
#pragma link C++ class o2::dataformats::V0 + ;
57+
#pragma link C++ class std::vector < o2::dataformats::V0> + ;
58+
5659
#endif
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
11+
#include "ReconstructionDataFormats/V0.h"
12+
13+
using namespace o2::dataformats;
14+
15+
V0::V0(const std::array<float, 3>& xyz, const std::array<float, 3>& pxyz,
16+
const o2::track::TrackParCov& trPos, const o2::track::TrackParCov& trNeg,
17+
GIndex trPosID, GIndex trNegID)
18+
: o2::track::TrackParCov{xyz, pxyz, 0, false}, mProngIDs{trPosID, trNegID}, mProngs{trPos, trNeg}
19+
{
20+
}
21+
22+
float V0::calcMass2(float massPos2, float massNeg2) const
23+
{
24+
auto p2 = getP2();
25+
auto p2pos = mProngs[0].getP2(), p2neg = mProngs[1].getP2();
26+
auto energy = std::sqrt(massPos2 + p2pos) + std::sqrt(massNeg2 + p2neg);
27+
return energy * energy - p2;
28+
}

Detectors/GlobalTrackingWorkflow/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ o2_add_library(GlobalTrackingWorkflow
1818
src/PrimaryVertexWriterSpec.cxx
1919
src/PrimaryVertexReaderSpec.cxx
2020
src/VertexTrackMatcherSpec.cxx
21+
src/SecondaryVertexingSpec.cxx
22+
src/SecondaryVertexWriterSpec.cxx
23+
src/SecondaryVertexReaderSpec.cxx
2124
PUBLIC_LINK_LIBRARIES O2::GlobalTracking
2225
O2::ITStracking
2326
O2::ITSWorkflow
@@ -36,12 +39,22 @@ o2_add_executable(vertexing-workflow
3639
COMPONENT_NAME primary
3740
SOURCES src/primary-vertexing-workflow.cxx
3841
PUBLIC_LINK_LIBRARIES O2::GlobalTrackingWorkflow )
39-
42+
4043
o2_add_executable(vertex-reader-workflow
4144
COMPONENT_NAME primary
4245
SOURCES src/primary-vertex-reader-workflow.cxx
4346
PUBLIC_LINK_LIBRARIES O2::GlobalTrackingWorkflow )
4447

48+
o2_add_executable(vertex-reader-workflow
49+
COMPONENT_NAME secondary
50+
SOURCES src/secondary-vertex-reader-workflow.cxx
51+
PUBLIC_LINK_LIBRARIES O2::GlobalTrackingWorkflow )
52+
53+
o2_add_executable(vertexing-workflow
54+
COMPONENT_NAME secondary
55+
SOURCES src/secondary-vertexing-workflow.cxx
56+
PUBLIC_LINK_LIBRARIES O2::GlobalTrackingWorkflow )
57+
4558

4659
add_subdirectory(tofworkflow)
4760
add_subdirectory(tpcinterpolationworkflow)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
11+
/// @file SecondaryVertexReaderSpec.h
12+
13+
#ifndef O2_SECONDARY_VERTEXREADER
14+
#define O2_SECONDARY_VERTEXREADER
15+
16+
#include "TFile.h"
17+
#include "TTree.h"
18+
19+
#include "Framework/DataProcessorSpec.h"
20+
#include "Framework/Task.h"
21+
#include "CommonDataFormat/RangeReference.h"
22+
#include "ReconstructionDataFormats/V0.h"
23+
24+
namespace o2
25+
{
26+
namespace vertexing
27+
{
28+
// read secondary vertices produces by the o2-secondary-vertexing-workflow
29+
30+
class SecondaryVertexReader : public o2::framework::Task
31+
{
32+
using RRef = o2::dataformats::RangeReference<int, int>;
33+
using V0 = o2::dataformats::V0;
34+
35+
public:
36+
SecondaryVertexReader() = default;
37+
~SecondaryVertexReader() override = default;
38+
void init(o2::framework::InitContext& ic) final;
39+
void run(o2::framework::ProcessingContext& pc) final;
40+
41+
protected:
42+
void connectTree();
43+
44+
bool mVerbose = false;
45+
46+
std::vector<V0> mV0s, *mV0sPtr = &mV0s;
47+
std::vector<RRef> mPV2V0Ref, *mPV2V0RefPtr = &mPV2V0Ref;
48+
49+
std::unique_ptr<TFile> mFile;
50+
std::unique_ptr<TTree> mTree;
51+
std::string mFileName = "";
52+
std::string mFileNameMatches = "";
53+
std::string mSVertexTreeName = "o2sim";
54+
std::string mV0BranchName = "V0s";
55+
std::string mPVertex2V0RefBranchName = "PV2V0Refs";
56+
};
57+
58+
/// create a processor spec
59+
/// read secondary vertex data from a root file
60+
o2::framework::DataProcessorSpec getSecondaryVertexReaderSpec();
61+
62+
} // namespace vertexing
63+
} // namespace o2
64+
65+
#endif
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
11+
/// @file SecondaryVertexWriterSpec.h
12+
13+
#ifndef O2_SECONDARY_VERTEX_WRITER
14+
#define O2_SECONDARY_VERTEX_WRITER
15+
16+
#include "Framework/DataProcessorSpec.h"
17+
18+
namespace o2
19+
{
20+
namespace vertexing
21+
{
22+
23+
/// create a processor spec
24+
framework::DataProcessorSpec getSecondaryVertexWriterSpec();
25+
26+
} // namespace vertexing
27+
} // namespace o2
28+
29+
#endif
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
11+
#ifndef O2_SECONDARY_VERTEXER_SPEC_H
12+
#define O2_SECONDARY_VERTEXER_SPEC_H
13+
14+
/// @file SecondaryVertexingSpec.h
15+
16+
#include "DetectorsVertexing/SVertexer.h"
17+
#include "Framework/DataProcessorSpec.h"
18+
#include "Framework/Task.h"
19+
#include "TStopwatch.h"
20+
21+
namespace o2
22+
{
23+
namespace vertexing
24+
{
25+
26+
using namespace o2::framework;
27+
28+
class SecondaryVertexingSpec : public Task
29+
{
30+
public:
31+
SecondaryVertexingSpec() = default;
32+
~SecondaryVertexingSpec() override = default;
33+
void init(InitContext& ic) final;
34+
void run(ProcessingContext& pc) final;
35+
void endOfStream(EndOfStreamContext& ec) final;
36+
37+
private:
38+
o2::vertexing::SVertexer mVertexer;
39+
TStopwatch mTimer;
40+
};
41+
42+
/// create a processor spec
43+
DataProcessorSpec getSecondaryVertexingSpec();
44+
45+
} // namespace vertexing
46+
} // namespace o2
47+
48+
#endif

0 commit comments

Comments
 (0)