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
2 changes: 2 additions & 0 deletions ALICE3/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ o2physics_target_root_dictionary(ALICE3Core

o2physics_add_library(FastTracker
SOURCES FastTracker.cxx
DetLayer.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore)

o2physics_target_root_dictionary(FastTracker
HEADERS FastTracker.h
DetLayer.h
LINKDEF FastTrackerLinkDef.h)
19 changes: 19 additions & 0 deletions ALICE3/Core/DetLayer.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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 DetLayer.cxx
/// \author David Dobrigkeit Chinellato
/// \since 11/03/2021
/// \brief Basic struct to hold information regarding a detector layer to be used in fast simulation
///

#include "DetLayer.h"
65 changes: 38 additions & 27 deletions ALICE3/Core/FastTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
layers.push_back(newLayer);
}

DetLayer FastTracker::GetLayer(int layer, bool ignoreBarrelLayers)
DetLayer FastTracker::GetLayer(int layer, bool ignoreBarrelLayers) const
{
int layerIdx = layer;
if (ignoreBarrelLayers) {
Expand All @@ -74,6 +74,18 @@
return layers[layerIdx];
}

int FastTracker::GetLayerIndex(std::string name) const
{
int i = 0;
for (const auto& layer : layers) {
if (layer.name == name) {
return i;
}
i++;
}
return -1;
}

void FastTracker::Print()
{
// print out layer setup
Expand All @@ -100,18 +112,18 @@
float resRPhiOT = pixelResolution[2];
float resZOT = pixelResolution[3];

layers.push_back(DetLayer{"bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0}); // 150 mum Be
layers.push_back(DetLayer{"ddd0", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
layers.push_back(DetLayer{"ddd1", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
layers.push_back(DetLayer{"ddd2", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
layers.push_back(DetLayer{"bpipe1", 5.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0}); // 500 mum Be
layers.push_back(DetLayer{"ddd3", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"ddd4", 10., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"ddd5", 13., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"ddd6", 16., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"ddd7", 25., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"ddd8", 40., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"ddd9", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be
AddLayer("ddd0", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
AddLayer("ddd1", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
AddLayer("ddd2", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
AddLayer("bpipe1", 5.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be
AddLayer("ddd3", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("ddd4", 10., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("ddd5", 13., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("ddd6", 16., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("ddd7", 25., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("ddd8", 40., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("ddd9", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
}

void FastTracker::AddSiliconALICE3v2(std::vector<float> pixelResolution)
Expand All @@ -128,19 +140,19 @@
float resRPhiOT = pixelResolution[2];
float resZOT = pixelResolution[3];

layers.push_back(DetLayer{"bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0}); // 150 mum Be
layers.push_back(DetLayer{"B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
layers.push_back(DetLayer{"B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
layers.push_back(DetLayer{"B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1});
layers.push_back(DetLayer{"bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0}); // 500 mum Be
layers.push_back(DetLayer{"B03", 3.75, 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"B04", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"B09", 60., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
layers.push_back(DetLayer{"B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1});
AddLayer("bpipe0", 0.48, 250, 0.00042, 2.772e-02, 0.0f, 0.0f, 0.0f, 0); // 150 mum Be
AddLayer("B00", 0.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
AddLayer("B01", 1.2, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
AddLayer("B02", 2.5, 250, x0IT, xrhoIB, resRPhiIT, resZIT, eff, 1);
AddLayer("bpipe1", 3.7, 250, 0.0014, 9.24e-02, 0.0f, 0.0f, 0.0f, 0); // 500 mum Be
AddLayer("B03", 3.75, 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("B04", 7., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("B05", 12., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("B06", 20., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("B07", 30., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("B08", 45., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("B09", 60., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
AddLayer("B10", 80., 250, x0OT, xrhoOT, resRPhiOT, resZOT, eff, 1);
}

void FastTracker::AddTPC(float phiResMean, float zResMean)
Expand Down Expand Up @@ -175,8 +187,8 @@
for (int i = 0; i < kNPassiveBound; i++) {
AddLayer(Form("tpc_boundary%d", i), rBoundary[i], zLength, radLBoundary[i], xrhoBoundary[i], 0); // dummy errors
}
for (Int_t k = 0; k < tpcRows; k++) {

Check failure on line 190 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
Float_t rowRadius = 0;

Check failure on line 191 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
if (k < innerRows)
rowRadius = rowOneRadius + k * tpcInnerRadialPitch;
else if (k >= innerRows && k < (innerRows + middleRows))
Expand All @@ -202,8 +214,8 @@
if (i == nSteps - 1)
index = 1;
z0 = -4 * sigmaD + i * dz0;
dist += index * (dz0 / 3.) * (1 / o2::math_utils::sqrt(o2::constants::math::TwoPI) / sigmaD) * exp(-z0 * z0 / 2. / sigmaD / sigmaD) * (1 / o2::math_utils::sqrt((z - z0) * (z - z0) + r * r));

Check failure on line 217 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
if (index != 4)

Check failure on line 218 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
index = 4;
else
index = 2;
Expand Down Expand Up @@ -315,7 +327,7 @@
float targetX = 1e+3;
bool ok = true;
inputTrack.getXatLabR(layers[il].r, targetX, magneticField);
if (targetX > 999)

Check failure on line 330 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
break; // failed to find intercept

ok = inputTrack.propagateTo(targetX, magneticField);
Expand All @@ -333,7 +345,6 @@
// was there a problem on this layer?
if (!ok && il > 0) { // may fail to reach target layer due to the eloss
float rad2 = inputTrack.getX() * inputTrack.getX() + inputTrack.getY() * inputTrack.getY();
float fMinRadTrack = 132.;
float maxR = layers[il - 1].r + kTrackingMargin * 2;
float minRad = (fMinRadTrack > 0 && fMinRadTrack < maxR) ? fMinRadTrack : maxR;
if (rad2 - minRad * minRad < kTrackingMargin * kTrackingMargin) { // check previously reached layer
Expand Down Expand Up @@ -423,8 +434,8 @@
// towards adding cluster: move to track alpha
double alpha = inwardTrack.getAlpha();
double xyz1[3]{
TMath::Cos(alpha) * spacePoint[0] + TMath::Sin(alpha) * spacePoint[1],

Check failure on line 437 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
-TMath::Sin(alpha) * spacePoint[0] + TMath::Cos(alpha) * spacePoint[1],

Check failure on line 438 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[root/entity]

Replace ROOT entities with equivalents from standard C++ or from O2.
spacePoint[2]};
if (!inwardTrack.propagateTo(xyz1[0], magneticField))
continue;
Expand Down Expand Up @@ -530,7 +541,7 @@
if (fcovm[ii][jj] * fcovm[ii][jj] > std::abs(fcovm[ii][ii] * fcovm[jj][jj])) {
rubenConditional = true;
if (makePositiveDefinite) {
fcovm[ii][jj] = TMath::Sign(1, fcovm[ii][jj]) * covMatFactor * sqrt(std::abs(fcovm[ii][ii] * fcovm[jj][jj]));

Check failure on line 544 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
}
}
}
Expand Down Expand Up @@ -568,7 +579,7 @@
for (int j = 0; j < 5; ++j)
val += eigVec[j][ii] * outputTrack.getParam(j);
// smear parameters according to eigenvalues
params_[ii] = gRandom->Gaus(val, sqrt(eigVal[ii]));

Check failure on line 582 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
}

// invert eigenvector matrix
Expand All @@ -581,7 +592,7 @@
outputTrack.setParam(val, ii);
}
// should make a sanity check that par[2] sin(phi) is in [-1, 1]
if (fabs(outputTrack.getParam(2)) > 1.) {

Check failure on line 595 in ALICE3/Core/FastTracker.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
LOG(info) << " --- smearTrack failed sin(phi) sanity check: " << outputTrack.getParam(2);
return -2;
}
Expand Down
24 changes: 23 additions & 1 deletion ALICE3/Core/FastTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class FastTracker
virtual ~FastTracker() {}

void AddLayer(TString name, float r, float z, float x0, float xrho, float resRPhi = 0.0f, float resZ = 0.0f, float eff = 0.0f, int type = 0);
DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true);
DetLayer GetLayer(const int layer, bool ignoreBarrelLayers = true) const;
int GetLayerIndex(const std::string name) const;

void AddSiliconALICE3v4(std::vector<float> pixelResolution);
void AddSiliconALICE3v2(std::vector<float> pixelResolution);
Expand All @@ -55,6 +56,15 @@ class FastTracker
// Definition of detector layers
std::vector<DetLayer> layers;
std::vector<std::vector<float>> hits; // bookkeep last added hits
void SetRadiationLength(const std::string layerName, float x0) { layers[GetLayerIndex(layerName)].x0 = x0; }
void SetRadius(const std::string layerName, float r) { layers[GetLayerIndex(layerName)].r = r; }
void SetResolutionRPhi(const std::string layerName, float resRPhi) { layers[GetLayerIndex(layerName)].resRPhi = resRPhi; }
void SetResolutionZ(const std::string layerName, float resZ) { layers[GetLayerIndex(layerName)].resZ = resZ; }
void SetResolution(const std::string layerName, float resRPhi, float resZ)
{
SetResolutionRPhi(layerName, resRPhi);
SetResolutionZ(layerName, resZ);
}

// operational
bool applyZacceptance; // check z acceptance or not
Expand All @@ -75,6 +85,17 @@ class FastTracker
float avgRapidity;
float lhcUPCScale;
float upcBackgroundMultiplier;
float fMinRadTrack = 132.;

// Setters and getters
void SetIntegrationTime(float t) { integrationTime = t; }
void SetMaxRadiusOfSlowDetectors(float r) { maxRadiusSlowDet = r; }
void SetAvgRapidity(float y) { avgRapidity = y; }
void SetdNdEtaCent(float d) { dNdEtaCent = d; }
void SetLhcUPCscale(float s) { lhcUPCScale = s; }
void SetBField(float b) { magneticField = b; }
void SetMinRadTrack(float r) { fMinRadTrack = r; }
// void SetAtLeastHits(int n) { fMinRadTrack = n; }

uint64_t covMatOK; // cov mat has negative eigenvals
uint64_t covMatNotOK; // cov mat has negative eigenvals
Expand All @@ -84,6 +105,7 @@ class FastTracker
int nSiliconPoints; // silicon-based space points added to track
int nGasPoints; // tpc-based space points added to track
std::vector<float> goodHitProbability;
float GetGoodHitProb(int layer) const { return goodHitProbability[layer]; }

ClassDef(FastTracker, 1);
};
Expand Down
Loading