Skip to content
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

Fiducial Filter #226

Merged
merged 28 commits into from
Jun 12, 2024
Merged

Fiducial Filter #226

merged 28 commits into from
Jun 12, 2024

Conversation

Gregtom3
Copy link
Contributor

Added a Fiducial Cut algorithm that handles pid==11,211,-211,2212 drift chamber cuts using REC::Traj bank data

Currently only using pass1 parameterization

meson test validator-clas12-FiducialFilter --verbose --test-args '\-f /cache/clas12/rg-a/production/recon/fall2018/torus-1/pass1/v1/dst/train/nSidis/nSidis_005036.hipo \-n 0 \-o ../validator_output' outputs before and after REC::Traj [x,y] 2d histograms for each drift chamber number. Below is the result for DC1

Before Fiducial Cuts

DC1_before

After Fiducial Cuts

DC1_after

@Gregtom3
Copy link
Contributor Author

#227

@c-dilks
Copy link
Member

c-dilks commented Jun 4, 2024

Updating branch to enable ubsan test

@c-dilks
Copy link
Member

c-dilks commented Jun 4, 2024

The undefined behavior sanitizer (ubsan) has just been re-enabled (see #135), and it looks like FiducialFilter isn't passing:

../iguana_src/src/iguana/algorithms/clas12/FiducialFilter/Algorithm.cc:222:31: runtime error: index -1 out of bounds for type 'const double[6][3][4]'
    #0 0x7fa729afc293 in iguana::clas12::FiducialFilter::DC_fiducial_cut_theta_phi_pass1(iguana::clas12::FiducialFilter::traj_row_data, int, int) const /__w/iguana/iguana/iguana_build/../iguana_src/src/iguana/algorithms/clas12/FiducialFilter/Algorithm.cc:222:31
    #1 0x7fa729af908b in iguana::clas12::FiducialFilter::Filter(iguana::clas12::FiducialFilter::traj_row_data, int, int) const /__w/iguana/iguana/iguana_build/../iguana_src/src/iguana/algorithms/clas12/FiducialFilter/Algorithm.cc:57:30
    #2 0x7fa729afe8a5 in iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const::$_0::operator()(hipo::bank&, int) const /__w/iguana/iguana/iguana_build/../iguana_src/src/iguana/algorithms/clas12/FiducialFilter/Algorithm.cc:44:24
    #3 0x7fa729afe50a in bool std::__invoke_impl<bool, iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const::$_0&, hipo::bank&, int>(std::__invoke_other, iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const::$_0&, hipo::bank&, int&&) /usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:61:14
    #4 0x7fa729afe398 in std::enable_if<is_invocable_r_v<bool, iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const::$_0&, hipo::bank&, int>, bool>::type std::__invoke_r<bool, iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const::$_0&, hipo::bank&, int>(iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const::$_0&, hipo::bank&, int&&) /usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:114:9
    #5 0x7fa729afdf04 in std::_Function_handler<bool (hipo::bank&, int), iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const::$_0>::_M_invoke(std::_Any_data const&, hipo::bank&, int&&) /usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_function.h:290:9
    #6 0x7fa72aa9dcae in hipo::bank::rowlist::filter(std::function<bool (hipo::bank&, int)>) (/__w/iguana/iguana/hipo/lib/pkgconfig/../../lib/libhipo4.so+0x16cae) (BuildId: 17bdf1d819d4799054a6307f196ba022f04f0584)
    #7 0x7fa729af72c0 in iguana::clas12::FiducialFilter::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const /__w/iguana/iguana/iguana_build/../iguana_src/src/iguana/algorithms/clas12/FiducialFilter/Algorithm.cc:37:38
    #8 0x7fa729aba853 in iguana::AlgorithmSequence::Run(std::vector<hipo::bank, std::allocator<hipo::bank>>&) const /__w/iguana/iguana/iguana_build/../iguana_src/src/iguana/algorithms/AlgorithmSequence.cc:15:13
    #9 0x5627d29af2af in TestAlgorithm(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, bool) /__w/iguana/iguana/iguana_build/../iguana_src/src/iguana/tests/include/TestAlgorithm.h:52:11
    #10 0x5627d29984dd in main /__w/iguana/iguana/iguana_build/../iguana_src/src/iguana/tests/iguana-test.cc:188:12
    #11 0x7fa728db4c87  (/usr/lib/libc.so.6+0x25c87) (BuildId: 32a656aa5562eece8c59a585f5eacd6cf5e2307b)
    #12 0x7fa728db4d4b in __libc_start_main (/usr/lib/libc.so.6+0x25d4b) (BuildId: 32a656aa5562eece8c59a585f5eacd6cf5e2307b)
    #13 0x5627d2960634 in _start (/__w/iguana/iguana/iguana_build/src/iguana/tests/iguana-test+0xa5634) (BuildId: 6042b5528e6c5249811a02ea0169ec1185d9839d)

Note that the easiest way to test this is to use the CI, but if you'd rather test locally, try setting build option b_sanitize=undefined and run meson test (as long as you're not using meson 1.4.0).

Copy link
Member

@c-dilks c-dilks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out what ubsan is unhappy about: sometimes sector==0, and when sector-1 is used as an array index, this is undefined behavior.

@c-dilks c-dilks enabled auto-merge (squash) June 12, 2024 15:59
@c-dilks c-dilks merged commit 3fdfdf3 into main Jun 12, 2024
43 checks passed
@c-dilks c-dilks deleted the pass1fid branch June 12, 2024 16:15
@c-dilks c-dilks linked an issue Jul 19, 2024 that may be closed by this pull request
@c-dilks c-dilks mentioned this pull request Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fiducial cuts for Pass 1
2 participants