-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement particle filtering for neuland simulation #1083
Conversation
Hi @jose-luis-rs . @SimonL2718 is a bachelor student from my group. Could you add him to the contributors such that the CI workflow could run? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, Simon
I leave some comments. Please fix them.
CMakeLists.txt
Outdated
@@ -549,6 +549,7 @@ if(NOT MODULE) | |||
add_subdirectory(tracking) | |||
add_subdirectory(passive) | |||
add_subdirectory(tcal) | |||
add_subdirectory(r3bgen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe don't change it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be with the entries for r3bbase and r3bdata or somewhere else entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, just revert back to the dev version. (between music and lumon).
void SetFilter(R3B::Neuland::BitSetParticle filtered_particles, double minimum_allowed_energy); | ||
[[nodiscard]] auto GetFilter() const -> R3B::Neuland::BitSetParticle { return filtered_particles_; } | ||
[[nodiscard]] auto GetMinimumAllowedEnergy() const -> double { return minimum_allowed_energy_; } | ||
auto ShouldNeulandPointBeFiltered(const R3BNeulandPoint& neuland_point) -> bool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name is too long. Your input parameter already contains NeulandPoint
type and you don't need to mention it again in the function name.
auto ShouldNeulandPointBeFiltered(const R3BNeulandPoint& neuland_point) -> bool; | |
auto CheckFiltered(const R3BNeulandPoint& neuland_point) -> bool; |
// energy in GeV | ||
double minimum_allowed_energy_ = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the comments in the same line.
// energy in GeV | |
double minimum_allowed_energy_ = 0; | |
double minimum_allowed_energy_ = 0; // energy in GeV |
neuland/executables/neulandSim.cxx
Outdated
auto const neutron_PID = 2112; | ||
auto const Sn_p = int{ 50 }; | ||
auto const Sn_z = int{ 123 }; | ||
auto const BeamEnergyAtTarget = 883.; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto const neutron_PID = 2112; | |
auto const Sn_p = int{ 50 }; | |
auto const Sn_z = int{ 123 }; | |
auto const BeamEnergyAtTarget = 883.; | |
constexpr auto neutron_PID = 2112; | |
constexpr auto Sn_p = 50; | |
constexpr auto Sn_z = 123; | |
constexpr auto BeamEnergyAtTarget = 883.; |
neuland/simulation/R3BNeuland.cxx
Outdated
constexpr auto seconds_to_nanoseconds = 1e9; | ||
static constexpr double BirkdP = 1.032; | ||
static constexpr double BirkC1 = 0.013 / BirkdP; | ||
static constexpr double BirkC2 = 9.6e-6 / (BirkdP * BirkdP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr auto seconds_to_nanoseconds = 1e9; | |
static constexpr double BirkdP = 1.032; | |
static constexpr double BirkC1 = 0.013 / BirkdP; | |
static constexpr double BirkC2 = 9.6e-6 / (BirkdP * BirkdP); | |
constexpr auto seconds_to_nanoseconds = 1e9; | |
constexpr auto BirkdP = 1.032; | |
constexpr auto BirkC1 = 0.013 / BirkdP; | |
constexpr auto BirkC2 = 9.6e-6 / (BirkdP * BirkdP); |
neuland/simulation/R3BNeuland.cxx
Outdated
{ | ||
// Apply Birk's law ( Adapted from G3BIRK/Geant3) | ||
if (charge != 0 && length > 0) | ||
{ | ||
Double_t birkC1Mod = BirkC1; | ||
double birkC1Mod = BirkC1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double birkC1Mod = BirkC1; | |
constexpr auto birkC1Mod = BirkC1; |
: FairMCPoint(point) | ||
, fLightYield(lightYield) | ||
, particle_id_(particle_id) | ||
, parent_particle_id_(parent_particle_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use curly brackets:
: FairMCPoint(point) | |
, fLightYield(lightYield) | |
, particle_id_(particle_id) | |
, parent_particle_id_(parent_particle_id) | |
: FairMCPoint { point } | |
, fLightYield{ lightYield } | |
, particle_id_{ particle_id } | |
, parent_particle_id_{ parent_particle_id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I change this for other construction methods of NeulandPoints aswell or just this one in particular?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, better change the other construction methods of neuland points.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some tips to fix the warnings from Clang-tidy
const Double_t lightYield, | ||
const int particle_id, | ||
const int parent_particle_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just tell static analyser to ignore this warning by adding NOLINTBEGIN
and NOLINTEND
// NOLINTBEGIN
R3BNeulandPoint(const Int_t trackID,
const Int_t detID,
const TVector3& pos,
const TVector3& mom,
const Double_t tof,
const Double_t length,
const Double_t eLoss,
const UInt_t EventId,
const Double_t lightYield,
const int particle_id,
const int parent_particle_id)
// NOLINTEND
constexpr auto neutron_pid = 2112; | ||
constexpr auto eLoss_proton = 0.7; | ||
constexpr auto eLoss_neutron = 0.3; | ||
TVector3 sample_vector; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TVector3 sample_vector; | |
const auto sample_vector = TVector3{}; |
NOTE: you should always use following style to initialize a variable:
auto var_name = Type {}; // const auto if necessary
|
||
NeulandPointFilter filter; | ||
|
||
R3BNeulandPoint protonPoint(0, 0, sample_vector, sample_vector, 0., 0., eLoss_proton, 0, 0., proton_pid, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R3BNeulandPoint protonPoint(0, 0, sample_vector, sample_vector, 0., 0., eLoss_proton, 0, 0., proton_pid, 0); | |
const auto protonPoint = R3BNeulandPoint {0, 0, sample_vector, sample_vector, 0., 0., eLoss_proton, 0, 0., proton_pid, 0}; |
NeulandPointFilter filter; | ||
|
||
R3BNeulandPoint protonPoint(0, 0, sample_vector, sample_vector, 0., 0., eLoss_proton, 0, 0., proton_pid, 0); | ||
R3BNeulandPoint neutronPoint(0, 0, sample_vector, sample_vector, 0., 0., eLoss_neutron, 0, 0., neutron_pid, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R3BNeulandPoint neutronPoint(0, 0, sample_vector, sample_vector, 0., 0., eLoss_neutron, 0, 0., neutron_pid, 0); | |
const auto neutronPoint = R3BNeulandPoint {0, 0, sample_vector, sample_vector, 0., 0., eLoss_neutron, 0, 0., neutron_pid, 0}; |
To fix the clang-format issue, just click its "Details", find the file names, go there and use "Space f m" to autoformat the file in neovim. |
R3BNeulandPoint() | ||
: FairMCPoint{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
R3BNeulandPoint() | |
: FairMCPoint{} | |
R3BNeulandPoint() |
@@ -42,21 +42,21 @@ class R3BNeulandPoint : public FairMCPoint | |||
const Double_t lightYield, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just disable this warning by:
// NOLINTBEGIN
R3BNeulandPoint(const Int_t trackID,
const Int_t detID,
const TVector3& pos,
const TVector3& mom,
const Double_t tof,
const Double_t length,
const Double_t eLoss,
const UInt_t EventId,
const int particle_id,
const int parent_particle_id)
// NOLINTEND
Hi, this branch was squashed in #1084 |
f84289d
to
e652eda
Compare
Please @SimonL2718 reopen this PR. It should be approved by the NeuLAND WG before merging. |
Please see this #1086 for the further discussion. |
New features:
Allow filtering for certain particles during digitization. Setup is done within neulandAna.cxx executable.
Checklist:
dev
branch