Skip to content

Commit

Permalink
Update DDD filtering on MTD-related volumes for better memory perform…
Browse files Browse the repository at this point in the history
…ance
  • Loading branch information
fabiocos committed Oct 28, 2024
1 parent b96fd02 commit d4baa1c
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions Geometry/MTDNumberingBuilder/plugins/DDCmsMTDConstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,50 @@ using angle_units::operators::convertRadToDeg;

class DDNameFilter : public DDFilter {
public:
void addNS(const std::string& addNS) { allowedNS_.emplace_back(addNS); }
void add(const std::string& add) { allowed_.emplace_back(add); }
void veto(const std::string& veto) { veto_.emplace_back(veto); }

bool accept(const DDExpandedView& ev) const final {
std::string currentName(ev.logicalPart().name().fullname());
for (const auto& test : veto_) {
if (currentName.find(test) != std::string::npos)
return false;
if (allowedNS_.size() == 0 && allowed_.size() == 0 && veto_.size() == 0) {
return true;
}
for (const auto& test : allowed_) {
if (currentName.find(test) != std::string::npos)
return true;
bool out(false);
std::string_view currentNSName(ev.logicalPart().name().ns());
for (const auto& test : allowedNS_) {
if (currentNSName.find(test) != std::string::npos) {
out = true;
if (allowed_.size() > 0 || veto_.size() > 0) {
std::string_view currentName(ev.logicalPart().name().name());
for (const auto& test : veto_) {
if (currentName.find(test) != std::string::npos) {
return false;
}
}
for (const auto& test : allowed_) {
if (currentName.find(test) != std::string::npos) {
return true;
}
}
}
break;
}
}
return false;
return out;
}

private:
std::vector<std::string> allowedNS_;
std::vector<std::string> allowed_;
std::vector<std::string> veto_;
};

std::unique_ptr<GeometricTimingDet> DDCmsMTDConstruction::construct(const DDCompactView& cpv) {
std::string attribute{"CMSCutsRegion"};
DDNameFilter filter;
filter.add("mtd:");
filter.add("btl:");
filter.add("etl:");

std::vector<std::string> volnames = {"FSide", "SupportPlate"};
for (auto const& theVol : volnames) {
filter.veto(theVol);
}
filter.addNS("mtd");
filter.addNS("btl");
filter.addNS("etl");

DDFilteredView fv(cpv, filter);

Expand Down

0 comments on commit d4baa1c

Please sign in to comment.