891 std::cout <<
"<TauDQMHistPlotter::endJob>:" << std::endl;
895 edm::LogError(
"endJob") <<
" Error in Configuration ParameterSet --> histograms will NOT be plotted !!";
901 edm::LogError(
"endJob") <<
" Failed to access dqmStore --> histograms will NOT be plotted !!";
912 gROOT->SetBatch(
true);
927 TPostScript* ps =
nullptr;
935 for (std::list<cfgEntryDrawJob>::const_iterator drawJob =
drawJobs_.begin(); drawJob !=
drawJobs_.end(); ++drawJob) {
938 std::cout <<
"--> processing drawJob " << drawJobName <<
"..." << std::endl;
941 TH1* stackedHistogram_sum =
nullptr;
942 std::list<TH1*> histogramsToDelete;
943 std::list<plotDefEntry*> drawOptionsToDelete;
945 typedef std::pair<TH1*, const plotDefEntry*> histogram_drawOption_pair;
946 std::list<histogram_drawOption_pair> allHistograms;
948 for (plotDefList::const_iterator
plot = drawJob->plots_.begin();
plot != drawJob->plots_.end(); ++
plot) {
952 std::cout <<
" dqmMonitorElementName_full = " << dqmMonitorElementName_full << std::endl;
955 TH1* histogram = dqmMonitorElement->
getTH1F();
957 std::cout <<
"Got Histogram " << std::endl;
961 if (histogram ==
nullptr) {
962 edm::LogError(
"endJob") <<
" Failed to access dqmMonitorElement = " << dqmMonitorElementName_full <<
","
963 <<
" needed by drawJob = " << drawJobName <<
" --> histograms will NOT be plotted !!";
967 if (!histogram->GetSumw2N())
970 const cfgEntryDrawOption* drawOptionConfig =
971 findCfgDef<cfgEntryDrawOption>(
plot->drawOptionEntry_,
drawOptionEntries_,
"drawOptionEntry", drawJobName);
972 if (drawOptionConfig ==
nullptr) {
973 edm::LogError(
"endJob") <<
" Failed to access information needed by drawJob = " << drawJobName
974 <<
" --> histograms will NOT be plotted !!";
980 TH1* histogram_centralValue = dynamic_cast<TH1*>(histogram->Clone());
981 histogram_centralValue->SetName(
std::string(histogram->GetName()).
append(
"_centralValue").data());
982 cfgEntryDrawOption drawOptionConfig_centralValue(*drawOptionConfig);
983 drawOptionConfig_centralValue.fillColor_ = 0;
984 drawOptionConfig_centralValue.fillStyle_ = 0;
985 drawOptionConfig_centralValue.drawOption_ =
"hist";
986 drawOptionConfig_centralValue.drawOptionLegend_ =
"l";
992 drawOptionName_centralValue,
993 cfgEntryDrawOption(drawOptionName_centralValue, drawOptionConfig_centralValue)));
994 plotDefEntry* plot_centralValue =
new plotDefEntry(*
plot);
995 plot_centralValue->drawOptionEntry_ = drawOptionName_centralValue;
996 allHistograms.push_back(histogram_drawOption_pair(histogram_centralValue, plot_centralValue));
997 histogramsToDelete.push_back(histogram_centralValue);
998 drawOptionsToDelete.push_back(plot_centralValue);
1001 TH1* histogram_ErrorBand = dynamic_cast<TH1*>(histogram->Clone());
1002 histogram_ErrorBand->SetName(
std::string(histogram->GetName()).
append(
"_ErrorBand").data());
1003 cfgEntryDrawOption drawOptionConfig_ErrorBand(*drawOptionConfig);
1004 drawOptionConfig_ErrorBand.markerColor_ = drawOptionConfig_ErrorBand.fillColor_;
1005 drawOptionConfig_ErrorBand.markerSize_ = 0.;
1006 drawOptionConfig_ErrorBand.lineColor_ = drawOptionConfig_ErrorBand.fillColor_;
1007 drawOptionConfig_ErrorBand.lineWidth_ = 0;
1008 drawOptionConfig_ErrorBand.drawOption_ =
"e2";
1009 drawOptionConfig_ErrorBand.drawOptionLegend_ =
"f";
1015 drawOptionName_ErrorBand, cfgEntryDrawOption(drawOptionName_ErrorBand, drawOptionConfig_ErrorBand)));
1016 plotDefEntry* plot_ErrorBand =
new plotDefEntry(*
plot);
1017 plot_ErrorBand->drawOptionEntry_ = drawOptionName_ErrorBand;
1018 plot_ErrorBand->isErrorBand_ =
true;
1019 allHistograms.push_back(histogram_drawOption_pair(histogram_ErrorBand, plot_ErrorBand));
1020 histogramsToDelete.push_back(histogram_ErrorBand);
1021 drawOptionsToDelete.push_back(plot_ErrorBand);
1022 }
else if (
plot->doStack_) {
1023 TH1* stackedHistogram = dynamic_cast<TH1*>(histogram->Clone());
1024 if (stackedHistogram_sum)
1025 stackedHistogram->Add(stackedHistogram_sum);
1026 stackedHistogram_sum = stackedHistogram;
1027 histogramsToDelete.push_back(stackedHistogram);
1028 allHistograms.push_back(histogram_drawOption_pair(stackedHistogram, &(*
plot)));
1030 allHistograms.push_back(histogram_drawOption_pair(histogram, &(*
plot)));
1036 double yAxisNorm = 0.;
1037 for (std::list<histogram_drawOption_pair>::const_iterator it = allHistograms.begin(); it != allHistograms.end();
1039 yAxisNorm =
TMath::Max(yAxisNorm, it->first->GetMaximum());
1044 const cfgEntryAxisX* xAxisConfig = findCfgDef<cfgEntryAxisX>(drawJob->xAxis_,
xAxes_,
"xAxis", drawJobName);
1045 const cfgEntryAxisY* yAxisConfig = findCfgDef<cfgEntryAxisY>(drawJob->yAxis_,
yAxes_,
"yAxis", drawJobName);
1046 const cfgEntryLegend* legendConfig = findCfgDef<cfgEntryLegend>(drawJob->legend_,
legends_,
"legend", drawJobName);
1047 if (xAxisConfig ==
nullptr || yAxisConfig ==
nullptr || legendConfig ==
nullptr) {
1048 edm::LogError(
"endJob") <<
" Failed to access information needed by drawJob = " << drawJobName
1049 <<
" --> histograms will NOT be plotted !!";
1060 legendConfig->applyTo(&
legend);
1062 std::list<histoDrawEntry> smProcessHistogramList;
1063 std::list<histoDrawEntry> bsmProcessHistogramList;
1064 std::list<histoDrawEntry> smSumHistogramList;
1065 std::list<histoDrawEntry> smSumUncertaintyHistogramList;
1066 std::list<histoDrawEntry> dataHistogramList;
1068 for (std::list<histogram_drawOption_pair>::const_iterator it = allHistograms.begin(); it != allHistograms.end();
1070 TH1* histogram = it->first;
1073 const cfgEntryDrawOption* drawOptionConfig = findCfgDef<cfgEntryDrawOption>(
1075 const cfgEntryProcess* processConfig =
1077 if (drawOptionConfig ==
nullptr || processConfig ==
nullptr) {
1078 edm::LogError(
"endJob") <<
" Failed to access information needed by drawJob = " << drawJobName
1079 <<
" --> histograms will NOT be plotted !!";
1083 if (!drawJob->title_.empty())
1084 histogram->SetTitle(drawJob->title_.data());
1086 xAxisConfig->applyTo(histogram);
1087 yAxisConfig->applyTo(histogram, yAxisNorm);
1089 bool yLogScale = (yAxisConfig->yScale_ ==
yScale_log) ?
true :
false;
1092 canvas.SetLogy(yLogScale);
1094 drawOptionConfig->applyTo(histogram);
1095 histogram->SetStats(
false);
1098 smSumUncertaintyHistogramList.push_back(
histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1100 if (processConfig->type_ ==
type_smMC) {
1101 smProcessHistogramList.push_back(
histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1102 }
else if (processConfig->type_ ==
type_bsmMC) {
1103 bsmProcessHistogramList.push_back(
histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1105 smSumHistogramList.push_back(
histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1106 }
else if (processConfig->type_ ==
type_Data) {
1107 dataHistogramList.push_back(
histoDrawEntry(histogram, drawOptionConfig->drawOption_.data()));
1114 : processConfig->legendEntryErrorBand_;
1115 legendDrawOption =
"f";
1118 legendDrawOption = drawOptionConfig->drawOptionLegend_;
1124 std::list<TPaveText>
labels;
1125 for (vstring::const_iterator labelName = drawJob->labels_.begin(); labelName != drawJob->labels_.end();
1127 const cfgEntryLabel* labelConfig = findCfgDef<cfgEntryLabel>(*labelName,
labels_,
"label", drawJobName);
1130 labelConfig->applyTo(&
label);
1142 bool isFirstHistogram =
true;
1148 for (std::list<histoDrawEntry>::reverse_iterator it = smProcessHistogramList.rbegin();
1149 it != smProcessHistogramList.rend();
1153 isFirstHistogram =
false;
1176 : modIndOutputFileName;
1177 canvas.Print(fullFileName.data());
1187 for (std::list<TH1*>::const_iterator histogram = histogramsToDelete.begin(); histogram != histogramsToDelete.end();
1189 delete (*histogram);
1192 for (std::list<plotDefEntry*>::const_iterator
drawOption = drawOptionsToDelete.begin();
1195 delete (*drawOption);