#include "TCanvas.h"
#include "TH1.h"
#include "TStyle.h"
#include "TROOT.h"
#include "TFile.h"
#include "TDirectory.h"
#include "TLegend.h"
#include "TLatex.h"
#include "THStack.h"
#include "TParameter.h"
#include "TMap.h"
#include "TMath.h"
#include "TGraphAsymmErrors.h"
#include "TGraphErrors.h"
#include "TArrow.h"
#include "TLine.h"
#include "TH2.h"
#include "TH3.h"
#include "TGaxis.h"
#include "TFormula.h"
#include "TF1.h"
#include "TF2.h"
#include "TFitResult.h"
#include "TRandom3.h"
#include "TObjArray.h"

#include "QFramework/TQNamedTaggable.h"
#include "QFramework/TQCompPlotter.h"
#include "QFramework/TQSampleDataReader.h"
#include "QFramework/TQHistogramUtils.h"
#include "QFramework/TQStringUtils.h"
#include "QFramework/TQUtils.h"
#include "QFramework/TQIterator.h"

// #define _DEBUG_
#include "QFramework/TQLibrary.h"

#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <stdlib.h>
#include <cmath>

////////////////////////////////////////////////////////////////////////////////////////////////
//
// TQCompPlotter:
//
// The TQCompPlotter provides advanced plotting features for the H->WW->lvlv analysis.
// It inherits basic plotting functionality from the abstract TQPlotter base class.
//
////////////////////////////////////////////////////////////////////////////////////////////////

ClassImp(TQCompPlotter)

//__________________________________________________________________________________|___________

TQCompPlotter::TQCompPlotter() : TQROOTPlotter() {
  // Default constructor of TQCompPlotter class
}

//__________________________________________________________________________________|___________

TQCompPlotter::TQCompPlotter(TQSampleFolder * baseSampleFolder) : TQROOTPlotter(baseSampleFolder) {
  // Constructor of TQCompPlotter class
}

//__________________________________________________________________________________|___________

TQCompPlotter::TQCompPlotter(TQSampleDataReader * dataSource) : TQROOTPlotter(dataSource) {
  // Constructor of TQCompPlotter clas
}

//______________________________________________________________________________________________

TQCompPlotter::~TQCompPlotter() {
  // Destructor of TQCompPlotter class:
}

//__________________________________________________________________________________|___________

void TQCompPlotter::reset() {
  // reset all the processes 
  TQPlotter::reset();
}

//__________________________________________________________________________________|___________

void TQCompPlotter::setStyle(TQTaggable& tags){
  // setup the default style tags
  double padScaling = 1.;
  double ratioPadScaling = 1.;
  double additionalTopMargin = 0.;
  bool showSub = tags.getTagBoolDefault("style.showSub",false);
  double ratioPadRatio = tags.getTagDoubleDefault("geometry.sub.height",0.35);
  //@tag: [style.topLegend] If this argument tag is set to true, the legend is shown at the top of the plot. Default: false.
  if(tags.getTagBoolDefault("style.topLegend",false)){
    tags.setTagDouble("geometry.main.margins.top",0.25);
    tags.setTagInteger("style.legend.fillColor",kWhite);
    tags.setTagInteger("style.legend.fillStyle",1001);
    tags.setTagDouble("labels.info.yPos",0.9);
    tags.setTagDouble("style.labels.yPos",0.9);
    tags.setTagBool("style.showMissing",false);
    tags.setTagDouble("legend.yMin",0.75);
    tags.setTagDouble("legend.yMax",0.95);
  }

  tags.setTagDouble("geometry.main.margins.top", 0.05);
  if((tags.hasTag("style.heatmap")|| tags.hasTag("style.migration")) && tags.getTagIntegerDefault("style.nDim",1) == 2){ //only change the margin if it's an actual 2D plot.
      tags.setTagDouble("geometry.main.margins.right", 0.12);
  } else {
    tags.setTagDouble("geometry.main.margins.right", 0.05);
  }
  tags.setTagDouble("geometry.main.margins.left", 0.16);
 
  tags.setTagDouble("geometry.main.xMin",0.);
  tags.setTagDouble("geometry.main.xMax",1.);
  tags.setTagDouble("geometry.main.yMax",1.);

  tags.setTagInteger("geometry.canvas.height",600);
  if (showSub){
    //@tag: [style.ratioTopMargin] This argument tag sets the top margin for ratio plots. Default: 0.015
    tags.setTagDouble("geometry.sub.margins.top", tags.getTagDoubleDefault("style.ratioTopMargin",0.015));
    tags.setTagDouble("geometry.sub.margins.bottom",0.16);
    tags.setTagDouble("geometry.sub.margins.left", 0.16);
    tags.setTagDouble("geometry.sub.margins.right", 0.05);
    tags.setTagInteger("geometry.canvas.width",600);
    padScaling = 1. / 8. * 6.;
    ratioPadScaling = (1. / ratioPadRatio) / 8. * 6.;
    additionalTopMargin = 0.1 * (padScaling - 1);
    tags.setTagDouble("geometry.main.additionalTopMargin",additionalTopMargin);
    tags.setTagDouble("geometry.main.scaling",padScaling);
    tags.setTagDouble("geometry.sub.scaling",ratioPadScaling);
 
    tags.setTagDouble("geometry.sub.xMin",0.);
    tags.setTagDouble("geometry.sub.yMin",0.);
    tags.setTagDouble("geometry.sub.xMax",1.);
    tags.setTagDouble("geometry.sub.yMax",ratioPadRatio);
    tags.setTagDouble("geometry.main.yMin",0);
    tags.setTagDouble("geometry.main.margins.bottom",ratioPadRatio/padScaling);
 
    tags.setTagBool("style.main.xAxis.showLabels",false);
    tags.setTagBool("style.main.xAxis.showTitle",false);
  } else {
    tags.setTagDouble("geometry.main.margins.bottom",0.16);
    tags.setTagDouble("geometry.main.yMin",0.);
    tags.setTagInteger("geometry.canvas.width",800);
  }

  tags.setTagInteger("style.text.font",42);
  tags.setTagDouble("style.textSize",0.05);
  // tags.setTagDouble("style.markerSize",1.2);
  tags.setTagInteger("style.markerType",20);

  tags.setTagInteger("style.main.lineColor",0);
  tags.setTagInteger("style.main.markerColor",0);
  tags.setTagInteger("style.main.fillColor",0);
  tags.setTagInteger("style.main.fillStyle",0);

  tags.setTagInteger("style.main.totalBkg.lineColor",kBlue);
  tags.setTagInteger("style.main.totalBkg.lineWidth",1);
  tags.setTagInteger("style.main.totalBkg.fillColor",0);
  tags.setTagInteger("style.main.totalBkg.fillStyle",0);
  tags.setTagInteger("style.main.totalBkgError.fillColor",14);
  tags.setTagInteger("style.main.totalBkgError.fillStyle",3254);

  tags.setTagInteger("style.ratio.mcErrorBand.fillColor",kOrange -2);
  tags.setTagInteger("style.ratio.mcErrorBand.fillStyle",1001);
  tags.setTagInteger("style.optScan.default.fillColor",kOrange -2);
  tags.setTagInteger("style.optScan.default.fillStyle",1001);
  tags.setTagInteger("style.optScan.left.fillColor",kRed);
  tags.setTagInteger("style.optScan.left.fillStyle",1001);
  tags.setTagInteger("style.optScan.right.fillColor",kBlue);
  tags.setTagInteger("style.optScan.right.fillStyle",1001);
 
  tags.setTagInteger("style.main.data.lineWidth",2);
  // tags.setTagDouble ("style.main.data.markerSize",1.0);
  // tags.setTagInteger("style.main.data.lineColor",kBlack);

  tags.setTagInteger("style.significance.fillColor",kRed);
  tags.setTagInteger("style.significance.fillStyle",1001);
  tags.setTagInteger("style.significance.lineColor",0);
  tags.setTagInteger("style.significance.lineStyle",0);

  //@tag:[style.tickLength] This argument tag controls the length of the x- and y-axis ticks. Default: 0.03
  double tickLength = tags.getTagDoubleDefault("style.tickLength",0.03);
  tags.setTagDouble("geometry.main.yAxis.tickLength",tickLength);
  tags.setTagDouble("geometry.main.xAxis.tickLength",tickLength);
  tags.setTagDouble("geometry.sub.yAxis.tickLength", tickLength*0.8); 
  // I found that the y ticks need to be scaled by 0.8 in the ratio plot in order to match the main plot
  // if anybody understands the reason behind this, please add a comment or eMail me: cburgard@cern.ch
  tags.setTagDouble("geometry.sub.xAxis.tickLength",tickLength);

  //@tag:[style.sub.yAxis.nDiv] This tag controls the number of divisions/ticks of the sub plot. The number of top level ticks is given by the two least significant digits (in decimal notation). The second two least significant digits determine the number of sub divisions (smaller ticks), the thrid least significant set of two digits controls the sub-sub-devisions. Default: 510 (10 top level divisions, 5 sub divisions)
  tags.setTagInteger("style.sub.yAxis.nDiv",tags.getTagIntegerDefault("style.ratio.nYdiv",510));

  tags.setTagDouble("legend.xMin",0.59);
  tags.setTagDouble("legend.xMax",0.90);
  tags.setTagDouble("legend.yMin",0.70);
  tags.setTagDouble("legend.yMax",0.92);

  tags.setTagBool("errors.showX",true);
  tags.setTagDouble("erros.widthX",0.5);
}

//__________________________________________________________________________________|___________

TObjArray* TQCompPlotter::collectHistograms(TQTaggable& tags){
  // use the TQSampleDataReader to retrieve all histograms from the sample folder
  
  bool verbose = tags.getTagBoolDefault("verbose",false );
  //@tag:[normalization] This argument tag allows to normalize histograms. Integral is normalized to the given value.
  bool normalize = tags.hasTag("normalization");
  tags.setTag("normalize",normalize);

  //@tag: [style.showUnderflow,style.showOverflow] This argument tag controls if under/overflow bins are shown in the histogram. Default: false.
  bool showUnderflow = tags.getTagBoolDefault ("style.showUnderflow",false);
  bool showOverflow = tags.getTagBoolDefault ("style.showOverflow",false );
  tags.setTagBool("includeOverflow",showOverflow);
  tags.setTagBool("includeUnderflow",showUnderflow);

  double normalization = tags.getTagDoubleDefault("normalization", 1.);
  bool includeUnderOverFlow = tags.getTagBoolDefault("includeUnderOverFlow",false);
  TString integralOptions = tags.getTagStringDefault("integralOptions",""); //set this to "width" to include the bin width when computing the histogram integral for normalization
  
  std::vector<TString> paths = std::vector<TString>();
  std::vector<TString> cuts = std::vector<TString>();
  if (tags.getTag("path",paths) < 1) {
    ERRORclass("no paths defined (path.0=\"processPath\")");
    tags.printTags();
    return NULL;
  }
  if (tags.getTag("name",cuts) < 1) {
    ERRORclass("no histograms defined (name.0=\"cut/variable\")");
    tags.printTags();
    return NULL;
  }
  if (paths.size() != cuts.size()) {
    ERRORclass("lists of paths and histograms have different lengths");
    return NULL;
  }
  TObjArray* histos = new TObjArray();
  
  for (size_t i=0; i<paths.size(); ++i) {
    TQTaggable tmpTags;
    tmpTags.importTagsWithoutPrefix(tags,TString::Format("style.%d.",(int)i),true);
    tmpTags.importTagsWithoutPrefix(tags,"style.",false);
    tmpTags.importTagsWithoutPrefix(this,"style.",false);
    tmpTags.setTagBool("includeOverflow",showOverflow);
    tmpTags.setTagBool("includeUnderflow",showUnderflow);
    TH1* h = this->fReader->getHistogram(paths.at(i),cuts.at(i),&tmpTags);
    if (!h) {
      WARNclass("Failed to retrieve histogram");
      continue;
    }
    if (h->GetDimension() > 1) {
      WARNclass("Only one dimensional histograms are supported, skipping...");
      continue;
    }
    h->SetName(TString::Format("hist.%d",(int)i));
    if (normalize) h->Scale(normalization/h->Integral( (includeUnderOverFlow ? 0 : 1) , h->GetNbinsX() + (includeUnderOverFlow ? 1 : 0)  , integralOptions));
    h->SetTitle(tmpTags.getTagStringDefault(TString::Format("label.%d",(int)(i)),h->GetTitle()));
    histos->Add(h);
  }
  
  // check consistency and create master histogram 
  TH1* hMaster = NULL;
  bool consistent = checkConsistency(hMaster, histos);
 
  // stop if there is no valid histogram or histograms are invalid
  if (!consistent){
    if(verbose) VERBOSEclass("consistency check failed");
    delete histos;
    return NULL;
  }
  if (!hMaster){
    if(verbose) VERBOSEclass("no histograms found");
    delete histos;
    return NULL;
  }
  
  hMaster->Reset();
  hMaster->SetTitle(tags.getTagStringDefault("title",hMaster->GetTitle()));
  TQTH1Iterator itr(histos);
  TH1* hMax = TQHistogramUtils::copyHistogram(hMaster,"totalBkg");
  while(itr.hasNext()) {
    TH1* h = itr.readNext();
    for (int i=0; i<std::min(TQHistogramUtils::getNBins(h),TQHistogramUtils::getNBins(hMax)); ++i) {
      hMax->SetBinContent(i,std::max(h->GetBinContent(i),hMax->GetBinContent(i)));
    }
  }
  this->addObject(hMax,"totalBkg");
  this->addObject(hMaster,"master");
  this->addObject(histos,"histos");

  return histos;
}

//__________________________________________________________________________________|___________

void TQCompPlotter::makeLegend(TQTaggable& tags, TObjArray* histos){
  // create a legend including the given list of histograms
  // @tags:style.showEventYields: show event yields (integral counts) in the legend
  // @tags:style.showEventYields.useUnderOverflow: include underflow and overflow in the event yields displayed in the legend (default:true)
  // @tags:style.nLegendCols: number of columns to be shown in legend
  // @tags:style.legendHeight: scaling factor for height of the legend
  bool showEventYields = tags.getTagBoolDefault ("style.showEventYields",false);
  int nLegendCols = tags.getTagIntegerDefault ("style.nLegendCols",showEventYields ? 1 : 2);
  double legendHeight = tags.getTagDoubleDefault ("style.legendHeight",1. );

  // the nominal coordinates of the legend

  // @tags:[geometry.legend.xMin,geometry.legend.xMax,geometry.legend.yMin,geometry.legend.yMax]: control the geometry of the legend in relative coordinates
  double x1 = tags.getTagDoubleDefault("geometry.legend.xMin",0.59);
  double y1 = tags.getTagDoubleDefault("geometry.legend.yMin",0.70) - tags.getTagDoubleDefault("geometry.main.additionalTopMargin",0.);
  double x2 = tags.getTagDoubleDefault("geometry.legend.xMax",0.90);
  double y2 = tags.getTagDoubleDefault("geometry.legend.yMax",0.92) - tags.getTagDoubleDefault("geometry.main.additionalTopMargin",0.);

  // if we plot the ratio, the canvas has to be divided which results in a
  // scaling of the legend. To avoid this, we have to rescale the legend's
  // position
  y1 = y2 - (y2 - y1) * tags.getTagDoubleDefault("geometry.main.scaling",1.);

  // calculate the number of entries
  int nEntries = 0;
  //@tag: style.showMissing: show empty legend entries where histogram is empty or could not be retrieved (default:true)
  bool showMissing = tags.getTagBoolDefault ("style.showMissing",true );
 
  nEntries += (showMissing ? histos->GetEntriesFast() : histos->GetEntries());

  // calculate the height of the legend
  int nLegendRows = (int)nEntries / nLegendCols + ((nEntries % nLegendCols) > 0 ? 1 : 0);
  legendHeight *= (y2 - y1) * (double)nLegendRows / 5.;

  // set the height of the legend
  y1 = y2 - legendHeight;
  // create the legend and set some attributes
  double tmpx1 = x1; 
  double tmpx2 = x2; 
  double tmpy1 = y1; 
  double tmpy2 = y2; 
 
  TLegend* legend = new TLegend(tmpx1, tmpy1, tmpx2, tmpy2);
  this->addObject(legend,"legend");
  legend->SetBorderSize(0);
  legend->SetNColumns(nLegendCols);
  if(tags.getTagBoolDefault("style.useLegendPad",false)){
    //@tags:style.useLegendPad: put the legend on a separate pad on the side of the plot
    legend->SetFillColor(0);
    legend->SetFillStyle(0);
  } else {
    //@tags:[style.legend.fillColor,style.legend.fillStyle]: control color and style of the legend with TLegend::SetFillColor and TLegend::SetFillStyle. defaults are 0.
    legend->SetFillColor(tags.getTagIntegerDefault("style.legend.fillColor",0));
    legend->SetFillStyle(tags.getTagIntegerDefault("style.legend.fillStyle",0));
  }
  //@tags: style.legend.textSize: control the font size (floating point number, default is 0.032)
  //@tags: style.legend.textSizeFixed: boolean to control whether the text size will be interpreted relative to canvas size (default) or absolute
  double textsize = tags.getTagDoubleDefault("style.legend.textSize",0.032);
  if (tags.getTagBoolDefault ("style.legend.textSizeFixed", false))
    legend->SetTextSize(textsize);
  else
    legend->SetTextSize(textsize * tags.getTagDoubleDefault("geometry.main.scaling",1.));
 
  
    //addAllHistogramsToLegend(tags,legend, ".isBackground", tags.getTagStringDefault("legend.dataDisplayType",".legendOptions='lep'"));
  
  
  // add the total background histogram to the legend
  TQTH1Iterator itr(histos);
  while (itr.hasNext()) {
    TH1* h = itr.readNext();
    if (!h) continue;
    TString id = h->GetName();
    TQStringUtils::removeLeadingText(id,"hist.");
    legend->AddEntry(h,tags.getTagStringDefault("label."+id,id));
  }
}

//__________________________________________________________________________________|___________

void TQCompPlotter::drawLegend(TQTaggable& tags){
  // draw the legend produced by TQCompPlotter::makeLegend
  bool verbose = tags.getTagBoolDefault("verbose",false);
  if(verbose) VERBOSEclass("drawing legend");
  TLegend* legend = this->getObject<TLegend>("legend");
  // draw the legend
  if(tags.getTagBoolDefault("style.useLegendPad",false)){
    this->getPad("legend");
    legend->Draw();
  } else {
    legend->Draw("same");
  }
}

//__________________________________________________________________________________|___________

TCanvas * TQCompPlotter::makePlot(TString/*histogram*/, TQTaggable& tags) {
  // master-function controlling the plotting
  bool verbose = tags.getTagBoolDefault("verbose",false);
 
  if(verbose) VERBOSEclass("entering function");
  
  gStyle->SetOptStat(false);
  gStyle->SetOptFit(false);
  gStyle->SetOptTitle(false);

  //////////////////////////////////////////////////////
  // obtain the histograms
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("collecting histograms");
  TObjArray* histos = this->collectHistograms(tags);
  if(!histos) return NULL;

  /*
  TQTH1Iterator histitr(histos);
  int nEntries = 0;
  bool is2D = false;
  while(histitr.hasNext()){
    TH1* hist = histitr.readNext();
    nEntries += hist->GetEntries();
    if(dynamic_cast<TH2*>(hist)) is2D=true;
  }
  if(nEntries < 1){
    WARNclass("refusing to plot histogram '%s' - no entries!",histogram.Data());
    return NULL;
  }
*/
  //////////////////////////////////////////////////////
  // the ratio plot can only be shown if there is a valid
  // data histogram and at least one MC background histogram 
  //////////////////////////////////////////////////////

  //if(verbose) VERBOSEclass("sanitizing tags");
  
  // @tag:style.overrideTotalBkgRequirement: usually, 1D plots without background are skipped. force plotting data/signal only with this option.
  
  TH1* hMaster = this->getObject<TH1>("master");
  if (!hMaster){
    if(verbose) VERBOSEclass("no master histogram found, quitting");
    return NULL;
  }
  TH1* hTotalBkg = this->getObject<TH1>("totalBkg");
  if (!hTotalBkg){
    if(verbose) VERBOSEclass("no maximum-bin-entries histogram found, quitting");
    return NULL;
  }

  /*@tag:[style.showRatio]
    
    control what is shown in the sub-plot. all of these default to 'false', only showing the main plot.
    if any of these are set to true, the corresponding sub plot is shown. only one sub plot can be shown at a time.

    style.showRatio: show the ratio between data and signal+bkg
   */
  bool showRatio = tags.getTagBoolDefault ("style.showRatio",false);
  int nDim = tags.getTagIntegerDefault("style.nDim",1);
  if(nDim != 1){
    showRatio = false;
  }
  
  //////////////////////////////////////////////////////
  // set and apply the style
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("applying style");
  this->setStyle(tags);

  double xscaling = tags.getTagDoubleDefault("geometry.xscaling",1.);
  //@tags:[geometry.main.*] control geometry parameters of the main pad
  this->applyGeometry(tags,hMaster, "main", xscaling,tags.getTagDoubleDefault("geometry.main.scaling",1.));
  this->applyStyle (tags,hMaster, "main", xscaling,tags.getTagDoubleDefault("geometry.main.scaling",1.));
  this->applyStyle (tags,hTotalBkg,"main.totalBkg",xscaling,tags.getTagDoubleDefault("geometry.main.scaling",1.));
 
  //////////////////////////////////////////////////////
  // canvas and pads
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("creating canvas");
  TCanvas * canvas = this->createCanvas(tags);
  if(!canvas) return NULL;
  canvas->Draw();
  TPad* pad = this->getPad("main");
  if(!pad){
    delete canvas;
    return NULL;
  }
  canvas->cd();

  bool axisOK = this->calculateAxisRanges1D(tags);
  if(!axisOK){
    if(verbose) VERBOSEclass("encountered invalid axis ranges, using defaults");
  }
  //////////////////////////////////////////////////////
  // create the stack
  //////////////////////////////////////////////////////
 /*
  if(hTotalBkg && nDim == 1){
    if(verbose) VERBOSEclass("stacking histograms");
    this->stackHistograms(tags,"stack");
  }
*/
  //////////////////////////////////////////////////////
  // legend
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("creating legend");
  if(tags.getTagBoolDefault("style.useLegendPad",false)){
    canvas->cd();
    TPad * legendPad = this->createPad(tags,"legend");
    legendPad->Draw();
    this->getPad("legend");
    if(!legendPad) return NULL;
    this->makeLegend(tags,histos);
  } else {
    this->makeLegend(tags,histos);
  }

  //////////////////////////////////////////////////////
  // basic label setup
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("setting labels");
  TString label;
  tags.setGlobalOverwrite(true);
  /*
  int labelidx = 0;  
  if (tags.getTagString("labels.lumi", label)){
    labelidx++;
    tags.setTagString(TString::Format("labels.%d",labelidx), label);
  }
  if (tags.getTagString("labels.process", label)){
    labelidx++;
    tags.setTagString(TString::Format("labels.%d",labelidx), label);
  }
  */

//  tags.setGlobalOverwrite(false);

  //////////////////////////////////////////////////////
  // draw main pad
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("drawing main pad");
  this->getPad("main");
  if(nDim == 1){
    if(!tags.getTagBoolDefault("allow1D",true))	return NULL;
    bool ok = this->drawHistograms(tags);
    if(!ok){
      return NULL;
    }
    this->drawLegend(tags);
    if(verbose) VERBOSEclass("drawing cut lines");
    this->drawCutLines1D(tags);
  } else {
    ERRORclass("unsupported dimensionality (nDim=%d)!",nDim);
    return NULL;
  }

  //////////////////////////////////////////////////////
  // draw the labels
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("drawing labels");
  this->setAxisLabels(tags);
  this->drawLabels(tags);

  //////////////////////////////////////////////////////
  // redraw main pad
  //////////////////////////////////////////////////////
  
  if(verbose) VERBOSEclass("refreshing drawing area");
  pad->RedrawAxis();
  pad->Update();
  pad->cd();

  //////////////////////////////////////////////////////
  // draw sub pad
  //////////////////////////////////////////////////////

  if(tags.getTagBoolDefault("style.showSub",false)){
    if(verbose) VERBOSEclass("drawing subplot");
    canvas->cd();
    
    if (showRatio){
      if(verbose) VERBOSEclass("drawing ratio");
      this->drawRatio(tags);
    } 
  }

  if(verbose) VERBOSEclass("all done!");
  // return the canvas
  return canvas;
}

//__________________________________________________________________________________|___________

bool TQCompPlotter::drawHistograms(TQTaggable& tags){
  // draw the stack produced by TQHWWPlotter::stackHistograms
  
  
  bool verbose = tags.getTagBoolDefault("verbose",false);

  TH1* hMaster = this->getObject<TH1>("master");
  if(!hMaster) return false;

  // the first histogram to draw is the SM histogram.
  hMaster->Draw("hist");
 
  
  if(tags.getTagBoolDefault("errors.showX",true)){
    double errWidthX = 0.5;
    if(tags.getTagDouble("errors.widthX", errWidthX))
      gStyle->SetErrorX(errWidthX);
  } else {
    gStyle->SetErrorX(0.);
  }

  //////////////////////////////////////////////////////
  // calculate axis ranges
  // rescale to avoid graphical collisions
  //////////////////////////////////////////////////////

  if(verbose) VERBOSEclass("calculating axis ranges & rescaling histograms");
  bool axisOK = this->calculateAxisRanges1D(tags);
  if(!axisOK){
    if(verbose) VERBOSEclass("encountered invalid axis ranges, using defaults");
  }

  //////////////////////////////////////////////////////
  // draw everything
  //////////////////////////////////////////////////////

  //@tag:style.*.drawOptions: control the draw options of this process (default: 'hist' for MC, 'ep' for data)
  
  if(verbose) VERBOSEclass("drawing histograms");
  // draw signal
  TQTH1Iterator itr(this->getObject<TObjArray>("histos"));
  while(itr.hasNext()){
    TH1* h = itr.readNext();
    if(!h) continue;
    TString id = h->GetName();
    TQStringUtils::removeLeadingText(id,"hist.");
    TQTaggable tmpTags;
    tmpTags.importTagsWithoutPrefix(tags,"style."+id+".");
    //set all kinds of drawing options for the histogram
    h->SetFillStyle(tmpTags.getTagIntegerDefault("fillStyle",0));
    h->SetFillColorAlpha(tmpTags.getTagIntegerDefault("fillColor",0),tmpTags.getTagDoubleDefault("fillColorAlpha",1.));
    h->SetLineColorAlpha(tmpTags.getTagIntegerDefault("lineColor",1),tmpTags.getTagDoubleDefault("lineColorAlpha",1.));
    h->SetLineWidth(tmpTags.getTagIntegerDefault("lineWidth",1));
    h->SetLineStyle(tmpTags.getTagIntegerDefault("lineStyle",1));
    h->SetMarkerColorAlpha(tmpTags.getTagIntegerDefault("markerColor",1),tmpTags.getTagDoubleDefault("makerColorAlpha",1.));
    h->SetMarkerSize(tmpTags.getTagDoubleDefault("markerSize",1.0));
    h->SetMarkerStyle(tmpTags.getTagIntegerDefault("markerStyle",1));
    
    h->Draw(tmpTags.getTagStringDefault("drawOptions", "hist") + " same");
  }
  
  return true;
}

//__________________________________________________________________________________|___________

bool TQCompPlotter::calculateAxisRanges1D(TQTaggable& tags){
  // calculate the axis ranges, taking into account the given block tags
  bool logScale = tags.getTagBoolDefault ("style.logScale",false );
  bool verbose = tags.getTagBoolDefault("verbose",false);
 
  TH1* hTotalBkg = this->getObject<TH1>("totalBkg");
  TList* histograms = new TList();
  if (hTotalBkg) histograms->Add(hTotalBkg);

  double min = std::numeric_limits<double>::infinity();
  TQTH1Iterator itr(this->getObject<TObjArray>("histos"));
  while(itr.hasNext()){
    TH1* h = itr.readNext();
    if(!h) continue;
    histograms->Add(h);
    double tmpmin = TQHistogramUtils::getMin(h, true);
    if(tmpmin < min) min = tmpmin;
  }
  
  if(logScale && min < tags.getTagDoubleDefault("style.logMinMin",1e-9) ) min = tags.getTagDoubleDefault("style.logMinMin",1e-9);

  bool showSub = tags.getTagBoolDefault ("style.showSub",false);
  double yVetoLeft = 0.84;
  TList* labels = tags.getTagList("labels");
  if (labels) yVetoLeft -= (showSub ? 0.08 : 0.09) * (double)labels->GetEntries() * tags.getTagDoubleDefault("geometry.main.scaling",1.);
  delete labels;

  double yVetoRight = tags.getTagDoubleDefault("legend.yMin",0.5) - tags.getTagDoubleDefault("legend.margin.right",0.05);
 
  tags.setTagDouble("blocks.x.0",0.5); tags.setTagDouble("blocks.y.0",yVetoLeft);
  tags.setTagDouble("blocks.x.1",1.0); tags.setTagDouble("blocks.y.1",yVetoRight);

  double max_precise = this->getHistogramUpperLimit(tags, histograms,min,true);
  delete histograms;

  tags.getTagDouble("style.min", min);
  if(logScale){
    tags.getTagDoubleDefault("style.logMin",min);
  } else {
    tags.getTagDoubleDefault("style.linMin",min);
  }

  double max;
  if(max_precise <= 0 || !TQUtils::isNum(max_precise) || max_precise < min){
    max = std::max(2*min,10.);
    if(verbose) VERBOSEclass("using default range");
  } else {
    if(verbose) VERBOSEclass("using rounded range");
    max = TQUtils::roundAutoUp(max_precise);
  }
 
  if(verbose) VERBOSEclass("calculated y-axis range is %g < y < %g (%g)",min,max,max_precise);
 
  // the user might want to overwrite the automatic upper limit on the y axis
  tags.getTagDouble("style.max", max);
  double maxscale = 1.0;
  tags.getTagDouble("style.max.scale", maxscale);

  TH1* hMaster = this->getObject<TH1>("master");
  hMaster->SetMinimum(min);
  hMaster->SetMaximum(max * maxscale);

  return !(max == 0);
}

//__________________________________________________________________________________|___________

void TQCompPlotter::drawLabels(TQTaggable& tags){
  // draw the labels given by the tags

  if(!tags.getTagBoolDefault("style.showLabels",true)) return;

  double scaling = tags.getTagDoubleDefault("geometry.main.scaling",1.);
  double textsize = tags.getTagDoubleDefault("style.textSize",0.05);
  int font = tags.getTagDoubleDefault("style.text.font",42);
  int color = tags.getTagDoubleDefault("style.text.color",1);
  double xscaling = tags.getTagDoubleDefault("geometry.xscaling",1.);

  double x = tags.getTagDoubleDefault("style.labels.xOffset",0.2)*xscaling;
 
  double y = tags.getTagDoubleDefault("style.labels.yPos",0.86 - tags.getTagDoubleDefault("geometry.main.additionalTopMargin",0.));
 
  bool drawATLAS = tags.getTagBoolDefault ("labels.drawATLAS",true);
 
  TString nfLabel = "";
  if(tags.getTagBoolDefault ("labels.drawNFInfo",false)){
    TString tmpLabel = tags.getTagStringDefault("labels.nfInfo","#color[2]{(NF applied for %s)}");
    if(TQStringUtils::countText(tmpLabel,"%s") == 1){
      TString nflist = this->getScaleFactorList(tags.getTagStringDefault("input.bkg",""));
      if(!nflist.IsNull()){
        nfLabel = TString::Format(tmpLabel.Data(),nflist.Data());
      }
    }
  }

  TString infoLabel = tags.getTagBoolDefault ("labels.drawInfo",true) ? tags.getTagStringDefault ("labels.info",TString::Format("Plot: \"%s\"", tags.getTagStringDefault("input.name","histogram").Data())) : "";
  TString atlasLabel = tags.getTagStringDefault ("labels.atlas","Private");
  TString stickerLabel = tags.getTagStringDefault ("labels.sticker","");
 
  if (drawATLAS) {
    // draw the ATLAS label
    TLatex l;
    l.SetNDC();
    l.SetTextFont(72);
    l.SetTextSize(textsize * tags.getTagDoubleDefault("labels.drawATLAS.scale",1.25) * scaling);
    l.SetTextColor(1);
    l.DrawLatex(x, y, tags.getTagStringDefault("labels.drawATLAS.text","ATLAS"));
  }
 
  if (!atlasLabel.IsNull()){
    // draw the ATLAS label addition
    TLatex p;
    p.SetNDC();
    p.SetTextFont(font);
    p.SetTextColor(color);
    p.SetTextSize(textsize * tags.getTagDoubleDefault("labels.atlas.scale",1.25) * scaling);
    p.DrawLatex(x + tags.getTagDoubleDefault("labels.atlas.xOffset",0.16)*xscaling, y, atlasLabel.Data());
  }
 
  if (!infoLabel.IsNull()){
    // draw the info label
    if(!nfLabel.IsNull()){
      infoLabel.Prepend(" ");
      infoLabel.Prepend(nfLabel);
    }
    TLatex l0;
    l0.SetNDC();
    l0.SetTextFont(font);
    bool newPlotStyle = tags.getTagBoolDefault ("style.newPlotStyle", false);
    if (newPlotStyle)
      l0.SetTextSize(textsize * tags.getTagDoubleDefault("labels.info.size",0.6) * scaling * 0.7);
    else
      l0.SetTextSize(textsize * tags.getTagDoubleDefault("labels.info.size",0.6) * scaling);
    l0.SetTextColor(color);
    double xpos = tags.getTagDoubleDefault("geometry.main.margins.left",0.16) + tags.getTagDoubleDefault("labels.info.xPos",1.)*(1. - tags.getTagDoubleDefault("geometry.main.margins.right",0.05) - tags.getTagDoubleDefault("geometry.main.margins.left",0.16));
    double ypos = 1. - scaling*(1.-tags.getTagDoubleDefault("labels.info.yPos",0.2))*tags.getTagDoubleDefault("geometry.main.margins.top",0.05);
    l0.SetTextAlign(tags.getTagIntegerDefault("labels.info.align",31));
    l0.DrawLatex(xpos, ypos, infoLabel.Data());
  }

  // draw additional labels
  TQIterator itr(tags.getTagList("labels"),true);
  double marginStep = tags.getTagDoubleDefault("style.labels.marginStep",0.06);
  double labelTextScale = tags.getTagDoubleDefault("style.labels.scale",0.85);
  size_t index = 1;
  while(itr.hasNext()){
    TObject* obj = itr.readNext();
    if(!obj) break;
    TLatex latex;
    latex.SetNDC();
    latex.SetTextFont(font);
    latex.SetTextSize(textsize * labelTextScale * scaling);
    latex.SetTextColor(color);
    latex.DrawLatex(x, y - marginStep * index * scaling,obj->GetName());
    index++;
  }
}

//__________________________________________________________________________________|___________

//__________________________________________________________________________________|___________

void TQCompPlotter::drawRatio(TQTaggable& tags){
  // draw a ratio-plot in the sub-pad
  double ratioMax = tags.getTagDoubleDefault ("style.ratioMax",1000.);
  double ratioMin = tags.getTagDoubleDefault ("style.ratioMin",0.);
  double ratioMaxQerr = tags.getTagDoubleDefault ("style.ratioMaxQerr",std::numeric_limits<double>::infinity());
  bool forceRatioLimits = tags.getTagBoolDefault ("style.forceRatioLimits",false );
  //bool asymmSysErrorBand = tags.getTagBoolDefault("errors.drawAsymmSysMC", false);
  bool verbose = tags.getTagBoolDefault("verbose",false);
  TObjArray* hArr = this->getObject<TObjArray>("histos");
  if (!hArr) {
    throw std::runtime_error("Failed to retrieve histogram array!");
  }
  int denom_index = tags.getTagIntegerDefault("denominatorIndex",0);
  std::vector<int> num_index = tags.getTagVInteger("numeratorIndex");
  if (num_index.size() < 1) {
    num_index.push_back(1);
  }
  
  TH1* h_denominator = dynamic_cast<TH1*>(hArr->FindObject(  ("hist."+std::to_string(denom_index)).c_str()  ));
  if(!h_denominator) return;
  if (verbose) VERBOSEclass("Found denominator histogram");
  
  //TObjArray* histosAsymmSys = 0;
  //if (asymmSysErrorBand) {
  //  histosAsymmSys = this->getObject<TObjArray>("asymmSys");
  //}
 
  TPad* ratioPad = this->getPad("sub");
  if(!ratioPad) return;
  ratioPad->cd();
 
  int nBins = h_denominator->GetNbinsX();

  int nPoints = 0;
  for (int i = 1; i <= nBins; i++) {
    if (h_denominator->GetBinContent(i) != 0.) {
      nPoints++;
    }
  }

  // the graph used to draw the error band on the ratio
  if(verbose) VERBOSEclass("generating ratio error graphs");
  TGraphAsymmErrors * ratioErrorGraph = new TGraphAsymmErrors(nPoints);
  ratioErrorGraph->SetTitle("Monte Carlo ratio error band");
  this->addObject(ratioErrorGraph,"ratioErrorGraph");
  //TGraphAsymmErrors * asymmErrorGraph;
  //if (asymmSysErrorBand){
  //  asymmErrorGraph = TQHistogramUtils::getGraph(h_denominator, histosAsymmSys);
  //  this->addObject(asymmErrorGraph,"asymmSysErrorBand");
  //}

  int iPoint = 0;
  for (int iBin = 1; iBin <= nBins; iBin++) {
    double MC = h_denominator->GetBinContent(iBin);
    double MCErr = h_denominator->GetBinError(iBin);
    double MCErrUpper = MCErr;
    double MCErrLower = MCErr;
    //if (asymmSysErrorBand) {
    //  MCErrUpper = asymmErrorGraph->GetErrorYhigh(iBin);
    //  MCErrLower = asymmErrorGraph->GetErrorYlow(iBin);
    //}
    if(MCErr == 0 || MC == 0) continue;
    double ratioBandErrorUpper = MCErrUpper / MC;
    double ratioBandErrorLower = MCErrLower / MC;
    // set the position and the width of the ratio error band
    ratioErrorGraph->SetPoint(iPoint, h_denominator->GetBinCenter(iBin), 1.);
 
    ratioErrorGraph->SetPointError(iPoint, h_denominator->GetBinWidth(iBin) / 2.,
                                   h_denominator->GetBinWidth(iBin) / 2.,
                                   ratioBandErrorLower, ratioBandErrorUpper);
    // if shape sys turned on we will have asymmetric error
    iPoint++;
  }

  if(verbose) VERBOSEclass("calculating geometry and axis ranges");
  // set the x range of the ratio graph to match the one of the main histogram
  double xLowerLimit = h_denominator->GetBinLowEdge(1);
  double xUpperLimit = h_denominator->GetBinLowEdge(nBins) + h_denominator->GetBinWidth(nBins);
  ratioErrorGraph->GetXaxis()->SetLimits(xLowerLimit, xUpperLimit);
  double ratioPadScaling = tags.getTagDoubleDefault("geometry.sub.scaling",1.);
  double xscaling = tags.getTagDoubleDefault("geometry.xscaling",1.);
  this->applyStyle (tags,ratioErrorGraph,"ratio.mcErrorBand",xscaling,ratioPadScaling);
  this->applyGeometry(tags,ratioErrorGraph,"sub" ,xscaling,ratioPadScaling);

  if(verbose) VERBOSEclass("drawing ratio error graph");
  ratioErrorGraph->Draw("A2");
  TH1* hMaster = this->getObject<TH1>("master");
  ratioErrorGraph->GetHistogram()->GetXaxis()->SetTitle(hMaster->GetXaxis()->GetTitle());
 
  TString dataLabel("");
  TList* graphs = new TList();
  TList* hists = new TList();
  for (size_t i=0; i<num_index.size();++i) {
    if (verbose) VERBOSEclass("trying to add 'hist.%d'",num_index[i]);
    TH1* h = dynamic_cast<TH1*>( hArr->FindObject(("hist."+std::to_string(num_index[i])).c_str()));
    if (!h) continue;
    hists->Add(h);
  }
  
  // graphs->SetOwner(true);

  // actual minimum and maximum ratio
  double actualRatioMin = 1.;
  double actualRatioMax = 1.;

  if(verbose) VERBOSEclass("generating ratio graphs");
  // loop over data histograms
  TQTH1Iterator itr(hists);

  /*if (tags.getTagBoolDefault("useToyData",false))
  {
    // set the x range of the dmb graph to match the one of the main histogram
    TH1 * h_numerator = TQHistogramUtils::copyHistogram(this->getObject<TH1>("toyData"),"tmp");
    TQTaggableIterator itr2(fProcesses);
    if(dataLabel.IsNull()) dataLabel = h_numerator->GetTitle();
    hists->Add(h_numerator);
  }*/

  while(itr.hasNext()){
    if (verbose) VERBOSEclass("generating numerator variant");
    // get the data histogram
    TH1* h_numerator = itr.readNext();
    //if(!hist) continue;
    //if(!hist->getTagBoolDefault(".isData",false)) continue;
    //TH1 * h_numerator = this->getObject<TH1>(this->makeHistogramIdentifier(process));
    if(!h_numerator) continue;
    if(dataLabel.IsNull()) dataLabel = h_numerator->GetTitle();
    //hists->Add(h_numerator);

    // calculate the number of valid ratio points: ratio points are considered
    // valid if they have a finite value (MC prediction != 0) (--> nPoints) and
    // the observed data is greater than zero (--> nRatioPoints)
    int nRatioPoints = 0;
    for (int i = 1; i <= nBins; i++) {
      double mcVal = h_denominator->GetBinContent(i);
      double dataVal = h_numerator->GetBinContent(i);
      if(mcVal == 0) continue;
      if(dataVal == 0) continue;
      if(!TQUtils::isNum(mcVal)){
        WARNclass("encountered non-numeric MC value: %f",mcVal);
        continue;
      }
      if(!TQUtils::isNum(dataVal)){
        WARNclass("encountered non-numeric data value: %f",dataVal);
        continue;
      }
      nRatioPoints++;
    }
 
    if(nRatioPoints < 1){
      // there is nothing to draw -- well, let's do nothing, then
      continue;
    }
 
    // the graph used to draw the ratio points
    TGraphErrors * ratioGraph = new TGraphErrors(nRatioPoints);
    this->addObject(ratioGraph,TString::Format("ratioGraph_%s",h_numerator->GetName()));
    ratioGraph->SetTitle(TString::Format("%s (ratio)",h_numerator->GetTitle()));
    ratioGraph->SetLineColor(h_numerator->GetLineColor());
    ratioGraph->SetMarkerSize(h_numerator->GetMarkerSize());
    ratioGraph->SetMarkerStyle(h_numerator->GetMarkerStyle());
    ratioGraph->SetMarkerColor(h_numerator->GetMarkerColor());
 
    int iRatioPoint = 0;
 
    // loop over all bins of the histogram
    for (int iBin = 1; iBin <= nBins; iBin++) {
      double x = h_denominator->GetBinCenter(iBin);
      // get the values and errors of data and MC for this bin
      //"numerator" = "data" in HWWPlotter (h_denominator = hTotalBackground)
      double numerator = h_numerator ->GetBinContent(iBin);
      double numeratorErr = h_numerator ->GetBinError (iBin);
      double denominator = h_denominator->GetBinContent(iBin);
      // cannot do anything if MC expectation is zero
      if (denominator == 0. || numerator <= 0.) continue;
 
      double ratio = numerator / denominator;
      double ratioError = ratio * numeratorErr / numerator;
      if(verbose) VERBOSEclass("adding ratio point with x=%f, y=%f (numerator=%f, denominator=%f)",x,ratio,numerator,denominator);
      ratioGraph->SetPoint(iRatioPoint, x, ratio);
      ratioGraph->SetPointError(iRatioPoint, 0., ratioError);
      iRatioPoint++;
    }
 
    this->applyStyle(tags   ,ratioGraph,"sub.data",1.,ratioPadScaling);
    
    double ratioMinAllowed = tags.getTagDoubleDefault ("style.ratioMinAllowed",ratioMin);
    double ratioMaxAllowed = tags.getTagDoubleDefault ("style.ratioMaxAllowed",ratioMax);
    actualRatioMin=ratioMinAllowed;
    actualRatioMax=ratioMaxAllowed;
    if(verbose) VERBOSEclass("drawRatio: allowed range of ratio graph: %f -- %f",actualRatioMin,actualRatioMax);

    this->estimateRangeY(ratioGraph,actualRatioMin,actualRatioMax,ratioMaxQerr);
 
    if(verbose) VERBOSEclass("drawRatio: estimated range of ratio graph: %f -- %f (ratioMaxQerr=%f)",actualRatioMin,actualRatioMax,ratioMaxQerr);

    if(actualRatioMin == actualRatioMax){
      if(verbose) VERBOSEclass("expanding ratio to not be empty");
      actualRatioMin *= 0.9;
      actualRatioMax *= 1.1;
    }
    
    if (forceRatioLimits)
      actualRatioMin = ratioMin;
    else 
      actualRatioMin = actualRatioMin-0.1*(actualRatioMax-actualRatioMin);
 
    if (forceRatioLimits)
      actualRatioMax = ratioMax;
    else
      actualRatioMax = actualRatioMax+0.1*(actualRatioMax-actualRatioMin);
 
    if(verbose) VERBOSEclass("drawRatio: final of ratio graph: %f -- %f",actualRatioMin,actualRatioMax);
 
    ratioErrorGraph->GetHistogram()->SetMaximum(actualRatioMax);
    ratioErrorGraph->GetHistogram()->SetMinimum(actualRatioMin);
 
    graphs->Add(ratioGraph);
  }

  TString totalBkgLabel = tags.getTagStringDefault ("labels.denominator", "SM");
  tags.getTagString("labels.numerator",dataLabel);

  ratioErrorGraph->GetHistogram()->GetXaxis()->SetTitle(hMaster->GetXaxis()->GetTitle());
  ratioErrorGraph->GetYaxis()->SetTitle(dataLabel + " / "+ tags.getTagStringDefault ("labels.denominator", "denominator") +" ");
 
  gStyle->SetEndErrorSize(0); 


  if(verbose) VERBOSEclass("drawing lines markers");
  // if 1. is included in the range of the y axis of the ratio plot...
  this->applyStyle(tags,ratioErrorGraph->GetHistogram()->GetYaxis(),"sub.yAxis");
  if ((ratioErrorGraph->GetHistogram()->GetMinimum() <= 1) && (ratioErrorGraph->GetHistogram()->GetMaximum() >= 1.)) {
    // draw the red line indicating 1 in the ratio plot and around 0 in case of
    // significance
    TLine * line = new TLine(xLowerLimit, 1., xUpperLimit, 1.);
    line->SetLineColor(kRed);
    line->Draw();
  }


  double textsize = tags.getTagDoubleDefault("style.textSize",0.05)* ratioPadScaling * tags.getTagDoubleDefault("style.ratio.fitSlope.printResults.textSize",0.5);
  TLatex l;
  l.SetNDC();
  l.SetTextSize(textsize);
  double fitResultPrintPosX = tags.getTagDoubleDefault("style.ratio.fitSlope.printResults.posX",0.2);
  double fitResultPrintPosY = tags.getTagDoubleDefault("style.ratio.fitSlope.printResults.posY",0.85);
  double fitResultPrintStepY = tags.getTagDoubleDefault("style.ratio.fitSlope.printResults.stepY",0.5);

  if(verbose) VERBOSEclass("drawing additional markers");
  TQGraphErrorsIterator itr2(graphs);
  while(itr2.hasNext()){
    TGraphErrors* ratioGraph = itr2.readNext();
    if(!ratioGraph) continue;

    if(tags.getTagBoolDefault("style.ratio.fitSlope",false)){
      ratioGraph->Fit("pol1","Q","",xLowerLimit,xUpperLimit);
      TF1* f = ratioGraph->GetFunction("pol1");
      f->SetLineColor(ratioGraph->GetLineColor());
      f->SetLineWidth(tags.getTagIntegerDefault("style.ratio.fitSlope.lineWidth",1));
      f->SetLineStyle(tags.getTagIntegerDefault("style.ratio.fitSlope.lineStyle",2));
 
      if (tags.getTagBoolDefault("style.ratio.fitSlope.printResults",false)) {
        l.SetTextColor(ratioGraph->GetLineColor());
        double slope = TQUtils::roundAuto(f->GetParameter(1));
        double slopeErr = TQUtils::roundAuto(f->GetParError(1));
        double chi2 = TQUtils::roundAuto(f->GetChisquare());
        TString s = TString::Format("slope #approx %g #pm %g (#chi^{2}#approx%g)",slope,slopeErr,chi2);
        l.DrawLatex(fitResultPrintPosX,fitResultPrintPosY,s);
        fitResultPrintPosY -= fitResultPrintStepY * textsize;
      }
 
    }
 
    ratioGraph->Draw("P SAME"); 

    this->drawArrows(tags,ratioGraph, actualRatioMin,actualRatioMax,verbose);

  }
} 



//__________________________________________________________________________________|___________


void TQCompPlotter::drawArrows(TQTaggable &tags,TGraphErrors *ratioGraph, double actualRatioMin, double actualRatioMax, bool verbose = false){
  Int_t nBins = ratioGraph->GetN();

  double arrowLength = tags.getTagDoubleDefault ("style.arrowLength",0.12 ); // fraction of the y-range
  double arrowOffset = tags.getTagDoubleDefault ("style.arrowOffset",0.08 ); // fraction of the y-range
  int arrowLineWidth = tags.getTagIntegerDefault ("style.arrowLineWidth",2 );
  double arrowHeadSize = tags.getTagDoubleDefault ("style.arrowHeadSize",0.03 );
  double padRatio = tags.getTagDoubleDefault("geometry.sub.height",0.35);

  double canvasHeight = tags.getTagDoubleDefault("geometry.canvas.height",600.);
  double canvasWidth = tags.getTagDoubleDefault("geometry.canvas.width",600.);
  double frameWidthFrac = 1. - tags.getTagDoubleDefault("geometry.sub.margins.right",0.1) - tags.getTagDoubleDefault("geometry.sub.margins.left",0.1);
  double frameWidth = frameWidthFrac * canvasWidth;
  double arrowHeight = arrowHeadSize * canvasHeight;
  double binWidth = frameWidth / nBins;
  double alpha = 2*std::atan(binWidth/(2*arrowHeight)) * 180 / 3.1415926;
 
  double arrowHeadAngle = tags.getTagDoubleDefault ("style.arrowHeadAngle",std::min(60.,alpha));
  TString arrowType = tags.getTagStringDefault ("style.arrowType", "|>" ); // refer to TArrow
  int arrowColor = tags.getTagIntegerDefault ("style.arrowColor",kRed);
 
  TArrow marker;
  marker.SetLineWidth(arrowLineWidth);
  marker.SetLineColor(arrowColor);
  marker.SetFillColor(arrowColor);
  marker.SetAngle(arrowHeadAngle);
  for(size_t i=0; i < (size_t)(ratioGraph->GetN()); i++){
    double x; double y;
    if( i != (size_t)(ratioGraph->GetPoint((int)i, x, y)))
      continue;
    double plrange = actualRatioMax - actualRatioMin;
    if(y > actualRatioMax){
      marker.DrawArrow(x,
                       actualRatioMax - (arrowOffset+arrowLength)*plrange,
                       x,
                       actualRatioMax - (arrowOffset)*plrange,
                       arrowHeadSize*padRatio,
                       arrowType);
      if(verbose) VERBOSEclass("drawing marker for point %i, y > %f",i,actualRatioMax);
    }
    if(y < actualRatioMin){
      marker.DrawArrow(x,
                       actualRatioMin + (arrowOffset+arrowLength)*plrange,
                       x,
                       actualRatioMin + arrowOffset*plrange,
                       arrowHeadSize*padRatio,
                       arrowType);
      if(verbose) VERBOSEclass("drawing marker for point %i, y < %f",i,actualRatioMin);
    }
  }
}

//__________________________________________________________________________________|___________

TString TQCompPlotter::getScaleFactorList(TString histname){
  // retrieve a comma-separated list of the scaled contributions (titles only)
  TString cutname;
  if(!TQStringUtils::readUpTo(histname,cutname,"/")) return "";
  if(!this->getNormalizationInfo()) return "";
  TQFolder* f = this->getNormalizationInfo()->getFolder(TString::Format(".cut.%s",cutname.Data()));
  if(!f) return "";
  TString retval = "";
  TQIterator itr(f->getListOfKeys(),true);
  while(itr.hasNext()){
    TObject* obj = itr.readNext();
    if(!obj) continue;
    if(!retval.IsNull()) retval.Append(",");
    retval.Append(f->getTagStringDefault(obj->GetName(),obj->GetName()));
  }
  return retval;
}

 TQCompPlotter.cxx:1
 TQCompPlotter.cxx:2
 TQCompPlotter.cxx:3
 TQCompPlotter.cxx:4
 TQCompPlotter.cxx:5
 TQCompPlotter.cxx:6
 TQCompPlotter.cxx:7
 TQCompPlotter.cxx:8
 TQCompPlotter.cxx:9
 TQCompPlotter.cxx:10
 TQCompPlotter.cxx:11
 TQCompPlotter.cxx:12
 TQCompPlotter.cxx:13
 TQCompPlotter.cxx:14
 TQCompPlotter.cxx:15
 TQCompPlotter.cxx:16
 TQCompPlotter.cxx:17
 TQCompPlotter.cxx:18
 TQCompPlotter.cxx:19
 TQCompPlotter.cxx:20
 TQCompPlotter.cxx:21
 TQCompPlotter.cxx:22
 TQCompPlotter.cxx:23
 TQCompPlotter.cxx:24
 TQCompPlotter.cxx:25
 TQCompPlotter.cxx:26
 TQCompPlotter.cxx:27
 TQCompPlotter.cxx:28
 TQCompPlotter.cxx:29
 TQCompPlotter.cxx:30
 TQCompPlotter.cxx:31
 TQCompPlotter.cxx:32
 TQCompPlotter.cxx:33
 TQCompPlotter.cxx:34
 TQCompPlotter.cxx:35
 TQCompPlotter.cxx:36
 TQCompPlotter.cxx:37
 TQCompPlotter.cxx:38
 TQCompPlotter.cxx:39
 TQCompPlotter.cxx:40
 TQCompPlotter.cxx:41
 TQCompPlotter.cxx:42
 TQCompPlotter.cxx:43
 TQCompPlotter.cxx:44
 TQCompPlotter.cxx:45
 TQCompPlotter.cxx:46
 TQCompPlotter.cxx:47
 TQCompPlotter.cxx:48
 TQCompPlotter.cxx:49
 TQCompPlotter.cxx:50
 TQCompPlotter.cxx:51
 TQCompPlotter.cxx:52
 TQCompPlotter.cxx:53
 TQCompPlotter.cxx:54
 TQCompPlotter.cxx:55
 TQCompPlotter.cxx:56
 TQCompPlotter.cxx:57
 TQCompPlotter.cxx:58
 TQCompPlotter.cxx:59
 TQCompPlotter.cxx:60
 TQCompPlotter.cxx:61
 TQCompPlotter.cxx:62
 TQCompPlotter.cxx:63
 TQCompPlotter.cxx:64
 TQCompPlotter.cxx:65
 TQCompPlotter.cxx:66
 TQCompPlotter.cxx:67
 TQCompPlotter.cxx:68
 TQCompPlotter.cxx:69
 TQCompPlotter.cxx:70
 TQCompPlotter.cxx:71
 TQCompPlotter.cxx:72
 TQCompPlotter.cxx:73
 TQCompPlotter.cxx:74
 TQCompPlotter.cxx:75
 TQCompPlotter.cxx:76
 TQCompPlotter.cxx:77
 TQCompPlotter.cxx:78
 TQCompPlotter.cxx:79
 TQCompPlotter.cxx:80
 TQCompPlotter.cxx:81
 TQCompPlotter.cxx:82
 TQCompPlotter.cxx:83
 TQCompPlotter.cxx:84
 TQCompPlotter.cxx:85
 TQCompPlotter.cxx:86
 TQCompPlotter.cxx:87
 TQCompPlotter.cxx:88
 TQCompPlotter.cxx:89
 TQCompPlotter.cxx:90
 TQCompPlotter.cxx:91
 TQCompPlotter.cxx:92
 TQCompPlotter.cxx:93
 TQCompPlotter.cxx:94
 TQCompPlotter.cxx:95
 TQCompPlotter.cxx:96
 TQCompPlotter.cxx:97
 TQCompPlotter.cxx:98
 TQCompPlotter.cxx:99
 TQCompPlotter.cxx:100
 TQCompPlotter.cxx:101
 TQCompPlotter.cxx:102
 TQCompPlotter.cxx:103
 TQCompPlotter.cxx:104
 TQCompPlotter.cxx:105
 TQCompPlotter.cxx:106
 TQCompPlotter.cxx:107
 TQCompPlotter.cxx:108
 TQCompPlotter.cxx:109
 TQCompPlotter.cxx:110
 TQCompPlotter.cxx:111
 TQCompPlotter.cxx:112
 TQCompPlotter.cxx:113
 TQCompPlotter.cxx:114
 TQCompPlotter.cxx:115
 TQCompPlotter.cxx:116
 TQCompPlotter.cxx:117
 TQCompPlotter.cxx:118
 TQCompPlotter.cxx:119
 TQCompPlotter.cxx:120
 TQCompPlotter.cxx:121
 TQCompPlotter.cxx:122
 TQCompPlotter.cxx:123
 TQCompPlotter.cxx:124
 TQCompPlotter.cxx:125
 TQCompPlotter.cxx:126
 TQCompPlotter.cxx:127
 TQCompPlotter.cxx:128
 TQCompPlotter.cxx:129
 TQCompPlotter.cxx:130
 TQCompPlotter.cxx:131
 TQCompPlotter.cxx:132
 TQCompPlotter.cxx:133
 TQCompPlotter.cxx:134
 TQCompPlotter.cxx:135
 TQCompPlotter.cxx:136
 TQCompPlotter.cxx:137
 TQCompPlotter.cxx:138
 TQCompPlotter.cxx:139
 TQCompPlotter.cxx:140
 TQCompPlotter.cxx:141
 TQCompPlotter.cxx:142
 TQCompPlotter.cxx:143
 TQCompPlotter.cxx:144
 TQCompPlotter.cxx:145
 TQCompPlotter.cxx:146
 TQCompPlotter.cxx:147
 TQCompPlotter.cxx:148
 TQCompPlotter.cxx:149
 TQCompPlotter.cxx:150
 TQCompPlotter.cxx:151
 TQCompPlotter.cxx:152
 TQCompPlotter.cxx:153
 TQCompPlotter.cxx:154
 TQCompPlotter.cxx:155
 TQCompPlotter.cxx:156
 TQCompPlotter.cxx:157
 TQCompPlotter.cxx:158
 TQCompPlotter.cxx:159
 TQCompPlotter.cxx:160
 TQCompPlotter.cxx:161
 TQCompPlotter.cxx:162
 TQCompPlotter.cxx:163
 TQCompPlotter.cxx:164
 TQCompPlotter.cxx:165
 TQCompPlotter.cxx:166
 TQCompPlotter.cxx:167
 TQCompPlotter.cxx:168
 TQCompPlotter.cxx:169
 TQCompPlotter.cxx:170
 TQCompPlotter.cxx:171
 TQCompPlotter.cxx:172
 TQCompPlotter.cxx:173
 TQCompPlotter.cxx:174
 TQCompPlotter.cxx:175
 TQCompPlotter.cxx:176
 TQCompPlotter.cxx:177
 TQCompPlotter.cxx:178
 TQCompPlotter.cxx:179
 TQCompPlotter.cxx:180
 TQCompPlotter.cxx:181
 TQCompPlotter.cxx:182
 TQCompPlotter.cxx:183
 TQCompPlotter.cxx:184
 TQCompPlotter.cxx:185
 TQCompPlotter.cxx:186
 TQCompPlotter.cxx:187
 TQCompPlotter.cxx:188
 TQCompPlotter.cxx:189
 TQCompPlotter.cxx:190
 TQCompPlotter.cxx:191
 TQCompPlotter.cxx:192
 TQCompPlotter.cxx:193
 TQCompPlotter.cxx:194
 TQCompPlotter.cxx:195
 TQCompPlotter.cxx:196
 TQCompPlotter.cxx:197
 TQCompPlotter.cxx:198
 TQCompPlotter.cxx:199
 TQCompPlotter.cxx:200
 TQCompPlotter.cxx:201
 TQCompPlotter.cxx:202
 TQCompPlotter.cxx:203
 TQCompPlotter.cxx:204
 TQCompPlotter.cxx:205
 TQCompPlotter.cxx:206
 TQCompPlotter.cxx:207
 TQCompPlotter.cxx:208
 TQCompPlotter.cxx:209
 TQCompPlotter.cxx:210
 TQCompPlotter.cxx:211
 TQCompPlotter.cxx:212
 TQCompPlotter.cxx:213
 TQCompPlotter.cxx:214
 TQCompPlotter.cxx:215
 TQCompPlotter.cxx:216
 TQCompPlotter.cxx:217
 TQCompPlotter.cxx:218
 TQCompPlotter.cxx:219
 TQCompPlotter.cxx:220
 TQCompPlotter.cxx:221
 TQCompPlotter.cxx:222
 TQCompPlotter.cxx:223
 TQCompPlotter.cxx:224
 TQCompPlotter.cxx:225
 TQCompPlotter.cxx:226
 TQCompPlotter.cxx:227
 TQCompPlotter.cxx:228
 TQCompPlotter.cxx:229
 TQCompPlotter.cxx:230
 TQCompPlotter.cxx:231
 TQCompPlotter.cxx:232
 TQCompPlotter.cxx:233
 TQCompPlotter.cxx:234
 TQCompPlotter.cxx:235
 TQCompPlotter.cxx:236
 TQCompPlotter.cxx:237
 TQCompPlotter.cxx:238
 TQCompPlotter.cxx:239
 TQCompPlotter.cxx:240
 TQCompPlotter.cxx:241
 TQCompPlotter.cxx:242
 TQCompPlotter.cxx:243
 TQCompPlotter.cxx:244
 TQCompPlotter.cxx:245
 TQCompPlotter.cxx:246
 TQCompPlotter.cxx:247
 TQCompPlotter.cxx:248
 TQCompPlotter.cxx:249
 TQCompPlotter.cxx:250
 TQCompPlotter.cxx:251
 TQCompPlotter.cxx:252
 TQCompPlotter.cxx:253
 TQCompPlotter.cxx:254
 TQCompPlotter.cxx:255
 TQCompPlotter.cxx:256
 TQCompPlotter.cxx:257
 TQCompPlotter.cxx:258
 TQCompPlotter.cxx:259
 TQCompPlotter.cxx:260
 TQCompPlotter.cxx:261
 TQCompPlotter.cxx:262
 TQCompPlotter.cxx:263
 TQCompPlotter.cxx:264
 TQCompPlotter.cxx:265
 TQCompPlotter.cxx:266
 TQCompPlotter.cxx:267
 TQCompPlotter.cxx:268
 TQCompPlotter.cxx:269
 TQCompPlotter.cxx:270
 TQCompPlotter.cxx:271
 TQCompPlotter.cxx:272
 TQCompPlotter.cxx:273
 TQCompPlotter.cxx:274
 TQCompPlotter.cxx:275
 TQCompPlotter.cxx:276
 TQCompPlotter.cxx:277
 TQCompPlotter.cxx:278
 TQCompPlotter.cxx:279
 TQCompPlotter.cxx:280
 TQCompPlotter.cxx:281
 TQCompPlotter.cxx:282
 TQCompPlotter.cxx:283
 TQCompPlotter.cxx:284
 TQCompPlotter.cxx:285
 TQCompPlotter.cxx:286
 TQCompPlotter.cxx:287
 TQCompPlotter.cxx:288
 TQCompPlotter.cxx:289
 TQCompPlotter.cxx:290
 TQCompPlotter.cxx:291
 TQCompPlotter.cxx:292
 TQCompPlotter.cxx:293
 TQCompPlotter.cxx:294
 TQCompPlotter.cxx:295
 TQCompPlotter.cxx:296
 TQCompPlotter.cxx:297
 TQCompPlotter.cxx:298
 TQCompPlotter.cxx:299
 TQCompPlotter.cxx:300
 TQCompPlotter.cxx:301
 TQCompPlotter.cxx:302
 TQCompPlotter.cxx:303
 TQCompPlotter.cxx:304
 TQCompPlotter.cxx:305
 TQCompPlotter.cxx:306
 TQCompPlotter.cxx:307
 TQCompPlotter.cxx:308
 TQCompPlotter.cxx:309
 TQCompPlotter.cxx:310
 TQCompPlotter.cxx:311
 TQCompPlotter.cxx:312
 TQCompPlotter.cxx:313
 TQCompPlotter.cxx:314
 TQCompPlotter.cxx:315
 TQCompPlotter.cxx:316
 TQCompPlotter.cxx:317
 TQCompPlotter.cxx:318
 TQCompPlotter.cxx:319
 TQCompPlotter.cxx:320
 TQCompPlotter.cxx:321
 TQCompPlotter.cxx:322
 TQCompPlotter.cxx:323
 TQCompPlotter.cxx:324
 TQCompPlotter.cxx:325
 TQCompPlotter.cxx:326
 TQCompPlotter.cxx:327
 TQCompPlotter.cxx:328
 TQCompPlotter.cxx:329
 TQCompPlotter.cxx:330
 TQCompPlotter.cxx:331
 TQCompPlotter.cxx:332
 TQCompPlotter.cxx:333
 TQCompPlotter.cxx:334
 TQCompPlotter.cxx:335
 TQCompPlotter.cxx:336
 TQCompPlotter.cxx:337
 TQCompPlotter.cxx:338
 TQCompPlotter.cxx:339
 TQCompPlotter.cxx:340
 TQCompPlotter.cxx:341
 TQCompPlotter.cxx:342
 TQCompPlotter.cxx:343
 TQCompPlotter.cxx:344
 TQCompPlotter.cxx:345
 TQCompPlotter.cxx:346
 TQCompPlotter.cxx:347
 TQCompPlotter.cxx:348
 TQCompPlotter.cxx:349
 TQCompPlotter.cxx:350
 TQCompPlotter.cxx:351
 TQCompPlotter.cxx:352
 TQCompPlotter.cxx:353
 TQCompPlotter.cxx:354
 TQCompPlotter.cxx:355
 TQCompPlotter.cxx:356
 TQCompPlotter.cxx:357
 TQCompPlotter.cxx:358
 TQCompPlotter.cxx:359
 TQCompPlotter.cxx:360
 TQCompPlotter.cxx:361
 TQCompPlotter.cxx:362
 TQCompPlotter.cxx:363
 TQCompPlotter.cxx:364
 TQCompPlotter.cxx:365
 TQCompPlotter.cxx:366
 TQCompPlotter.cxx:367
 TQCompPlotter.cxx:368
 TQCompPlotter.cxx:369
 TQCompPlotter.cxx:370
 TQCompPlotter.cxx:371
 TQCompPlotter.cxx:372
 TQCompPlotter.cxx:373
 TQCompPlotter.cxx:374
 TQCompPlotter.cxx:375
 TQCompPlotter.cxx:376
 TQCompPlotter.cxx:377
 TQCompPlotter.cxx:378
 TQCompPlotter.cxx:379
 TQCompPlotter.cxx:380
 TQCompPlotter.cxx:381
 TQCompPlotter.cxx:382
 TQCompPlotter.cxx:383
 TQCompPlotter.cxx:384
 TQCompPlotter.cxx:385
 TQCompPlotter.cxx:386
 TQCompPlotter.cxx:387
 TQCompPlotter.cxx:388
 TQCompPlotter.cxx:389
 TQCompPlotter.cxx:390
 TQCompPlotter.cxx:391
 TQCompPlotter.cxx:392
 TQCompPlotter.cxx:393
 TQCompPlotter.cxx:394
 TQCompPlotter.cxx:395
 TQCompPlotter.cxx:396
 TQCompPlotter.cxx:397
 TQCompPlotter.cxx:398
 TQCompPlotter.cxx:399
 TQCompPlotter.cxx:400
 TQCompPlotter.cxx:401
 TQCompPlotter.cxx:402
 TQCompPlotter.cxx:403
 TQCompPlotter.cxx:404
 TQCompPlotter.cxx:405
 TQCompPlotter.cxx:406
 TQCompPlotter.cxx:407
 TQCompPlotter.cxx:408
 TQCompPlotter.cxx:409
 TQCompPlotter.cxx:410
 TQCompPlotter.cxx:411
 TQCompPlotter.cxx:412
 TQCompPlotter.cxx:413
 TQCompPlotter.cxx:414
 TQCompPlotter.cxx:415
 TQCompPlotter.cxx:416
 TQCompPlotter.cxx:417
 TQCompPlotter.cxx:418
 TQCompPlotter.cxx:419
 TQCompPlotter.cxx:420
 TQCompPlotter.cxx:421
 TQCompPlotter.cxx:422
 TQCompPlotter.cxx:423
 TQCompPlotter.cxx:424
 TQCompPlotter.cxx:425
 TQCompPlotter.cxx:426
 TQCompPlotter.cxx:427
 TQCompPlotter.cxx:428
 TQCompPlotter.cxx:429
 TQCompPlotter.cxx:430
 TQCompPlotter.cxx:431
 TQCompPlotter.cxx:432
 TQCompPlotter.cxx:433
 TQCompPlotter.cxx:434
 TQCompPlotter.cxx:435
 TQCompPlotter.cxx:436
 TQCompPlotter.cxx:437
 TQCompPlotter.cxx:438
 TQCompPlotter.cxx:439
 TQCompPlotter.cxx:440
 TQCompPlotter.cxx:441
 TQCompPlotter.cxx:442
 TQCompPlotter.cxx:443
 TQCompPlotter.cxx:444
 TQCompPlotter.cxx:445
 TQCompPlotter.cxx:446
 TQCompPlotter.cxx:447
 TQCompPlotter.cxx:448
 TQCompPlotter.cxx:449
 TQCompPlotter.cxx:450
 TQCompPlotter.cxx:451
 TQCompPlotter.cxx:452
 TQCompPlotter.cxx:453
 TQCompPlotter.cxx:454
 TQCompPlotter.cxx:455
 TQCompPlotter.cxx:456
 TQCompPlotter.cxx:457
 TQCompPlotter.cxx:458
 TQCompPlotter.cxx:459
 TQCompPlotter.cxx:460
 TQCompPlotter.cxx:461
 TQCompPlotter.cxx:462
 TQCompPlotter.cxx:463
 TQCompPlotter.cxx:464
 TQCompPlotter.cxx:465
 TQCompPlotter.cxx:466
 TQCompPlotter.cxx:467
 TQCompPlotter.cxx:468
 TQCompPlotter.cxx:469
 TQCompPlotter.cxx:470
 TQCompPlotter.cxx:471
 TQCompPlotter.cxx:472
 TQCompPlotter.cxx:473
 TQCompPlotter.cxx:474
 TQCompPlotter.cxx:475
 TQCompPlotter.cxx:476
 TQCompPlotter.cxx:477
 TQCompPlotter.cxx:478
 TQCompPlotter.cxx:479
 TQCompPlotter.cxx:480
 TQCompPlotter.cxx:481
 TQCompPlotter.cxx:482
 TQCompPlotter.cxx:483
 TQCompPlotter.cxx:484
 TQCompPlotter.cxx:485
 TQCompPlotter.cxx:486
 TQCompPlotter.cxx:487
 TQCompPlotter.cxx:488
 TQCompPlotter.cxx:489
 TQCompPlotter.cxx:490
 TQCompPlotter.cxx:491
 TQCompPlotter.cxx:492
 TQCompPlotter.cxx:493
 TQCompPlotter.cxx:494
 TQCompPlotter.cxx:495
 TQCompPlotter.cxx:496
 TQCompPlotter.cxx:497
 TQCompPlotter.cxx:498
 TQCompPlotter.cxx:499
 TQCompPlotter.cxx:500
 TQCompPlotter.cxx:501
 TQCompPlotter.cxx:502
 TQCompPlotter.cxx:503
 TQCompPlotter.cxx:504
 TQCompPlotter.cxx:505
 TQCompPlotter.cxx:506
 TQCompPlotter.cxx:507
 TQCompPlotter.cxx:508
 TQCompPlotter.cxx:509
 TQCompPlotter.cxx:510
 TQCompPlotter.cxx:511
 TQCompPlotter.cxx:512
 TQCompPlotter.cxx:513
 TQCompPlotter.cxx:514
 TQCompPlotter.cxx:515
 TQCompPlotter.cxx:516
 TQCompPlotter.cxx:517
 TQCompPlotter.cxx:518
 TQCompPlotter.cxx:519
 TQCompPlotter.cxx:520
 TQCompPlotter.cxx:521
 TQCompPlotter.cxx:522
 TQCompPlotter.cxx:523
 TQCompPlotter.cxx:524
 TQCompPlotter.cxx:525
 TQCompPlotter.cxx:526
 TQCompPlotter.cxx:527
 TQCompPlotter.cxx:528
 TQCompPlotter.cxx:529
 TQCompPlotter.cxx:530
 TQCompPlotter.cxx:531
 TQCompPlotter.cxx:532
 TQCompPlotter.cxx:533
 TQCompPlotter.cxx:534
 TQCompPlotter.cxx:535
 TQCompPlotter.cxx:536
 TQCompPlotter.cxx:537
 TQCompPlotter.cxx:538
 TQCompPlotter.cxx:539
 TQCompPlotter.cxx:540
 TQCompPlotter.cxx:541
 TQCompPlotter.cxx:542
 TQCompPlotter.cxx:543
 TQCompPlotter.cxx:544
 TQCompPlotter.cxx:545
 TQCompPlotter.cxx:546
 TQCompPlotter.cxx:547
 TQCompPlotter.cxx:548
 TQCompPlotter.cxx:549
 TQCompPlotter.cxx:550
 TQCompPlotter.cxx:551
 TQCompPlotter.cxx:552
 TQCompPlotter.cxx:553
 TQCompPlotter.cxx:554
 TQCompPlotter.cxx:555
 TQCompPlotter.cxx:556
 TQCompPlotter.cxx:557
 TQCompPlotter.cxx:558
 TQCompPlotter.cxx:559
 TQCompPlotter.cxx:560
 TQCompPlotter.cxx:561
 TQCompPlotter.cxx:562
 TQCompPlotter.cxx:563
 TQCompPlotter.cxx:564
 TQCompPlotter.cxx:565
 TQCompPlotter.cxx:566
 TQCompPlotter.cxx:567
 TQCompPlotter.cxx:568
 TQCompPlotter.cxx:569
 TQCompPlotter.cxx:570
 TQCompPlotter.cxx:571
 TQCompPlotter.cxx:572
 TQCompPlotter.cxx:573
 TQCompPlotter.cxx:574
 TQCompPlotter.cxx:575
 TQCompPlotter.cxx:576
 TQCompPlotter.cxx:577
 TQCompPlotter.cxx:578
 TQCompPlotter.cxx:579
 TQCompPlotter.cxx:580
 TQCompPlotter.cxx:581
 TQCompPlotter.cxx:582
 TQCompPlotter.cxx:583
 TQCompPlotter.cxx:584
 TQCompPlotter.cxx:585
 TQCompPlotter.cxx:586
 TQCompPlotter.cxx:587
 TQCompPlotter.cxx:588
 TQCompPlotter.cxx:589
 TQCompPlotter.cxx:590
 TQCompPlotter.cxx:591
 TQCompPlotter.cxx:592
 TQCompPlotter.cxx:593
 TQCompPlotter.cxx:594
 TQCompPlotter.cxx:595
 TQCompPlotter.cxx:596
 TQCompPlotter.cxx:597
 TQCompPlotter.cxx:598
 TQCompPlotter.cxx:599
 TQCompPlotter.cxx:600
 TQCompPlotter.cxx:601
 TQCompPlotter.cxx:602
 TQCompPlotter.cxx:603
 TQCompPlotter.cxx:604
 TQCompPlotter.cxx:605
 TQCompPlotter.cxx:606
 TQCompPlotter.cxx:607
 TQCompPlotter.cxx:608
 TQCompPlotter.cxx:609
 TQCompPlotter.cxx:610
 TQCompPlotter.cxx:611
 TQCompPlotter.cxx:612
 TQCompPlotter.cxx:613
 TQCompPlotter.cxx:614
 TQCompPlotter.cxx:615
 TQCompPlotter.cxx:616
 TQCompPlotter.cxx:617
 TQCompPlotter.cxx:618
 TQCompPlotter.cxx:619
 TQCompPlotter.cxx:620
 TQCompPlotter.cxx:621
 TQCompPlotter.cxx:622
 TQCompPlotter.cxx:623
 TQCompPlotter.cxx:624
 TQCompPlotter.cxx:625
 TQCompPlotter.cxx:626
 TQCompPlotter.cxx:627
 TQCompPlotter.cxx:628
 TQCompPlotter.cxx:629
 TQCompPlotter.cxx:630
 TQCompPlotter.cxx:631
 TQCompPlotter.cxx:632
 TQCompPlotter.cxx:633
 TQCompPlotter.cxx:634
 TQCompPlotter.cxx:635
 TQCompPlotter.cxx:636
 TQCompPlotter.cxx:637
 TQCompPlotter.cxx:638
 TQCompPlotter.cxx:639
 TQCompPlotter.cxx:640
 TQCompPlotter.cxx:641
 TQCompPlotter.cxx:642
 TQCompPlotter.cxx:643
 TQCompPlotter.cxx:644
 TQCompPlotter.cxx:645
 TQCompPlotter.cxx:646
 TQCompPlotter.cxx:647
 TQCompPlotter.cxx:648
 TQCompPlotter.cxx:649
 TQCompPlotter.cxx:650
 TQCompPlotter.cxx:651
 TQCompPlotter.cxx:652
 TQCompPlotter.cxx:653
 TQCompPlotter.cxx:654
 TQCompPlotter.cxx:655
 TQCompPlotter.cxx:656
 TQCompPlotter.cxx:657
 TQCompPlotter.cxx:658
 TQCompPlotter.cxx:659
 TQCompPlotter.cxx:660
 TQCompPlotter.cxx:661
 TQCompPlotter.cxx:662
 TQCompPlotter.cxx:663
 TQCompPlotter.cxx:664
 TQCompPlotter.cxx:665
 TQCompPlotter.cxx:666
 TQCompPlotter.cxx:667
 TQCompPlotter.cxx:668
 TQCompPlotter.cxx:669
 TQCompPlotter.cxx:670
 TQCompPlotter.cxx:671
 TQCompPlotter.cxx:672
 TQCompPlotter.cxx:673
 TQCompPlotter.cxx:674
 TQCompPlotter.cxx:675
 TQCompPlotter.cxx:676
 TQCompPlotter.cxx:677
 TQCompPlotter.cxx:678
 TQCompPlotter.cxx:679
 TQCompPlotter.cxx:680
 TQCompPlotter.cxx:681
 TQCompPlotter.cxx:682
 TQCompPlotter.cxx:683
 TQCompPlotter.cxx:684
 TQCompPlotter.cxx:685
 TQCompPlotter.cxx:686
 TQCompPlotter.cxx:687
 TQCompPlotter.cxx:688
 TQCompPlotter.cxx:689
 TQCompPlotter.cxx:690
 TQCompPlotter.cxx:691
 TQCompPlotter.cxx:692
 TQCompPlotter.cxx:693
 TQCompPlotter.cxx:694
 TQCompPlotter.cxx:695
 TQCompPlotter.cxx:696
 TQCompPlotter.cxx:697
 TQCompPlotter.cxx:698
 TQCompPlotter.cxx:699
 TQCompPlotter.cxx:700
 TQCompPlotter.cxx:701
 TQCompPlotter.cxx:702
 TQCompPlotter.cxx:703
 TQCompPlotter.cxx:704
 TQCompPlotter.cxx:705
 TQCompPlotter.cxx:706
 TQCompPlotter.cxx:707
 TQCompPlotter.cxx:708
 TQCompPlotter.cxx:709
 TQCompPlotter.cxx:710
 TQCompPlotter.cxx:711
 TQCompPlotter.cxx:712
 TQCompPlotter.cxx:713
 TQCompPlotter.cxx:714
 TQCompPlotter.cxx:715
 TQCompPlotter.cxx:716
 TQCompPlotter.cxx:717
 TQCompPlotter.cxx:718
 TQCompPlotter.cxx:719
 TQCompPlotter.cxx:720
 TQCompPlotter.cxx:721
 TQCompPlotter.cxx:722
 TQCompPlotter.cxx:723
 TQCompPlotter.cxx:724
 TQCompPlotter.cxx:725
 TQCompPlotter.cxx:726
 TQCompPlotter.cxx:727
 TQCompPlotter.cxx:728
 TQCompPlotter.cxx:729
 TQCompPlotter.cxx:730
 TQCompPlotter.cxx:731
 TQCompPlotter.cxx:732
 TQCompPlotter.cxx:733
 TQCompPlotter.cxx:734
 TQCompPlotter.cxx:735
 TQCompPlotter.cxx:736
 TQCompPlotter.cxx:737
 TQCompPlotter.cxx:738
 TQCompPlotter.cxx:739
 TQCompPlotter.cxx:740
 TQCompPlotter.cxx:741
 TQCompPlotter.cxx:742
 TQCompPlotter.cxx:743
 TQCompPlotter.cxx:744
 TQCompPlotter.cxx:745
 TQCompPlotter.cxx:746
 TQCompPlotter.cxx:747
 TQCompPlotter.cxx:748
 TQCompPlotter.cxx:749
 TQCompPlotter.cxx:750
 TQCompPlotter.cxx:751
 TQCompPlotter.cxx:752
 TQCompPlotter.cxx:753
 TQCompPlotter.cxx:754
 TQCompPlotter.cxx:755
 TQCompPlotter.cxx:756
 TQCompPlotter.cxx:757
 TQCompPlotter.cxx:758
 TQCompPlotter.cxx:759
 TQCompPlotter.cxx:760
 TQCompPlotter.cxx:761
 TQCompPlotter.cxx:762
 TQCompPlotter.cxx:763
 TQCompPlotter.cxx:764
 TQCompPlotter.cxx:765
 TQCompPlotter.cxx:766
 TQCompPlotter.cxx:767
 TQCompPlotter.cxx:768
 TQCompPlotter.cxx:769
 TQCompPlotter.cxx:770
 TQCompPlotter.cxx:771
 TQCompPlotter.cxx:772
 TQCompPlotter.cxx:773
 TQCompPlotter.cxx:774
 TQCompPlotter.cxx:775
 TQCompPlotter.cxx:776
 TQCompPlotter.cxx:777
 TQCompPlotter.cxx:778
 TQCompPlotter.cxx:779
 TQCompPlotter.cxx:780
 TQCompPlotter.cxx:781
 TQCompPlotter.cxx:782
 TQCompPlotter.cxx:783
 TQCompPlotter.cxx:784
 TQCompPlotter.cxx:785
 TQCompPlotter.cxx:786
 TQCompPlotter.cxx:787
 TQCompPlotter.cxx:788
 TQCompPlotter.cxx:789
 TQCompPlotter.cxx:790
 TQCompPlotter.cxx:791
 TQCompPlotter.cxx:792
 TQCompPlotter.cxx:793
 TQCompPlotter.cxx:794
 TQCompPlotter.cxx:795
 TQCompPlotter.cxx:796
 TQCompPlotter.cxx:797
 TQCompPlotter.cxx:798
 TQCompPlotter.cxx:799
 TQCompPlotter.cxx:800
 TQCompPlotter.cxx:801
 TQCompPlotter.cxx:802
 TQCompPlotter.cxx:803
 TQCompPlotter.cxx:804
 TQCompPlotter.cxx:805
 TQCompPlotter.cxx:806
 TQCompPlotter.cxx:807
 TQCompPlotter.cxx:808
 TQCompPlotter.cxx:809
 TQCompPlotter.cxx:810
 TQCompPlotter.cxx:811
 TQCompPlotter.cxx:812
 TQCompPlotter.cxx:813
 TQCompPlotter.cxx:814
 TQCompPlotter.cxx:815
 TQCompPlotter.cxx:816
 TQCompPlotter.cxx:817
 TQCompPlotter.cxx:818
 TQCompPlotter.cxx:819
 TQCompPlotter.cxx:820
 TQCompPlotter.cxx:821
 TQCompPlotter.cxx:822
 TQCompPlotter.cxx:823
 TQCompPlotter.cxx:824
 TQCompPlotter.cxx:825
 TQCompPlotter.cxx:826
 TQCompPlotter.cxx:827
 TQCompPlotter.cxx:828
 TQCompPlotter.cxx:829
 TQCompPlotter.cxx:830
 TQCompPlotter.cxx:831
 TQCompPlotter.cxx:832
 TQCompPlotter.cxx:833
 TQCompPlotter.cxx:834
 TQCompPlotter.cxx:835
 TQCompPlotter.cxx:836
 TQCompPlotter.cxx:837
 TQCompPlotter.cxx:838
 TQCompPlotter.cxx:839
 TQCompPlotter.cxx:840
 TQCompPlotter.cxx:841
 TQCompPlotter.cxx:842
 TQCompPlotter.cxx:843
 TQCompPlotter.cxx:844
 TQCompPlotter.cxx:845
 TQCompPlotter.cxx:846
 TQCompPlotter.cxx:847
 TQCompPlotter.cxx:848
 TQCompPlotter.cxx:849
 TQCompPlotter.cxx:850
 TQCompPlotter.cxx:851
 TQCompPlotter.cxx:852
 TQCompPlotter.cxx:853
 TQCompPlotter.cxx:854
 TQCompPlotter.cxx:855
 TQCompPlotter.cxx:856
 TQCompPlotter.cxx:857
 TQCompPlotter.cxx:858
 TQCompPlotter.cxx:859
 TQCompPlotter.cxx:860
 TQCompPlotter.cxx:861
 TQCompPlotter.cxx:862
 TQCompPlotter.cxx:863
 TQCompPlotter.cxx:864
 TQCompPlotter.cxx:865
 TQCompPlotter.cxx:866
 TQCompPlotter.cxx:867
 TQCompPlotter.cxx:868
 TQCompPlotter.cxx:869
 TQCompPlotter.cxx:870
 TQCompPlotter.cxx:871
 TQCompPlotter.cxx:872
 TQCompPlotter.cxx:873
 TQCompPlotter.cxx:874
 TQCompPlotter.cxx:875
 TQCompPlotter.cxx:876
 TQCompPlotter.cxx:877
 TQCompPlotter.cxx:878
 TQCompPlotter.cxx:879
 TQCompPlotter.cxx:880
 TQCompPlotter.cxx:881
 TQCompPlotter.cxx:882
 TQCompPlotter.cxx:883
 TQCompPlotter.cxx:884
 TQCompPlotter.cxx:885
 TQCompPlotter.cxx:886
 TQCompPlotter.cxx:887
 TQCompPlotter.cxx:888
 TQCompPlotter.cxx:889
 TQCompPlotter.cxx:890
 TQCompPlotter.cxx:891
 TQCompPlotter.cxx:892
 TQCompPlotter.cxx:893
 TQCompPlotter.cxx:894
 TQCompPlotter.cxx:895
 TQCompPlotter.cxx:896
 TQCompPlotter.cxx:897
 TQCompPlotter.cxx:898
 TQCompPlotter.cxx:899
 TQCompPlotter.cxx:900
 TQCompPlotter.cxx:901
 TQCompPlotter.cxx:902
 TQCompPlotter.cxx:903
 TQCompPlotter.cxx:904
 TQCompPlotter.cxx:905
 TQCompPlotter.cxx:906
 TQCompPlotter.cxx:907
 TQCompPlotter.cxx:908
 TQCompPlotter.cxx:909
 TQCompPlotter.cxx:910
 TQCompPlotter.cxx:911
 TQCompPlotter.cxx:912
 TQCompPlotter.cxx:913
 TQCompPlotter.cxx:914
 TQCompPlotter.cxx:915
 TQCompPlotter.cxx:916
 TQCompPlotter.cxx:917
 TQCompPlotter.cxx:918
 TQCompPlotter.cxx:919
 TQCompPlotter.cxx:920
 TQCompPlotter.cxx:921
 TQCompPlotter.cxx:922
 TQCompPlotter.cxx:923
 TQCompPlotter.cxx:924
 TQCompPlotter.cxx:925
 TQCompPlotter.cxx:926
 TQCompPlotter.cxx:927
 TQCompPlotter.cxx:928
 TQCompPlotter.cxx:929
 TQCompPlotter.cxx:930
 TQCompPlotter.cxx:931
 TQCompPlotter.cxx:932
 TQCompPlotter.cxx:933
 TQCompPlotter.cxx:934
 TQCompPlotter.cxx:935
 TQCompPlotter.cxx:936
 TQCompPlotter.cxx:937
 TQCompPlotter.cxx:938
 TQCompPlotter.cxx:939
 TQCompPlotter.cxx:940
 TQCompPlotter.cxx:941
 TQCompPlotter.cxx:942
 TQCompPlotter.cxx:943
 TQCompPlotter.cxx:944
 TQCompPlotter.cxx:945
 TQCompPlotter.cxx:946
 TQCompPlotter.cxx:947
 TQCompPlotter.cxx:948
 TQCompPlotter.cxx:949
 TQCompPlotter.cxx:950
 TQCompPlotter.cxx:951
 TQCompPlotter.cxx:952
 TQCompPlotter.cxx:953
 TQCompPlotter.cxx:954
 TQCompPlotter.cxx:955
 TQCompPlotter.cxx:956
 TQCompPlotter.cxx:957
 TQCompPlotter.cxx:958
 TQCompPlotter.cxx:959
 TQCompPlotter.cxx:960
 TQCompPlotter.cxx:961
 TQCompPlotter.cxx:962
 TQCompPlotter.cxx:963
 TQCompPlotter.cxx:964
 TQCompPlotter.cxx:965
 TQCompPlotter.cxx:966
 TQCompPlotter.cxx:967
 TQCompPlotter.cxx:968
 TQCompPlotter.cxx:969
 TQCompPlotter.cxx:970
 TQCompPlotter.cxx:971
 TQCompPlotter.cxx:972
 TQCompPlotter.cxx:973
 TQCompPlotter.cxx:974
 TQCompPlotter.cxx:975
 TQCompPlotter.cxx:976
 TQCompPlotter.cxx:977
 TQCompPlotter.cxx:978
 TQCompPlotter.cxx:979
 TQCompPlotter.cxx:980
 TQCompPlotter.cxx:981
 TQCompPlotter.cxx:982
 TQCompPlotter.cxx:983
 TQCompPlotter.cxx:984
 TQCompPlotter.cxx:985
 TQCompPlotter.cxx:986
 TQCompPlotter.cxx:987
 TQCompPlotter.cxx:988
 TQCompPlotter.cxx:989
 TQCompPlotter.cxx:990
 TQCompPlotter.cxx:991
 TQCompPlotter.cxx:992
 TQCompPlotter.cxx:993
 TQCompPlotter.cxx:994
 TQCompPlotter.cxx:995
 TQCompPlotter.cxx:996
 TQCompPlotter.cxx:997
 TQCompPlotter.cxx:998
 TQCompPlotter.cxx:999
 TQCompPlotter.cxx:1000
 TQCompPlotter.cxx:1001
 TQCompPlotter.cxx:1002
 TQCompPlotter.cxx:1003
 TQCompPlotter.cxx:1004
 TQCompPlotter.cxx:1005
 TQCompPlotter.cxx:1006
 TQCompPlotter.cxx:1007
 TQCompPlotter.cxx:1008
 TQCompPlotter.cxx:1009
 TQCompPlotter.cxx:1010
 TQCompPlotter.cxx:1011
 TQCompPlotter.cxx:1012
 TQCompPlotter.cxx:1013
 TQCompPlotter.cxx:1014
 TQCompPlotter.cxx:1015
 TQCompPlotter.cxx:1016
 TQCompPlotter.cxx:1017
 TQCompPlotter.cxx:1018
 TQCompPlotter.cxx:1019
 TQCompPlotter.cxx:1020
 TQCompPlotter.cxx:1021
 TQCompPlotter.cxx:1022
 TQCompPlotter.cxx:1023
 TQCompPlotter.cxx:1024
 TQCompPlotter.cxx:1025
 TQCompPlotter.cxx:1026
 TQCompPlotter.cxx:1027
 TQCompPlotter.cxx:1028
 TQCompPlotter.cxx:1029
 TQCompPlotter.cxx:1030
 TQCompPlotter.cxx:1031
 TQCompPlotter.cxx:1032
 TQCompPlotter.cxx:1033
 TQCompPlotter.cxx:1034
 TQCompPlotter.cxx:1035
 TQCompPlotter.cxx:1036
 TQCompPlotter.cxx:1037
 TQCompPlotter.cxx:1038
 TQCompPlotter.cxx:1039
 TQCompPlotter.cxx:1040
 TQCompPlotter.cxx:1041
 TQCompPlotter.cxx:1042
 TQCompPlotter.cxx:1043
 TQCompPlotter.cxx:1044
 TQCompPlotter.cxx:1045
 TQCompPlotter.cxx:1046
 TQCompPlotter.cxx:1047
 TQCompPlotter.cxx:1048
 TQCompPlotter.cxx:1049
 TQCompPlotter.cxx:1050
 TQCompPlotter.cxx:1051
 TQCompPlotter.cxx:1052
 TQCompPlotter.cxx:1053
 TQCompPlotter.cxx:1054
 TQCompPlotter.cxx:1055
 TQCompPlotter.cxx:1056
 TQCompPlotter.cxx:1057
 TQCompPlotter.cxx:1058
 TQCompPlotter.cxx:1059
 TQCompPlotter.cxx:1060
 TQCompPlotter.cxx:1061
 TQCompPlotter.cxx:1062
 TQCompPlotter.cxx:1063
 TQCompPlotter.cxx:1064
 TQCompPlotter.cxx:1065
 TQCompPlotter.cxx:1066
 TQCompPlotter.cxx:1067
 TQCompPlotter.cxx:1068
 TQCompPlotter.cxx:1069
 TQCompPlotter.cxx:1070
 TQCompPlotter.cxx:1071
 TQCompPlotter.cxx:1072
 TQCompPlotter.cxx:1073
 TQCompPlotter.cxx:1074
 TQCompPlotter.cxx:1075
 TQCompPlotter.cxx:1076
 TQCompPlotter.cxx:1077
 TQCompPlotter.cxx:1078
 TQCompPlotter.cxx:1079
 TQCompPlotter.cxx:1080
 TQCompPlotter.cxx:1081
 TQCompPlotter.cxx:1082
 TQCompPlotter.cxx:1083
 TQCompPlotter.cxx:1084
 TQCompPlotter.cxx:1085
 TQCompPlotter.cxx:1086
 TQCompPlotter.cxx:1087
 TQCompPlotter.cxx:1088
 TQCompPlotter.cxx:1089
 TQCompPlotter.cxx:1090
 TQCompPlotter.cxx:1091
 TQCompPlotter.cxx:1092
 TQCompPlotter.cxx:1093
 TQCompPlotter.cxx:1094
 TQCompPlotter.cxx:1095
 TQCompPlotter.cxx:1096
 TQCompPlotter.cxx:1097
 TQCompPlotter.cxx:1098
 TQCompPlotter.cxx:1099
 TQCompPlotter.cxx:1100
 TQCompPlotter.cxx:1101
 TQCompPlotter.cxx:1102
 TQCompPlotter.cxx:1103
 TQCompPlotter.cxx:1104
 TQCompPlotter.cxx:1105
 TQCompPlotter.cxx:1106
 TQCompPlotter.cxx:1107
 TQCompPlotter.cxx:1108
 TQCompPlotter.cxx:1109
 TQCompPlotter.cxx:1110
 TQCompPlotter.cxx:1111
 TQCompPlotter.cxx:1112
 TQCompPlotter.cxx:1113
 TQCompPlotter.cxx:1114
 TQCompPlotter.cxx:1115
 TQCompPlotter.cxx:1116
 TQCompPlotter.cxx:1117
 TQCompPlotter.cxx:1118
 TQCompPlotter.cxx:1119
 TQCompPlotter.cxx:1120
 TQCompPlotter.cxx:1121
 TQCompPlotter.cxx:1122
 TQCompPlotter.cxx:1123
 TQCompPlotter.cxx:1124
 TQCompPlotter.cxx:1125
 TQCompPlotter.cxx:1126
 TQCompPlotter.cxx:1127
 TQCompPlotter.cxx:1128
 TQCompPlotter.cxx:1129
 TQCompPlotter.cxx:1130
 TQCompPlotter.cxx:1131
 TQCompPlotter.cxx:1132
 TQCompPlotter.cxx:1133
 TQCompPlotter.cxx:1134
 TQCompPlotter.cxx:1135
 TQCompPlotter.cxx:1136
 TQCompPlotter.cxx:1137
 TQCompPlotter.cxx:1138
 TQCompPlotter.cxx:1139
 TQCompPlotter.cxx:1140
 TQCompPlotter.cxx:1141
 TQCompPlotter.cxx:1142
 TQCompPlotter.cxx:1143
 TQCompPlotter.cxx:1144
 TQCompPlotter.cxx:1145
 TQCompPlotter.cxx:1146
 TQCompPlotter.cxx:1147
 TQCompPlotter.cxx:1148
 TQCompPlotter.cxx:1149
 TQCompPlotter.cxx:1150
 TQCompPlotter.cxx:1151
 TQCompPlotter.cxx:1152
 TQCompPlotter.cxx:1153
 TQCompPlotter.cxx:1154
 TQCompPlotter.cxx:1155
 TQCompPlotter.cxx:1156
 TQCompPlotter.cxx:1157
 TQCompPlotter.cxx:1158
 TQCompPlotter.cxx:1159
 TQCompPlotter.cxx:1160
 TQCompPlotter.cxx:1161
 TQCompPlotter.cxx:1162
 TQCompPlotter.cxx:1163
 TQCompPlotter.cxx:1164
 TQCompPlotter.cxx:1165
 TQCompPlotter.cxx:1166
 TQCompPlotter.cxx:1167
 TQCompPlotter.cxx:1168
 TQCompPlotter.cxx:1169
 TQCompPlotter.cxx:1170
 TQCompPlotter.cxx:1171
 TQCompPlotter.cxx:1172
 TQCompPlotter.cxx:1173
 TQCompPlotter.cxx:1174
 TQCompPlotter.cxx:1175
 TQCompPlotter.cxx:1176
 TQCompPlotter.cxx:1177
 TQCompPlotter.cxx:1178
 TQCompPlotter.cxx:1179
 TQCompPlotter.cxx:1180
 TQCompPlotter.cxx:1181
 TQCompPlotter.cxx:1182
 TQCompPlotter.cxx:1183