10 #include "dqm_core/LibraryManager.h"
11 #include "dqm_core/AlgorithmManager.h"
13 #include "dqm_core/test/DummyAlgorithmConfig.h"
16 #include <boost/scoped_ptr.hpp>
18 #include <TCollection.h>
19 #include <TDirectory.h>
68 message +=
"Algorithm: RepeatAlgorithm\n";
69 message +=
"Description: Repeats the specified algorithm for each input reference.\n";
70 message +=
"Parameters: AuxAlgName--xxx: run algorithm xxx\n";
71 message +=
" RepeatAlgorithm--ResultsNEntries: return # of entries of reference histogram as a result\n";
82 std::map<std::string,double>
tags;
83 std::unique_ptr<TObjArray> returnObjs(
new TObjArray);
91 catch (dqm_core::Exception& ex) {
92 throw dqm_core::BadConfig( ERS_HERE,
"RepeatAlgorithm", ex.what(), ex );
98 }
catch (dqm_core::BadConfig &) {
99 throw dqm_core::BadConfig( ERS_HERE,
"RepeatAlgorithm",
"No references defined for RepeatAlgorithm - this makes no sense" );
101 const TCollection* listptr(
dynamic_cast<const TCollection*
>(
ref));
103 throw dqm_core::BadConfig( ERS_HERE,
"RepeatAlgorithm",
"Reference needs to be a TCollection" );
106 while ( TObject* ireference = itr.Next() ) {
114 std::map<std::string,double>::const_iterator tagsEnd = subResult->tags_.end();
115 std::map<std::string,double>::const_iterator tagsIter = subResult->tags_.begin();
116 for( ; tagsIter != tagsEnd; ++tagsIter ) {
117 tags[ireference->GetName() + std::string(
"|") + tagsIter->first] = tagsIter->second;
119 tags[ireference->GetName() + std::string(
"|Status")] = subResult->status_;
122 if( ireference->IsA()->InheritsFrom(
"TH1" )){
123 TH1* hireference =
dynamic_cast<TH1*
>(ireference);
125 tags[ireference->GetName() + std::string(
"|NEntries")] = hireference->GetEntries();
130 if (subResult->getObject()) {
140 if (!returnObjs->IsEmpty()) {
141 result->object_.reset(returnObjs.release());
147 dqm_core::AlgorithmConfig*
156 auto rv(
new dqm_core::test::DummyAlgorithmConfig(
reference));
158 for (
const auto& parVal :
config.getParameters()) {
159 if (parVal.first.find(
"AuxAlgName--") == std::string::npos
160 && parVal.first.find(
"RepeatAlgorithm--") == std::string::npos) {
161 rv->addParameter(parVal.first, parVal.second);
164 for (
const auto& grthr :
config.getGreenThresholds()) {
165 rv->addGreenThreshold(grthr.first, grthr.second);
167 for (
const auto& rdthr :
config.getRedThresholds()) {
168 rv->addRedThreshold(rdthr.first, rdthr.second);