Skip to content
Snippets Groups Projects
Commit c0f2d0f7 authored by Benedict Winter's avatar Benedict Winter
Browse files

Add missing piece to use transfer for imported (mostly theory) systematics

parent b122108d
No related branches found
No related tags found
2 merge requests!664analysis developments,!611WIP: Histogram processing harmonization
Pipeline #1734208 passed
......@@ -218,9 +218,17 @@ namespace TSBaseActions {
TQFolder* copy = systematic->copy();
copy->setTagString("transferred",source->GetName());
if(systematic->hasTagString("HistoLow") && systematic->hasTagString("HistoHigh")){
if(!systematic->hasTagString("HistoRelLow") or !systematic->hasTagString("HistoRelHigh")){
manager->warn(TString::Format("Transfer for HistoSys only supported for imported systematics. Will instead delete %s HistoSys for region %s and sample %s",systematic->GetName(),region->GetName(),sample->GetName()));
delete copy;
continue;
}
TString nameLow = TString::Format("%s_%s_HistoLow",region->GetName(),sample->GetName());
TString nameHigh = TString::Format("%s_%s_HistoHigh",region->GetName(),sample->GetName());
TH1* nomHist = dynamic_cast<TH1*>(histograms->getObject(sample->getTagStringDefault("Histo","")));
TH1* lowHist = dynamic_cast<TH1*>(histograms->getObject(systematic->getTagStringDefault("HistoRelLow","")));
TH1* highHist = dynamic_cast<TH1*>(histograms->getObject(systematic->getTagStringDefault("HistoRelHigh","")));
TH1* lowHist = dynamic_cast<TH1*>(histograms->getObject(systematic->getTagStringDefault("HistoRelLow",""))->Clone(nameLow));
TH1* highHist = dynamic_cast<TH1*>(histograms->getObject(systematic->getTagStringDefault("HistoRelHigh",""))->Clone(nameHigh));
if(!TQHistogramUtils::checkConsistency(nomHist,lowHist) || !TQHistogramUtils::checkConsistency(nomHist,highHist)){
manager->error(TString::Format("transferred histograms are inconsistent, skipping!\n\tnom\t%s\n\tlow\t%s\n\thigh\t%s",TQStringUtils::getDetails(nomHist).Data(),TQStringUtils::getDetails(lowHist).Data(),TQStringUtils::getDetails(highHist).Data()));
delete copy;
......@@ -228,13 +236,16 @@ namespace TSBaseActions {
}
lowHist->Multiply(nomHist);
highHist->Multiply(nomHist);
// FIXME HAVE TO REPLACE UP WITH 'highHist' AND LOW WITH 'lowHist'
/*
TString destlow=TString(std::string(systematic->getTagStringDefault("HistoLow",""))+"!");
TString desthigh=TString(std::string(systematic->getTagStringDefault("HistoHigh",""))+"!");
histograms->addObject(lowHist,destlow.Data());
histograms->addObject(highHist,desthigh.Data());
*/
TString histoPathLow=systematic->getTagStringDefault("HistoLow","");
TString histoPathHigh=systematic->getTagStringDefault("HistoHigh","");
TQFolder::getPathTail(histoPathLow);
TQFolder::getPathTail(histoPathHigh);
TQStringUtils::ensureTrailingText(histoPathLow,"/");
TQStringUtils::ensureTrailingText(histoPathHigh,"/");
histograms->addObject(lowHist,histoPathLow.Data());
histograms->addObject(highHist,histoPathHigh.Data());
copy->setTagString("HistoLow",TQFolder::concatPaths(histoPathLow.Data(),lowHist->GetName()));
copy->setTagString("HistoHigh",TQFolder::concatPaths(histoPathHigh.Data(),highHist->GetName()));
}
++j;
sample->addFolder(copy);
......
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