@@ -22,38 +22,50 @@ using angle_units::operators::convertRadToDeg;
2222
2323class DDNameFilter : public DDFilter {
2424public:
25+ void addNS (const std::string& addNS) { allowedNS_.emplace_back (addNS); }
2526 void add (const std::string& add) { allowed_.emplace_back (add); }
2627 void veto (const std::string& veto) { veto_.emplace_back (veto); }
2728
2829 bool accept (const DDExpandedView& ev) const final {
29- std::string currentName (ev.logicalPart ().name ().fullname ());
30- for (const auto & test : veto_) {
31- if (currentName.find (test) != std::string::npos)
32- return false ;
30+ if (allowedNS_.size () == 0 && allowed_.size () == 0 && veto_.size () == 0 ) {
31+ return true ;
3332 }
34- for (const auto & test : allowed_) {
35- if (currentName.find (test) != std::string::npos)
36- return true ;
33+ bool out (false );
34+ std::string_view currentNSName (ev.logicalPart ().name ().ns ());
35+ for (const auto & test : allowedNS_) {
36+ if (currentNSName.find (test) != std::string::npos) {
37+ out = true ;
38+ if (allowed_.size () > 0 || veto_.size () > 0 ) {
39+ std::string_view currentName (ev.logicalPart ().name ().name ());
40+ for (const auto & test : veto_) {
41+ if (currentName.find (test) != std::string::npos) {
42+ return false ;
43+ }
44+ }
45+ for (const auto & test : allowed_) {
46+ if (currentName.find (test) != std::string::npos) {
47+ return true ;
48+ }
49+ }
50+ }
51+ break ;
52+ }
3753 }
38- return false ;
54+ return out ;
3955 }
4056
4157private:
58+ std::vector<std::string> allowedNS_;
4259 std::vector<std::string> allowed_;
4360 std::vector<std::string> veto_;
4461};
4562
4663std::unique_ptr<GeometricTimingDet> DDCmsMTDConstruction::construct (const DDCompactView& cpv) {
4764 std::string attribute{" CMSCutsRegion" };
4865 DDNameFilter filter;
49- filter.add (" mtd:" );
50- filter.add (" btl:" );
51- filter.add (" etl:" );
52-
53- std::vector<std::string> volnames = {" FSide" , " SupportPlate" };
54- for (auto const & theVol : volnames) {
55- filter.veto (theVol);
56- }
66+ filter.addNS (" mtd" );
67+ filter.addNS (" btl" );
68+ filter.addNS (" etl" );
5769
5870 DDFilteredView fv (cpv, filter);
5971
0 commit comments