Skip to content
Snippets Groups Projects
Commit e3c30751 authored by Carsten Burgard's avatar Carsten Burgard :speech_balloon:
Browse files

added some error catching

parent b33b6311
No related branches found
No related tags found
2 merge requests!283Master,!212Resolve "ActionPrintSystematicsImpact not very user-friendly"
Pipeline #
......@@ -43,19 +43,21 @@ namespace TSBaseActions {
TQFolder* model = models()->getFolder(config->GetName());
if(!model){
manager->error(TString::Format("no such model available: '%s'",config->GetName()));
models()->print();
return false;
}
manager->info(TString::Format("printing for model '%s'",model->GetName()));
TQFolder textReplacements("replacements");
for(const auto& s:config->getTagVString("textReplacements")){
for(const auto& s:config->getTagVString("textReplacements")){
textReplacements.importFromTextFile(s);
}
bool showYields = config->getTagBoolDefault("showYields",false);
bool showDiff = config->getTagBoolDefault("showDifference",true);
bool useTitles = config->getTagBoolDefault("useTitles",false);
bool useTitles = config->getTagBoolDefault("useTitles",false);
std::map< std::pair< const std::string, const std::string>, std::map<const std::string, TQFolder* > > systematics;
std::map< const std::string, std::string > sampleTitles;
std::map< const std::string, std::string > sampleTitles;
std::vector<std::string> channelList;
std::vector<std::string> sampleList;
std::vector<std::string> systematicList;
......@@ -87,10 +89,10 @@ namespace TSBaseActions {
if(!sample) continue;
TString samplename(sample->GetName());
if(!TQStringUtils::removeLeadingText(samplename,"Sample.")) continue;
if(matchAny(samplename,sampleBlacklist) || !matchAny(samplename,sampleFilter)) continue;
std::string samplenamestr(samplename.Data());
std::string sampletitle = sample->getTagStandardStringDefault("style.title","");
sampleTitles[samplenamestr] = sampletitle;
if(matchAny(samplename,sampleBlacklist) || !matchAny(samplename,sampleFilter)) continue;
std::string samplenamestr(samplename.Data());
std::string sampletitle = sample->getTagStandardStringDefault("style.title","");
sampleTitles[samplenamestr] = sampletitle;
if(!in(sampleList,samplename.Data())) {
sampleList.push_back(samplename.Data());
sampleNorm.push_back(sample->getTagDoubleDefault(".integral.nominal",0.));
......@@ -166,16 +168,11 @@ namespace TSBaseActions {
jOffset++;
continue; //this entry doesn't exist (we skipped it before)
}
if(useTitles){
table->setEntry(0, j+1-jOffset, sampleTitles[sampleList[j]]);
} else {
table->setEntry(0, j+1-jOffset, textReplace(TString(sampleList[j].data()),textReplacements));
}
TString collabel = useTitles ? sampleTitles[sampleList[j]] : textReplace(TString(sampleList[j].data()),textReplacements);
table->setEntry(0, j+1-jOffset, collabel);
for(size_t k=0; k<nSysts; ++k){
//if (j==0) { //on first iteration over all syst, create row label
table->setEntry(k+1,0,textReplace(TString(systematicList[k].data()),textReplacements));
//}
TString rowlabel = textReplace(TString(systematicList[k].data()),textReplacements);
table->setEntry(k+1,0,rowlabel);
TQFolder* syst = systematics[coordinate][systematicList[k]];
if(!syst){
if(verbose)
......
......@@ -26,6 +26,7 @@ namespace TSBaseActions {
TQFolder* model = models()->getFolder(config->GetName());
if(!model){
manager->error(TString::Format("no such model available: '%s'",config->GetName()));
return false;
}
TQFolderIterator transfers = config->getListOfFolders("?");
......@@ -205,9 +206,7 @@ namespace TSBaseActions {
}
}
return (i>0);
}
}
//no valid mode was selected
manager->error("Failed to perform, no valid mode was selected!");
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment