Skip to content

Commit

Permalink
Merge branch 'main' into refactor-comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger authored Dec 5, 2023
2 parents 25d347d + 707800c commit 3da0df7
Show file tree
Hide file tree
Showing 22 changed files with 167 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
-DACTS_BUILD_EXAMPLES_EDM4HEP=ON
- name: Run IWYU
run: python3 iwyu-install/bin/iwyu_tool.py -p acts-build/ -j2 -- --mapping_file=acts/CI/iwyu/mapping.imp | tee iwyu-output.txt
run: python3 iwyu-install/bin/iwyu_tool.py -p acts-build/ -j2 -- -Xiwyu --mapping_file=acts/CI/iwyu/mapping.imp | tee iwyu-output.txt
- name: Filter IWYU output
run: python3 acts/CI/iwyu/filter.py acts/CI/iwyu/filter.yaml iwyu-output.txt iwyu-filtered.txt
- name: Apply IWYU
Expand Down
16 changes: 16 additions & 0 deletions CI/iwyu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# IWYU = Include what you use

This tool finds unused includes and suggestes additional includes and declarations.

It is not very stable at the moment and takes a few hours to complete within ACTS therefor it only runs once a week and can be triggered manually.

There is also not sufficient filtering offered by IWYU at the moment. For that reason there is a specific filtering script for now which tries to get rid of unwanted changes.

offline resources
- [GitHub Actions Workflow](../../.github/workflows/iwyu.yml)
- [Custom filter script](./filter.py)

online resources

- https://include-what-you-use.org/
- https://github.com/include-what-you-use/include-what-you-use
6 changes: 3 additions & 3 deletions CI/iwyu/filter.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
remove_lines:
# ignore unexiting std
# ignore if not existing in std
- "^#include <new>"
- "^#include <bits/"
- "^#include <ext/"
Expand All @@ -8,7 +8,7 @@ remove_lines:
- "namespace Eigen {"
# ignore boost
- "^(- )?#include <boost/"
# don remove ipp
# don't remove ipp
- "^- #include [<\"].*\\.ipp"
# ignore pybind11
- "^(- )?#include <pybind11/"
Expand All @@ -21,7 +21,7 @@ replace_lines:
- "^#include <unistd\\.h>": "#include <cunistd>"
- "^#include <stdint\\.h>": "#include <cstdint>"
- "^#include <stdlib.h>": "#include <cstdlib>"
# don use ipp
# don't use ipp
- "^#include ([<\"].*)\\.ipp": "#include \\1.hpp"

ignore_files:
Expand Down
3 changes: 3 additions & 0 deletions Core/include/Acts/Geometry/CylinderVolumeBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ class CylinderVolumeBuilder : public ITrackingVolumeBuilder {
/// -------------------- MB (inner [0]) ---------------
std::array<std::shared_ptr<const ISurfaceMaterial>, 6> boundaryMaterial{
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};

/// Volume signature
int volumeSignature = -1;
};

/// Constructor
Expand Down
8 changes: 0 additions & 8 deletions Core/include/Acts/Seeding/GNN_DataStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ class TrigFTF_GNN_DataStorage {
float max_tau = 100.0;
// can't do this bit yet as dont have cluster width
if (useClusterWidth) {
// const Trk::SpacePoint* osp = sp.offlineSpacePoint();
// const InDet::PixelCluster* pCL = dynamic_cast<const
// InDet::PixelCluster*>(osp->clusterList().first);
// float cluster_width = pCL->width().widthPhiRZ().y();
float cluster_width = 1; // temporary while cluster width not available
min_tau = 6.7 * (cluster_width - 0.2);
max_tau =
Expand All @@ -194,10 +190,6 @@ class TrigFTF_GNN_DataStorage {
sp, min_tau, max_tau)); // adding ftf member to nodes
} else {
if (useClusterWidth) {
// const Trk::SpacePoint* osp = sp.offlineSpacePoint();
// const InDet::PixelCluster* pCL = dynamic_cast<const
// InDet::PixelCluster*>(osp->clusterList().first);
// float cluster_width = pCL->width().widthPhiRZ().y();
float cluster_width = 1; // temporary while cluster width not available
if (cluster_width > 0.2) {
return -3;
Expand Down
11 changes: 5 additions & 6 deletions Core/include/Acts/Seeding/GNN_TrackingFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ class TrigFTF_GNN_TrackingFilter {
const float weight_x = 0.5;
const float weight_y = 0.5;

const float maxDChi2_x = 60.0; // 35.0;
const float maxDChi2_y = 60.0; // 31.0;
const float maxDChi2_x = 60.0; // was 35.0;
const float maxDChi2_y = 60.0; // was 31.0;

const float add_hit = 14.0;

Expand Down Expand Up @@ -306,7 +306,6 @@ class TrigFTF_GNN_TrackingFilter {
Cy[1][1] = ts.m_Cy[1][1];

// chi2 test

float resid_x = mx - X[0];
float resid_y = my - Y[0];

Expand All @@ -317,7 +316,7 @@ class TrigFTF_GNN_TrackingFilter {

int type = getLayerType(pS->m_n1->m_sp_FTF.combined_ID);

if (type == 0) { // barrel TO-DO: split into barrel Pixel and barrel SCT
if (type == 0) { // barrel TODO: split into barrel Pixel and barrel SCT
sigma_rz = sigma_y * sigma_y;
} else {
sigma_rz = sigma_y * ts.m_Y[1];
Expand All @@ -338,7 +337,6 @@ class TrigFTF_GNN_TrackingFilter {
ts.m_J += add_hit - dchi2_x * weight_x - dchi2_y * weight_y;

// state update

float Kx[3] = {Dx * Cx[0][0], Dx * Cx[0][1], Dx * Cx[0][2]};
float Ky[2] = {Dy * Cy[0][0], Dy * Cy[0][1]};

Expand All @@ -360,6 +358,7 @@ class TrigFTF_GNN_TrackingFilter {
ts.m_Cy[i][j] = Cy[i][j] - Ky[i] * CHy[j];
}
}

ts.m_refX = refX;
ts.m_refY = refY;
return true;
Expand All @@ -371,7 +370,7 @@ class TrigFTF_GNN_TrackingFilter {
}); // iterator to vector member with this id
int index = std::distance(m_geo.begin(), iterator);

return m_geo.at(index).m_type;
return m_geo.at(index).m_type; // needs to be 0, 2, or -2
}

const std::vector<Acts::TrigInDetSiLayer>& m_geo;
Expand Down
24 changes: 9 additions & 15 deletions Core/include/Acts/Seeding/SeedFinderFTF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,16 @@ class SeedFinderFTF {
void loadSpacePoints(
const std::vector<FTF_SP<external_spacepoint_t>> &FTF_SP_vect);

// inner
template <typename output_container_t>
void createSeeds(
const Acts::RoiDescriptor &roi,
const Acts::TrigFTF_GNN_Geometry<external_spacepoint_t> &gnngeo);

// create seeeds function
template <typename input_container_t, typename output_container_t,
typename callable_t>
void createSeeds_old(const Acts::SeedFinderOptions &options,
const input_container_t &spacePoints,
output_container_t &out_cont,
callable_t &&extract_coordinates) const;

template <typename input_container_t, typename callable_t>
std::vector<seed_t> createSeeds_old(const Acts::SeedFinderOptions &options,
const input_container_t &spacePoints,
callable_t &&extract_coordinates) const;
const Acts::RoiDescriptor & /*roi*/,
const Acts::TrigFTF_GNN_Geometry<external_spacepoint_t> & /*gnngeo*/,
output_container_t & /*out_cont*/);
// outer
std::vector<seed_t> createSeeds(
const Acts::RoiDescriptor & /*roi*/,
const Acts::TrigFTF_GNN_Geometry<external_spacepoint_t> & /*gnngeo*/);

private:
enum Dim { DimPhi = 0, DimR = 1, DimZ = 2 };
Expand Down
86 changes: 39 additions & 47 deletions Core/include/Acts/Seeding/SeedFinderFTF.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ void SeedFinderFTF<external_spacepoint_t>::loadSpacePoints(
m_storage->addSpacePoint(FTF_sp, (m_config.m_useClusterWidth > 0));
}

m_config.m_nMaxPhiSlice = 1;
m_config.m_phiSliceWidth = 2 * M_PI / m_config.m_nMaxPhiSlice;

m_storage->sortByPhi();
Expand All @@ -70,25 +69,13 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(
std::vector<GNN_TrigTracklet<external_spacepoint_t>>& vTracks,
const Acts::RoiDescriptor& roi,
const Acts::TrigFTF_GNN_Geometry<external_spacepoint_t>& gnngeo) {
// long term move these to ftf finder config, then m_config. to access them
const int MaxEdges = 2000000;

const float cut_dphi_max = 0.012;
const float cut_dcurv_max = 0.001;
const float cut_tau_ratio_max = 0.007;
const float min_z0 = -2800; // roiDescriptor->zedMinus(); //blank for now,
// get from config eventually
const float max_z0 = 2800; // roiDescriptor->zedPlus();

const float maxOuterRadius = 550.0;
const float cut_zMinU =
min_z0 +
maxOuterRadius * roi.dzdrMinus(); // dzdr can only find =0 in athena
const float cut_zMaxU = max_z0 + maxOuterRadius * roi.dzdrPlus();

float m_minR_squ = 1; // set earlier
float m_maxCurv = 1;

const float min_z0 = roi.zedMinus();
const float max_z0 = roi.zedPlus();
const float cut_zMinU = min_z0 + m_config.maxOuterRadius * roi.dzdrMinus();
const float cut_zMaxU = max_z0 + m_config.maxOuterRadius * roi.dzdrPlus();
float m_minR_squ = m_config.m_tripletPtMin * m_config.m_tripletPtMin /
std::pow(m_config.ptCoeff, 2); // from athena
float m_maxCurv = m_config.ptCoeff / m_config.m_tripletPtMin;
const float maxKappa_high_eta = 0.8 / m_minR_squ;
const float maxKappa_low_eta = 0.6 / m_minR_squ;

Expand All @@ -100,7 +87,7 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(

std::vector<Acts::TrigFTF_GNN_Edge<external_spacepoint_t>> edgeStorage;

edgeStorage.reserve(MaxEdges);
edgeStorage.reserve(m_config.MaxEdges);

int nEdges = 0;

Expand Down Expand Up @@ -256,7 +243,7 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(
continue;
}

float zouter = z0 + maxOuterRadius * tau;
float zouter = z0 + m_config.maxOuterRadius * tau;

if (zouter < cut_zMinU || zouter > cut_zMaxU) {
continue;
Expand Down Expand Up @@ -300,8 +287,9 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(
float tau2 = edgeStorage.at(n2_in_idx).m_p[0];
float tau_ratio = tau2 * uat_1 - 1.0f;

if (std::fabs(tau_ratio) > cut_tau_ratio_max) { // bad
// match
if (std::fabs(tau_ratio) >
m_config.cut_tau_ratio_max) { // bad
// match
continue;
}
isGood = true; // good match found
Expand All @@ -316,7 +304,7 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(
float dPhi2 = std::asin(curv * r2);
float dPhi1 = std::asin(curv * r1);

if (nEdges < MaxEdges) {
if (nEdges < m_config.MaxEdges) {
edgeStorage.emplace_back(n1, n2, exp_eta, curv, phi1 + dPhi1,
phi2 + dPhi2);

Expand Down Expand Up @@ -395,11 +383,11 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(
float tau2 = pNS->m_p[0];
float tau_ratio = tau2 * uat_1 - 1.0f;

if (tau_ratio < -cut_tau_ratio_max) {
if (tau_ratio < -m_config.cut_tau_ratio_max) {
last_out = out_idx;
continue;
}
if (tau_ratio > cut_tau_ratio_max) {
if (tau_ratio > m_config.cut_tau_ratio_max) {
break;
}

Expand All @@ -411,14 +399,14 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(
dPhi -= 2 * M_PI;
}

if (dPhi < -cut_dphi_max || dPhi > cut_dphi_max) {
if (dPhi < -m_config.cut_dphi_max || dPhi > m_config.cut_dphi_max) {
continue;
}

float curv2 = pNS->m_p[1];
float dcurv = curv2 - curv1;

if (dcurv < -cut_dcurv_max || dcurv > cut_dcurv_max) {
if (dcurv < -m_config.cut_dcurv_max || dcurv > m_config.cut_dcurv_max) {
continue;
}

Expand Down Expand Up @@ -497,7 +485,7 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(

std::vector<Acts::TrigFTF_GNN_Edge<external_spacepoint_t>*> vSeeds;

vSeeds.reserve(MaxEdges / 2);
vSeeds.reserve(m_config.MaxEdges / 2);

for (int edgeIndex = 0; edgeIndex < nEdges; edgeIndex++) {
Acts::TrigFTF_GNN_Edge<external_spacepoint_t>* pS =
Expand Down Expand Up @@ -662,9 +650,11 @@ void SeedFinderFTF<external_spacepoint_t>::runGNN_TrackFinder(
}

template <typename external_spacepoint_t>
template <typename output_container_t>
void SeedFinderFTF<external_spacepoint_t>::createSeeds(
const Acts::RoiDescriptor& roi,
const Acts::TrigFTF_GNN_Geometry<external_spacepoint_t>& gnngeo) {
const Acts::TrigFTF_GNN_Geometry<external_spacepoint_t>& gnngeo,
output_container_t& out_cont) {
std::vector<GNN_TrigTracklet<external_spacepoint_t>>
vTracks; // make empty vector

Expand Down Expand Up @@ -705,27 +695,29 @@ void SeedFinderFTF<external_spacepoint_t>::createSeeds(
}
}
vTracks.clear();
}

// // still to be developed
template <typename external_spacepoint_t>
template <typename input_container_t, typename output_container_t,
typename callable_t>
void SeedFinderFTF<external_spacepoint_t>::createSeeds_old(
const Acts::SeedFinderOptions& /*options*/,
const input_container_t& /*spacePoints*/, output_container_t& /*out_cont*/,
callable_t&& /*extract_coordinates*/) const {}
for (auto& triplet : m_triplets) {
const external_spacepoint_t* S1 =
triplet.s1().SP; // triplet-> FTF_SP-> simspacepoint
const external_spacepoint_t* S2 = triplet.s2().SP;
const external_spacepoint_t* S3 = triplet.s3().SP;

// input to seed
float Vertex = 0;
float Quality = triplet.Q();
// make a new seed, add to vector of seeds
out_cont.emplace_back(*S1, *S2, *S3, Vertex, Quality);
}
}

// outer called in alg
template <typename external_spacepoint_t>
template <typename input_container_t, typename callable_t>
std::vector<Seed<external_spacepoint_t>>
SeedFinderFTF<external_spacepoint_t>::createSeeds_old(
const Acts::SeedFinderOptions& options,
const input_container_t& spacePoints,
callable_t&& extract_coordinates) const {
SeedFinderFTF<external_spacepoint_t>::createSeeds(
const Acts::RoiDescriptor& roi,
const Acts::TrigFTF_GNN_Geometry<external_spacepoint_t>& gnngeo) {
std::vector<seed_t> r;
createSeeds_old(options, spacePoints, r,
std::forward<callable_t>(extract_coordinates));
createSeeds(roi, gnngeo, r);
return r;
}

Expand Down
36 changes: 23 additions & 13 deletions Core/include/Acts/Seeding/SeedFinderFTFConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,32 @@ struct SeedFinderFTFConfig {
// helix. This is useful for e.g. misaligned seeding.
float helixCutTolerance = 1.;

float m_phiSliceWidth{};
float m_nMaxPhiSlice{};
bool m_useClusterWidth = false;
std::string fastrack_input_file;
float m_phiSliceWidth{}; // initialised in loadSpacePoints function
float m_nMaxPhiSlice = 53; // used to calculate phi slices
bool m_useClusterWidth =
false; // bool for use of cluster width in loadSpacePoints function
std::string fastrack_input_file; // input file for fastrack object
std::vector<TrigInDetSiLayer> m_layerGeometry;

// for run function
// m_settings:
// for runGNN_TrackFinder
bool m_LRTmode = true; // eventually want to set from full chain
bool m_useEtaBinning = true;
bool m_doubletFilterRZ = true;
float m_minDeltaRadius = 5.0; // eventually set in config or to equivalent
// acts 2.0 but increasing to test loops
// float m_maxDeltaRadius = 270.0 ;
float m_tripletD0Max = 4.0; // m_settings
unsigned int m_maxTripletBufferLength = 3;
bool m_useEtaBinning =
true; // bool to use eta binning from geometry structure
bool m_doubletFilterRZ = true; // bool applies new Z cuts on doublets
float m_minDeltaRadius = 2.0; // min dr for doublet
float m_tripletD0Max = 4.0; // D0 cut for triplets
unsigned int m_maxTripletBufferLength =
3; // maximum number of space points per triplet
int MaxEdges = 2000000; // max number of GNN edges/doublets
float cut_dphi_max = 0.012; // phi cut for triplets
float cut_dcurv_max = 0.001; // curv cut for triplets
float cut_tau_ratio_max = 0.007; // tau cut for doublets and triplets
float maxOuterRadius = 550.0; // used to calculate Z cut on doublets
float m_PtMin = 1000.0;
float m_tripletPtMinFrac = 0.3;
float m_tripletPtMin = m_PtMin * m_tripletPtMinFrac; // Limit on triplet pt
double ptCoeff =
0.29997 * 1.9972 / 2.0; // ~0.3*B/2 - assumes nominal field of 2*T

// ROI:
bool containsPhi() {
Expand Down
1 change: 0 additions & 1 deletion Core/src/TrackFinding/FasTrackConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,4 @@ FasTrackConnector::~FasTrackConnector() {
}
}
}

} // namespace Acts
Loading

0 comments on commit 3da0df7

Please sign in to comment.