91 return std::regex_match(device.name.begin(), device.name.end(), std::regex(expression.c_str()));
95 unsigned long tpcSectorMask = pTpcSectorMask ? *pTpcSectorMask : 0xFFFFFFFFF;
96 std::bitset<NSectors> validSectors = 0;
97 bool haveMatchedInput =
false;
98 uint64_t activeSectors = 0;
99 std::vector<uint64_t> validSectorsExternal(externalInputMatchers ? externalInputMatchers->size() : 0);
100 size_t nActiveInputRoutes = 0;
101 size_t nMaxPartsPerRoute = 0;
103 for (
auto it = inputs.begin(),
end = inputs.end(); it !=
end; ++it) {
104 nMaxPartsPerRoute = it.size() > nMaxPartsPerRoute ? it.size() : nMaxPartsPerRoute;
105 bool haveActivePart =
false;
106 for (
auto const&
ref : it) {
110 haveActivePart =
true;
111 auto const* dh = framework::DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
115 for (
size_t idx = 0,
end = inputMatchers.size(); idx <
end; idx++) {
116 auto const& spec = inputMatchers[idx];
118 haveMatchedInput =
true;
119 if (inputType == -1) {
122 }
else if (inputType != (
int)idx) {
123 std::stringstream error;
124 error << fmt::format(
"routing error, input messages must all be of the same type previously bound to {} {}/{}/{}",
127 dh->dataDescription, dh->subSpecification);
128 throw std::runtime_error(error.str());
130 auto const* sectorHeader = framework::DataRefUtils::getHeader<o2::tpc::TPCSectorHeader*>(
ref);
131 if (sectorHeader ==
nullptr) {
132 throw std::runtime_error(
"TPC sector header missing on header stack");
134 activeSectors |= (sectorHeader->activeSectors & tpcSectorMask);
135 validSectors |= (sectorHeader->sectorBits & tpcSectorMask);
141 if (externalInputMatchers) {
142 for (
size_t idx = 0,
end = externalInputMatchers->size(); idx <
end; idx++) {
143 auto const& spec = (*externalInputMatchers)[idx];
145 auto const* sectorHeader = framework::DataRefUtils::getHeader<o2::tpc::TPCSectorHeader*>(
ref);
146 if (sectorHeader ==
nullptr) {
147 throw std::runtime_error(
"TPC sector header missing on header stack");
149 activeSectors |= (sectorHeader->activeSectors & tpcSectorMask);
150 validSectorsExternal[idx] |= (sectorHeader->sectorBits & tpcSectorMask);
156 if (haveActivePart) {
157 ++nActiveInputRoutes;
161 if (externalInputMatchers) {
163 for (
size_t idx = 0,
end = externalInputMatchers->size(); idx <
end; idx++) {
164 if (validSectorsExternal[idx] == 0 || validSectorsExternal[idx] != activeSectors) {
177 if ((inputMatchers.size() == 0 || (haveMatchedInput && activeSectors == validSectors.to_ulong())) &&
178 (!bRequireAll || nActiveInputRoutes == inputs.size())) {
182 }
else if (activeSectors == 0 && nActiveInputRoutes == inputs.size()) {
197 for (
auto& input : inputs) {
198 auto* dph = framework::DataRefUtils::getHeader<o2::framework::DataProcessingHeader*>(input);
202 if (!(**orderCheck)(dph->startTime)) {