#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 153 of file ConditionsSingleton.cxx.
155 std::erase(cleanCond,
' ');
156 std::map<std::string, std::string> condition_map, reference_map;
160 if(inp.find(
'=')!=std::string::npos){
161 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
162 boost::char_separator<char> refSep(
";");
163 boost::char_separator<char> condSep(
",:");
164 tokenizer referenceConditionPairs(inp, refSep);
165 std::string defaultRef(
"");
166 std::map<std::string,std::string> conditionalReferences;
168 tok_iter!=referenceConditionPairs.end();++tok_iter){
169 if(std::string((*tok_iter)).
find(
'=')!=std::string::npos){
170 if(std::string(*tok_iter).find(
':')!=std::string::npos){
171 std::vector<std::string> conds;
172 boost::split(conds,*tok_iter,boost::is_any_of(std::string(
":")));
174 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
175 }
else if(conds.size()<2){
176 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
181 reference_map.clear();
184 return conds.at(conds.size()-1);
189 if(defaultRef.empty()){
190 defaultRef=*tok_iter;
192 std::cout<<
"WARNING! overwriting old default reference \""
193 <<defaultRef<<
"\" with \""
194 <<*tok_iter<<
"\""<<std::endl;
195 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 141 of file ConditionsSingleton.cxx.
143 for (std::map<std::string, std::string>::const_iterator cond_iter = refConds.begin();
144 cond_iter != refConds.end(); ++cond_iter) {
146 if (currentConds.find((*cond_iter).first) == currentConds.end())
return false;
147 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 65 of file ConditionsSingleton.cxx.
69 std::vector<std::string> refs;
71 if(inp.find(
'=')!=std::string::npos){
72 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
73 boost::char_separator<char> refSep(
";");
74 boost::char_separator<char> condSep(
",:");
75 tokenizer referenceConditionPairs(inp, refSep);
76 std::string defaultRef(
"");
78 tok_iter!=referenceConditionPairs.end();++tok_iter){
79 if(std::string((*tok_iter)).
find(
'=')!=std::string::npos){
80 if(std::string(*tok_iter).find(
':')!=std::string::npos){
81 std::vector<std::string> conds;
82 boost::split(conds,*tok_iter,boost::is_any_of(std::string(
":")));
84 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
85 }
else if(conds.size()<2){
86 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
89 refs.push_back(conds.at(conds.size()-1));
93 if(defaultRef.empty()){
96 std::cout<<
"WARNING! overwriting old default reference \""
97 <<defaultRef<<
"\" with \""
98 <<*tok_iter<<
"\""<<std::endl;
101 std::cout<<
"Default reference = "<<defaultRef<<std::endl;
108 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 216 of file ConditionsSingleton.cxx.
217 std::vector<std::pair<std::string,std::string> > condPairs;
218 std::map<std::string,std::string> pairMap;
220 std::string defaultRef(
"");
221 if(inp.find(
'=')!=std::string::npos){
222 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
223 boost::char_separator<char> refSep(
";");
224 boost::char_separator<char> condSep(
",:");
225 tokenizer referenceConditionPairs(inp, refSep);
226 std::map<std::string,std::string> conditionalReferences;
228 tok_iter!=referenceConditionPairs.end();++tok_iter){
229 if(std::string((*tok_iter)).
find(
'=')!=std::string::npos){
230 if(std::string(*tok_iter).find(
':')!=std::string::npos){
231 std::vector<std::string> conds;
232 boost::split(conds,*tok_iter,boost::is_any_of(std::string(
":")));
234 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
235 }
else if(conds.size()<2){
236 std::cerr<<
"Warning malformed reference \""<<inp<<
"\""<<std::endl;
239 condPairs.push_back(std::make_pair(conds.at(conds.size()-2),conds.at(conds.size()-1)));
243 if(defaultRef.empty()){
244 defaultRef=*tok_iter;
246 std::cout<<
"WARNING! overwriting old default reference \""
247 <<defaultRef<<
"\" with \""
248 <<*tok_iter<<
"\""<<std::endl;
249 defaultRef=*tok_iter;
257 if(!defaultRef.empty())condPairs.push_back(std::make_pair(
"",defaultRef));
260 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 281 of file ConditionsSingleton.cxx.
283 std::cerr<<
"Reference must have a name"<<std::endl;
289 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 42 of file ConditionsSingleton.cxx.
50 std::cerr <<
"Unable to figure out refsource mapping: THIS IS ALSO REALLY BAD!!!" << std::endl;
51 std::cerr <<
"This happened for reference " << rawref << std::endl;
54 return value->GetName();
◆ makeConditionMap()
void dqi::ConditionsSingleton::makeConditionMap |
( |
std::map< std::string, std::string > & |
cmap, |
|
|
const std::string & |
condition |
|
) |
| |
Definition at line 116 of file ConditionsSingleton.cxx.
120 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
122 std::erase(cleanCond,
' ');
123 boost::char_separator<char> condSep(
",");
124 tokenizer conditionPairs(
condition, condSep);
125 for (tokenizer::const_iterator tok_iter = conditionPairs.begin();
126 tok_iter != conditionPairs.end(); ++tok_iter) {
127 std::vector<std::string> splitpairs;
128 boost::split(splitpairs, *tok_iter, boost::is_any_of(std::string(
"=")));
129 if (splitpairs.size() != 2) {
130 std::cerr <<
"WARNING: malformed condition \"" << *tok_iter <<
"\"" << std::endl;
133 if (cmap.find(splitpairs[0]) != cmap.end()) {
134 std::cerr <<
"WARNING: redefinition of condition " << splitpairs[0] << std::endl;
136 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 264 of file ConditionsSingleton.cxx.
266 std::cerr<<
"Warning old name of the reference is empty. New name is \""<<
newName<<
"\""<<std::endl;
270 std::cerr<<
"Warning new name of the reference is empty. Old name is \""<<oldName<<
"\""<<std::endl;
276 std::cerr<<
"Warning reference \""<<oldName<<
"\" is added to map before as \""
◆ setRefSourceMapping()
void dqi::ConditionsSingleton::setRefSourceMapping |
( |
const TMap * |
refsourcedata | ) |
|
Definition at line 35 of file ConditionsSingleton.cxx.
36 if (! refsourcedata) {
37 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: