#include "QFramework/TQLibrary.h"

#include "QFramework/TQCutflowPlotter.h"
#include "QFramework/TQUtils.h"
#include "QFramework/TQIterator.h"

////////////////////////////////////////////////////////////////////////////////////////////////
//
// TQCutflowPlotter:
//
// The TQCutflowPlotter class uses an TQSampleDataReader to obtain
// cutflow numbers to plot a cutflow as a bar-chart.
//
////////////////////////////////////////////////////////////////////////////////////////////////

ClassImp(TQCutflowPlotter)

TQCutflowPlotter::TQCutflowPlotter(TQSampleFolder* sf) : TQPresenter(sf) {
  // constructor using a sample folder
}

TQCutflowPlotter::TQCutflowPlotter(TQSampleDataReader* reader) : TQPresenter(reader) {
  // constructor using a sample data reader
}



bool TQCutflowPlotter::writeToFile(const TString& filename, const TString& tags){
  // write the cutflow plot to a file
  // supported formats (can be set with "format=<format>") are:
  // - tikz: TikZ-formatted LaTeX text file for a bar chart
  // - plain: CSV-formatted numbers for processing with some external software
  TQTaggable tmp(tags);
  return this->writeToFile(filename,tmp);
}

bool TQCutflowPlotter::writeToFile(const TString& filename, TQTaggable& tags){
  // write the cutflow plot to a file
  // supported formats (can be set with "format=<format>") are:
  // - tikz: TikZ-formatted LaTeX text file for a bar chart
  // - plain: CSV-formatted numbers for processing with some external software
  tags.importTags(this);
  std::ofstream ofile(filename);
  if(!ofile.is_open()){
    return false;
  }
  TString format = "tikz";
  //@tag: [format] Sets the format in which the cut flow is plotted. Default: "tikz", other values: "plain". Argument tag overrides object tag.
  tags.getTagString("format",format);
  format.ToLower();
  if(format.CompareTo("tikz") == 0){
    this->writeTikZHead(ofile,tags);
    this->writeTikZBody(ofile,tags);
    this->writeTikZFoot(ofile,tags);
  } else if(format.CompareTo("plain") == 0){
    this->writePlain(ofile,tags);
  } else {
    ofile.close();
    return false;
  }
  ofile.close();
  return true;
}


void TQCutflowPlotter::writeTikZHead(std::ostream& out, TQTaggable& tags){
  // write the TikZ-head to a stream
  tags.importTags(this);
  //@tag: [standalone] If this argument tag is set to true, tikz formated output is produced as a standalone version. Argument tag overrides object tag.
  if(tags.getTagBoolDefault("standalone",true)){
    out << "\\documentclass {standalone}" << std::endl;
    out << "\\usepackage{pgfplots, pgfplotstable}" << std::endl;
    out << "\\pgfplotsset{compat=1.8} " << std::endl;
    out << "\\pgfplotsset{single xbar legend/.style={legend image code/.code={\\draw[##1,/tikz/.cd,bar width=6pt,bar shift=0pt,xbar] plot coordinates {(0.8em,0pt)};}}}" << std::endl;
    out << "\\begin{document}" << std::endl;
  }
}

void TQCutflowPlotter::writePlain(std::ostream& out, TQTaggable& tags){
  // write a the "plain" numbers in CSV format to some stream
  tags.importTags(this);  
  //@tag:[style.plain.sep] This tag specifies the seperator used in plain text output. Default: ",". Argument tag overrides object tag.
  TString sep = tags.getTagStringDefault("style.plain.sep",",");
  //@tag:[style.plain.leadCellContent] This tag specifies the content of the top left cell in plain text output. Default: "Cut/Process". Argument tag overrides object tag.
  out << tags.getTagStringDefault("style.plain.leadCellContent","Cut/Process");
  TQTaggableIterator processes(this->fProcesses);
  while(processes.hasNext()){
    TQTaggable* process = processes.readNext();
    if(process){
      TString processPath;
      //@tag: [.path] This process tag specifies the location of the process in the TQFolder structure.
      if(process->getTagString(".path",processPath)){
				processPath = tags.replaceInText(processPath);
				if(TQFolder::isValidPath(processPath,true,true,true)){
					out << sep << processPath;
				}
      }
    }
  }
  out << std::endl;
  TQTaggableIterator cuts(this->fCuts);
  while(cuts.hasNext()){
    TQTaggable* cut = cuts.readNext();
    if(!cut) continue;
    TString cutTitle, cutName;
    //@tag: [.name] This cut/process tag specifies the name of the respective cut/process
    if(cut->getTagString(".name",cutName)){
      if(cutName.BeginsWith("|")) continue;
      out << cutName;
      std::vector<double> numbers;
      processes.reset(); 
      while(processes.hasNext()){
        TQTaggable* process = processes.readNext();
        if(process){
          TString processPath;
          if(process->getTagString(".path",processPath)){
						processPath = tags.replaceInText(processPath);
						if(TQFolder::isValidPath(processPath,true,true,true)){
							TQCounter * counter = fReader->getCounter(processPath, cutName,&tags);
							if (counter) {
								double number = counter->getCounter();
								if(TQUtils::isNum(number)) numbers.push_back(number);
								else numbers.push_back(0.);
								delete counter;
							} else {
								numbers.push_back(0.);
							}
						}
					}
        }
      }
      //@tag: [style.normalize] If this tag is set to true, the cutflow is normalized such that the sum of all processes at one cut stage is one. Default: false. Argument tag overrides object tag.
      if(tags.getTagBoolDefault("style.normalize",false)){
        double normalization = 0.;
        for(size_t i=0; i<numbers.size(); i++){
          normalization += numbers[i];
        }
        if(normalization > 0){
          for(size_t i=0; i<numbers.size(); i++){
            out << sep;
            out << numbers[i]/normalization;
          }
        } else {
          for(size_t i=0; i<numbers.size(); i++){
            out << sep;
            out << 0;
          }
        }
      } else {
        for(size_t i=0; i<numbers.size(); i++){
          out << sep;
          out << numbers[i];
        }
      }
      out << std::endl;
    }
  }
}

void TQCutflowPlotter::writeTikZBody(std::ostream& out, TQTaggable& tags){
  // write the TikZ-body to a stream

  tags.importTags(this);
  std::vector<TString> styles;
  std::vector<TString> processnames;
  std::vector<TString> processtitles;
  TQTaggableIterator processes(this->fProcesses);
	if(!processes.hasNext()){
		WARNclass("no processes booked, writing empty cutflow plot!");
	}
  while(processes.hasNext()){
    TQTaggable* process = processes.readNext();
    if(process){
      TString processPath, processName, processStyle, processTitle;
			if(process->getTagString(".path",processPath)){
				processPath = tags.replaceInText(processPath);
				if(TQFolder::isValidPath(processPath,true,true,true)){
					if(!process->getTagString(".name",processName)){
						processName = TQFolder::makeValidIdentifier(processPath);
					}
					//@tag: [.style] This process tag specifies the style used in tikz output for the respective process. If it is not set on the process, it is retrieved from the common base folder of the folders belonging to this process.
					TList* folders = fReader->getListOfSampleFolders(processPath);
					TQFolder* f = fReader->getSampleFolder()->findCommonBaseFolder(folders);
					delete folders;
					processStyle = "";
					int color;
					//@tag: [~style.default.histFillColor] This (sample-)folder tag specifies the fill color used for processes for which folder is the common base folder.
					if(process->getTagInteger("histFillColor",color)||process->getTagInteger("color",color)||f->getTagInteger("~style.default.histFillColor",color)){
						processStyle.Append("fill=");
						TString colorName = processName;
						colorName.Prepend("fill");
						TString colordef =  TQStringUtils::getColorDefStringLaTeX(colorName,color);
						out << colordef << std::endl;
						processStyle.Append(colorName);
					}
					//@tag: [~style.default.histLineColor] This (sample-)folder tag specifies the line color used for processes for which folder is the common base folder.
					if(process->getTagInteger("histLineColor",color)||process->getTagInteger("color",color)||f->getTagInteger("~style.default.histLineColor",color)){
						if(color != kBlack){
							if(!processStyle.IsNull()) processStyle.Append(",");
							processStyle.Append("draw=");
							TString colorName = processName;
							colorName.Prepend("draw");
							TString colordef =  TQStringUtils::getColorDefStringLaTeX(colorName,color);
							out << colordef << std::endl;
							processStyle.Append(colorName);
						}
					}
					process->getTagString(".style",processStyle);
					if(f){
						f->getTagString("~style.default.title",processTitle);
					}
					process->getTagString(".title",processTitle);
					styles.push_back(processStyle);
					processnames.push_back(processName);
					processtitles.push_back(TQStringUtils::convertROOTTeX2LaTeX(processTitle));
				}
			}
    }
  }
 
  out << "\\begin{tikzpicture}" << std::endl;
  out << "\\pgfplotstableread[col sep=comma]{" << std::endl;
 
  out << "label";
  for(size_t i=0; i<processnames.size(); i++){
    out << "," << "{" << processnames[i] << "}";
  }
  out << std::endl;
 
  int nCuts = 0;
  TQTaggableIterator cuts(this->fCuts);
  while(cuts.hasNext()){
    TQTaggable* cut = cuts.readNext();
    if(!cut) continue;
    TString cutTitle, cutName;
    if(!cut->getTagString(".name",cutName)) continue;
    if(!cut->getTagString(".title",cutTitle)) cutTitle=cutName;
    if(cutName.BeginsWith("|")) continue;
		cutTitle.ReplaceAll("_","");
    out << "{" << cutTitle << "}"; 
    nCuts++;
    std::vector<double> numbers;
    processes.reset(); 
    while(processes.hasNext()){
      TQTaggable* process = processes.readNext();
      if(process){
        TString processPath;
				if(process->getTagString(".path",processPath)){
					processPath = tags.replaceInText(processPath);
					if(TQFolder::isValidPath(processPath,true,true,true)){
						TQCounter * counter = fReader->getCounter(processPath, cutName,&tags);
						if (counter) {
							double number = counter->getCounter();
							if(TQUtils::isNum(number)) numbers.push_back(number);
							else numbers.push_back(0.);
							delete counter;
						} else {
							numbers.push_back(0.);
						}
					}
        }
      }
    }
    if(tags.getTagBoolDefault("style.normalize",true)){
      double normalization = 0.;
      for(size_t i=0; i<numbers.size(); i++){
        normalization += numbers[i];
      }
      if(normalization > 0){
        for(size_t i=0; i<numbers.size(); i++){
          out << ",";
          out << "{" << numbers[i]/normalization << "}";
        }
      } else {
        for(size_t i=0; i<numbers.size(); i++){
          out << ",";
          out << "{" << 0 << "}";
        }
      }
    } else {
      for(size_t i=0; i<numbers.size(); i++){
        out << ",";
        out << "{" << numbers[i] << "}";
      }
    }
    out << std::endl;
  }
 
  out << "}\\datatable" << std::endl;
  out << "\\begin{axis}[" << std::endl;
  //@tag: [style.tikz.lineHeight] This tag determines the line height in tikz formated output. Default: "1.5em". Argument tag overrides object tag. 
  out << " height=" << nCuts << "*" << tags.getTagStringDefault("style.tikz.lineHeight","1.5em") << "," << std::endl;
  //@tag: [style.tikz.width] This tag determines the width in tikz formated output. Default: "3cm". Argument tag overrides object tag. 
  out << " width=" << tags.getTagStringDefault("style.tikz.width","3cm") << "," << std::endl;
  out << " scale only axis," << std::endl;
  //@tag: [style.tikz.enlargeLimits] This tag determines value of the "enlarge y limits" option in tikz formated output. Default: "5pt". Argument tag overrides object tag. 
  out << " enlarge y limits={abs=" << tags.getTagStringDefault("style.tikz.enlargeLimits","5pt") << "}," << std::endl;
  out << " xmin=0," << std::endl;
  out << " tick align=outside," << std::endl;
  out << " axis x line*=bottom," << std::endl;
  out << " axis y line*=left," << std::endl;
	out << " legend cell align=left,legend style={draw=none,at={(1.10,0.5)},anchor=west}," << std::endl;
  out << " every y tick/.style={draw=none}," << std::endl;
  out << " xbar stacked, " << std::endl;
  //@tag: [style.tikz.reverseYordering] If this tag is set to true, the option "y dir=reverse" is added for tikz formated output. Default: true. Argument tag overrides object tag.
  if(tags.getTagBoolDefault("style.tikz.reverseYordering",true)) out << " y dir=reverse," << std::endl; 
  //@tag: [style.tikz.normalize] If this tag is set to true, the following options are added for tikz formated output: "scaled x ticks=false", "x tick label style={/pgf/number format/fixed}", "enlarge x limits=false". If set to false, "enlarge x limits=upper" is used. Default: true. Argument tag overrides object tag.
  if(tags.getTagBoolDefault("style.tikz.normalize",true)){
    out << " scaled x ticks=false," << std::endl; 
    out << " x tick label style={/pgf/number format/fixed}," << std::endl;
    out << " enlarge x limits=false," << std::endl;
  } else {
    out << " enlarge x limits=upper," << std::endl;
  }
  //@tag: [style.tikz.barWidth] This tag specifies the bar width for tikz formated output. Default: "10pt". Argument tag overrides object tag.
  out << " bar width=" << tags.getTagStringDefault("style.tikz.barWidth","10pt") << "," << std::endl;
  out << " ytick=data," << std::endl;
  out << " yticklabels from table={\\datatable}{label}," << std::endl;
  out << "]" << std::endl;
 
  processes.reset();
  size_t idx = 0;
  while(processes.hasNext()){
    TQTaggable* process = processes.readNext();
    if(process){
      TString processStyle, processName, processPath, processTitle;
      if(process->getTagString(".path",processPath)){
				processPath = tags.replaceInText(processPath);
				if(TQFolder::isValidPath(processPath,true,true,true)){
					if(!process->getTagString(".name",processName)){
						processName = TQFolder::makeValidIdentifier(processPath);
					}
					out << "\\addplot[";
					out << styles[idx];
					out << "] table [x=" << processName << ", y expr=\\coordindex] {\\datatable};" << std::endl;
					idx++;
				}
      }
    }
  }
  //@tag: [style.showLegend] If this tag is set to true, a legend is added to tikz formated output. Default: false. Argument tag overrides object tag.
  if(tags.getTagBoolDefault("style.showLegend",false)){
		bool mathtitles = tags.getTagBoolDefault("style.legendMathTitles",false);
    out << "\\legend{";
    for(size_t i=0; i<processtitles.size(); i++){
      if(i!=0) out << ",";
			if(mathtitles || ( (processtitles[i].Contains("\\") || processtitles[i].Contains("_") || processtitles[i].Contains("^")) && !processtitles[i].Contains("$")) ){
				out << "\\ensuremath{" << processtitles[i] << "}";
			} else {
				out << processtitles[i];
			}
    }
    out << "}" << std::endl;
  }
  out << "\\end{axis}" << std::endl;
  out << "\\end{tikzpicture}%" << std::endl;
 
}

void TQCutflowPlotter::writeTikZFoot(std::ostream& out, TQTaggable& tags){
  // write the TikZ-foot to a stream
  if(tags.getTagBoolDefault("standalone",true)){
    out << "\\end{document}" << std::endl;
  }
}

void TQCutflowPlotter::setup(){
  // set some default tags
}

 TQCutflowPlotter.cxx:1
 TQCutflowPlotter.cxx:2
 TQCutflowPlotter.cxx:3
 TQCutflowPlotter.cxx:4
 TQCutflowPlotter.cxx:5
 TQCutflowPlotter.cxx:6
 TQCutflowPlotter.cxx:7
 TQCutflowPlotter.cxx:8
 TQCutflowPlotter.cxx:9
 TQCutflowPlotter.cxx:10
 TQCutflowPlotter.cxx:11
 TQCutflowPlotter.cxx:12
 TQCutflowPlotter.cxx:13
 TQCutflowPlotter.cxx:14
 TQCutflowPlotter.cxx:15
 TQCutflowPlotter.cxx:16
 TQCutflowPlotter.cxx:17
 TQCutflowPlotter.cxx:18
 TQCutflowPlotter.cxx:19
 TQCutflowPlotter.cxx:20
 TQCutflowPlotter.cxx:21
 TQCutflowPlotter.cxx:22
 TQCutflowPlotter.cxx:23
 TQCutflowPlotter.cxx:24
 TQCutflowPlotter.cxx:25
 TQCutflowPlotter.cxx:26
 TQCutflowPlotter.cxx:27
 TQCutflowPlotter.cxx:28
 TQCutflowPlotter.cxx:29
 TQCutflowPlotter.cxx:30
 TQCutflowPlotter.cxx:31
 TQCutflowPlotter.cxx:32
 TQCutflowPlotter.cxx:33
 TQCutflowPlotter.cxx:34
 TQCutflowPlotter.cxx:35
 TQCutflowPlotter.cxx:36
 TQCutflowPlotter.cxx:37
 TQCutflowPlotter.cxx:38
 TQCutflowPlotter.cxx:39
 TQCutflowPlotter.cxx:40
 TQCutflowPlotter.cxx:41
 TQCutflowPlotter.cxx:42
 TQCutflowPlotter.cxx:43
 TQCutflowPlotter.cxx:44
 TQCutflowPlotter.cxx:45
 TQCutflowPlotter.cxx:46
 TQCutflowPlotter.cxx:47
 TQCutflowPlotter.cxx:48
 TQCutflowPlotter.cxx:49
 TQCutflowPlotter.cxx:50
 TQCutflowPlotter.cxx:51
 TQCutflowPlotter.cxx:52
 TQCutflowPlotter.cxx:53
 TQCutflowPlotter.cxx:54
 TQCutflowPlotter.cxx:55
 TQCutflowPlotter.cxx:56
 TQCutflowPlotter.cxx:57
 TQCutflowPlotter.cxx:58
 TQCutflowPlotter.cxx:59
 TQCutflowPlotter.cxx:60
 TQCutflowPlotter.cxx:61
 TQCutflowPlotter.cxx:62
 TQCutflowPlotter.cxx:63
 TQCutflowPlotter.cxx:64
 TQCutflowPlotter.cxx:65
 TQCutflowPlotter.cxx:66
 TQCutflowPlotter.cxx:67
 TQCutflowPlotter.cxx:68
 TQCutflowPlotter.cxx:69
 TQCutflowPlotter.cxx:70
 TQCutflowPlotter.cxx:71
 TQCutflowPlotter.cxx:72
 TQCutflowPlotter.cxx:73
 TQCutflowPlotter.cxx:74
 TQCutflowPlotter.cxx:75
 TQCutflowPlotter.cxx:76
 TQCutflowPlotter.cxx:77
 TQCutflowPlotter.cxx:78
 TQCutflowPlotter.cxx:79
 TQCutflowPlotter.cxx:80
 TQCutflowPlotter.cxx:81
 TQCutflowPlotter.cxx:82
 TQCutflowPlotter.cxx:83
 TQCutflowPlotter.cxx:84
 TQCutflowPlotter.cxx:85
 TQCutflowPlotter.cxx:86
 TQCutflowPlotter.cxx:87
 TQCutflowPlotter.cxx:88
 TQCutflowPlotter.cxx:89
 TQCutflowPlotter.cxx:90
 TQCutflowPlotter.cxx:91
 TQCutflowPlotter.cxx:92
 TQCutflowPlotter.cxx:93
 TQCutflowPlotter.cxx:94
 TQCutflowPlotter.cxx:95
 TQCutflowPlotter.cxx:96
 TQCutflowPlotter.cxx:97
 TQCutflowPlotter.cxx:98
 TQCutflowPlotter.cxx:99
 TQCutflowPlotter.cxx:100
 TQCutflowPlotter.cxx:101
 TQCutflowPlotter.cxx:102
 TQCutflowPlotter.cxx:103
 TQCutflowPlotter.cxx:104
 TQCutflowPlotter.cxx:105
 TQCutflowPlotter.cxx:106
 TQCutflowPlotter.cxx:107
 TQCutflowPlotter.cxx:108
 TQCutflowPlotter.cxx:109
 TQCutflowPlotter.cxx:110
 TQCutflowPlotter.cxx:111
 TQCutflowPlotter.cxx:112
 TQCutflowPlotter.cxx:113
 TQCutflowPlotter.cxx:114
 TQCutflowPlotter.cxx:115
 TQCutflowPlotter.cxx:116
 TQCutflowPlotter.cxx:117
 TQCutflowPlotter.cxx:118
 TQCutflowPlotter.cxx:119
 TQCutflowPlotter.cxx:120
 TQCutflowPlotter.cxx:121
 TQCutflowPlotter.cxx:122
 TQCutflowPlotter.cxx:123
 TQCutflowPlotter.cxx:124
 TQCutflowPlotter.cxx:125
 TQCutflowPlotter.cxx:126
 TQCutflowPlotter.cxx:127
 TQCutflowPlotter.cxx:128
 TQCutflowPlotter.cxx:129
 TQCutflowPlotter.cxx:130
 TQCutflowPlotter.cxx:131
 TQCutflowPlotter.cxx:132
 TQCutflowPlotter.cxx:133
 TQCutflowPlotter.cxx:134
 TQCutflowPlotter.cxx:135
 TQCutflowPlotter.cxx:136
 TQCutflowPlotter.cxx:137
 TQCutflowPlotter.cxx:138
 TQCutflowPlotter.cxx:139
 TQCutflowPlotter.cxx:140
 TQCutflowPlotter.cxx:141
 TQCutflowPlotter.cxx:142
 TQCutflowPlotter.cxx:143
 TQCutflowPlotter.cxx:144
 TQCutflowPlotter.cxx:145
 TQCutflowPlotter.cxx:146
 TQCutflowPlotter.cxx:147
 TQCutflowPlotter.cxx:148
 TQCutflowPlotter.cxx:149
 TQCutflowPlotter.cxx:150
 TQCutflowPlotter.cxx:151
 TQCutflowPlotter.cxx:152
 TQCutflowPlotter.cxx:153
 TQCutflowPlotter.cxx:154
 TQCutflowPlotter.cxx:155
 TQCutflowPlotter.cxx:156
 TQCutflowPlotter.cxx:157
 TQCutflowPlotter.cxx:158
 TQCutflowPlotter.cxx:159
 TQCutflowPlotter.cxx:160
 TQCutflowPlotter.cxx:161
 TQCutflowPlotter.cxx:162
 TQCutflowPlotter.cxx:163
 TQCutflowPlotter.cxx:164
 TQCutflowPlotter.cxx:165
 TQCutflowPlotter.cxx:166
 TQCutflowPlotter.cxx:167
 TQCutflowPlotter.cxx:168
 TQCutflowPlotter.cxx:169
 TQCutflowPlotter.cxx:170
 TQCutflowPlotter.cxx:171
 TQCutflowPlotter.cxx:172
 TQCutflowPlotter.cxx:173
 TQCutflowPlotter.cxx:174
 TQCutflowPlotter.cxx:175
 TQCutflowPlotter.cxx:176
 TQCutflowPlotter.cxx:177
 TQCutflowPlotter.cxx:178
 TQCutflowPlotter.cxx:179
 TQCutflowPlotter.cxx:180
 TQCutflowPlotter.cxx:181
 TQCutflowPlotter.cxx:182
 TQCutflowPlotter.cxx:183
 TQCutflowPlotter.cxx:184
 TQCutflowPlotter.cxx:185
 TQCutflowPlotter.cxx:186
 TQCutflowPlotter.cxx:187
 TQCutflowPlotter.cxx:188
 TQCutflowPlotter.cxx:189
 TQCutflowPlotter.cxx:190
 TQCutflowPlotter.cxx:191
 TQCutflowPlotter.cxx:192
 TQCutflowPlotter.cxx:193
 TQCutflowPlotter.cxx:194
 TQCutflowPlotter.cxx:195
 TQCutflowPlotter.cxx:196
 TQCutflowPlotter.cxx:197
 TQCutflowPlotter.cxx:198
 TQCutflowPlotter.cxx:199
 TQCutflowPlotter.cxx:200
 TQCutflowPlotter.cxx:201
 TQCutflowPlotter.cxx:202
 TQCutflowPlotter.cxx:203
 TQCutflowPlotter.cxx:204
 TQCutflowPlotter.cxx:205
 TQCutflowPlotter.cxx:206
 TQCutflowPlotter.cxx:207
 TQCutflowPlotter.cxx:208
 TQCutflowPlotter.cxx:209
 TQCutflowPlotter.cxx:210
 TQCutflowPlotter.cxx:211
 TQCutflowPlotter.cxx:212
 TQCutflowPlotter.cxx:213
 TQCutflowPlotter.cxx:214
 TQCutflowPlotter.cxx:215
 TQCutflowPlotter.cxx:216
 TQCutflowPlotter.cxx:217
 TQCutflowPlotter.cxx:218
 TQCutflowPlotter.cxx:219
 TQCutflowPlotter.cxx:220
 TQCutflowPlotter.cxx:221
 TQCutflowPlotter.cxx:222
 TQCutflowPlotter.cxx:223
 TQCutflowPlotter.cxx:224
 TQCutflowPlotter.cxx:225
 TQCutflowPlotter.cxx:226
 TQCutflowPlotter.cxx:227
 TQCutflowPlotter.cxx:228
 TQCutflowPlotter.cxx:229
 TQCutflowPlotter.cxx:230
 TQCutflowPlotter.cxx:231
 TQCutflowPlotter.cxx:232
 TQCutflowPlotter.cxx:233
 TQCutflowPlotter.cxx:234
 TQCutflowPlotter.cxx:235
 TQCutflowPlotter.cxx:236
 TQCutflowPlotter.cxx:237
 TQCutflowPlotter.cxx:238
 TQCutflowPlotter.cxx:239
 TQCutflowPlotter.cxx:240
 TQCutflowPlotter.cxx:241
 TQCutflowPlotter.cxx:242
 TQCutflowPlotter.cxx:243
 TQCutflowPlotter.cxx:244
 TQCutflowPlotter.cxx:245
 TQCutflowPlotter.cxx:246
 TQCutflowPlotter.cxx:247
 TQCutflowPlotter.cxx:248
 TQCutflowPlotter.cxx:249
 TQCutflowPlotter.cxx:250
 TQCutflowPlotter.cxx:251
 TQCutflowPlotter.cxx:252
 TQCutflowPlotter.cxx:253
 TQCutflowPlotter.cxx:254
 TQCutflowPlotter.cxx:255
 TQCutflowPlotter.cxx:256
 TQCutflowPlotter.cxx:257
 TQCutflowPlotter.cxx:258
 TQCutflowPlotter.cxx:259
 TQCutflowPlotter.cxx:260
 TQCutflowPlotter.cxx:261
 TQCutflowPlotter.cxx:262
 TQCutflowPlotter.cxx:263
 TQCutflowPlotter.cxx:264
 TQCutflowPlotter.cxx:265
 TQCutflowPlotter.cxx:266
 TQCutflowPlotter.cxx:267
 TQCutflowPlotter.cxx:268
 TQCutflowPlotter.cxx:269
 TQCutflowPlotter.cxx:270
 TQCutflowPlotter.cxx:271
 TQCutflowPlotter.cxx:272
 TQCutflowPlotter.cxx:273
 TQCutflowPlotter.cxx:274
 TQCutflowPlotter.cxx:275
 TQCutflowPlotter.cxx:276
 TQCutflowPlotter.cxx:277
 TQCutflowPlotter.cxx:278
 TQCutflowPlotter.cxx:279
 TQCutflowPlotter.cxx:280
 TQCutflowPlotter.cxx:281
 TQCutflowPlotter.cxx:282
 TQCutflowPlotter.cxx:283
 TQCutflowPlotter.cxx:284
 TQCutflowPlotter.cxx:285
 TQCutflowPlotter.cxx:286
 TQCutflowPlotter.cxx:287
 TQCutflowPlotter.cxx:288
 TQCutflowPlotter.cxx:289
 TQCutflowPlotter.cxx:290
 TQCutflowPlotter.cxx:291
 TQCutflowPlotter.cxx:292
 TQCutflowPlotter.cxx:293
 TQCutflowPlotter.cxx:294
 TQCutflowPlotter.cxx:295
 TQCutflowPlotter.cxx:296
 TQCutflowPlotter.cxx:297
 TQCutflowPlotter.cxx:298
 TQCutflowPlotter.cxx:299
 TQCutflowPlotter.cxx:300
 TQCutflowPlotter.cxx:301
 TQCutflowPlotter.cxx:302
 TQCutflowPlotter.cxx:303
 TQCutflowPlotter.cxx:304
 TQCutflowPlotter.cxx:305
 TQCutflowPlotter.cxx:306
 TQCutflowPlotter.cxx:307
 TQCutflowPlotter.cxx:308
 TQCutflowPlotter.cxx:309
 TQCutflowPlotter.cxx:310
 TQCutflowPlotter.cxx:311
 TQCutflowPlotter.cxx:312
 TQCutflowPlotter.cxx:313
 TQCutflowPlotter.cxx:314
 TQCutflowPlotter.cxx:315
 TQCutflowPlotter.cxx:316
 TQCutflowPlotter.cxx:317
 TQCutflowPlotter.cxx:318
 TQCutflowPlotter.cxx:319
 TQCutflowPlotter.cxx:320
 TQCutflowPlotter.cxx:321
 TQCutflowPlotter.cxx:322
 TQCutflowPlotter.cxx:323
 TQCutflowPlotter.cxx:324
 TQCutflowPlotter.cxx:325
 TQCutflowPlotter.cxx:326
 TQCutflowPlotter.cxx:327
 TQCutflowPlotter.cxx:328
 TQCutflowPlotter.cxx:329
 TQCutflowPlotter.cxx:330
 TQCutflowPlotter.cxx:331
 TQCutflowPlotter.cxx:332
 TQCutflowPlotter.cxx:333
 TQCutflowPlotter.cxx:334
 TQCutflowPlotter.cxx:335
 TQCutflowPlotter.cxx:336
 TQCutflowPlotter.cxx:337
 TQCutflowPlotter.cxx:338
 TQCutflowPlotter.cxx:339
 TQCutflowPlotter.cxx:340
 TQCutflowPlotter.cxx:341
 TQCutflowPlotter.cxx:342
 TQCutflowPlotter.cxx:343
 TQCutflowPlotter.cxx:344
 TQCutflowPlotter.cxx:345
 TQCutflowPlotter.cxx:346
 TQCutflowPlotter.cxx:347
 TQCutflowPlotter.cxx:348
 TQCutflowPlotter.cxx:349
 TQCutflowPlotter.cxx:350
 TQCutflowPlotter.cxx:351
 TQCutflowPlotter.cxx:352
 TQCutflowPlotter.cxx:353
 TQCutflowPlotter.cxx:354
 TQCutflowPlotter.cxx:355
 TQCutflowPlotter.cxx:356
 TQCutflowPlotter.cxx:357
 TQCutflowPlotter.cxx:358
 TQCutflowPlotter.cxx:359
 TQCutflowPlotter.cxx:360
 TQCutflowPlotter.cxx:361
 TQCutflowPlotter.cxx:362
 TQCutflowPlotter.cxx:363
 TQCutflowPlotter.cxx:364
 TQCutflowPlotter.cxx:365
 TQCutflowPlotter.cxx:366
 TQCutflowPlotter.cxx:367
 TQCutflowPlotter.cxx:368
 TQCutflowPlotter.cxx:369
 TQCutflowPlotter.cxx:370