ATLAS Offline Software
Loading...
Searching...
No Matches
dqi::HanAlgorithmConfig Class Reference

#include <HanAlgorithmConfig.h>

Inheritance diagram for dqi::HanAlgorithmConfig:
Collaboration diagram for dqi::HanAlgorithmConfig:

Public Member Functions

 HanAlgorithmConfig (const HanConfigAssessor &hca, TFile *config)
 HanAlgorithmConfig (TObject *reference, const std::map< std::string, double > &parameters, const std::map< std::string, std::string > &stringParameters, const std::map< std::string, double > &greenThresholds, const std::map< std::string, double > &redThresholds, const HanConfigAssessor *hca)
virtual ~HanAlgorithmConfig ()
virtual TObject * getReference () const override

Protected Member Functions

void CopyAlgConfig (const HanConfigAssessor &hca)
void CopyRuntimeConfig ()

Protected Attributes

TFile * m_file
TObject * m_ref
const HanConfigAssessorm_hca

Detailed Description

Definition at line 22 of file HanAlgorithmConfig.h.

Constructor & Destructor Documentation

◆ HanAlgorithmConfig() [1/2]

dqi::HanAlgorithmConfig::HanAlgorithmConfig ( const HanConfigAssessor & hca,
TFile * config )

Definition at line 30 of file HanAlgorithmConfig.cxx.

32 : m_file(config)
33 , m_ref(0)
34{
35 CopyAlgConfig( hca );
37}
void CopyAlgConfig(const HanConfigAssessor &hca)

◆ HanAlgorithmConfig() [2/2]

dqi::HanAlgorithmConfig::HanAlgorithmConfig ( TObject * reference,
const std::map< std::string, double > & parameters,
const std::map< std::string, std::string > & stringParameters,
const std::map< std::string, double > & greenThresholds,
const std::map< std::string, double > & redThresholds,
const HanConfigAssessor * hca )

Definition at line 39 of file HanAlgorithmConfig.cxx.

46 : m_file(0)
47 , m_ref(reference)
48 , m_hca(hca)
49{
50 m_parameters = parameters;
51 m_generic_parameters = stringParameters;
52 m_green_thresholds = greenThresholds;
53 m_red_thresholds = redThresholds;
55}
const HanConfigAssessor * m_hca

◆ ~HanAlgorithmConfig()

dqi::HanAlgorithmConfig::~HanAlgorithmConfig ( )
virtual

Definition at line 57 of file HanAlgorithmConfig.cxx.

59{
60 delete m_ref;
61}

Member Function Documentation

◆ CopyAlgConfig()

void dqi::HanAlgorithmConfig::CopyAlgConfig ( const HanConfigAssessor & hca)
protected

Definition at line 89 of file HanAlgorithmConfig.cxx.

91{
92 typedef std::map< std::string, double >::value_type ParsVal_t;
93 typedef std::map< std::string, double >::value_type ThrVal_t;
94
95 m_hca = &hca;
96
97 std::string parName;
98 TIter nextPar( hca.GetAllAlgPars() );
99 HanConfigAlgPar* par;
100 while( (par = dynamic_cast<HanConfigAlgPar*>( nextPar() )) != 0 ) {
101 parName = std::string( par->GetName() );
102 ParsVal_t parMapVal( parName, par->GetValue() );
103 m_parameters.insert( std::move(parMapVal) );
104 }
105 TIter nextStrPar( hca.GetAllAlgStrPars() );
106 HanConfigParMap* strPar;
107 while( (strPar = dynamic_cast<HanConfigParMap*>( nextStrPar() )) != 0 ) {
108 m_generic_parameters.emplace( strPar->GetName(), strPar->GetValue() );
109 }
110
111 std::string limName;
112 TIter nextLim( hca.GetAllAlgLimits() );
113 HanConfigAlgLimit* lim;
114 while( (lim = dynamic_cast<HanConfigAlgLimit*>( nextLim() )) != 0 ) {
115 limName = std::string( lim->GetName() );
116 ThrVal_t greenMapVal( limName, lim->GetGreen() );
117 m_green_thresholds.insert( std::move(greenMapVal) );
118 ThrVal_t redMapVal( limName, lim->GetRed() );
119 m_red_thresholds.insert( std::move(redMapVal) );
120 }
121
122 std::string refName( hca.GetAlgRefName() );
123 if( refName != "" ) {
124 TKey* key = dqi::getObjKey( m_file, refName );
125 if (key == NULL) {
126 std::cout << "ERROR: can't find reference " << refName << std::endl;
127 } else {
128 if (hca.GetIsRegex()) {
129 TMap* map = dynamic_cast<TMap*>(key->ReadObj());
130 if (! map) {
131 std::cerr << "Problem reading TMap input for regex" << std::endl;
132 m_ref = nullptr;
133 } else {
134 std::cout << "Get reference for " << hca.GetHistPath() << std::endl;
135 m_ref = map->GetValue(hca.GetHistPath());
136 }
137 } else {
138 // not a regex
139 m_ref = key->ReadObj();
140 }
141 }
142 }
143}
TKey * getObjKey(TDirectory *dir, const std::string &path)
Definition HanUtils.cxx:36

◆ CopyRuntimeConfig()

void dqi::HanAlgorithmConfig::CopyRuntimeConfig ( )
protected

Definition at line 146 of file HanAlgorithmConfig.cxx.

148{
150
151 m_generic_parameters.emplace( "runtime_path", runtime.getPath() );
152 if ( runtime.pathIsRunDirectory() )
153 m_parameters.emplace( "run_number", runtime.getPathRunNumber() );
154}
static HanRuntimeConfigSingleton & getInstance()

◆ getReference()

TObject * dqi::HanAlgorithmConfig::getReference ( ) const
overridevirtual

Definition at line 65 of file HanAlgorithmConfig.cxx.

67{
68 if (m_ref) {
69 TObject* rv = m_ref->Clone();
70 if (rv) {
71 return rv;
72 } else {
73 const char* parname = m_hca ? m_hca->GetName() : "???";
74 throw dqm_core::BadConfig( ERS_HERE, parname,
75 "Unable to clone reference" );
76 }
77 }
78 const char* parname = m_hca ? m_hca->GetName() : "???";
79 throw dqm_core::BadConfig( ERS_HERE, parname,
80 "No reference histogram provided" );
81}

Member Data Documentation

◆ m_file

TFile* dqi::HanAlgorithmConfig::m_file
protected

Definition at line 44 of file HanAlgorithmConfig.h.

◆ m_hca

const HanConfigAssessor* dqi::HanAlgorithmConfig::m_hca
protected

Definition at line 47 of file HanAlgorithmConfig.h.

◆ m_ref

TObject* dqi::HanAlgorithmConfig::m_ref
protected

Definition at line 46 of file HanAlgorithmConfig.h.


The documentation for this class was generated from the following files: