165 {
166
167
168 const std::vector<std::shared_ptr<Monitored::HistogramFiller>>* fillerList{&m_fillers};
169
170 std::optional<std::vector<std::shared_ptr<Monitored::HistogramFiller>> > matchedFillerList;
171 if (m_useCache) {
172 const auto match = m_fillerCacheMap.find(fillerKey(monitoredVariables));
173 if (
match != m_fillerCacheMap.end()) {
174 fillerList = &
match->second;
175 } else {
176
177 matchedFillerList.emplace();
178 }
179 }
180
181 for ( auto filler: *fillerList ) {
182 const int fillerCardinality = filler->histogramVariablesNames().size() + (filler->histogramWeightName().
empty() ? 0: 1) + (filler->histogramCutMaskName().
empty() ? 0 : 1);
183
184 if ( fillerCardinality == 1 ) {
185 for ( auto& var: monitoredVariables ) {
186 if (
var.get().name().compare( filler->histogramVariablesNames()[0] ) == 0 ) {
187 {
188 auto guard{filler->getLock()};
189 filler->fill({&
var.get()});
190 }
191 if (matchedFillerList) {
192 matchedFillerList->push_back(std::move(filler));
193 }
194 break;
195 }
196 }
197 } else {
198 int matchesCount = 0;
199 Monitored::HistogramFiller::VariablesPack vars;
200 for ( const auto& var: monitoredVariables ) {
201 bool matched = false;
202 for (
unsigned fillerVarIndex = 0; fillerVarIndex < filler->histogramVariablesNames().
size(); ++fillerVarIndex ) {
203 if (
var.get().name().compare( filler->histogramVariablesNames()[fillerVarIndex] ) == 0 ) {
204 vars.
set(fillerVarIndex, &
var.get());
205 matched = true;
206 matchesCount++;
207 break;
208 }
209 }
210 if ( matchesCount == fillerCardinality ) break;
211 if ( not matched ) {
212 if (
var.get().name().compare( filler->histogramWeightName() ) == 0 ) {
214 matchesCount ++;
215 }
else if (
var.get().name().compare( filler->histogramCutMaskName() ) == 0 ) {
217 matchesCount++;
218 }
219 }
220 if ( matchesCount == fillerCardinality ) break;
221 }
222 if ( matchesCount == fillerCardinality ) {
223 {
224 auto guard{filler->getLock()};
225 filler->fill( vars );
226 }
227 if (matchedFillerList) {
228 matchedFillerList->push_back(std::move(filler));
229 }
230 }
else if (
ATH_UNLIKELY( msgLvl(MSG::DEBUG) && matchesCount != 0 ) ) {
231 invokeFillersDebug(
msg(), vars, filler, monitoredVariables);
232 }
233 }
234 }
235
236 if (matchedFillerList) {
237
238
239 m_fillerCacheMap.emplace(fillerKey(monitoredVariables), std::move(*matchedFillerList));
240 }
241}
static const Attributes_t empty
bool match(std::string s1, std::string s2)
match the individual directories of two strings
const Monitored::IMonitoredVariable * cut
pointer to cut mask variable, typically absent
void set(unsigned index, const IMonitoredVariable *ptr)
sets monitored variable at the index (may need to resize vector of variables)
const Monitored::IMonitoredVariable * weight
pointer to weight variable, typically absent