Skip to content

Commit

Permalink
Merge branch 'dev' into dev_pull_request2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrohr authored Feb 12, 2023
2 parents a61b705 + e3ccf73 commit f72f75d
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 104 deletions.
4 changes: 2 additions & 2 deletions Detectors/ITSMFT/ITS/calibration/src/NoiseCalibratorSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ void NoiseCalibratorSpec::run(ProcessingContext& pc)
LOG(info) << "Minimum number of noise counts has been reached !";
if (mMode == ProcessingMode::Full || mMode == ProcessingMode::Normalize) {
sendOutput(pc.outputs());
pc.services().get<ControlService>().readyToQuit(mStopMeOnly ? QuitRequest::Me : QuitRequest::All);
// pc.services().get<ControlService>().readyToQuit(mStopMeOnly ? QuitRequest::Me : QuitRequest::All);
} else {
sendAccumulatedMap(pc.outputs());
pc.services().get<o2::framework::ControlService>().endOfStream();
// pc.services().get<o2::framework::ControlService>().endOfStream();
}
}

Expand Down
4 changes: 3 additions & 1 deletion Detectors/ITSMFT/MFT/tracking/include/MFTTracking/Tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ class Tracker : public TrackerConfig
bool fitTracks(ROframe<T>&);
void computeTracksMClabels(const std::vector<T>&);

void configure(const MFTTrackingParam& trkParam, bool firstTracker);
void configure(const MFTTrackingParam& trkParam, int trackerID);
void initializeFinder();
int getTrackerID() const { return mTrackerID; }

private:
void findTracksLTF(ROframe<T>&);
Expand Down Expand Up @@ -143,6 +144,7 @@ class Tracker : public TrackerConfig
void addCellToCurrentTrackCA(const Int_t, const Int_t, ROframe<T>&);
void addCellToCurrentRoad(ROframe<T>&, const Int_t, const Int_t, const Int_t, const Int_t, Int_t&);

int mTrackerID = 0;
Float_t mBz;
std::vector<MCCompLabel> mTrackLabels;
std::unique_ptr<o2::mft::TrackFitter<T>> mTrackFitter = nullptr;
Expand Down
52 changes: 26 additions & 26 deletions Detectors/ITSMFT/MFT/tracking/include/MFTTracking/TrackerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ using namespace constants::mft;
using BinContainer = std::array<std::array<std::array<std::vector<Int_t>, constants::index_table::MaxRPhiBins>, (constants::mft::LayersNumber - 1)>, (constants::mft::LayersNumber - 1)>;
using RArray = std::array<Float_t, constants::mft::LayersNumber>;
using PhiArray = std::array<Int_t, constants::mft::LayersNumber>;
using InverseRArray = std::array<Float_t, constants::mft::LayersNumber>;

class TrackerConfig
{
Expand All @@ -49,53 +48,54 @@ class TrackerConfig

protected:
// tracking configuration parameters
Int_t mMinTrackPointsLTF;
Int_t mMinTrackPointsCA;
Int_t mMinTrackStationsLTF;
Int_t mMinTrackStationsCA;
Float_t mLTFclsRCut;
Float_t mLTFclsR2Cut;
Float_t mROADclsRCut;
Float_t mROADclsR2Cut;
Int_t mRBins;
Int_t mPhiBins;
Int_t mRPhiBins;
Float_t mZVtxMin;
Float_t mZVtxMax;
Float_t mRCutAtZmin;
Bool_t mLTFConeRadius;
Bool_t mCAConeRadius;
Int_t mMinTrackPointsLTF{};
Int_t mMinTrackPointsCA{};
Int_t mMinTrackStationsLTF{};
Int_t mMinTrackStationsCA{};
Float_t mLTFclsRCut{};
Float_t mLTFclsR2Cut{};
Float_t mROADclsRCut{};
Float_t mROADclsR2Cut{};
Int_t mRBins{};
Int_t mPhiBins{};
Int_t mRPhiBins{};
Float_t mZVtxMin{};
Float_t mZVtxMax{};
Float_t mRCutAtZmin{};
Bool_t mLTFConeRadius{};
Bool_t mCAConeRadius{};
/// Special track finder for TED shots and cosmics, with full scan of the clusters
bool mFullClusterScan = false;
Float_t mTrueTrackMCThreshold; // Minimum fraction of correct MC labels to tag True tracks
Float_t mTrueTrackMCThreshold{}; // Minimum fraction of correct MC labels to tag True tracks

static std::mutex sTCMutex;

static Float_t mPhiBinSize;
static Float_t mInversePhiBinSize;

static std::unique_ptr<InverseRArray> mInverseRBinSize;
static std::unique_ptr<PhiArray> mPhiBinWin;
static std::unique_ptr<RArray> mRBinSize;
static RArray mInverseRBinSize;
static RArray mRBinSize;
static PhiArray mPhiBinWin;

static std::unique_ptr<BinContainer> mBins;
static std::unique_ptr<BinContainer> mBinsS;
std::array<std::array<std::pair<Int_t, Int_t>, constants::index_table::MaxRPhiBins>, constants::mft::LayersNumber> mClusterBinIndexRange;
std::array<std::array<std::pair<Int_t, Int_t>, constants::index_table::MaxRPhiBins>, constants::mft::LayersNumber> mClusterBinIndexRange{};

ClassDefNV(TrackerConfig, 3);
};

inline Float_t TrackerConfig::mPhiBinSize;
inline Float_t TrackerConfig::mInversePhiBinSize;

inline std::unique_ptr<InverseRArray> TrackerConfig::mInverseRBinSize;
inline std::unique_ptr<PhiArray> TrackerConfig::mPhiBinWin;
inline std::unique_ptr<RArray> TrackerConfig::mRBinSize;
inline RArray TrackerConfig::mInverseRBinSize;
inline RArray TrackerConfig::mRBinSize;
inline PhiArray TrackerConfig::mPhiBinWin;
inline std::unique_ptr<BinContainer> TrackerConfig::mBins;
inline std::unique_ptr<BinContainer> TrackerConfig::mBinsS;

inline const Int_t TrackerConfig::getRBinIndex(const Float_t r, const Int_t layer) const
{
return (Int_t)((r - constants::index_table::RMin[layer]) * (*mInverseRBinSize)[layer]);
return (Int_t)((r - constants::index_table::RMin[layer]) * mInverseRBinSize[layer]);
}

inline const Int_t TrackerConfig::getPhiBinIndex(const Float_t phi) const
Expand Down
39 changes: 20 additions & 19 deletions Detectors/ITSMFT/MFT/tracking/src/Tracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ void Tracker<T>::setBz(Float_t bz)

//_________________________________________________________________________________________________
template <typename T>
void Tracker<T>::configure(const MFTTrackingParam& trkParam, bool firstTracker)
void Tracker<T>::configure(const MFTTrackingParam& trkParam, int trackerID)
{
/// initialize from MFTTrackingParam (command line configuration parameters)
bool firstTracker = trackerID == 0;
mTrackerID = trackerID;
initialize(trkParam);

mTrackFitter->setMFTRadLength(trkParam.MFTRadLength);
Expand Down Expand Up @@ -110,37 +112,40 @@ void Tracker<T>::configure(const MFTTrackingParam& trkParam, bool firstTracker)
template <typename T>
void Tracker<T>::initializeFinder()
{

if (mFullClusterScan) {
return;
}
static bool staticInitDone = false;

// The lock will prevent executing the code below at the same time for different tracker copes (one will wait for other)
std::lock_guard<std::mutex> guard(TrackerConfig::sTCMutex);
if (mBins) {

if (staticInitDone) {
return;
}
TrackerConfig::initBinContainers();
staticInitDone = true;

/// calculate Look-Up-Table of the R-Phi bins projection from one layer to another
/// layer1 + global R-Phi bin index ---> layer2 + R bin index + Phi bin index
/// To be executed by the first tracker in case of multiple threads

for (auto layer = 0; layer < constants::mft::LayersNumber; layer++) {
// Conical track-finder binning.
// Needs to be executed only once since it is filling static data members used by all tracker threads
mPhiBinSize = (constants::index_table::PhiMax - constants::index_table::PhiMin) / mPhiBins;
mInversePhiBinSize = 1.0 / mPhiBinSize;
(*mRBinSize)[layer] = (constants::index_table::RMax[layer] - constants::index_table::RMin[layer]) / mRBins;
(*mInverseRBinSize)[layer] = 1.0 / (*mRBinSize)[layer];
mRBinSize[layer] = (constants::index_table::RMax[layer] - constants::index_table::RMin[layer]) / mRBins;
mInverseRBinSize[layer] = 1.0 / mRBinSize[layer];
auto ZL0 = LayerZCoordinate()[0];
auto deltaZ = (abs(LayerZCoordinate()[layer]) - abs(ZL0));
auto binArcLenght = constants::index_table::RMin[layer] * o2::constants::math::TwoPI / mPhiBins;
Float_t NconicalBins = 2.0 * deltaZ * mRCutAtZmin / (abs(ZL0) + mZVtxMin) / binArcLenght;
(*mPhiBinWin)[layer] = std::max(3, int(ceil(NconicalBins)));
LOG(debug) << "mPhiBinWin[" << layer << "] = " << (*mPhiBinWin)[layer] << std::endl;
mPhiBinWin[layer] = std::max(3, int(ceil(NconicalBins)));
LOG(debug) << "mPhiBinWin[" << layer << "] = " << mPhiBinWin[layer] << std::endl;
}

if (mFullClusterScan) { // bin containers are needed only for the fullClusterScan
return;
}

TrackerConfig::initBinContainers();

Float_t dz, x, y, r, phi, x_proj, y_proj, r_proj, phi_proj, zLayer1, zLayer2;
Int_t binIndex1, binIndex2, binIndex2S, binR_proj, binPhi_proj;

Expand All @@ -150,7 +155,7 @@ void Tracker<T>::initializeFinder()
for (Int_t iRBin = 0; iRBin < mRBins; ++iRBin) {
bool isFirstPhiBin = true;

r = (iRBin + 0.5) * (*mRBinSize)[layer1] + constants::index_table::RMin[layer1];
r = (iRBin + 0.5) * mRBinSize[layer1] + constants::index_table::RMin[layer1];

for (Int_t iPhiBin = 0; iPhiBin < mPhiBins; ++iPhiBin) {
isFirstPhiBin = !iPhiBin;
Expand All @@ -176,7 +181,7 @@ void Tracker<T>::initializeFinder()
binR_proj = getRBinIndex(r_proj, layer2);
binPhi_proj = getPhiBinIndex(phi_proj);

int binwPhiS = (*mPhiBinWin)[layer2];
int binwPhiS = mPhiBinWin[layer2];
int binhwPhiS = binwPhiS / 2;

float rMin = r * (mZVtxMax + abs(zLayer2)) / (mZVtxMax + abs(zLayer1));
Expand Down Expand Up @@ -208,7 +213,7 @@ void Tracker<T>::initializeFinder()
}
}

int binwPhi = (*mPhiBinWin)[layer2];
int binwPhi = mPhiBinWin[layer2];
int binhwPhi = binwPhi / 2;

for (Int_t binR = rBinMin; binR <= rBinMax; ++binR) {
Expand Down Expand Up @@ -1098,10 +1103,6 @@ Tracker<T>::~Tracker()
// Deallocate the memory that was previously reserved for these arrays
TrackerConfig::mBins.reset();
TrackerConfig::mBinsS.reset();

TrackerConfig::mRBinSize.reset();
TrackerConfig::mPhiBinWin.reset();
TrackerConfig::mInverseRBinSize.reset();
}

template class Tracker<o2::mft::TrackLTF>;
Expand Down
9 changes: 0 additions & 9 deletions Detectors/ITSMFT/MFT/tracking/src/TrackerConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,4 @@ void o2::mft::TrackerConfig::initBinContainers()
if (!mBinsS) {
mBinsS = std::make_unique<BinContainer>();
}
if (!mRBinSize) {
mRBinSize = std::make_unique<RArray>();
}
if (!mPhiBinWin) {
mPhiBinWin = std::make_unique<PhiArray>();
}
if (!mInverseRBinSize) {
mInverseRBinSize = std::make_unique<InverseRArray>();
}
}
28 changes: 23 additions & 5 deletions Detectors/ITSMFT/MFT/workflow/src/TrackerSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace o2
{
namespace mft
{
//#define _TIMING_

void TrackerDPL::init(InitContext& ic)
{
Expand Down Expand Up @@ -131,17 +132,34 @@ void TrackerDPL::run(ProcessingContext& pc)
};

auto launchTrackFinder = [](auto* tracker, auto* workerROFs) {
#ifdef _TIMING_
long tStart = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count(), tStartROF = tStart, tEnd = tStart;
size_t rofCNT = 0;
#endif
for (auto& rofData : *workerROFs) {
{
tracker->findTracks(rofData);
}
tracker->findTracks(rofData);
#ifdef _TIMING_
long tEndROF = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
LOGP(info, "launchTrackFinder| tracker:{} did {}-th ROF in {} mus: {} clusters -> {} tracks", tracker->getTrackerID(), ++rofCNT, tEndROF - tStartROF, rofData.getTotalClusters(), rofData.getTracks().size());
tStartROF = tEnd = tEndROF;
#endif
}
#ifdef _TIMING_
LOGP(info, "launchTrackFinder| done: tracker:{} processed {} ROFS in {} mus", tracker->getTrackerID(), workerROFs->size(), tEnd - tStart);
#endif
};

auto launchFitter = [](auto* tracker, auto* workerROFs) {
#ifdef _TIMING_
long tStart = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
#endif
for (auto& rofData : *workerROFs) {
tracker->fitTracks(rofData);
}
#ifdef _TIMING_
long tEnd = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
LOGP(info, "launchTrackFitter| done: tracker:{} fitted {} ROFS in {} mus", tracker->getTrackerID(), workerROFs->size(), tEnd - tStart);
#endif
};

auto runMFTTrackFinder = [&, this](auto& trackerVec, auto& roFrameDataVec) {
Expand Down Expand Up @@ -342,7 +360,7 @@ void TrackerDPL::updateTimeDependentParams(ProcessingContext& pc)
for (auto i = 0; i < mNThreads; i++) {
auto& tracker = mTrackerLVec.emplace_back(std::make_unique<o2::mft::Tracker<TrackLTFL>>(mUseMC));
tracker->setBz(0);
tracker->configure(trackingParam, !i);
tracker->configure(trackingParam, i);
}
} else {
LOG(info) << "Starting MFT tracker: Field is on! Bz = " << Bz;
Expand All @@ -351,7 +369,7 @@ void TrackerDPL::updateTimeDependentParams(ProcessingContext& pc)
for (auto i = 0; i < mNThreads; i++) {
auto& tracker = mTrackerVec.emplace_back(std::make_unique<o2::mft::Tracker<TrackLTF>>(mUseMC));
tracker->setBz(Bz);
tracker->configure(trackingParam, !i);
tracker->configure(trackingParam, i);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,28 @@ namespace its3
class SegmentationSuperAlpide
{
public:
SegmentationSuperAlpide(int layer = 0) : mLayer{layer},
mPitchCol{SuperAlpideParams::Instance().pitchCol},
mPitchRow{SuperAlpideParams::Instance().pitchRow},
mNCols{static_cast<int>(mLength / mPitchCol)},
mNRows{static_cast<int>(double(mRadii[layer] + mSensorLayerThickness / 2) * double(constants::math::PI) / double(mPitchRow) + 1)},
mNPixels{mNRows * mNCols},
mActiveMatrixSizeCols{mPitchCol * mNCols},
mActiveMatrixSizeRows{mPitchRow * mNRows},
mSensorSizeCols{mActiveMatrixSizeCols + mPassiveEdgeSide + mPassiveEdgeSide},
mSensorSizeRows{mActiveMatrixSizeRows + mPassiveEdgeTop + mPassiveEdgeReadOut}
{
LOGP(info, "SegmentationSuperAlpide:");
LOGP(info, "PitchCol={} PitchRow={}", mPitchCol, mPitchRow);
LOGP(info, "Layer {}: ActiveMatrixSizeRows={} ActiveMatrixSizeCols={}", mLayer, mActiveMatrixSizeCols, mActiveMatrixSizeRows);
LOGP(info, "Rows={} Cols={} NPixels={}", mNRows, mNCols, mNPixels);
}
static constexpr std::array<float, 10> mRadii = {1.8f, 2.4f, 3.0f, 7.0f, 10.f}; ///< radii for different layers
static constexpr float mLength = 27.15f; ///< chip length
const float mPitchCol; ///< pixel column size
const float mPitchRow; ///< pixel row size
const int mNCols; ///< number of columns
const int mNRows; ///< number of rows
const int mNPixels; ///< total number of pixels
const int mLayer; ///< chip layer
static constexpr float mPassiveEdgeReadOut = 0.; ///< width of the readout edge (Passive bottom)
static constexpr float mPassiveEdgeTop = 0.; ///< Passive area on top
static constexpr float mPassiveEdgeSide = 0.; ///< width of Passive area on left/right of the sensor
const float mActiveMatrixSizeCols; ///< Active size along columns
const float mActiveMatrixSizeRows; ///< Active size along rows
SegmentationSuperAlpide(int layer, float pitchCol, float pitchRow) : mLayer{layer}, mPitchCol{pitchCol}, mPitchRow{pitchRow} { print(); }
SegmentationSuperAlpide(int layer = 0) : SegmentationSuperAlpide(layer, SuperAlpideParams::Instance().pitchCol, SuperAlpideParams::Instance().pitchRow) {}

static constexpr std::array<float, 10> mRadii = {1.8f, 2.4f, 3.0f, 7.0f, 10.f}; ///< radii for different layers
static constexpr float mLength = 27.15f; ///< chip length
const int mLayer; ///< chip layer
const float mPitchCol; ///< pixel column size
const float mPitchRow; ///< pixel row size
const int mNCols{static_cast<int>(mLength / mPitchCol)}; ///< number of columns
const int mNRows{static_cast<int>(double(mRadii[mLayer] + mSensorLayerThickness / 2) * double(constants::math::PI) / double(mPitchRow) + 1)}; ///< number of rows
const int mNPixels{mNRows * mNCols}; ///< total number of pixels
static constexpr float mPassiveEdgeReadOut = 0.; ///< width of the readout edge (Passive bottom)
static constexpr float mPassiveEdgeTop = 0.; ///< Passive area on top
static constexpr float mPassiveEdgeSide = 0.; ///< width of Passive area on left/right of the sensor
const float mActiveMatrixSizeCols{mPitchCol * mNCols}; ///< Active size along columns
const float mActiveMatrixSizeRows{mPitchRow * mNRows}; ///< Active size along rows

// effective thickness of sensitive layer, accounting for charge collection non-uniformity, https://alice.its.cern.ch/jira/browse/AOC-46
static constexpr float mSensorLayerThicknessEff = 28.e-4; ///< effective thickness of sensitive part
static constexpr float mSensorLayerThickness = 30.e-4; ///< physical thickness of sensitive part
const float mSensorSizeCols; ///< SensorSize along columns
const float mSensorSizeRows; ///< SensorSize along rows
static constexpr float mSensorLayerThicknessEff = 28.e-4; ///< effective thickness of sensitive part
static constexpr float mSensorLayerThickness = 30.e-4; ///< physical thickness of sensitive part
const float mSensorSizeCols{mActiveMatrixSizeCols + mPassiveEdgeSide + mPassiveEdgeSide}; ///< SensorSize along columns
const float mSensorSizeRows{mActiveMatrixSizeRows + mPassiveEdgeTop + mPassiveEdgeReadOut}; ///< SensorSize along rows

~SegmentationSuperAlpide() = default;

Expand Down
15 changes: 6 additions & 9 deletions Detectors/Upgrades/ITS3/base/src/SegmentationSuperAlpide.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@
/// \brief Implementation of the SegmentationSuperAlpide class

#include "ITS3Base/SegmentationSuperAlpide.h"
#include <cstdio>
#include <Framework/Logger.h>

ClassImp(o2::its3::SegmentationSuperAlpide);

using namespace o2::its3;

void SegmentationSuperAlpide::print()
void o2::its3::SegmentationSuperAlpide::print()
{
printf("Pixel size: %.2f (along %d rows) %.2f (along %d columns) microns\n", mPitchRow * 1e4, mNRows, mPitchCol * 1e4, mNCols);
printf("Passive edges: bottom: %.2f, top: %.2f, left/right: %.2f microns\n",
mPassiveEdgeReadOut * 1e4, mPassiveEdgeTop * 1e4, mPassiveEdgeSide * 1e4);
printf("Active/Total size: %.6f/%.6f (rows) %.6f/%.6f (cols) cm\n", mActiveMatrixSizeRows, mSensorSizeRows,
mActiveMatrixSizeCols, mSensorSizeCols);
LOGP(info, "SegmentationSuperAlpide:");
LOGP(info, "Layer {}: Active/Total size {:.2f}/{:.2f} (rows) x {:.2f}/{:.2f}", mLayer, mActiveMatrixSizeRows, mSensorSizeRows, mActiveMatrixSizeCols, mSensorSizeCols);
LOGP(info, "Pixel size: {:.2f} (along {} rows) {:.2f} (along {} columns) microns", mPitchRow * 1e4, mNRows, mPitchCol * 1e4, mNCols);
LOGP(info, "Passive edges: bottom: {:.6f}, top: {:.6f}, left/right: {:.6f} microns", mPassiveEdgeReadOut * 1e4, mPassiveEdgeTop * 1e4, mPassiveEdgeSide * 1e4);
}
Loading

0 comments on commit f72f75d

Please sign in to comment.