ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
dqm_algorithms::tools::DumpConfig Class Reference

#include <DumpConfig.h>

Collaboration diagram for dqm_algorithms::tools::DumpConfig:

Public Member Functions

 DumpConfig (const std::string &ParameterName, dqm_core::test::DummyAlgorithmConfig &config, const std::string &algorithmname, const std::string &histogramname, const std::string &reffilename="", const std::string &refhistogramname="", float weight=1., const std::string &regionname="")
 
 ~DumpConfig ()
 
void DumpOnlineConfig (const std::string &filename, bool dumpAgent=true)
 
void DumpOfflineConfig (const std::string &filename)
 

Private Member Functions

void WriteThresholdFromMap (const std::map< std::string, double > &object, const std::string &ParameterName, const std::string &Name)
 
void DumpThresholds ()
 
void DumpParams ()
 
void DumpRegion ()
 
void DumpAgent ()
 

Private Attributes

std::ofstream m_myfile
 
std::map< std::string, double > m_params
 
std::map< std::string, std::string > m_strParams
 
std::map< std::string, double > m_gthresh
 
std::map< std::string, double > m_rthresh
 
std::vector< std::string > m_red_id
 
std::vector< std::string > m_green_id
 
std::vector< std::string > m_param_id
 
std::string m_ParameterName
 
dqm_core::test::DummyAlgorithmConfig m_config
 
std::string m_regionname
 
std::string m_algorithmname
 
std::string m_histogramname
 
std::string m_refhistogramname
 
std::string m_reffilename
 
float m_weight
 

Detailed Description

Definition at line 20 of file DumpConfig.h.

Constructor & Destructor Documentation

◆ DumpConfig()

dqm_algorithms::tools::DumpConfig::DumpConfig ( const std::string &  ParameterName,
dqm_core::test::DummyAlgorithmConfig &  config,
const std::string &  algorithmname,
const std::string &  histogramname,
const std::string &  reffilename = "",
const std::string &  refhistogramname = "",
float  weight = 1.,
const std::string &  regionname = "" 
)

Definition at line 10 of file DumpConfig.cxx.

18  :
19  m_ParameterName(ParameterName),
21  m_regionname(regionname),
22  m_algorithmname(algorithmname),
23  m_histogramname(histogramname),
24  m_refhistogramname(refhistogramname),
25  m_reffilename(reffilename),
27 {
28 }

◆ ~DumpConfig()

dqm_algorithms::tools::DumpConfig::~DumpConfig ( )

Definition at line 30 of file DumpConfig.cxx.

30  {
31 }

Member Function Documentation

◆ DumpAgent()

void dqm_algorithms::tools::DumpConfig::DumpAgent ( )
private

Definition at line 53 of file DumpConfig.cxx.

53  {
54  m_myfile<<"<obj class=\"DQAgent\" id=\""+m_regionname+"\">\n";
55  m_myfile<<"<attr name=\"Parameters\" type=\"string\">\"-n "+m_regionname+" -p ${TDAQ_PARTITION}\"</attr>\n";
56  m_myfile<<"<attr name=\"RestartParameters\" type=\"string\">\"-n "+m_regionname+" -p ${TDAQ_PARTITION}\"</attr>\n";
57  m_myfile<<"<attr name=\"ControlledByOnline\" type=\"bool\">1</attr>\n";
58  m_myfile<<"<attr name=\"IfDies\" type=\"enum\">\"Restart\"</attr>\n";
59  m_myfile<<"<attr name=\"IfFailed\" type=\"enum\">\"Restart\"</attr>\n";
60  m_myfile<<"<attr name=\"StartAt\" type=\"enum\">\"Boot\"</attr>\n";
61  m_myfile<<"<attr name=\"StopAt\" type=\"enum\">\"Shutdown\"</attr>\n";
62  m_myfile<<"<attr name=\"InitTimeout\" type=\"u32\">0</attr>\n";
63  m_myfile<<"<attr name=\"StartIn\" type=\"string\">\"\"</attr>\n";
64  m_myfile<<"<attr name=\"InputDevice\" type=\"string\">\"\"</attr>\n";
65  m_myfile<<"<attr name=\"Logging\" type=\"bool\">1</attr>\n";
66  m_myfile<<"<rel name=\"InitializationDependsFrom\" num=\"0\">\n";
67  m_myfile<<"</rel>\n";
68  m_myfile<<"<rel name=\"ShutdownDependsFrom\" num=\"0\"></rel>\n";
69  m_myfile<<"<rel name=\"Program\">\"Binary\" \"dqmf_agent\"</rel>\n";
70  m_myfile<<"<rel name=\"ExplicitTag\">\"\" \"\"</rel>\n";
71  m_myfile<<"<rel name=\"Uses\" num=\"0\"></rel>\n";
72  m_myfile<<"<rel name=\"ProcessEnvironment\" num=\"0\">\n";
73  m_myfile<<"</rel>\n";
74  m_myfile<<"<rel name=\"RunsOn\">\"\" \"\"</rel>\n";
75  m_myfile<<"<rel name=\"DQRegions\" num=\"1\">\n";
76  m_myfile<<" \"DQRegion\" \""+m_regionname+"\"\n";
77  m_myfile<<"</rel>\n";
78 m_myfile<<"</obj>\n";
79 
80 
81 }

◆ DumpOfflineConfig()

void dqm_algorithms::tools::DumpConfig::DumpOfflineConfig ( const std::string &  filename)

Definition at line 262 of file DumpConfig.cxx.

262  {
263 
264  m_myfile.open(filename.c_str());
265 
266  m_myfile.close();
267 
268 }

◆ DumpOnlineConfig()

void dqm_algorithms::tools::DumpConfig::DumpOnlineConfig ( const std::string &  filename,
bool  dumpAgent = true 
)

Definition at line 162 of file DumpConfig.cxx.

162  {
163 
164  m_myfile.open(filename.c_str());
165  //open file
166  int length;
167  char * buffer;
168 
169  ifstream is;
170  is.open ("../share/oks-xml-header.txt", ios::in );
171 
172  // get length of file:
173  is.seekg (0, ios::end);
174  length = is.tellg();
175  is.seekg (0, ios::beg);
176 
177  // allocate memory:
178  buffer = new char [length];
179 
180  // read data as a block:
181  is.read (buffer,length);
182  is.close();
183 
184  m_myfile.write (buffer,length);
185 
186  delete[] buffer;
187 
188  if (m_regionname != ""){
189  DumpRegion();
190  if (dumpAgent) {
191  DumpAgent();
192  }
193  }
194 
195  m_myfile << "<obj class=\"DQParameter\" id=\""+m_ParameterName+"\">\n";
196  m_myfile <<"<attr name=\"InputDataSource\" type=\"string\">\"Histogramming.PT."+m_histogramname+"\"</attr>\n";
197 
198  char weightline [500];
199  sprintf(weightline, "<attr name=\"Weight\" type=\"float\">%f</attr>\n", m_weight);
200  m_myfile<<weightline;
201  m_myfile <<"<rel name=\"Algorithm\"> \"DQAlgorithm\" \""+m_algorithmname+"\"</rel>\n";
202  m_myfile <<"<attr name=\"Action\" type=\"string\">\"\"</attr>\n";
203 
204  // Parameters....
205  m_params=m_config.getParameters();
206  int paramsize=m_params.size();
207  m_strParams=m_config.getGenericParameters();
208  paramsize+=m_strParams.size();
209 
210  char paramsline [500];
211  sprintf(paramsline, "<rel name=\"AlgorithmParameters\" num=\"%d\">\n", paramsize);
212 m_myfile <<paramsline;
213 
214  std::map<std::string,double>::const_iterator iter;
215  for ( auto& param : m_params ) {
216  m_myfile <<" \"DQAlgorithmParameter\" \"Params_"+m_ParameterName+"_"+param.first+"\"\n";
217  m_param_id.push_back("Params_"+m_ParameterName+"_"+param.first);
218  }
219  for ( auto& param : m_strParams ) {
220  m_myfile <<" \"DQAlgorithmParameter\" \"Params_"+m_ParameterName+"_"+param.first+"\"\n";
221  m_param_id.push_back("Params_"+m_ParameterName+"_"+param.first);
222  }
223  m_myfile<<"</rel>\n";
224 
225  // Reference histogram
226  if (m_refhistogramname == "" && m_reffilename=="") {
227  m_myfile<<"<rel name=\"References\" num=\"0\"> </rel>\n";
228  }else {
229  m_myfile<<"<rel name=\"References\" num=\"1\">\"DQReference\" \"ref_"+m_ParameterName+"\"</rel>\n";
230  }
231 
232  //Green Threshold............
233  m_gthresh=m_config.getGreenThresholds();
235 
236  //Red Threshold............
237  m_rthresh=m_config.getRedThresholds();
239 
240  m_myfile<<"</obj>\n\n\n";
241 
242 //References
243  if (m_refhistogramname != "" && m_reffilename != "") {
244  m_myfile<<"<obj class=\"DQReference\" id=\"ref_"+m_ParameterName+"\">\n";
245  m_myfile<<"<attr name=\"Reference\" type=\"string\">\""+m_reffilename+":"+m_refhistogramname+"\"</attr>\n";
246  m_myfile<<"<attr name=\"ExternalConditionName\" type=\"string\">\"\"</attr>\n";
247  m_myfile<<"<attr name=\"ExternalConditionValue\" type=\"double\">0</attr>\n";
248  m_myfile<<"</obj>\n\n";
249 }
250  DumpThresholds();
251 
252  DumpParams();
253 
254 
255  m_myfile<<"</oks-data>";
256 
257  m_myfile.close();
258 
259 }

◆ DumpParams()

void dqm_algorithms::tools::DumpConfig::DumpParams ( )
private

Definition at line 136 of file DumpConfig.cxx.

136  {
137 
138  char pline[500];
139  int count=0;
140 
141  for ( auto& param : m_params ) {
142  m_myfile<<"<obj class=\"DQAlgorithmParameter\" id=\""+m_param_id[count]+"\">\n";
143  m_myfile<<" <attr name=\"Name\" type=\"string\">\""+param.first+"\"</attr>\n";
144  sprintf(pline, " <attr name=\"Value\" type=\"double\" num=\"1\">%4.2f</attr>\n</obj>\n\n",param.second);
145  m_myfile<<pline;
146  ++count;
147  }
148 
149  for ( auto& param : m_strParams ) {
150  m_myfile<<"<obj class=\"DQAlgorithmParameter\" id=\""+m_param_id[count]+"\">\n";
151  m_myfile<<" <attr name=\"Name\" type=\"string\">\""+param.first+"\"</attr>\n";
152  m_myfile<<" <attr name=\"Value\" type=\"string\" num=\"1\">"+param.second+"</attr>\n";
153  m_myfile<<"</obj>\n\n";
154  ++count;
155  }
156 
157 }

◆ DumpRegion()

void dqm_algorithms::tools::DumpConfig::DumpRegion ( )
private

Definition at line 34 of file DumpConfig.cxx.

34  {
35  m_myfile<<"<obj class=\"DQRegion\" id=\""+m_regionname+"\">\n";
36  m_myfile<<"<attr name=\"InputDataSource\" type=\"string\">\"\"</attr>\n";
37  m_myfile<<"<attr name=\"Weight\" type=\"float\">1</attr>\n";
38  m_myfile<<"<attr name=\"Action\" type=\"string\">\"\"</attr>\n";
39  m_myfile<<"<rel name=\"Algorithm\">\"DQAlgorithm\" \"SimpleSummary\"</rel>\n";
40  m_myfile<<"<rel name=\"AlgorithmParameters\" num=\"0\"></rel>\n";
41  m_myfile<<"<rel name=\"References\" num=\"0\"></rel>\n";
42  m_myfile<<"<rel name=\"GreenThresholds\" num=\"0\"></rel>\n";
43  m_myfile<<"<rel name=\"RedThresholds\" num=\"0\"></rel>\n";
44  m_myfile<<"<rel name=\"DQRegions\" num=\"0\"></rel>\n";
45  m_myfile<<"<rel name=\"DQParameters\" num=\"1\">\n";
46  m_myfile<<" \"DQParameter\" \""+m_ParameterName+"\"\n";
47  m_myfile<<"</rel>\n";
48 m_myfile<<"</obj>\n\n";
49 
50 }

◆ DumpThresholds()

void dqm_algorithms::tools::DumpConfig::DumpThresholds ( )
private

Definition at line 107 of file DumpConfig.cxx.

107  {
108 
110  int count=0;
111  char line[500];
112  std::map<std::string,double> thresh;
113  std::vector<std::string> id;
114  for (int i=0; i<2;++i){
115  if (i== 0 ) {
117  id=m_green_id;
118  }else {
119  thresh=m_rthresh;
120  id=m_red_id;
121  }
122 
123  for (iter=thresh.begin();iter!=thresh.end();++iter){
124  m_myfile<<"<obj class=\"DQThreshold\" id=\""+id[count]+"\">\n";
125  m_myfile<<" <attr name=\"Name\" type=\"string\">\""+iter->first+"\"</attr>\n";
126  sprintf(line, " <attr name=\"Value\" type=\"double\">%4.2f</attr>\n</obj>\n\n",iter->second);
127  m_myfile<<line;
128  ++count;
129  }
130  count=0;
131  }
132 
133 }

◆ WriteThresholdFromMap()

void dqm_algorithms::tools::DumpConfig::WriteThresholdFromMap ( const std::map< std::string, double > &  object,
const std::string &  ParameterName,
const std::string &  Name 
)
private

Definition at line 85 of file DumpConfig.cxx.

85  {
86  int objsize=object.size();
87  char line[500];
88 sprintf(line, "<rel name=\"%sThresholds\" num=\"%d\">\n", Name.c_str(),objsize);
89  m_myfile<<line;
90  std::map<std::string,double>::const_iterator iter;
91 
92  for (iter=object.begin();iter!=object.end();++iter){
93  if (Name == "Red"){
94  m_red_id.push_back(Name+"Thresh_"+ParameterName+"_"+iter->first);
95  }else {
96  m_green_id.push_back(Name+"Thresh_"+ParameterName+"_"+iter->first);
97  }
98 
99  m_myfile <<" \"DQThreshold\" \""+Name+"Thresh_"+ParameterName+"_"+iter->first+"\"\n";
100 
101  }
102  m_myfile<<"</rel>\n";
103 
104 }

Member Data Documentation

◆ m_algorithmname

std::string dqm_algorithms::tools::DumpConfig::m_algorithmname
private

Definition at line 56 of file DumpConfig.h.

◆ m_config

dqm_core::test::DummyAlgorithmConfig dqm_algorithms::tools::DumpConfig::m_config
private

Definition at line 54 of file DumpConfig.h.

◆ m_green_id

std::vector<std::string> dqm_algorithms::tools::DumpConfig::m_green_id
private

Definition at line 50 of file DumpConfig.h.

◆ m_gthresh

std::map<std::string,double> dqm_algorithms::tools::DumpConfig::m_gthresh
private

Definition at line 47 of file DumpConfig.h.

◆ m_histogramname

std::string dqm_algorithms::tools::DumpConfig::m_histogramname
private

Definition at line 57 of file DumpConfig.h.

◆ m_myfile

std::ofstream dqm_algorithms::tools::DumpConfig::m_myfile
private

Definition at line 44 of file DumpConfig.h.

◆ m_param_id

std::vector<std::string> dqm_algorithms::tools::DumpConfig::m_param_id
private

Definition at line 51 of file DumpConfig.h.

◆ m_ParameterName

std::string dqm_algorithms::tools::DumpConfig::m_ParameterName
private

Definition at line 53 of file DumpConfig.h.

◆ m_params

std::map<std::string,double> dqm_algorithms::tools::DumpConfig::m_params
private

Definition at line 45 of file DumpConfig.h.

◆ m_red_id

std::vector<std::string> dqm_algorithms::tools::DumpConfig::m_red_id
private

Definition at line 49 of file DumpConfig.h.

◆ m_reffilename

std::string dqm_algorithms::tools::DumpConfig::m_reffilename
private

Definition at line 59 of file DumpConfig.h.

◆ m_refhistogramname

std::string dqm_algorithms::tools::DumpConfig::m_refhistogramname
private

Definition at line 58 of file DumpConfig.h.

◆ m_regionname

std::string dqm_algorithms::tools::DumpConfig::m_regionname
private

Definition at line 55 of file DumpConfig.h.

◆ m_rthresh

std::map<std::string,double> dqm_algorithms::tools::DumpConfig::m_rthresh
private

Definition at line 48 of file DumpConfig.h.

◆ m_strParams

std::map<std::string,std::string> dqm_algorithms::tools::DumpConfig::m_strParams
private

Definition at line 46 of file DumpConfig.h.

◆ m_weight

float dqm_algorithms::tools::DumpConfig::m_weight
private

Definition at line 60 of file DumpConfig.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
dqm_algorithms::tools::DumpConfig::m_refhistogramname
std::string m_refhistogramname
Definition: DumpConfig.h:58
checkFileSG.line
line
Definition: checkFileSG.py:75
dqm_algorithms::tools::DumpConfig::m_regionname
std::string m_regionname
Definition: DumpConfig.h:55
physval_make_web_display.thresh
thresh
Definition: physval_make_web_display.py:36
dqm_algorithms::tools::DumpConfig::DumpAgent
void DumpAgent()
Definition: DumpConfig.cxx:53
dqm_algorithms::tools::DumpConfig::m_reffilename
std::string m_reffilename
Definition: DumpConfig.h:59
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
dqm_algorithms::tools::DumpConfig::DumpThresholds
void DumpThresholds()
Definition: DumpConfig.cxx:107
dqm_algorithms::tools::DumpConfig::m_ParameterName
std::string m_ParameterName
Definition: DumpConfig.h:53
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
dqm_algorithms::tools::DumpConfig::WriteThresholdFromMap
void WriteThresholdFromMap(const std::map< std::string, double > &object, const std::string &ParameterName, const std::string &Name)
Definition: DumpConfig.cxx:85
lumiFormat.i
int i
Definition: lumiFormat.py:85
dqm_algorithms::tools::DumpConfig::m_weight
float m_weight
Definition: DumpConfig.h:60
dqm_algorithms::tools::DumpConfig::m_myfile
std::ofstream m_myfile
Definition: DumpConfig.h:44
dqm_algorithms::tools::DumpConfig::DumpRegion
void DumpRegion()
Definition: DumpConfig.cxx:34
dqm_algorithms::tools::DumpConfig::m_algorithmname
std::string m_algorithmname
Definition: DumpConfig.h:56
dqm_algorithms::tools::DumpConfig::m_red_id
std::vector< std::string > m_red_id
Definition: DumpConfig.h:49
dqm_algorithms::tools::DumpConfig::m_strParams
std::map< std::string, std::string > m_strParams
Definition: DumpConfig.h:46
dqm_algorithms::tools::DumpConfig::DumpParams
void DumpParams()
Definition: DumpConfig.cxx:136
dqm_algorithms::tools::DumpConfig::m_histogramname
std::string m_histogramname
Definition: DumpConfig.h:57
dqm_algorithms::tools::DumpConfig::m_gthresh
std::map< std::string, double > m_gthresh
Definition: DumpConfig.h:47
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
dqm_algorithms::tools::DumpConfig::m_green_id
std::vector< std::string > m_green_id
Definition: DumpConfig.h:50
dqm_algorithms::tools::DumpConfig::m_param_id
std::vector< std::string > m_param_id
Definition: DumpConfig.h:51
Name
JetDumper::Name Name
Definition: JetDumper.cxx:19
dqm_algorithms::tools::DumpConfig::m_params
std::map< std::string, double > m_params
Definition: DumpConfig.h:45
dqm_algorithms::tools::DumpConfig::m_rthresh
std::map< std::string, double > m_rthresh
Definition: DumpConfig.h:48
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
dqm_algorithms::tools::DumpConfig::m_config
dqm_core::test::DummyAlgorithmConfig m_config
Definition: DumpConfig.h:54