Skip to content
Merged
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 @@ -79,6 +79,7 @@ class AbstractRef

GPUdi() bool operator==(const AbstractRef& o) const { return getRawWOFlags() == o.getRawWOFlags(); }
GPUdi() bool operator!=(const AbstractRef& o) const { return !operator==(o); }
GPUdi() void clear() { setRaw((Base_t(SrcMask & ((0x1 << NBSrc) - 1)) << NBIdx) | Base_t(IdxMask & ((0x1 << NBIdx) - 1))); }

protected:
Base_t mRef = IdxMask | (SrcMask << NBIdx); // packed reference, dummy by default
Expand Down
4 changes: 4 additions & 0 deletions Detectors/Align/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ o2_add_library(Align
src/EventVertex.cxx
src/AlignConfig.cxx
src/Mille.cxx
src/AlgPntDbg.cxx
src/AlgTrcDbg.cxx
PUBLIC_LINK_LIBRARIES O2::FrameworkLogger
O2::Steer
O2::ReconstructionDataFormats
Expand Down Expand Up @@ -82,6 +84,8 @@ o2_target_root_dictionary(
include/Align/GeometricalConstraint.h
include/Align/utils.h
include/Align/AlignConfig.h
include/Align/AlgPntDbg.h
include/Align/AlgTrcDbg.h
)

add_subdirectory(Workflow)
Expand Down
6 changes: 6 additions & 0 deletions Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ void BarrelAlignmentSpec::init(InitContext& ic)
if (ic.options().get<bool>("apply-xor")) {
mTRDTransformer->setApplyXOR();
}
auto prevShift = mTRDTransformer->isShiftApplied();
if (getenv("ALIEN_JDL_LPMPRODUCTIONTYPE") && std::strcmp(getenv("ALIEN_JDL_LPMPRODUCTIONTYPE"), "MC") == 0) {
// apply artificial pad shift in case non-ideal alignment is used to compensate for shift in current alignment from real data
mTRDTransformer->setApplyShift(false);
}
LOGP(info, "Old TRD shift : {} new : {}", prevShift, mTRDTransformer->isShiftApplied());
mController->setTRDTransformer(mTRDTransformer.get());
}
mController->setAllowAfterburnerTracks(ic.options().get<bool>("allow-afterburner-tracks"));
Expand Down
91 changes: 91 additions & 0 deletions Detectors/Align/include/Align/AlgPntDbg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright 2019-2020 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.

/// @file AlignmentPoint.h
/// @author ruben.shahoyan@cern.ch, michael.lettrich@cern.ch
/// @since 2021-02-01
/// @brief Meausered point in the sensor.

/**
* Compact alignment point info for debugging
*/

#ifndef ALGPNTDBG_H
#define ALGPNTDBG_H

#include "Align/AlignmentPoint.h"

namespace o2
{
namespace align
{

struct AlgPntDbg {
public:
using DetID = o2::detectors::DetID;
//
enum {
UpperLeg = 0
};
//
AlgPntDbg() = default;
AlgPntDbg(const AlgPntDbg&) = default;
~AlgPntDbg() = default;
AlgPntDbg& operator=(const AlgPntDbg& other) = default;
AlgPntDbg(const AlignmentPoint* point) : mDetID(point->getDetID()), mSID(point->getSID()), mAlpha(point->getAlphaSens()), mX(point->getXTracking()), mY(point->getYTracking()), mZ(point->getZTracking()), mErrYY(point->getYZErrTracking()[0]), mErrZZ(point->getYZErrTracking()[2]), mErrYZ(point->getYZErrTracking()[1])
{
mSinAlp = std::sin(mAlpha);
mCosAlp = std::cos(mAlpha);
mSnp = point->getTrParamWSA()[2]; // track Snp at the sensor
if (point->isInvDir()) {
setUpperLeg();
}
}

float getR() const { return std::sqrt(mX * mX + mY * mY); }
float getYTrack() const { return mY + mYRes; }
float getZTrack() const { return mZ + mZRes; }
float getXTrack() const { return mX; }
float getXLab() const { return mX * mCosAlp - mY * mSinAlp; }
float getYLab() const { return mX * mSinAlp + mY * mCosAlp; }
float getZLap() const { return mZ; }
float getXTrackLab() const { return mX * mCosAlp - getYTrack() * mSinAlp; }
float getYTrackLab() const { return mX * mSinAlp + getYTrack() * mCosAlp; }
float getZTrackLab() const { return getZTrack(); }
float getPhi() const { return std::atan2(getYLab(), getXLab()); }
void setFlag(int i) { mFlags |= 0x1 << i; }
bool getFlag(int i) const { return (mFlags & (0x1 << i)) != 0; }

void setUpperLeg() { setFlag(int(UpperLeg)); }
bool isUpperLeg() const { return getFlag(int(UpperLeg)); }

int mDetID{}; // DetectorID
int16_t mSID = -1; // sensor ID in the detector
uint16_t mFlags = 0; // flags
float mAlpha = 0.f; // Alpha of tracking frame
float mSinAlp = 0.f;
float mCosAlp = 0.f;
float mX = 0.f; // tracking X
float mY = 0.f; // tracking Y
float mZ = 0.f; // Z
float mYRes = 0.f; // tracking Y residual (track - point)
float mZRes = 0.f; // Z residual
float mErrYY = 0.f;
float mErrZZ = 0.f;
float mErrYZ = 0.f;
float mSnp = 0.f;

ClassDefNV(AlgPntDbg, 1);
};

} // namespace align
} // namespace o2
#endif
90 changes: 90 additions & 0 deletions Detectors/Align/include/Align/AlgTrcDbg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Copyright 2019-2020 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.

/// @file AlgTrcDbg.h
/// @author ruben.shahoyan@cern.ch

#ifndef ALGTRCDBG_H
#define ALGTRCDBG_H

#include "Align/AlignmentTrack.h"
#include "Align/AlgPntDbg.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "ReconstructionDataFormats/Track.h"

namespace o2
{
namespace align
{

struct AlgTrcDbg : public o2::track::TrackParCov {
AlgTrcDbg(const AlignmentTrack* trc) { setTrackParam(trc); }
AlgTrcDbg() = default;
~AlgTrcDbg() = default;
AlgTrcDbg(const AlgTrcDbg&) = default;
AlgTrcDbg& operator=(const AlgTrcDbg&) = default;

bool setTrackParam(const AlignmentTrack* trc)
{
if (!trc) {
return false;
}
setX(trc->getX());
setY(trc->getAlpha());
for (int i = 0; i < 5; i++) {
setParam(trc->getParam(i), i);
}
for (int i = 0; i < 15; i++) {
setCov(trc->getCov()[i], i);
}
mPoints.clear();
for (int i = 0; i < trc->getNPoints(); i++) {
const auto* tpoint = trc->getPoint(i);
if (tpoint->containsMeasurement()) {
auto& pnt = mPoints.emplace_back(tpoint);
pnt.mYRes = trc->getResidual(0, i);
pnt.mZRes = trc->getResidual(1, i);
}
}
setX(trc->getX());
setY(trc->getAlpha());
for (int i = 0; i < 5; i++) {
setParam(trc->getParam(i), i);
}
for (int i = 0; i < 15; i++) {
setCov(trc->getCov()[i], i);
}
for (int i = 0; i < trc->getNPoints(); i++) {
const auto* tpoint = trc->getPoint(i);
if (tpoint->containsMeasurement()) {
auto& pnt = mPoints.emplace_back(tpoint);
pnt.mYRes = trc->getResidual(0, i);
pnt.mZRes = trc->getResidual(1, i);
}
}
mGID.clear();
mGIDCosmUp.clear();
return true;
}

auto getNPoints() const { return mPoints.size(); }
bool isCosmic() const { return mGIDCosmUp.isSourceSet(); }

std::vector<AlgPntDbg> mPoints;
o2::dataformats::GlobalTrackID mGID{};
o2::dataformats::GlobalTrackID mGIDCosmUp{}; // GID of upper leg in case of cosmic
//
ClassDefNV(AlgTrcDbg, 1);
};

} // namespace align
} // namespace o2
#endif
11 changes: 8 additions & 3 deletions Detectors/Align/include/Align/AlignConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ struct AlignConfig : public o2::conf::ConfigurableParamHelper<AlignConfig> {
float q2PtMin[NTrackTypes] = {0.01, 0.01};
float q2PtMax[NTrackTypes] = {10., 10.};
float tglMax[NTrackTypes] = {3., 10.};
float defPTB0Coll = 0.6;
float defPTB0Cosm = 3.0;
int minPoints[NTrackTypes] = {4, 10};
int minDetAcc[NTrackTypes] = {1, 1};

Expand All @@ -54,7 +56,7 @@ struct AlignConfig : public o2::conf::ConfigurableParamHelper<AlignConfig> {
int minTOFClusters = 1; // min TOF clusters to accept track
int maxTPCRowsCombined = 1; // allow combining clusters on so many rows to a single cluster
int discardEdgePadrows = 3; // discard padrow if its distance to stack edge padrow < this
float discardSectorEdgeDepth = 2.; // discard clusters too close to the sector edge
float discardSectorEdgeDepth = 2.5; // discard clusters too close to the sector edge
float ITSOverlapMargin = 0.15; // consider for overlaps only clusters within this marging from the chip edge (in cm)
float ITSOverlapMaxChi2 = 16; // max chi2 between track and overlapping cluster
int ITSOverlapEdgeRows = 1; // require clusters to not have pixels closer than this distance from the edge
Expand All @@ -71,8 +73,11 @@ struct AlignConfig : public o2::conf::ConfigurableParamHelper<AlignConfig> {
int minTOFClustersCosm = 0; // min TOF clusters to accept track
int minTOFClustersCosmLeg = 1; // min TOF clusters per leg to accept track

int minTPCPadRow = 0; // min TPC pad-row to account
int maxTPCPadRow = 151; // max TPC pad-row to account
int minTPCPadRow = 6; // min TPC pad-row to account
int maxTPCPadRow = 146; // max TPC pad-row to account

float cosmMaxDSnp = 0.025; // reject cosmic tracks with larger than this snp difference
float cosmMaxDTgl = 0.1; // reject cosmic tracks with larger than this tgl difference

float maxDCAforVC[2] = {-1, -1}; // DCA cut in R,Z to allow track be subjected to vertex constraint
float maxChi2forVC = -1; // track-vertex chi2 cut to allow the track be subjected to vertex constraint
Expand Down
2 changes: 1 addition & 1 deletion Detectors/Align/include/Align/AlignableSensorHMPID.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace o2
namespace align
{

class AlignableSensorHMPID : public AlignableSensor
class AlignableSensorHMPID final : public AlignableSensor
{
public:
AlignableSensorHMPID(const char* name = 0, int vid = 0, int iid = 0, int isec = 0);
Expand Down
2 changes: 1 addition & 1 deletion Detectors/Align/include/Align/AlignableSensorITS.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace o2
namespace align
{

class AlignableSensorITS : public AlignableSensor
class AlignableSensorITS final : public AlignableSensor
{
public:
AlignableSensorITS() = default;
Expand Down
2 changes: 1 addition & 1 deletion Detectors/Align/include/Align/AlignableSensorTOF.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace o2
namespace align
{

class AlignableSensorTOF : public AlignableSensor
class AlignableSensorTOF final : public AlignableSensor
{
public:
AlignableSensorTOF() = default;
Expand Down
2 changes: 1 addition & 1 deletion Detectors/Align/include/Align/AlignableSensorTPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace o2
namespace align
{

class AlignableSensorTPC : public AlignableSensor
class AlignableSensorTPC final : public AlignableSensor
{
public:
AlignableSensorTPC() = default;
Expand Down
7 changes: 6 additions & 1 deletion Detectors/Align/include/Align/AlignableSensorTRD.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace o2
namespace align
{

class AlignableSensorTRD : public AlignableSensor
class AlignableSensorTRD final : public AlignableSensor
{
public:
AlignableSensorTRD() = default;
Expand All @@ -35,7 +35,12 @@ class AlignableSensorTRD : public AlignableSensor
int getSector() const { return mSector; }
void setSector(int sc) { mSector = (uint8_t)sc; }
void dPosTraDParCalib(const AlignmentPoint* pnt, double* deriv, int calibID, const AlignableVolume* parent = nullptr) const final;

void prepareMatrixL2G(bool reco = false) final;
void prepareMatrixL2GIdeal() final;
void prepareMatrixT2L() final;
void prepareMatrixClAlg() final;
void prepareMatrixClAlgReco() final;

protected:
uint8_t mSector = 0; // sector ID
Expand Down
13 changes: 10 additions & 3 deletions Detectors/Align/include/Align/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "DetectorsBase/GeometryManager.h"
#include "DetectorsBase/Propagator.h"
#include "Align/AlignmentTrack.h"
#include "Align/AlgTrcDbg.h"
#include "ReconstructionDataFormats/PrimaryVertex.h"
#include "ReconstructionDataFormats/TrackCosmics.h"
#include "DataFormatsTPC/VDriftCorrFact.h"
Expand Down Expand Up @@ -53,9 +54,8 @@
#include <TTree.h>
#include <TFile.h>
#include "Align/Mille.h"
#include "GPUO2Interface.h"
#include "GPUParam.h"
#include "DataFormatsTPC/WorkflowHelper.h"
// #include "GPUO2Interface.h"
// #include "DataFormatsTPC/WorkflowHelper.h"

namespace o2
{
Expand All @@ -72,6 +72,11 @@ namespace utils
class TreeStreamRedirector;
}

namespace gpu
{
class GPUParam;
}

namespace align
{

Expand Down Expand Up @@ -220,6 +225,7 @@ class Controller final : public TObject
void initMIlleOutput();
void initResidOutput();
bool storeProcessedTrack(o2::dataformats::GlobalTrackID tid = {});
void extractDbgTrack();
void printStatistics() const;
//
void genPedeSteerFile(const Option_t* opt = "") const;
Expand Down Expand Up @@ -302,6 +308,7 @@ class Controller final : public TObject
float mMPRecOutFraction = 0.;
float mControlFraction = 0.;
std::unique_ptr<AlignmentTrack> mAlgTrack; // current alignment track
AlgTrcDbg mAlgTrackDbg; // current alignment track debug version
const o2::globaltracking::RecoContainer* mRecoData = nullptr; // externally set RecoContainer
const o2::trd::TrackletTransformer* mTRDTransformer = nullptr; // TRD tracket transformer
bool mTRDTrigRecFilterActive = false; // select TRD triggers processed with ITS
Expand Down
2 changes: 1 addition & 1 deletion Detectors/Align/include/Align/ResidualsControllerFast.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace o2
namespace align
{

class ResidualsControllerFast : public TObject
class ResidualsControllerFast final : public TObject
{
public:
enum { kCosmicBit = BIT(14),
Expand Down
22 changes: 22 additions & 0 deletions Detectors/Align/src/AlgPntDbg.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2019-2020 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.

/// @file AlgPntDbg.h

#include "Align/AlgPntDbg.h"

namespace o2
{
namespace align
{

} // namespace align
} // namespace o2
Loading