// @(#)root/roostats:$Id:  cranmer $
// Author: Kyle Cranmer, Akira Shibata
/*************************************************************************
 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/


#ifndef ROOSTATS_ESTIMATESUMMARY_h
#define ROOSTATS_ESTIMATESUMMARY_h

#include "TH1.h"
#include <string>
#include <vector>
#include <map>
#include <iostream>
#include "TObject.h"


namespace RooStats{
namespace HistFactory{

struct  EstimateSummary : public TObject {

  enum ConstraintType{ Gaussian, Poisson };            
   
   struct NormFactor{
      std::string name;
      double val, high, low;
      bool constant;
   };


   class ShapeSys{
   public:
     ShapeSys() : name(""), hist(NULL) {;}
     std::string name;
     TH1* hist;
     ConstraintType constraint;
   };
      

   typedef std::vector<std::string> vecstring;
   typedef std::vector<TH1*> vechist;
   typedef std::pair<double, double> pairdouble;
   typedef std::map<std::string, std::pair<double, double> > mappair;
      
   // simple structure to hold necessary information about each channel
   EstimateSummary();
   virtual ~EstimateSummary();
   void Print(const char *opt = 0) const ;
   void AddSyst( const std::string & sname, TH1* low, TH1* high);
   bool operator==(const EstimateSummary &other) const ;
   bool CompareHisto( const TH1 * one, const TH1 * two) const ;
   
   
   //data members .
   std::string name; 
   std::string channel; 
   std::string normName;
   TH1* nominal;  // x pb per jet bin.  all histograms need index of binning to be consistent
   std::vector<std::string> systSourceForHist;
   std::vector<TH1*> lowHists; // x pb per jet bin for - variations over list of systematics
   std::vector<TH1*> highHists; // x pb per jet bin for + variations over list of systematics
   std::map<std::string, std::pair<double, double> > overallSyst; // "acceptance"->(0.8,1.2)
   std::pair<double, double> dummyForRoot;
   std::vector<NormFactor> normFactor;



  bool IncludeStatError; // Flag to implement Statistical errors for this sample
  ConstraintType StatConstraintType;  // The type of constraint binwise stat errors
  Double_t RelErrorThreshold; // The minimum relative uncertainty for a bin to use stat errors
  TH1* relStatError; // An (optional) externally provided shape for this error

  //  bool doShapeFactor; // A flag to include a ShapeFactor ParamatarizedHistogram
  std::string shapeFactorName; //
  std::vector<ShapeSys> shapeSysts; //

   ClassDef(RooStats::HistFactory::EstimateSummary,1)
};

}
}

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