#include <ConditionsSingleton.h>
Definition at line 17 of file ConditionsSingleton.h.
◆ ConditionsSingleton() [1/2]
dqi::ConditionsSingleton::ConditionsSingleton |
( |
| ) |
|
|
privatedefault |
◆ ~ConditionsSingleton()
dqi::ConditionsSingleton::~ConditionsSingleton |
( |
| ) |
|
|
privatedefault |
◆ ConditionsSingleton() [2/2]
◆ conditionalSelect()
std::string dqi::ConditionsSingleton::conditionalSelect |
( |
std::string |
inp, |
|
|
const std::string & |
condition |
|
) |
| |
Definition at line 154 of file ConditionsSingleton.cxx.
156 boost::algorithm::erase_all(cleanCond,
" ");
157 std::map<std::string, std::string> condition_map, reference_map;
159 boost::algorithm::erase_all(inp,
" ");
161 if(inp.find(
'=')!=std::string::npos){
162 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
163 boost::char_separator<char> refSep(
";");
164 boost::char_separator<char> condSep(
",:");
165 tokenizer referenceConditionPairs(inp, refSep);
166 std::string defaultRef(
"");
167 std::map<std::string,std::string> conditionalReferences;
169 tok_iter!=referenceConditionPairs.end();++tok_iter){
170 if(std::string((*tok_iter)).
find(
'=')!=std::string::npos){
171 if(std::string(*tok_iter).find(
':')!=std::string::npos){
172 std::vector<std::string> conds;
173 boost::split(conds,*tok_iter,boost::is_any_of(std::string(
":")));
175 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
176 }
else if(conds.size()<2){
177 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
182 reference_map.clear();
185 return conds.at(conds.size()-1);
190 if(defaultRef.empty()){
191 defaultRef=*tok_iter;
193 std::cout<<
"WARNING! overwriting old default reference \""
194 <<defaultRef<<
"\" with \""
195 <<*tok_iter<<
"\""<<std::endl;
196 defaultRef=*tok_iter;
◆ conditionsMatch()
bool dqi::ConditionsSingleton::conditionsMatch |
( |
std::map< std::string, std::string > & |
refConds, |
|
|
std::map< std::string, std::string > & |
currentConds |
|
) |
| const |
Definition at line 142 of file ConditionsSingleton.cxx.
144 for (std::map<std::string, std::string>::const_iterator cond_iter = refConds.begin();
145 cond_iter != refConds.end(); ++cond_iter) {
147 if (currentConds.find((*cond_iter).first) == currentConds.end())
return false;
148 if ((*cond_iter).second != currentConds[(*cond_iter).first])
return false;
◆ getAllReferenceNames()
std::vector< std::string > dqi::ConditionsSingleton::getAllReferenceNames |
( |
std::string |
inp | ) |
const |
Definition at line 66 of file ConditionsSingleton.cxx.
67 boost::algorithm::erase_all(inp,
" ");
70 std::vector<std::string> refs;
72 if(inp.find(
'=')!=std::string::npos){
73 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
74 boost::char_separator<char> refSep(
";");
75 boost::char_separator<char> condSep(
",:");
76 tokenizer referenceConditionPairs(inp, refSep);
77 std::string defaultRef(
"");
79 tok_iter!=referenceConditionPairs.end();++tok_iter){
80 if(std::string((*tok_iter)).
find(
'=')!=std::string::npos){
81 if(std::string(*tok_iter).find(
':')!=std::string::npos){
82 std::vector<std::string> conds;
83 boost::split(conds,*tok_iter,boost::is_any_of(std::string(
":")));
85 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
86 }
else if(conds.size()<2){
87 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
90 refs.push_back(conds.at(conds.size()-1));
94 if(defaultRef.empty()){
97 std::cout<<
"WARNING! overwriting old default reference \""
98 <<defaultRef<<
"\" with \""
99 <<*tok_iter<<
"\""<<std::endl;
100 defaultRef=*tok_iter;
102 std::cout<<
"Default reference = "<<defaultRef<<std::endl;
109 if(!defaultRef.empty())refs.push_back(defaultRef);
◆ getCondition()
const std::string & dqi::ConditionsSingleton::getCondition |
( |
| ) |
const |
◆ getConditionReferencePairs()
std::vector< std::pair< std::string, std::string > > dqi::ConditionsSingleton::getConditionReferencePairs |
( |
std::string |
inp | ) |
const |
Definition at line 217 of file ConditionsSingleton.cxx.
218 std::vector<std::pair<std::string,std::string> > condPairs;
219 std::map<std::string,std::string> pairMap;
220 boost::algorithm::erase_all(inp,
" ");
221 std::string defaultRef(
"");
222 if(inp.find(
'=')!=std::string::npos){
223 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
224 boost::char_separator<char> refSep(
";");
225 boost::char_separator<char> condSep(
",:");
226 tokenizer referenceConditionPairs(inp, refSep);
227 std::map<std::string,std::string> conditionalReferences;
229 tok_iter!=referenceConditionPairs.end();++tok_iter){
230 if(std::string((*tok_iter)).
find(
'=')!=std::string::npos){
231 if(std::string(*tok_iter).find(
':')!=std::string::npos){
232 std::vector<std::string> conds;
233 boost::split(conds,*tok_iter,boost::is_any_of(std::string(
":")));
235 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
236 }
else if(conds.size()<2){
237 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
240 condPairs.push_back(std::make_pair(conds.at(conds.size()-2),conds.at(conds.size()-1)));
244 if(defaultRef.empty()){
245 defaultRef=*tok_iter;
247 std::cout<<
"WARNING! overwriting old default reference \""
248 <<defaultRef<<
"\" with \""
249 <<*tok_iter<<
"\""<<std::endl;
250 defaultRef=*tok_iter;
258 if(!defaultRef.empty())condPairs.push_back(std::make_pair(
"",defaultRef));
261 condPairs.push_back(std::make_pair(
"",inp));
◆ getInstance()
◆ getNewReferenceName()
std::string dqi::ConditionsSingleton::getNewReferenceName |
( |
const std::string & |
oldName, |
|
|
bool |
quiet = false |
|
) |
| const |
Definition at line 282 of file ConditionsSingleton.cxx.
284 std::cerr<<
"Reference must have a name"<<std::endl;
290 if(!
quiet)std::cerr<<
"Non-existent reference\""<<oldName<<
"\". Returning empty string"<<std::endl;
◆ getNewRefHistoName()
std::string dqi::ConditionsSingleton::getNewRefHistoName |
( |
| ) |
|
◆ getNumReferenceHistos()
int dqi::ConditionsSingleton::getNumReferenceHistos |
( |
| ) |
const |
◆ getRefSourceData()
std::string dqi::ConditionsSingleton::getRefSourceData |
( |
const std::string & |
rawref | ) |
const |
Definition at line 43 of file ConditionsSingleton.cxx.
51 std::cerr <<
"Unable to figure out refsource mapping: THIS IS ALSO REALLY BAD!!!" << std::endl;
52 std::cerr <<
"This happened for reference " << rawref << std::endl;
55 return value->GetName();
◆ makeConditionMap()
void dqi::ConditionsSingleton::makeConditionMap |
( |
std::map< std::string, std::string > & |
cmap, |
|
|
const std::string & |
condition |
|
) |
| |
Definition at line 117 of file ConditionsSingleton.cxx.
121 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
123 boost::algorithm::erase_all(cleanCond,
" ");
124 boost::char_separator<char> condSep(
",");
125 tokenizer conditionPairs(
condition, condSep);
126 for (tokenizer::const_iterator tok_iter = conditionPairs.begin();
127 tok_iter != conditionPairs.end(); ++tok_iter) {
128 std::vector<std::string> splitpairs;
129 boost::split(splitpairs, *tok_iter, boost::is_any_of(std::string(
"=")));
130 if (splitpairs.size() != 2) {
131 std::cerr <<
"WARNING: malformed condition \"" << *tok_iter <<
"\"" << std::endl;
134 if (cmap.find(splitpairs[0]) != cmap.end()) {
135 std::cerr <<
"WARNING: redefinition of condition " << splitpairs[0] << std::endl;
137 cmap[splitpairs[0]] = splitpairs[1];
◆ operator=()
◆ setCondition()
void dqi::ConditionsSingleton::setCondition |
( |
const std::string & |
c | ) |
|
◆ setNewReferenceName()
void dqi::ConditionsSingleton::setNewReferenceName |
( |
const std::string & |
oldName, |
|
|
const std::string & |
newName |
|
) |
| |
Definition at line 265 of file ConditionsSingleton.cxx.
267 std::cerr<<
"Warning old name of the reference is empty. New name is \""<<
newName<<
"\""<<std::endl;
271 std::cerr<<
"Warning new name of the reference is empty. Old name is \""<<oldName<<
"\""<<std::endl;
277 std::cerr<<
"Warning reference \""<<oldName<<
"\" is added to map before as \""
◆ setRefSourceMapping()
void dqi::ConditionsSingleton::setRefSourceMapping |
( |
const TMap * |
refsourcedata | ) |
|
Definition at line 36 of file ConditionsSingleton.cxx.
37 if (! refsourcedata) {
38 std::cerr <<
"You are setting a bad refsourcedata! This will cause you trouble later!" << std::endl;
◆ m_currentConditions
std::string dqi::ConditionsSingleton::m_currentConditions |
|
private |
◆ m_numRefHisto
int dqi::ConditionsSingleton::m_numRefHisto {0} |
|
private |
◆ m_referenceMap
std::map<std::string,std::string> dqi::ConditionsSingleton::m_referenceMap |
|
private |
◆ m_refsourcedata
const TMap* dqi::ConditionsSingleton::m_refsourcedata {nullptr} |
|
private |
The documentation for this class was generated from the following files: