893 std::cout <<
"<TauDQMHistPlotter::endJob>:" << std::endl;
897 edm::LogError(
"endJob") <<
" Error in Configuration ParameterSet --> histograms will NOT be plotted !!";
903 edm::LogError(
"endJob") <<
" Failed to access dqmStore --> histograms will NOT be plotted !!";
914 gROOT->SetBatch(
true);
929 TPostScript* ps =
nullptr;
937 for (std::list<cfgEntryDrawJob>::const_iterator drawJob =
drawJobs_.begin(); drawJob !=
drawJobs_.end(); ++drawJob) {
940 std::cout <<
"--> processing drawJob " << drawJobName <<
"..." << std::endl;
943 TH1* stackedHistogram_sum =
nullptr;
944 std::list<TH1*> histogramsToDelete;
945 std::list<plotDefEntry*> drawOptionsToDelete;
947 typedef std::pair<TH1*, const plotDefEntry*> histogram_drawOption_pair;
948 std::list<histogram_drawOption_pair> allHistograms;
950 for (plotDefList::const_iterator
plot = drawJob->plots_.begin();
plot != drawJob->plots_.end(); ++
plot) {
954 std::cout <<
" dqmMonitorElementName_full = " << dqmMonitorElementName_full << std::endl;
957 TH1* histogram = dqmMonitorElement->
getTH1F();
959 std::cout <<
"Got Histogram " << std::endl;
963 if (histogram ==
nullptr) {
964 edm::LogError(
"endJob") <<
" Failed to access dqmMonitorElement = " << dqmMonitorElementName_full <<
"," 965 <<
" needed by drawJob = " << drawJobName <<
" --> histograms will NOT be plotted !!";
969 if (!histogram->GetSumw2N())
972 const cfgEntryDrawOption* drawOptionConfig =
973 findCfgDef<cfgEntryDrawOption>(
plot->drawOptionEntry_,
drawOptionEntries_,
"drawOptionEntry", drawJobName);
974 if (drawOptionConfig ==
nullptr) {
975 edm::LogError(
"endJob") <<
" Failed to access information needed by drawJob = " << drawJobName
976 <<
" --> histograms will NOT be plotted !!";
980 if (drawOptionConfig->drawOption_ == drawOption_eBand) {
982 TH1* histogram_centralValue =
dynamic_cast<TH1*
>(histogram->Clone());
983 histogram_centralValue->SetName(
std::string(histogram->GetName()).
append(
"_centralValue").data());
984 cfgEntryDrawOption drawOptionConfig_centralValue(*drawOptionConfig);
985 drawOptionConfig_centralValue.fillColor_ = 0;
986 drawOptionConfig_centralValue.fillStyle_ = 0;
987 drawOptionConfig_centralValue.drawOption_ =
"hist";
988 drawOptionConfig_centralValue.drawOptionLegend_ =
"l";
994 drawOptionName_centralValue,
995 cfgEntryDrawOption(drawOptionName_centralValue, drawOptionConfig_centralValue)));
996 plotDefEntry* plot_centralValue =
new plotDefEntry(*
plot);
997 plot_centralValue->drawOptionEntry_ = drawOptionName_centralValue;
998 allHistograms.push_back(histogram_drawOption_pair(histogram_centralValue, plot_centralValue));
999 histogramsToDelete.push_back(histogram_centralValue);
1000 drawOptionsToDelete.push_back(plot_centralValue);
1003 TH1* histogram_ErrorBand =
dynamic_cast<TH1*
>(histogram->Clone());
1004 histogram_ErrorBand->SetName(
std::string(histogram->GetName()).
append(
"_ErrorBand").data());
1005 cfgEntryDrawOption drawOptionConfig_ErrorBand(*drawOptionConfig);
1006 drawOptionConfig_ErrorBand.markerColor_ = drawOptionConfig_ErrorBand.fillColor_;
1007 drawOptionConfig_ErrorBand.markerSize_ = 0.;
1008 drawOptionConfig_ErrorBand.lineColor_ = drawOptionConfig_ErrorBand.fillColor_;
1009 drawOptionConfig_ErrorBand.lineWidth_ = 0;
1010 drawOptionConfig_ErrorBand.drawOption_ =
"e2";
1011 drawOptionConfig_ErrorBand.drawOptionLegend_ =
"f";
1017 drawOptionName_ErrorBand, cfgEntryDrawOption(drawOptionName_ErrorBand, drawOptionConfig_ErrorBand)));
1018 plotDefEntry* plot_ErrorBand =
new plotDefEntry(*
plot);
1019 plot_ErrorBand->drawOptionEntry_ = drawOptionName_ErrorBand;
1020 plot_ErrorBand->isErrorBand_ =
true;
1021 allHistograms.push_back(histogram_drawOption_pair(histogram_ErrorBand, plot_ErrorBand));
1022 histogramsToDelete.push_back(histogram_ErrorBand);
1023 drawOptionsToDelete.push_back(plot_ErrorBand);
1024 }
else if (
plot->doStack_) {
1025 TH1* stackedHistogram =
dynamic_cast<TH1*
>(histogram->Clone());
1026 if (stackedHistogram_sum)
1027 stackedHistogram->Add(stackedHistogram_sum);
1028 stackedHistogram_sum = stackedHistogram;
1029 histogramsToDelete.push_back(stackedHistogram);
1030 allHistograms.push_back(histogram_drawOption_pair(stackedHistogram, &(*
plot)));
1032 allHistograms.push_back(histogram_drawOption_pair(histogram, &(*
plot)));
1038 double yAxisNorm = 0.;
1039 for (std::list<histogram_drawOption_pair>::const_iterator
it = allHistograms.begin();
it != allHistograms.end();
1041 yAxisNorm =
TMath::Max(yAxisNorm,
it->first->GetMaximum());
1046 const cfgEntryAxisX* xAxisConfig = findCfgDef<cfgEntryAxisX>(drawJob->xAxis_,
xAxes_,
"xAxis", drawJobName);
1047 const cfgEntryAxisY* yAxisConfig = findCfgDef<cfgEntryAxisY>(drawJob->yAxis_,
yAxes_,
"yAxis", drawJobName);
1048 const cfgEntryLegend* legendConfig = findCfgDef<cfgEntryLegend>(drawJob->legend_,
legends_,
"legend", drawJobName);
1049 if (xAxisConfig ==
nullptr || yAxisConfig ==
nullptr || legendConfig ==
nullptr) {
1050 edm::LogError(
"endJob") <<
" Failed to access information needed by drawJob = " << drawJobName
1051 <<
" --> histograms will NOT be plotted !!";
1058 TLegend
legend(defaultLegendPosX,
1060 defaultLegendPosX + defaultLegendSizeX,
1061 defaultLegendPosY + defaultLegendSizeY);
1062 legendConfig->applyTo(&
legend);
1064 std::list<histoDrawEntry> smProcessHistogramList;
1065 std::list<histoDrawEntry> bsmProcessHistogramList;
1066 std::list<histoDrawEntry> smSumHistogramList;
1067 std::list<histoDrawEntry> smSumUncertaintyHistogramList;
1068 std::list<histoDrawEntry> dataHistogramList;
1070 for (std::list<histogram_drawOption_pair>::const_iterator
it = allHistograms.begin();
it != allHistograms.end();
1072 TH1* histogram =
it->first;
1075 const cfgEntryDrawOption* drawOptionConfig = findCfgDef<cfgEntryDrawOption>(
1077 const cfgEntryProcess* processConfig =
1079 if (drawOptionConfig ==
nullptr || processConfig ==
nullptr) {
1080 edm::LogError(
"endJob") <<
" Failed to access information needed by drawJob = " << drawJobName
1081 <<
" --> histograms will NOT be plotted !!";
1085 if (!drawJob->title_.empty())
1086 histogram->SetTitle(drawJob->title_.data());
1088 xAxisConfig->applyTo(histogram);
1089 yAxisConfig->applyTo(histogram, yAxisNorm);
1091 bool yLogScale = (yAxisConfig->yScale_ == yScale_log) ?
true :
false;
1094 canvas.SetLogy(yLogScale);
1096 drawOptionConfig->applyTo(histogram);
1097 histogram->SetStats(
false);
1100 smSumUncertaintyHistogramList.push_back(histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1102 if (processConfig->type_ == type_smMC) {
1103 smProcessHistogramList.push_back(histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1104 }
else if (processConfig->type_ == type_bsmMC) {
1105 bsmProcessHistogramList.push_back(histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1106 }
else if (processConfig->type_ == type_smSumMC) {
1107 smSumHistogramList.push_back(histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1108 }
else if (processConfig->type_ == type_Data) {
1109 dataHistogramList.push_back(histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1116 : processConfig->legendEntryErrorBand_;
1117 legendDrawOption =
"f";
1120 legendDrawOption = drawOptionConfig->drawOptionLegend_;
1126 std::list<TPaveText>
labels;
1127 for (vstring::const_iterator
labelName = drawJob->labels_.begin();
labelName != drawJob->labels_.end();
1129 const cfgEntryLabel* labelConfig = findCfgDef<cfgEntryLabel>(*
labelName,
labels_,
"label", drawJobName);
1132 labelConfig->applyTo(&
label);
1144 bool isFirstHistogram =
true;
1145 drawHistograms(smSumUncertaintyHistogramList, isFirstHistogram);
1146 drawHistograms(smSumHistogramList, isFirstHistogram);
1150 for (std::list<histoDrawEntry>::reverse_iterator
it = smProcessHistogramList.rbegin();
1151 it != smProcessHistogramList.rend();
1155 isFirstHistogram =
false;
1158 drawHistograms(bsmProcessHistogramList, isFirstHistogram);
1159 drawHistograms(dataHistogramList, isFirstHistogram);
1178 : modIndOutputFileName;
1179 canvas.Print(fullFileName.data());
1189 for (std::list<TH1*>::const_iterator histogram = histogramsToDelete.begin(); histogram != histogramsToDelete.end();
1191 delete (*histogram);
1194 for (std::list<plotDefEntry*>::const_iterator
drawOption = drawOptionsToDelete.begin();
1197 delete (*drawOption);
std::string replace_string(const std::string &src, const std::string &keyword, const std::string ¶meter, unsigned minReplacements, unsigned maxReplacements, int &errorFlag)
Log< level::Error, false > LogError
std::string dqmDirectoryName(const std::string &dqmRootDirectory, const std::string &dqmSubDirectory)
std::map< std::string, cfgEntryLegend > legends_
std::string outputFileName_
std::map< std::string, cfgEntryLabel > labels_
std::map< std::string, cfgEntryProcess > processes_
std::map< std::string, cfgEntryAxisX > xAxes_
labelName
Custom Jet reco ####.
virtual TH1F * getTH1F() const
std::string outputFilePath_
std::map< std::string, cfgEntryDrawOption > drawOptionEntries_
const std::string plotKeyword
std::list< cfgEntryDrawJob > drawJobs_
const std::string dqmRootDirectory
std::map< std::string, cfgEntryAxisY > yAxes_
std::string indOutputFileName_