Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ namespace itsmft
{
class Hit;
}
namespace trkft3
{
class Hit;
}
namespace tof
{
class HitType;
Expand Down Expand Up @@ -246,11 +250,11 @@ struct DetIDToHitTypes<o2::detectors::DetID::IT3> {
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::TRK> {
using HitType = o2::itsmft::Hit;
using HitType = o2::trkft3::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FT3> {
using HitType = o2::itsmft::Hit;
using HitType = o2::trkft3::Hit;
};
template <>
struct DetIDToHitTypes<o2::detectors::DetID::FCT> {
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/Detectors/Upgrades/ALICE3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
# or submit itself to any jurisdiction.

add_subdirectory(FD3)
add_subdirectory(TRK)
add_subdirectory(TRKFT3)
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,4 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

o2_add_library(DataFormatsTRK
SOURCES src/Cluster.cxx
src/ROFRecord.cxx
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat
O2::DataFormatsITSMFT
O2::SimulationDataFormat
)

o2_target_root_dictionary(DataFormatsTRK
HEADERS include/DataFormatsTRK/Cluster.h
include/DataFormatsTRK/ROFRecord.h
LINKDEF src/DataFormatsTRKLinkDef.h
)
add_subdirectory(common)
24 changes: 24 additions & 0 deletions DataFormats/Detectors/Upgrades/ALICE3/TRKFT3/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2019-2026 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

o2_add_library(DataFormatsTRKFT3
SOURCES src/Digit.cxx
src/Hit.cxx
src/ROFRecord.cxx
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat
O2::SimulationDataFormat)

o2_target_root_dictionary(DataFormatsTRKFT3
HEADERS include/DataFormatsTRKFT3/Cluster.h
include/DataFormatsTRKFT3/Digit.h
include/DataFormatsTRKFT3/Hit.h
include/DataFormatsTRKFT3/ROFRecord.h
LINKDEF src/DataFormatsTRKFT3LinkDef.h)
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,44 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_DATAFORMATSTRK_CLUSTER_H
#define ALICEO2_DATAFORMATSTRK_CLUSTER_H
#ifndef ALICEO2_DATAFORMATSTRKFT3_CLUSTER_H
#define ALICEO2_DATAFORMATSTRKFT3_CLUSTER_H

#include "DetectorsCommonDataFormats/DetID.h"
#include <Rtypes.h>
#include <cstdint>
#include <sstream>
#include <string>

namespace o2::trk
namespace o2::trkft3
{

template <int DetID>
struct Cluster {
static_assert(DetID == o2::detectors::DetID::TRK || DetID == o2::detectors::DetID::FT3, "only TRK and FT3 clusters are supported");

uint16_t chipID = 0;
uint16_t row = 0;
uint16_t col = 0;
uint16_t size = 1;
int16_t subDetID = -1;
int16_t layer = -1;
int16_t disk = -1;

std::string asString() const;
std::string asString() const
{
std::ostringstream stream;
stream << o2::detectors::DetID(DetID).getName() << " cluster chip=" << chipID
<< " row=" << row << " col=" << col << " size=" << size
<< " subDet=" << subDetID << " layer=" << layer;
return stream.str();
}

ClassDefNV(Cluster, 1);
};

} // namespace o2::trk
using TRKCluster = Cluster<o2::detectors::DetID::TRK>;
using FT3Cluster = Cluster<o2::detectors::DetID::FT3>;

} // namespace o2::trkft3

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_DATAFORMATSTRKFT3_DIGIT_H
#define ALICEO2_DATAFORMATSTRKFT3_DIGIT_H

#include "Rtypes.h"
#include <climits>
#include <iosfwd>

namespace o2::trkft3
{

class Digit
{
public:
Digit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0);
~Digit() = default;

UShort_t getChipIndex() const { return mChipIndex; }
UShort_t getColumn() const { return mCol; }
UShort_t getRow() const { return mRow; }
Int_t getCharge() const { return mCharge; }

void setChipIndex(UShort_t index) { mChipIndex = index; }
void setPixelIndex(UShort_t row, UShort_t col)
{
mRow = row;
mCol = col;
}
void setCharge(Int_t charge) { mCharge = charge < USHRT_MAX ? charge : USHRT_MAX; }
void addCharge(int charge) { setCharge(charge + int(mCharge)); }

std::ostream& print(std::ostream& output) const;
friend std::ostream& operator<<(std::ostream& output, const Digit& digi)
{
digi.print(output);
return output;
}

private:
UShort_t mChipIndex = 0;
UShort_t mRow = 0;
UShort_t mCol = 0;
UShort_t mCharge = 0;

ClassDefNV(Digit, 1);
};

} // namespace o2::trkft3

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_DATAFORMATSTRKFT3_HIT_H
#define ALICEO2_DATAFORMATSTRKFT3_HIT_H

#include <ostream>
#include <vector>

#include "CommonUtils/ShmAllocator.h"
#include "SimulationDataFormat/BaseHits.h"
#include "Rtypes.h"
#include "TVector3.h"

namespace o2::trkft3
{

class Hit : public o2::BasicXYZEHit<Float_t, Float_t>
{
public:
enum HitStatus_t {
kTrackEntering = 0x1,
kTrackInside = 0x1 << 1,
kTrackExiting = 0x1 << 2,
kTrackOut = 0x1 << 3,
kTrackStopped = 0x1 << 4,
kTrackAlive = 0x1 << 5
};

Hit() = default;

Hit(int trackID, unsigned short detID, const TVector3& startPos, const TVector3& endPos, const TVector3& startMom,
double startE, double endTime, double eLoss, unsigned char startStatus, unsigned char endStatus);

math_utils::Point3D<Float_t> GetPosStart() const { return mPosStart; }
Float_t GetStartX() const { return mPosStart.X(); }
Float_t GetStartY() const { return mPosStart.Y(); }
Float_t GetStartZ() const { return mPosStart.Z(); }
template <typename F>
void GetStartPosition(F& x, F& y, F& z) const
{
x = GetStartX();
y = GetStartY();
z = GetStartZ();
}

math_utils::Vector3D<Float_t> GetMomentum() const { return mMomentum; }
math_utils::Vector3D<Float_t>& GetMomentum() { return mMomentum; }
Float_t GetPx() const { return mMomentum.X(); }
Float_t GetPy() const { return mMomentum.Y(); }
Float_t GetPz() const { return mMomentum.Z(); }
Float_t GetE() const { return mE; }
Float_t GetTotalEnergy() const { return GetE(); }

UChar_t GetStatusEnd() const { return mTrackStatusEnd; }
UChar_t GetStatusStart() const { return mTrackStatusStart; }

Bool_t IsEntering() const { return mTrackStatusEnd & kTrackEntering; }
Bool_t IsInside() const { return mTrackStatusEnd & kTrackInside; }
Bool_t IsExiting() const { return mTrackStatusEnd & kTrackExiting; }
Bool_t IsOut() const { return mTrackStatusEnd & kTrackOut; }
Bool_t IsStopped() const { return mTrackStatusEnd & kTrackStopped; }
Bool_t IsAlive() const { return mTrackStatusEnd & kTrackAlive; }

Bool_t IsEnteringStart() const { return mTrackStatusStart & kTrackEntering; }
Bool_t IsInsideStart() const { return mTrackStatusStart & kTrackInside; }
Bool_t IsExitingStart() const { return mTrackStatusStart & kTrackExiting; }
Bool_t IsOutStart() const { return mTrackStatusStart & kTrackOut; }
Bool_t IsStoppedStart() const { return mTrackStatusStart & kTrackStopped; }
Bool_t IsAliveStart() const { return mTrackStatusStart & kTrackAlive; }

void SetPosStart(const math_utils::Point3D<Float_t>& p) { mPosStart = p; }

void Print(const Option_t* opt) const;
friend std::ostream& operator<<(std::ostream& of, const Hit& point)
{
of << "-I- Hit: O2 trkft3 point for track " << point.GetTrackID() << " in detector " << point.GetDetectorID() << std::endl;
return of;
}

private:
math_utils::Vector3D<Float_t> mMomentum; ///< momentum at entrance
math_utils::Point3D<Float_t> mPosStart; ///< position at entrance, base position is at exit
Float_t mE = 0.f; ///< total energy at entrance
UChar_t mTrackStatusEnd = 0; ///< MC status flag at exit
UChar_t mTrackStatusStart = 0; ///< MC status at starting point

ClassDefNV(Hit, 3);
};

} // namespace o2::trkft3

#ifdef USESHM
namespace std
{
template <>
class allocator<o2::trkft3::Hit> : public o2::utils::ShmAllocator<o2::trkft3::Hit>
{
};
} // namespace std
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_DATAFORMATSTRK_ROFRECORD_H
#define ALICEO2_DATAFORMATSTRK_ROFRECORD_H
#ifndef ALICEO2_DATAFORMATSTRKFT3_ROFRECORD_H
#define ALICEO2_DATAFORMATSTRKFT3_ROFRECORD_H

#include "CommonDataFormat/InteractionRecord.h"
#include "CommonDataFormat/RangeReference.h"
#include <Rtypes.h>
#include <cstdint>
#include <string>

namespace o2::trk
namespace o2::trkft3
{

class ROFRecord
Expand Down Expand Up @@ -56,20 +56,6 @@ class ROFRecord
ClassDefNV(ROFRecord, 1);
};

struct MC2ROFRecord {
using ROFtype = unsigned int;

int eventRecordID = -1;
int rofRecordID = 0;
ROFtype minROF = 0;
ROFtype maxROF = 0;

MC2ROFRecord() = default;
MC2ROFRecord(int evID, int rofRecID, ROFtype mnrof, ROFtype mxrof) : eventRecordID(evID), rofRecordID(rofRecID), minROF(mnrof), maxROF(mxrof) {}

ClassDefNV(MC2ROFRecord, 1);
};

} // namespace o2::trk
} // namespace o2::trkft3

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class o2::trkft3::Digit + ;
#pragma link C++ class std::vector < o2::trkft3::Digit> + ;
#pragma link C++ class o2::trkft3::Hit + ;
#pragma link C++ class std::vector < o2::trkft3::Hit> + ;
#pragma link C++ class o2::trkft3::Cluster < o2::detectors::DetID::TRK> + ;
#pragma link C++ class std::vector < o2::trkft3::Cluster < o2::detectors::DetID::TRK>> + ;
#pragma link C++ class o2::trkft3::Cluster < o2::detectors::DetID::FT3> + ;
#pragma link C++ class std::vector < o2::trkft3::Cluster < o2::detectors::DetID::FT3>> + ;
#pragma link C++ class o2::trkft3::ROFRecord + ;
#pragma link C++ class std::vector < o2::trkft3::ROFRecord> + ;

#endif
Loading
Loading