|
61 | 61 | #include <string> |
62 | 62 | #include <utility> // for pair |
63 | 63 | #include <vector> |
| 64 | +#include <unordered_set> |
64 | 65 | // Terra incognita.... |
65 | 66 | #include <pthread.h> |
66 | 67 |
|
@@ -123,8 +124,8 @@ namespace |
123 | 124 | double m_tdriftmax = 0; |
124 | 125 |
|
125 | 126 | // --- new members for dead/hot map --- |
126 | | - hitMaskTpc *deadMap = nullptr; |
127 | | - hitMaskTpc *hotMap = nullptr; |
| 127 | + hitMaskTpcSet *deadMap = nullptr; |
| 128 | + hitMaskTpcSet *hotMap = nullptr; |
128 | 129 | bool maskDead = false; |
129 | 130 | bool maskHot = false; |
130 | 131 |
|
@@ -605,43 +606,53 @@ namespace |
605 | 606 |
|
606 | 607 | TrkrDefs::hitsetkey tpcHitSetKey = TpcDefs::genHitSetKey(my_data.layer, my_data.sector, my_data.side); |
607 | 608 |
|
| 609 | + // pads just outside the cluster in phi |
| 610 | + const int left_pad = phibinlo - 1; |
| 611 | + const int right_pad = phibinhi + 1; |
| 612 | + |
608 | 613 | // --- Dead channels --- |
609 | | - if (my_data.maskDead && my_data.deadMap->count(tpcHitSetKey)) |
| 614 | + if (my_data.maskDead) |
| 615 | + { |
| 616 | + auto it = my_data.deadMap->find(tpcHitSetKey); |
| 617 | + if (it != my_data.deadMap->end()) |
610 | 618 | { |
611 | | - const auto &deadvec = (*my_data.deadMap)[tpcHitSetKey]; |
612 | | - |
613 | | - for (const auto &deadkey : deadvec) |
614 | | - { |
615 | | - int dphi = TpcDefs::getPad(deadkey); |
| 619 | + const auto &deadset = it->second; |
616 | 620 |
|
617 | | - bool touch = (dphi == phibinlo - 1 || dphi == phibinhi + 1); |
| 621 | + if (left_pad >= 0 && |
| 622 | + deadset.count(TpcDefs::genHitKey(left_pad, 0))) |
| 623 | + { |
| 624 | + nedge++; |
| 625 | + } |
618 | 626 |
|
619 | | - if (touch) |
620 | | - { |
621 | | - nedge++; |
622 | | - continue; |
623 | | - } |
624 | | - } |
| 627 | + if (right_pad < my_data.phibins && |
| 628 | + deadset.count(TpcDefs::genHitKey(right_pad, 0))) |
| 629 | + { |
| 630 | + nedge++; |
| 631 | + } |
625 | 632 | } |
| 633 | + } |
626 | 634 |
|
627 | 635 | // --- Hot channels --- |
628 | | - if (my_data.maskHot && my_data.hotMap->count(tpcHitSetKey)) |
| 636 | + if (my_data.maskHot) |
| 637 | + { |
| 638 | + auto it = my_data.hotMap->find(tpcHitSetKey); |
| 639 | + if (it != my_data.hotMap->end()) |
629 | 640 | { |
630 | | - const auto &hotvec = (*my_data.hotMap)[tpcHitSetKey]; |
631 | | - |
632 | | - for (const auto &hotkey : hotvec) |
633 | | - { |
634 | | - int hphi = TpcDefs::getPad(hotkey); |
| 641 | + const auto &hotset = it->second; |
635 | 642 |
|
636 | | - bool touch = (hphi == phibinlo -1 || hphi == phibinhi + 1); |
| 643 | + if (left_pad >= 0 && |
| 644 | + hotset.count(TpcDefs::genHitKey(left_pad, 0))) |
| 645 | + { |
| 646 | + nedge++; |
| 647 | + } |
637 | 648 |
|
638 | | - if (touch) |
639 | | - { |
640 | | - nedge++; |
641 | | - continue; |
642 | | - } |
643 | | - } |
| 649 | + if (right_pad < my_data.phibins && |
| 650 | + hotset.count(TpcDefs::genHitKey(right_pad, 0))) |
| 651 | + { |
| 652 | + nedge++; |
| 653 | + } |
644 | 654 | } |
| 655 | + } |
645 | 656 |
|
646 | 657 | // This is the global position |
647 | 658 | double clusiphi = iphi_sum / adc_sum; |
@@ -843,24 +854,28 @@ namespace |
843 | 854 | // Helper function to check if a pad is masked |
844 | 855 | auto is_pad_masked = [&](int abs_pad) -> bool |
845 | 856 | { |
846 | | - if (my_data->maskDead && my_data->deadMap->count(tpcHitSetKey)) |
| 857 | + TrkrDefs::hitkey key = TpcDefs::genHitKey(abs_pad, 0); |
| 858 | + |
| 859 | + if (my_data->maskDead) |
| 860 | + { |
| 861 | + auto it = my_data->deadMap->find(tpcHitSetKey); |
| 862 | + if (it != my_data->deadMap->end() && |
| 863 | + it->second.count(key)) |
847 | 864 | { |
848 | | - const auto &deadvec = (*my_data->deadMap)[tpcHitSetKey]; |
849 | | - for (const auto &deadkey : deadvec) |
850 | | - { |
851 | | - if (TpcDefs::getPad(deadkey) == abs_pad) |
852 | | - return true; |
853 | | - } |
| 865 | + return true; |
854 | 866 | } |
855 | | - if (my_data->maskHot && my_data->hotMap->count(tpcHitSetKey)) |
| 867 | + } |
| 868 | + |
| 869 | + if (my_data->maskHot) |
| 870 | + { |
| 871 | + auto it = my_data->hotMap->find(tpcHitSetKey); |
| 872 | + if (it != my_data->hotMap->end() && |
| 873 | + it->second.count(key)) |
856 | 874 | { |
857 | | - const auto &hotvec = (*my_data->hotMap)[tpcHitSetKey]; |
858 | | - for (const auto &hotkey : hotvec) |
859 | | - { |
860 | | - if (TpcDefs::getPad(hotkey) == abs_pad) |
861 | | - return true; |
862 | | - } |
| 875 | + return true; |
863 | 876 | } |
| 877 | + } |
| 878 | + |
864 | 879 | return false; |
865 | 880 | }; |
866 | 881 |
|
@@ -1806,7 +1821,7 @@ int TpcClusterizer::End(PHCompositeNode * /*topNode*/) |
1806 | 1821 | return Fun4AllReturnCodes::EVENT_OK; |
1807 | 1822 | } |
1808 | 1823 |
|
1809 | | -void TpcClusterizer::makeChannelMask(hitMaskTpc &aMask, const std::string &dbName, const std::string &totalChannelsToMask) |
| 1824 | +void TpcClusterizer::makeChannelMask(hitMaskTpcSet &aMask, const std::string &dbName, const std::string &totalChannelsToMask) |
1810 | 1825 | { |
1811 | 1826 | CDBTTree *cdbttree; |
1812 | 1827 | if (m_maskFromFile) |
@@ -1837,7 +1852,7 @@ void TpcClusterizer::makeChannelMask(hitMaskTpc &aMask, const std::string &dbNam |
1837 | 1852 |
|
1838 | 1853 | TrkrDefs::hitsetkey DeadChannelHitKey = TpcDefs::genHitSetKey(Layer, Sector, Side); |
1839 | 1854 | TrkrDefs::hitkey DeadHitKey = TpcDefs::genHitKey((unsigned int) Pad, 0); |
1840 | | - aMask[DeadChannelHitKey].push_back(DeadHitKey); |
| 1855 | + aMask[DeadChannelHitKey].insert(DeadHitKey); |
1841 | 1856 | } |
1842 | 1857 |
|
1843 | 1858 | delete cdbttree; |
|
0 commit comments