//this file looks like plain C, but it's actually -*- c++ -*-
#ifndef __TQCutflowPrinter__
#define __TQCutflowPrinter__

#include "QFramework/TQPresenter.h"
#include "QFramework/TQTable.h"

class TQCutflowPrinter : public TQPresenter {

protected:

  bool fVerbose = true;
  
  bool getScaleFactors (TQTaggable& tags, TQNamedTaggable* cut, TList* sfList, double& value, double& error, bool& applied, bool& equal, TString& info);
  bool getValues (TQTaggable& tags, TQNamedTaggable* cut, TQNamedTaggable* process, double& value, double& error, int& raw, TString& info, TString& defaultTitle, TList* sfList);
  bool getValues(TQTaggable& tags, TQNamedTaggable* cut, TQNamedTaggable* process, double& number, double& statError, double& expSysError, double& theoSysError, bool includeScaleUncertainty, int& raw, TString& info, TString& defaultTitle, TList* sfList);
  bool getScaleFactors (TQTaggable& tags, TQNamedTaggable* cut, TQNamedTaggable* process, double& value, double& error, bool& applied, bool& equal, TString& info);
  void getCounterValueAndStatError(
      const TString& processName,
      const TString& cutName,
      double& count,
      double& statErr,
      int& raw,
      TString& info,
      TQTaggable tags,
      TList* sfList
  );
  void getCounterValueAndErrors(
      const TString& processName,
      const TString& cutName,
      double& count,
      double& statErr,
      double& theoSysErr,
      int& raw,
      TString& info,
      TQTaggable tags,
      TList* sfList
  );
  TString makeCellContents (TQTaggable& tags, TQNamedTaggable* cut, TQNamedTaggable* process);
  TString makeSFCellContents(TQTaggable& tags, TQNamedTaggable* cut, TQNamedTaggable* process, TString& info);
 
public:

  TQCutflowPrinter();
  TQCutflowPrinter(TQSampleFolder * samples);
  TQCutflowPrinter(TQSampleDataReader * reader);

  bool readProcessesFromFile(TString fileName, TString channel);
  bool readCutsFromFile (TString fileName, bool addscline=false);

  void addCutflowCut (TString cutName, TString cutTitle, int sfPolicy=0);
  void addCutflowProcess(TString processName, TString processTitle);

  int sanitizeProcesses();
  int sanitizeCuts();

  void setVerbose(bool v);

  TQTable * createTable(const TString& tags = "");
  TQTable * createTable(TQTaggable* tags);
  TQTable * createTable(TQTaggable tags);
 
  void dumpProcesses(std::ostream& out);
  void dumpCuts(std::ostream& out);

  virtual ~TQCutflowPrinter();
 
  ClassDefOverride(TQCutflowPrinter, 0); // presenter class to print cutflows

};

#endif
 TQCutflowPrinter.h:1
 TQCutflowPrinter.h:2
 TQCutflowPrinter.h:3
 TQCutflowPrinter.h:4
 TQCutflowPrinter.h:5
 TQCutflowPrinter.h:6
 TQCutflowPrinter.h:7
 TQCutflowPrinter.h:8
 TQCutflowPrinter.h:9
 TQCutflowPrinter.h:10
 TQCutflowPrinter.h:11
 TQCutflowPrinter.h:12
 TQCutflowPrinter.h:13
 TQCutflowPrinter.h:14
 TQCutflowPrinter.h:15
 TQCutflowPrinter.h:16
 TQCutflowPrinter.h:17
 TQCutflowPrinter.h:18
 TQCutflowPrinter.h:19
 TQCutflowPrinter.h:20
 TQCutflowPrinter.h:21
 TQCutflowPrinter.h:22
 TQCutflowPrinter.h:23
 TQCutflowPrinter.h:24
 TQCutflowPrinter.h:25
 TQCutflowPrinter.h:26
 TQCutflowPrinter.h:27
 TQCutflowPrinter.h:28
 TQCutflowPrinter.h:29
 TQCutflowPrinter.h:30
 TQCutflowPrinter.h:31
 TQCutflowPrinter.h:32
 TQCutflowPrinter.h:33
 TQCutflowPrinter.h:34
 TQCutflowPrinter.h:35
 TQCutflowPrinter.h:36
 TQCutflowPrinter.h:37
 TQCutflowPrinter.h:38
 TQCutflowPrinter.h:39
 TQCutflowPrinter.h:40
 TQCutflowPrinter.h:41
 TQCutflowPrinter.h:42
 TQCutflowPrinter.h:43
 TQCutflowPrinter.h:44
 TQCutflowPrinter.h:45
 TQCutflowPrinter.h:46
 TQCutflowPrinter.h:47
 TQCutflowPrinter.h:48
 TQCutflowPrinter.h:49
 TQCutflowPrinter.h:50
 TQCutflowPrinter.h:51
 TQCutflowPrinter.h:52
 TQCutflowPrinter.h:53
 TQCutflowPrinter.h:54
 TQCutflowPrinter.h:55
 TQCutflowPrinter.h:56
 TQCutflowPrinter.h:57
 TQCutflowPrinter.h:58
 TQCutflowPrinter.h:59
 TQCutflowPrinter.h:60
 TQCutflowPrinter.h:61
 TQCutflowPrinter.h:62
 TQCutflowPrinter.h:63
 TQCutflowPrinter.h:64
 TQCutflowPrinter.h:65
 TQCutflowPrinter.h:66
 TQCutflowPrinter.h:67
 TQCutflowPrinter.h:68
 TQCutflowPrinter.h:69
 TQCutflowPrinter.h:70
 TQCutflowPrinter.h:71
 TQCutflowPrinter.h:72