Skip to content

Commit

Permalink
Apply comments namespace and type renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
VourMa committed Jul 21, 2024
1 parent 1a6e27b commit e54c6f1
Show file tree
Hide file tree
Showing 8 changed files with 547 additions and 556 deletions.
279 changes: 137 additions & 142 deletions RecoTracker/LSTCore/src/alpaka/NeuralNetwork.h

Large diffs are not rendered by default.

612 changes: 304 additions & 308 deletions RecoTracker/LSTCore/src/alpaka/NeuralNetworkWeights.h

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions RecoTracker/LSTCore/standalone/code/core/AccessHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,83 +5,83 @@
#include <tuple>
#include "Event.h"

using lstEvent = lst::Event<ALPAKA_ACCELERATOR_NAMESPACE::Acc3D>;
using LSTEvent = lst::Event<ALPAKA_ACCELERATOR_NAMESPACE::Acc3D>;

enum { kpT5 = 7, kpT3 = 5, kT5 = 4, kpLS = 8 };

// ----* Hit *----
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> convertHitsToHitIdxsAndHitTypes(
lstEvent* event, std::vector<unsigned int> hits);
LSTEvent* event, std::vector<unsigned int> hits);

// ----* pLS *----
std::vector<unsigned int> getPixelHitsFrompLS(lstEvent* event, unsigned int pLS);
std::vector<unsigned int> getPixelHitIdxsFrompLS(lstEvent* event, unsigned int pLS);
std::vector<unsigned int> getPixelHitTypesFrompLS(lstEvent* event, unsigned int pLS);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFrompLS(lstEvent* event,
std::vector<unsigned int> getPixelHitsFrompLS(LSTEvent* event, unsigned int pLS);
std::vector<unsigned int> getPixelHitIdxsFrompLS(LSTEvent* event, unsigned int pLS);
std::vector<unsigned int> getPixelHitTypesFrompLS(LSTEvent* event, unsigned int pLS);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFrompLS(LSTEvent* event,
unsigned pLS);

// ----* MD *----
std::vector<unsigned int> getHitsFromMD(lstEvent* event, unsigned int MD);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromMD(lstEvent* event,
std::vector<unsigned int> getHitsFromMD(LSTEvent* event, unsigned int MD);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromMD(LSTEvent* event,
unsigned MD);

// ----* LS *----
std::vector<unsigned int> getMDsFromLS(lstEvent* event, unsigned int LS);
std::vector<unsigned int> getHitsFromLS(lstEvent* event, unsigned int LS);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromLS(lstEvent* event,
std::vector<unsigned int> getMDsFromLS(LSTEvent* event, unsigned int LS);
std::vector<unsigned int> getHitsFromLS(LSTEvent* event, unsigned int LS);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromLS(LSTEvent* event,
unsigned LS);

// ----* T3 *----
std::vector<unsigned int> getLSsFromT3(lstEvent* event, unsigned int T3);
std::vector<unsigned int> getMDsFromT3(lstEvent* event, unsigned int T3);
std::vector<unsigned int> getHitsFromT3(lstEvent* event, unsigned int T3);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromT3(lstEvent* event,
std::vector<unsigned int> getLSsFromT3(LSTEvent* event, unsigned int T3);
std::vector<unsigned int> getMDsFromT3(LSTEvent* event, unsigned int T3);
std::vector<unsigned int> getHitsFromT3(LSTEvent* event, unsigned int T3);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromT3(LSTEvent* event,
unsigned T3);

// ----* T5 *----
std::vector<unsigned int> getT3sFromT5(lstEvent* event, unsigned int T5);
std::vector<unsigned int> getLSsFromT5(lstEvent* event, unsigned int T5);
std::vector<unsigned int> getMDsFromT5(lstEvent* event, unsigned int T5);
std::vector<unsigned int> getHitsFromT5(lstEvent* event, unsigned int T5);
std::vector<unsigned int> getHitIdxsFromT5(lstEvent* event, unsigned int T5);
std::vector<unsigned int> getHitTypesFromT5(lstEvent* event, unsigned int T5);
std::vector<unsigned int> getModuleIdxsFromT5(lstEvent* event, unsigned int T5);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromT5(lstEvent* event,
std::vector<unsigned int> getT3sFromT5(LSTEvent* event, unsigned int T5);
std::vector<unsigned int> getLSsFromT5(LSTEvent* event, unsigned int T5);
std::vector<unsigned int> getMDsFromT5(LSTEvent* event, unsigned int T5);
std::vector<unsigned int> getHitsFromT5(LSTEvent* event, unsigned int T5);
std::vector<unsigned int> getHitIdxsFromT5(LSTEvent* event, unsigned int T5);
std::vector<unsigned int> getHitTypesFromT5(LSTEvent* event, unsigned int T5);
std::vector<unsigned int> getModuleIdxsFromT5(LSTEvent* event, unsigned int T5);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromT5(LSTEvent* event,
unsigned T5);

// ----* pT3 *----
unsigned int getPixelLSFrompT3(lstEvent* event, unsigned int pT3);
unsigned int getT3FrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getLSsFrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getMDsFrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getOuterTrackerHitsFrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getPixelHitsFrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getHitsFrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getHitIdxsFrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getHitTypesFrompT3(lstEvent* event, unsigned int pT3);
std::vector<unsigned int> getModuleIdxsFrompT3(lstEvent* event, unsigned int pT3);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFrompT3(lstEvent* event,
unsigned int getPixelLSFrompT3(LSTEvent* event, unsigned int pT3);
unsigned int getT3FrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getLSsFrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getMDsFrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getOuterTrackerHitsFrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getPixelHitsFrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getHitsFrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getHitIdxsFrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getHitTypesFrompT3(LSTEvent* event, unsigned int pT3);
std::vector<unsigned int> getModuleIdxsFrompT3(LSTEvent* event, unsigned int pT3);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFrompT3(LSTEvent* event,
unsigned pT3);

// ----* pT5 *----
unsigned int getPixelLSFrompT5(lstEvent* event, unsigned int pT5);
unsigned int getT5FrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getT3sFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getLSsFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getMDsFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getOuterTrackerHitsFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getPixelHitsFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getHitsFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getHitIdxsFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getHitTypesFrompT5(lstEvent* event, unsigned int pT5);
std::vector<unsigned int> getModuleIdxsFrompT5(lstEvent* event, unsigned int pT5);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFrompT5(lstEvent* event,
unsigned int getPixelLSFrompT5(LSTEvent* event, unsigned int pT5);
unsigned int getT5FrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getT3sFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getLSsFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getMDsFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getOuterTrackerHitsFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getPixelHitsFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getHitsFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getHitIdxsFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getHitTypesFrompT5(LSTEvent* event, unsigned int pT5);
std::vector<unsigned int> getModuleIdxsFrompT5(LSTEvent* event, unsigned int pT5);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFrompT5(LSTEvent* event,
unsigned pT5);

// ----* TC *----
std::vector<unsigned int> getLSsFromTC(lstEvent* event, unsigned int TC);
std::vector<unsigned int> getHitsFromTC(lstEvent* event, unsigned int TC);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromTC(lstEvent* event,
std::vector<unsigned int> getLSsFromTC(LSTEvent* event, unsigned int TC);
std::vector<unsigned int> getHitsFromTC(LSTEvent* event, unsigned int TC);
std::tuple<std::vector<unsigned int>, std::vector<unsigned int>> getHitIdxsAndHitTypesFromTC(LSTEvent* event,
unsigned int TC);

#endif
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef lstMath_h
#define lstMath_h
#ifndef lst_math_h
#define lst_math_h
#include <tuple>
#include <vector>
#include <cmath>

namespace lstMath {
namespace lst_math {
inline float Phi_mpi_pi(float x) {
if (std::isnan(x)) {
std::cout << "MathUtil::Phi_mpi_pi() function called with NaN" << std::endl;
Expand Down Expand Up @@ -209,5 +209,5 @@ namespace lstMath {

return Hit(x, y, 0);
};
} // namespace lstMath
} // namespace lst_math
#endif
8 changes: 4 additions & 4 deletions RecoTracker/LSTCore/standalone/code/core/trkCore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -501,13 +501,13 @@ float drfracSimHitConsistentWithHelix(int isimtrk, int isimhitidx) {
int charge = trk.sim_q()[isimtrk];

// Construct helix object
lstMath::Helix helix(pt, eta, phi, vx, vy, vz, charge);
lst_math::Helix helix(pt, eta, phi, vx, vy, vz, charge);

return drfracSimHitConsistentWithHelix(helix, isimhitidx);
}

//__________________________________________________________________________________________
float drfracSimHitConsistentWithHelix(lstMath::Helix &helix, int isimhitidx) {
float drfracSimHitConsistentWithHelix(lst_math::Helix &helix, int isimhitidx) {
// Sim hit vector
std::vector<float> point = {trk.simhit_x()[isimhitidx], trk.simhit_y()[isimhitidx], trk.simhit_z()[isimhitidx]};

Expand Down Expand Up @@ -539,13 +539,13 @@ float distxySimHitConsistentWithHelix(int isimtrk, int isimhitidx) {
int charge = trk.sim_q()[isimtrk];

// Construct helix object
lstMath::Helix helix(pt, eta, phi, vx, vy, vz, charge);
lst_math::Helix helix(pt, eta, phi, vx, vy, vz, charge);

return distxySimHitConsistentWithHelix(helix, isimhitidx);
}

//__________________________________________________________________________________________
float distxySimHitConsistentWithHelix(lstMath::Helix &helix, int isimhitidx) {
float distxySimHitConsistentWithHelix(lst_math::Helix &helix, int isimhitidx) {
// Sim hit vector
std::vector<float> point = {trk.simhit_x()[isimhitidx], trk.simhit_y()[isimhitidx], trk.simhit_z()[isimhitidx]};

Expand Down
36 changes: 18 additions & 18 deletions RecoTracker/LSTCore/standalone/code/core/trkCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
#include "TSystem.h"
#include "AnalysisConfig.h"
#include "ModuleConnectionMap.h"
#include "lstMath.h"
#include "lst_math.h"
#include "Event.h"
#include <numeric>
#include <filesystem>

using lstEvent = lst::Event<ALPAKA_ACCELERATOR_NAMESPACE::Acc3D>;
using LSTEvent = lst::Event<ALPAKA_ACCELERATOR_NAMESPACE::Acc3D>;

// --------------------- ======================== ---------------------

bool goodEvent();
float runMiniDoublet(lstEvent *event, int evt);
float runSegment(lstEvent *event);
float runT4(lstEvent *event);
float runT4x(lstEvent *event);
float runpT4(lstEvent *event);
float runT3(lstEvent *event);
float runTrackCandidate(lstEvent *event, bool no_pls_dupclean, bool tc_pls_triplets);
float runQuintuplet(lstEvent *event);
float runPixelQuintuplet(lstEvent *event);
float runPixelLineSegment(lstEvent *event, bool no_pls_dupclean);
float runpT3(lstEvent *event);
float runMiniDoublet(LSTEvent *event, int evt);
float runSegment(LSTEvent *event);
float runT4(LSTEvent *event);
float runT4x(LSTEvent *event);
float runpT4(LSTEvent *event);
float runT3(LSTEvent *event);
float runTrackCandidate(LSTEvent *event, bool no_pls_dupclean, bool tc_pls_triplets);
float runQuintuplet(LSTEvent *event);
float runPixelQuintuplet(LSTEvent *event);
float runPixelLineSegment(LSTEvent *event, bool no_pls_dupclean);
float runpT3(LSTEvent *event);

// --------------------- ======================== ---------------------

Expand All @@ -40,9 +40,9 @@ int getDenomSimTrkType(std::vector<int> simidxs);
// --------------------- ======================== ---------------------

float drfracSimHitConsistentWithHelix(int isimtrk, int isimhitidx);
float drfracSimHitConsistentWithHelix(lstMath::Helix &helix, int isimhitidx);
float drfracSimHitConsistentWithHelix(lst_math::Helix &helix, int isimhitidx);
float distxySimHitConsistentWithHelix(int isimtrk, int isimhitidx);
float distxySimHitConsistentWithHelix(lstMath::Helix &helix, int isimhitidx);
float distxySimHitConsistentWithHelix(lst_math::Helix &helix, int isimhitidx);
TVector3 calculateR3FromPCA(const TVector3 &p3, const float dxy, const float dz);

// --------------------- ======================== ---------------------
Expand Down Expand Up @@ -71,7 +71,7 @@ void addInputsToLineSegmentTrackingPreLoad(std::vector<std::vector<float>> &out_
std::vector<std::vector<int8_t>> &out_pixelType_vec,
std::vector<std::vector<char>> &out_isQuad_vec);

float addInputsToEventPreLoad(lstEvent *event,
float addInputsToEventPreLoad(LSTEvent *event,
bool useOMP,
std::vector<float> trkX,
std::vector<float> trkY,
Expand Down Expand Up @@ -107,7 +107,7 @@ void writeMetaData();
// --------------------- ======================== ---------------------

// DEPRECATED FUNCTION
float addInputsToLineSegmentTrackingUsingExplicitMemory(lstEvent &event);
float addInputsToLineSegmentTracking(lstEvent &event, bool useOMP);
float addInputsToLineSegmentTrackingUsingExplicitMemory(LSTEvent &event);
float addInputsToLineSegmentTracking(LSTEvent &event, bool useOMP);

#endif
8 changes: 4 additions & 4 deletions RecoTracker/LSTCore/standalone/code/core/write_sdl_ntuple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void setGnnNtupleBranches(lst::Event<Acc3D>* event) {
sg_index_map[sgIdx] = ana.tx->getBranch<std::vector<int>>("LS_isFake").size() - 1;

// // T5 eta and phi are computed using outer and innermost hits
// lstMath::Hit hitA(trk.ph2_x()[anchitidx], trk.ph2_y()[anchitidx], trk.ph2_z()[anchitidx]);
// lst_math::Hit hitA(trk.ph2_x()[anchitidx], trk.ph2_y()[anchitidx], trk.ph2_z()[anchitidx]);
// const float phi = hitA.phi();
// const float eta = hitA.eta();
}
Expand Down Expand Up @@ -683,7 +683,7 @@ void setGnnNtupleMiniDoublet(lst::Event<Acc3D>* event, unsigned int MD) {
float pt = hit0_r * lst::k2Rinv1GeVf / sin(dphichange);

// T5 eta and phi are computed using outer and innermost hits
lstMath::Hit hitA(trk.ph2_x()[anchitidx], trk.ph2_y()[anchitidx], trk.ph2_z()[anchitidx]);
lst_math::Hit hitA(trk.ph2_x()[anchitidx], trk.ph2_y()[anchitidx], trk.ph2_z()[anchitidx]);
const float phi = hitA.phi();
const float eta = hitA.eta();

Expand Down Expand Up @@ -911,8 +911,8 @@ std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned
const float pt = quintuplets->innerRadius[T5] * lst::k2Rinv1GeVf * 2;

// T5 eta and phi are computed using outer and innermost hits
lstMath::Hit hitA(trk.ph2_x()[Hit_0], trk.ph2_y()[Hit_0], trk.ph2_z()[Hit_0]);
lstMath::Hit hitB(trk.ph2_x()[Hit_8], trk.ph2_y()[Hit_8], trk.ph2_z()[Hit_8]);
lst_math::Hit hitA(trk.ph2_x()[Hit_0], trk.ph2_y()[Hit_0], trk.ph2_z()[Hit_0]);
lst_math::Hit hitB(trk.ph2_x()[Hit_8], trk.ph2_y()[Hit_8], trk.ph2_z()[Hit_8]);
const float phi = hitA.phi();
const float eta = hitB.eta();

Expand Down
54 changes: 27 additions & 27 deletions RecoTracker/LSTCore/standalone/code/core/write_sdl_ntuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@
#include <iostream>
#include <tuple>

#include "lstMath.h"
#include "lst_math.h"
#include "Event.h"

#include "AnalysisConfig.h"
#include "trkCore.h"
#include "AccessHelper.h"

using lstEvent = lst::Event<ALPAKA_ACCELERATOR_NAMESPACE::Acc3D>;
using LSTEvent = lst::Event<ALPAKA_ACCELERATOR_NAMESPACE::Acc3D>;

// Common
void createOutputBranches();
void createRequiredOutputBranches();
void createOptionalOutputBranches();
void createGnnNtupleBranches();

void fillOutputBranches(lstEvent* event);
void setOutputBranches(lstEvent* event);
void setOptionalOutputBranches(lstEvent* event);
void setPixelQuintupletOutputBranches(lstEvent* event);
void setQuintupletOutputBranches(lstEvent* event);
void setPixelTripletOutputBranches(lstEvent* event);
void setGnnNtupleBranches(lstEvent* event);
void setGnnNtupleMiniDoublet(lstEvent* event, unsigned int MD);

std::tuple<int, float, float, float, int, std::vector<int>> parseTrackCandidate(lstEvent* event, unsigned int);
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parsepT5(lstEvent* event,
void fillOutputBranches(LSTEvent* event);
void setOutputBranches(LSTEvent* event);
void setOptionalOutputBranches(LSTEvent* event);
void setPixelQuintupletOutputBranches(LSTEvent* event);
void setQuintupletOutputBranches(LSTEvent* event);
void setPixelTripletOutputBranches(LSTEvent* event);
void setGnnNtupleBranches(LSTEvent* event);
void setGnnNtupleMiniDoublet(LSTEvent* event, unsigned int MD);

std::tuple<int, float, float, float, int, std::vector<int>> parseTrackCandidate(LSTEvent* event, unsigned int);
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parsepT5(LSTEvent* event,
unsigned int);
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parsepT3(lstEvent* event,
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parsepT3(LSTEvent* event,
unsigned int);
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parseT5(lstEvent* event,
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parseT5(LSTEvent* event,
unsigned int);
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parsepLS(lstEvent* event,
std::tuple<float, float, float, std::vector<unsigned int>, std::vector<unsigned int>> parsepLS(LSTEvent* event,
unsigned int);

// Print multiplicities
void printMiniDoubletMultiplicities(lstEvent* event);
void printHitMultiplicities(lstEvent* event);
void printMiniDoubletMultiplicities(LSTEvent* event);
void printHitMultiplicities(LSTEvent* event);

// Print objects (GPU)
void printAllObjects(lstEvent* event);
void printpT4s(lstEvent* event);
void printMDs(lstEvent* event);
void printLSs(lstEvent* event);
void printpLSs(lstEvent* event);
void printT3s(lstEvent* event);
void printT4s(lstEvent* event);
void printTCs(lstEvent* event);
void printAllObjects(LSTEvent* event);
void printpT4s(LSTEvent* event);
void printMDs(LSTEvent* event);
void printLSs(LSTEvent* event);
void printpLSs(LSTEvent* event);
void printT3s(LSTEvent* event);
void printT4s(LSTEvent* event);
void printTCs(LSTEvent* event);

// Print anomalous multiplicities
void debugPrintOutlierMultiplicities(lstEvent* event);
void debugPrintOutlierMultiplicities(LSTEvent* event);

#endif

0 comments on commit e54c6f1

Please sign in to comment.