178 {
179
181 DQParSet_t::const_iterator regexEnd =
m_regexlist.end();
182 for (DQParSet_t::const_iterator regex =
m_regexlist.begin(); regex != regexEnd; ++regex)
183 {
184 TSeqCollection* resultList = (*m_outputMap)[*
regex];
185 if (resultList == 0)
186 {
187 std::cerr << "Can't find original list for regex???" << std::endl;
188 }
189 else
190 {
191 tmpRegex.insert(DQOutputMap_t::value_type(*regex, resultList));
192 (*m_outputMap).erase(*regex);
193 DQParMap_t::const_iterator
i =
m_dqPars.find(*regex);
195 {
196 dqm_core::Region*
parent =
i->second;
197
199
200 static_cast<TSeqCollection*
>((*m_outputMap)[
parentName])->Remove(resultList);
201 }
202 }
203 }
204
205
206 DQResultMap_t::const_iterator rEnd =
m_dqResults.end();
207 for (DQResultMap_t::const_iterator
r =
m_dqResults.begin();
r != rEnd; ++
r)
208 {
209 const std::string
name(
r->first);
210 const dqm_core::Result&
result(*(
r->second));
211
213 DQParMap_t::const_iterator
i =
m_dqPars.find(name);
214
216 {
217 dqm_core::Region*
parent =
i->second;
219 }
220
221
222 TSeqCollection* resultList = (*m_outputMap)[
name];
224 std::string storename(name);
225
226 if (resultList == NULL)
227 {
228
229 bool isRegex = false;
231 for (DQParSet_t::const_iterator regex =
m_regexlist.begin(); regex != regexEnd; ++regex)
232 {
233 std::string::size_type regexlen =
regex->length();
234 if (*regex +
"_" ==
name.substr(0, regexlen + 1))
235 {
236 isRegex = true;
238 std::string::size_type atsign =
regex->rfind(
'@');
239 if (atsign != std::string::npos)
240 {
241 extra =
regex->substr(atsign, std::string::npos);
242 }
243 storename =
name.substr(regexlen + 1, std::string::npos);
244 break;
245 }
246 }
247 if (isRegex)
248 {
250 {
251 std::cerr << "WARNING: setInput() has not been set; cannot publish regex results" << std::endl;
252 continue;
253 }
254 resultList =
static_cast<TSeqCollection*
>(tmpRegex[
parname]->Clone());
255 (*m_outputMap)[storename +
extra] = resultList;
256 DQParMap_t::const_iterator
i =
m_dqPars.find(parname);
258 std::cerr << "WARNING: Can't find parname in m_dqPars" << std::endl;
259 continue;
260 }
262 bool use_full_name = false;
264 {
265 std::unique_ptr<const HanConfigAssessor>
a(
m_config->GetAssessor(parentName, parname));
267 {
268 std::string store_using_path;
269 const HanConfigParMap* hcpm =
a->GetAnnotation(
"store_using_path");
270 if (hcpm)
271 {
272 store_using_path.assign(hcpm->GetValue());
273 }
274 boost::algorithm::to_lower(store_using_path);
275 if (store_using_path == "1" || store_using_path == "yes" || store_using_path == "true")
276 {
277 use_full_name = true;
278 }
279 }
280 }
281 if (use_full_name)
282 {
283 resultList->SetName((boost::algorithm::replace_all_copy(storename, "/", "_") + extra + "_").c_str());
284 }
285 else
286 {
287 resultList->SetName((storename + extra + "_").c_str());
288 }
289 dynamic_cast<TSeqCollection*
>((*m_outputMap)[
parentName])->Add(resultList);
291 if (key != 0)
292 {
293 const char* className =
key->GetClassName();
294 if ((strncmp(className, "TH", 2) == 0) || (strncmp(className, "TGraph", 6) == 0) ||
295 (strncmp(className, "TProfile", 8) == 0) || (strncmp(className, "TEfficiency", 11) == 0))
296 {
297 TNamed* transobj =
dynamic_cast<TNamed*
>(
key->ReadObj());
298 if (transobj != NULL)
299 {
300 HanHistogramLink* hhl =
new HanHistogramLink(
m_input, storename);
301 if (use_full_name)
302 {
303 hhl->SetName((boost::algorithm::replace_all_copy(storename, "/", "_") + extra).c_str());
304 }
305 else
306 {
307 hhl->SetName((std::string(transobj->GetName()) + extra).c_str());
308 }
309
310
311 resultList->Add(hhl);
312 }
313 else
314 {
315 std::cerr << "TNamed* cast failed for " << storename << std::endl;
316 }
317 }
318 }
319 else
320 {
321 std::cout << "key is NULL" << std::endl;
322 }
323 }
324 else
325 {
326 std::cerr <<
"WARNING: Unable to find mapping for " <<
name << std::endl;
327 continue;
328 }
329 }
330
331
332 if (resultList)
333 {
334 resultList = dynamic_cast<TSeqCollection*>(resultList->FindObject("Results"));
335 }
336
337 if (resultList == nullptr)
338 {
339 std::cerr <<
"Warning: no result list found associated with '" <<
name <<
"'\n";
340 continue;
341 }
342
343
344 resultList->Add(
newTObjArray(
"Status",
new TObjString(StatusToStr(
result.status_).c_str()), 1));
345
346
347 std::map<std::string, double>::const_iterator
iter =
result.tags_.begin();
349 {
350 std::ostringstream tagval;
351 tagval << std::setprecision(4) <<
iter->second;
352 resultList->Add(
newTObjArray(
iter->first.c_str(),
new TObjString(tagval.str().c_str()), 1));
353 }
354
355
356 TObject* resultobj =
result.getObject();
357 if (resultobj != 0)
358 {
359 TObject* resultobjclone = resultobj->Clone();
361 {
362 resultList->Add(resultobjclone);
363 }
364 else
365 {
366 std::cerr <<
"Discarding result object " <<
result.getObject()->GetName() << std::endl;
367 delete resultobjclone;
368 }
369 }
370
372 {
373 TObject*
ref =
m_config->GetReference(parentName, parname);
375 {
377 {
378 resultList->Add(
ref);
379 }
380 else
381 {
382 std::cerr <<
"Discarding reference object " <<
ref->GetName() << std::endl;
383 }
384 }
385 }
386 }
387 }
const boost::regex ref(r_ef)
std::map< std::string, TSeqCollection * > DQOutputMap_t
TSeqCollection * newTObjArray(const char *name, TObject *obj=0, Int_t size=TCollection::kInitCapacity)
bool setNameGeneral(TObject *obj, const std::string &name)
TKey * getObjKey(TDirectory *dir, const std::string &path)