Skip to content

Commit 3783dba

Browse files
authored
Merge c518093 into sapling-pr-archive-ehellbar
2 parents 232a8c6 + c518093 commit 3783dba

67 files changed

Lines changed: 1201 additions & 785 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.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

.skills/create-a-new-file/SKILL.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: create-a-new-file
3+
description: describes how to create a new file
4+
---
5+
6+
## Copyright statements
7+
8+
The copyright statement for ALICE / O2 is found in ./o2-copyright-statement.md. It should be at the beginning of
9+
the new file using the proper commenting syntax for the given programming language. For example in C++ it should be commented via
10+
multiline comments:
11+
12+
``` C++
13+
// Copyright 2019-<current-year> CERN and copyright holders of ALICE O2.
14+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
15+
// ...
16+
```
17+
18+
The only part which needs to be adapted by you is the `<current-year>` which you need to replace with the actual current year.
19+
20+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2019-<current-year> CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This is the main repository of the ALICE Experiment Simulation, Reconstruction and Analysis Framework.
2+
3+
The skills specific to developing code for this repository can be found in
4+
the `.skills/` folder of this project.
5+

DataFormats/Headers/include/Headers/DataHeader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ constexpr o2::header::DataDescription gDataDescriptionClusters{"CLUSTERS"};
600600
constexpr o2::header::DataDescription gDataDescriptionTracks{"TRACKS"};
601601
constexpr o2::header::DataDescription gDataDescriptionConfig{"CONFIGURATION"};
602602
constexpr o2::header::DataDescription gDataDescriptionInfo{"INFORMATION"};
603+
constexpr o2::header::DataDescription gDataDescriptionEos{"EOS"};
603604
constexpr o2::header::DataDescription gDataDescriptionROOTStreamers{"ROOT STREAMERS"};
604605
constexpr o2::header::DataDescription gDataDescriptionDISTSTF{"DISTSUBTIMEFRAME"};
605606
/// @} // end of doxygen group

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackFwd.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ using SMatrix55Sym = ROOT::Math::SMatrix<double, 5, 5, ROOT::Math::MatRepSym<dou
3131
using SMatrix55Std = ROOT::Math::SMatrix<double, 5>;
3232
using SMatrix5 = ROOT::Math::SVector<Double_t, 5>;
3333

34+
template <typename value_T>
35+
class TrackParametrization; // fwd declaration for conversion method
36+
37+
template <typename value_T>
38+
class TrackParametrizationWithError; // fwd declaration for conversion method
39+
3440
class TrackParFwd
3541
{ // Forward track parameterization, kinematics only.
3642
public:
@@ -42,6 +48,9 @@ class TrackParFwd
4248
TrackParFwd(TrackParFwd&&) = delete;
4349
TrackParFwd& operator=(TrackParFwd&&) = delete;
4450

51+
template <typename T>
52+
void toBarrelTrackPar(TrackParametrization<T>& t) const;
53+
4554
/// return Z coordinate (cm)
4655
Double_t getZ() const { return mZ; }
4756
/// set Z coordinate (cm)
@@ -145,6 +154,9 @@ class TrackParCovFwd : public TrackParFwd
145154
TrackParCovFwd& operator=(const TrackParCovFwd& tpf) = default;
146155
TrackParCovFwd(const Double_t z, const SMatrix5& parameters, const SMatrix55Sym& covariances, const Double_t chi2);
147156

157+
template <typename T>
158+
void toBarrelTrackParCov(TrackParametrizationWithError<T>& t) const;
159+
148160
const SMatrix55Sym& getCovariances() const { return mCovariances; }
149161
void setCovariances(const SMatrix55Sym& covariances) { mCovariances = covariances; }
150162
void deleteCovariances() { mCovariances = SMatrix55Sym(); }

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackParametrization.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class DCA;
6666

6767
namespace track
6868
{
69+
70+
class TrackParFwd; // fwd declaration for conversion method
71+
6972
// aliases for track elements
7073
enum ParLabels : int { kY,
7174
kZ,
@@ -252,6 +255,7 @@ class TrackParametrization
252255
GPUd() void printParam() const;
253256
GPUd() void printParamHexadecimal();
254257
#ifndef GPUCA_ALIGPUCODE
258+
void toFwdTrackPar(TrackParFwd& t) const;
255259
std::string asString() const;
256260
std::string asStringHexadecimal();
257261
size_t hash() const { return hash(getX(), getAlpha(), getY(), getZ(), getSnp(), getTgl(), getQ2Pt()); }

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackParametrizationWithError.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ namespace o2
2525
namespace track
2626
{
2727

28+
class TrackParCovFwd; // fwd declaration for conversion method
29+
2830
template <typename value_T = float>
2931
class TrackParametrizationWithError : public TrackParametrization<value_T>
3032
{ // track+error parameterization
@@ -82,6 +84,7 @@ class TrackParametrizationWithError : public TrackParametrization<value_T>
8284
GPUd() void print() const;
8385
GPUd() void printHexadecimal();
8486
#ifndef GPUCA_ALIGPUCODE
87+
bool toFwdTrackParCov(TrackParCovFwd& t) const;
8588
std::string asString() const;
8689
std::string asStringHexadecimal();
8790
#endif

DataFormats/Reconstruction/src/TrackFwd.cxx

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "ReconstructionDataFormats/TrackFwd.h"
13+
#include "ReconstructionDataFormats/TrackParametrization.h"
14+
#include "ReconstructionDataFormats/TrackParametrizationWithError.h"
1315
#include "Math/MatrixFunctions.h"
1416
#include <GPUCommonLogger.h>
1517

@@ -41,7 +43,7 @@ void TrackParFwd::propagateParamToZlinear(double zEnd)
4143
auto dZ = (zEnd - getZ());
4244
auto phi0 = getPhi();
4345
auto [sinphi0, cosphi0] = o2::math_utils::sincosd(phi0);
44-
auto invtanl0 = 1.0 / getTanl();
46+
auto invtanl0 = 1.0 / getTgl();
4547
auto n = dZ * invtanl0;
4648
mParameters(0) += n * cosphi0;
4749
mParameters(1) += n * sinphi0;
@@ -572,5 +574,79 @@ void TrackParCovFwd::propagateToDCAhelix(double zField, const std::array<double,
572574
return;
573575
}
574576

577+
template <typename T>
578+
void TrackParFwd::toBarrelTrackPar(TrackParametrization<T>& t) const
579+
{
580+
// we select the barrel frame with alpha = phi, then by construction the snp is 0
581+
auto alpha = getPhi();
582+
auto csa = TMath::Cos(alpha), sna = TMath::Sin(alpha);
583+
t.setAlpha(alpha);
584+
t.setX(csa * getX() + sna * getY());
585+
t.setY(-sna * getX() + csa * getY());
586+
t.setZ(getZ());
587+
t.setSnp(0);
588+
t.setTgl(getTanl());
589+
t.setQ2Pt(getInvQPt());
590+
}
591+
592+
template <typename T>
593+
void TrackParCovFwd::toBarrelTrackParCov(TrackParametrizationWithError<T>& t) const
594+
{
595+
// We select the barrel frame with alpha = phi, then by construction the snp is 0
596+
auto alpha = getPhi();
597+
auto csa = TMath::Cos(alpha), sna = TMath::Sin(alpha);
598+
t.setAlpha(alpha);
599+
t.setX(csa * getX() + sna * getY());
600+
t.setY(-sna * getX() + csa * getY());
601+
t.setZ(getZ());
602+
t.setSnp(0);
603+
t.setTgl(getTgl());
604+
t.setQ2Pt(getInvQPt());
605+
/*
606+
The standard Jacobian d{barrel_param} / d{fwd_param} should be augmented by the "forward" uncertainty
607+
in X_barrel translated to uncertainty in Z, i.e:
608+
A fwd param variation delta_x, delta_y leads to barrel frame coordinate variaion
609+
delta_xb = csa delta_x + sna delta_y
610+
delta_yb = -sna delta_x + csa delta_y
611+
with dx_b/dz = csp/tgL = 1/tgL, dy_b/dz = snp/tgL = 0 (for phi 0 in the tracking frame) the variation of delta_xb would require
612+
a shift in delta_zb = -tgL delta_xb to stat at the same X.
613+
So, for alpha=phi (-> snp=0) choice the full Jacobian fwd->barrel is:
614+
/ -sna csa 0 0 0 \
615+
| -tgL*csa -tgL*sna 0 0 0 |
616+
| 0 0 1 0 0 |
617+
| 0 0 0 1 0 |
618+
\ 0 0 0 0 1 /
619+
*/
620+
const T a1 = -sna;
621+
const T a2 = csa;
622+
const T b1 = -getTgl() * csa;
623+
const T b2 = -getTgl() * sna;
624+
const T cphi = 1;
625+
const auto& C = getCovariances();
626+
typename TrackParametrizationWithError<T>::covMat_t covBarrel = {
627+
T(a1 * a1 * C(0, 0) + 2 * a1 * a2 * C(0, 1) + a2 * a2 * C(1, 1)), // kSigY2
628+
T(a1 * b1 * C(0, 0) + (a1 * b2 + a2 * b1) * C(0, 1) + a2 * b2 * C(1, 1)), // kSigZY
629+
T(b1 * b1 * C(0, 0) + 2 * b1 * b2 * C(0, 1) + b2 * b2 * C(1, 1)), // kSigZ2
630+
T(csa * (a1 * C(0, 2) + a2 * C(1, 2))), // kSigSnpY
631+
T(csa * (b1 * C(0, 2) + b2 * C(1, 2))), // kSigSnpZ
632+
T(csa * csa * C(2, 2)), // kSigSnp2
633+
T(a1 * C(0, 3) + a2 * C(1, 3)), // kSigTglY
634+
T(b1 * C(0, 3) + b2 * C(1, 3)), // kSigTglZ
635+
T(csa * C(2, 3)), // kSigTglSnp
636+
T(C(3, 3)), // kSigTgl2
637+
T(a1 * C(0, 4) + a2 * C(1, 4)), // kSigQ2PtY
638+
T(b1 * C(0, 4) + b2 * C(1, 4)), // kSigQ2PtZ
639+
T(csa * C(2, 4)), // kSigQ2PtSnp
640+
T(C(3, 4)), // kSigQ2PtTgl
641+
T(C(4, 4)) // kSigQ2Pt2
642+
};
643+
t.setCov(covBarrel);
644+
}
645+
646+
template void TrackParFwd::toBarrelTrackPar<float>(TrackParametrization<float>&) const;
647+
template void TrackParFwd::toBarrelTrackPar<double>(TrackParametrization<double>&) const;
648+
template void TrackParCovFwd::toBarrelTrackParCov<float>(TrackParametrizationWithError<float>&) const;
649+
template void TrackParCovFwd::toBarrelTrackParCov<double>(TrackParametrizationWithError<double>&) const;
650+
575651
} // namespace track
576652
} // namespace o2

DataFormats/Reconstruction/src/TrackParametrization.cxx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#ifndef GPUCA_ALIGPUCODE
2828
#include <fmt/printf.h>
29+
#include "ReconstructionDataFormats/TrackFwd.h"
2930
#endif
3031

3132
using namespace o2::gpu;
@@ -985,6 +986,21 @@ GPUd() typename TrackParametrization<value_T>::value_t TrackParametrization<valu
985986
return ttmp.propagateParamToDCA({xmv, ymv, zmv}, b, &dca) ? dca[1] : -9999.;
986987
}
987988

989+
#ifndef GPUCA_ALIGPUCODE
990+
//______________________________________________
991+
template <typename value_T>
992+
void TrackParametrization<value_T>::toFwdTrackPar(TrackParFwd& t) const
993+
{
994+
auto p = getXYZGlo();
995+
t.setZ(p.Z());
996+
t.setX(p.X());
997+
t.setY(p.Y());
998+
t.setPhi(getPhi());
999+
t.setTanl(getTgl());
1000+
t.setInvQPt(getQ2Pt());
1001+
}
1002+
#endif
1003+
9881004
namespace o2::track
9891005
{
9901006
#if !defined(GPUCA_GPUCODE) || defined(GPUCA_GPUCODE_DEVICE) // FIXME: DR: WORKAROUND to avoid CUDA bug creating host symbols for device code.

0 commit comments

Comments
 (0)