ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
dqm_algorithms::RepeatAlgorithm Class Reference

#include <RepeatAlgorithm.h>

Inheritance diagram for dqm_algorithms::RepeatAlgorithm:
Collaboration diagram for dqm_algorithms::RepeatAlgorithm:

Public Member Functions

 RepeatAlgorithm (const RepeatAlgorithm &other)
 
 RepeatAlgorithm ()
 
RepeatAlgorithmoperator= (const RepeatAlgorithm &other)
 
virtual ~RepeatAlgorithm ()
 
virtual dqm_core::Algorithm * clone ()
 
virtual dqm_core::Resultexecute (const std::string &name, const TObject &data, const dqm_core::AlgorithmConfig &config)
 
dqm_core::AlgorithmConfig * ConfigureSubAlg (const dqm_core::AlgorithmConfig &config, TObject *reference)
 
virtual void printDescription (std::ostream &out)
 

Protected Attributes

std::shared_ptr< dqm_core::Algorithm > m_subalg
 

Detailed Description

Definition at line 17 of file RepeatAlgorithm.h.

Constructor & Destructor Documentation

◆ RepeatAlgorithm() [1/2]

dqm_algorithms::RepeatAlgorithm::RepeatAlgorithm ( const RepeatAlgorithm other)

Definition at line 30 of file RepeatAlgorithm.cxx.

31  :
32  m_subalg() {
33 }

◆ RepeatAlgorithm() [2/2]

dqm_algorithms::RepeatAlgorithm::RepeatAlgorithm ( )

Definition at line 44 of file RepeatAlgorithm.cxx.

46 {
47  dqm_core::AlgorithmManager::instance().registerAlgorithm("RepeatAlgorithm", this);
48 }

◆ ~RepeatAlgorithm()

dqm_algorithms::RepeatAlgorithm::~RepeatAlgorithm ( )
virtual

Definition at line 50 of file RepeatAlgorithm.cxx.

52 {
53 }

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqm_algorithms::RepeatAlgorithm::clone ( )
virtual

Definition at line 56 of file RepeatAlgorithm.cxx.

58 {
59  return new RepeatAlgorithm(*this);
60 }

◆ ConfigureSubAlg()

dqm_core::AlgorithmConfig * dqm_algorithms::RepeatAlgorithm::ConfigureSubAlg ( const dqm_core::AlgorithmConfig &  config,
TObject *  reference 
)

Definition at line 148 of file RepeatAlgorithm.cxx.

150 {
151 // caller owns the returned object
152 
153 // what we do: copy reference, params, limits to newly created config
154 // copy all params except AuxAlgName--blah and RepeatAlgorithm--blah
155 
156  auto rv(new dqm_core::test::DummyAlgorithmConfig(reference));
157 
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);
162  }
163  }
164  for (const auto& grthr : config.getGreenThresholds()) {
165  rv->addGreenThreshold(grthr.first, grthr.second);
166  }
167  for (const auto& rdthr : config.getRedThresholds()) {
168  rv->addRedThreshold(rdthr.first, rdthr.second);
169  }
170  return rv;
171 }

◆ execute()

dqm_core::Result * dqm_algorithms::RepeatAlgorithm::execute ( const std::string &  name,
const TObject &  data,
const dqm_core::AlgorithmConfig &  config 
)
virtual

Definition at line 78 of file RepeatAlgorithm.cxx.

80 {
82  std::map<std::string,double> tags;
83  std::unique_ptr<TObjArray> returnObjs(new TObjArray);
84 
85  if (!m_subalg.get()) {
86  // rely on requested subalg not changing over time
87  std::string subalgname(dqm_algorithms::tools::ExtractAlgorithmName(config));
88  try {
89  m_subalg.reset(dqm_core::AlgorithmManager::instance().getAlgorithm(subalgname));
90  }
91  catch (dqm_core::Exception& ex) {
92  throw dqm_core::BadConfig( ERS_HERE, "RepeatAlgorithm", ex.what(), ex );
93  }
94  }
95  TObject* ref(0);
96  try {
97  ref = config.getReference();
98  } catch (dqm_core::BadConfig &) {
99  throw dqm_core::BadConfig( ERS_HERE, "RepeatAlgorithm", "No references defined for RepeatAlgorithm - this makes no sense" );
100  }
101  const TCollection* listptr(dynamic_cast<const TCollection*>(ref));
102  if (!listptr) {
103  throw dqm_core::BadConfig( ERS_HERE, "RepeatAlgorithm", "Reference needs to be a TCollection" );
104  }
105  TIter itr(listptr);
106  while ( TObject* ireference = itr.Next() ) {
107  boost::scoped_ptr<dqm_core::AlgorithmConfig> subConfig(ConfigureSubAlg(config, ireference));
108  dqm_core::Result* subResult = m_subalg->execute( name, data, *subConfig );
109  if( subResult->status_ != dqm_core::Result::Undefined ) {
111  status = ( subResult->status_ < status ) ? subResult->status_ : status;
112  }
113 
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;
118  }
119  tags[ireference->GetName() + std::string("|Status")] = subResult->status_;
120  if ( dqm_algorithms::tools::GetFirstFromMap("RepeatAlgorithm--ResultsNEntries", config.getParameters(), 0) > 0 ) {
121 
122  if( ireference->IsA()->InheritsFrom( "TH1" )){
123  TH1* hireference = dynamic_cast<TH1*>(ireference);
124  if (hireference) {
125  tags[ireference->GetName() + std::string("|NEntries")] = hireference->GetEntries();
126  }
127  }
128  }
129 
130  if (subResult->getObject()) {
131  // do nothing here; ROOT handling is terrible
132  // returnObjs->Add(subResult->getObject()->Clone());
133  }
134  //delete subConfig;
135  delete subResult;
136  }
137 
139  result->tags_ = tags;
140  if (!returnObjs->IsEmpty()) {
141  result->object_.reset(returnObjs.release());
142  }
143 
144  return result;
145 }

◆ operator=()

RepeatAlgorithm & dqm_algorithms::RepeatAlgorithm::operator= ( const RepeatAlgorithm other)

Definition at line 36 of file RepeatAlgorithm.cxx.

37  {
38  if (this != &other) {
39  m_subalg = other.m_subalg;
40  }
41  return *this;
42 }

◆ printDescription()

void dqm_algorithms::RepeatAlgorithm::printDescription ( std::ostream &  out)
virtual

Definition at line 63 of file RepeatAlgorithm.cxx.

65 {
66  std::string message;
67  message += "\n";
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";
72 
73  out << message;
74 }

Member Data Documentation

◆ m_subalg

std::shared_ptr<dqm_core::Algorithm> dqm_algorithms::RepeatAlgorithm::m_subalg
protected

Definition at line 35 of file RepeatAlgorithm.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
dqm_algorithms::RepeatAlgorithm::m_subalg
std::shared_ptr< dqm_core::Algorithm > m_subalg
Definition: RepeatAlgorithm.h:35
reference
Definition: hcg.cxx:437
ReweightUtils.message
message
Definition: ReweightUtils.py:15
dqm_algorithms::tools::ExtractAlgorithmName
std::string ExtractAlgorithmName(const dqm_core::AlgorithmConfig &config)
Definition: AlgorithmHelper.cxx:615
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
tags
std::vector< std::string > tags
Definition: hcg.cxx:102
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
dqm_algorithms::RepeatAlgorithm::RepeatAlgorithm
RepeatAlgorithm()
Definition: RepeatAlgorithm.cxx:45
python.handimod.Green
int Green
Definition: handimod.py:524
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
dq_make_web_display.rv
def rv
Definition: dq_make_web_display.py:219
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
ref
const boost::regex ref(r_ef)
TH1
Definition: rootspy.cxx:268
merge.status
status
Definition: merge.py:17
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
dqm_algorithms::RepeatAlgorithm::ConfigureSubAlg
dqm_core::AlgorithmConfig * ConfigureSubAlg(const dqm_core::AlgorithmConfig &config, TObject *reference)
Definition: RepeatAlgorithm.cxx:149