20 ClassImp(RooStats::HistFactory::EstimateSummary);
25 namespace HistFactory {
27 EstimateSummary::EstimateSummary(){
31 IncludeStatError =
false;
32 StatConstraintType=Gaussian;
33 RelErrorThreshold=0.0;
37 EstimateSummary::~EstimateSummary(){}
39 void EstimateSummary::Print(
const char * )
const {
40 cout <<
"EstimateSummary (name = " << name <<
" empty = " << name.empty() <<
")"<< endl;
41 cout <<
" TObj name = " << this->GetName() << endl;
42 cout <<
" Channel = " << channel << endl;
43 cout <<
" NormName = " << normName << endl;
44 cout <<
" Nominal ptr = " << nominal << endl;
45 if (nominal) cout <<
" Nominal hist name = " << nominal->GetName() << endl;
46 cout <<
" Number of hist variations = " << systSourceForHist.size()
47 <<
" " << lowHists.size() <<
" "
48 <<
" " << highHists.size() << endl;
49 cout <<
" Number of overall systematics = " << overallSyst.size() << endl;
52 void EstimateSummary::AddSyst(
const string &sname, TH1* low, TH1* high){
53 systSourceForHist.push_back(sname);
54 lowHists.push_back(low);
55 highHists.push_back(high);
58 bool EstimateSummary::operator==(
const EstimateSummary &other)
const {
63 if(! (name==other.name)){
64 cout <<
"names don't match : " << name <<
" vs " << other.name << endl;
67 if(! (channel==other.channel)){
68 cout <<
"channel names don't match : " << channel <<
" vs " << other.channel << endl;
71 if(! (normName==other.normName)){
72 cout <<
"norm names don't match : " << normName <<
" vs " << other.normName << endl;
75 if(! (shapeFactorName==other.shapeFactorName)){
76 cout <<
"norm names don't match : " << shapeFactorName <<
" vs " << other.shapeFactorName << endl;
79 if (nominal && other.nominal)
80 if(! CompareHisto( this->nominal, other.nominal ) ) {
81 cout <<
"nominal histo don't match" << endl;
84 if(! (IncludeStatError==other.IncludeStatError)){
85 cout <<
"Include Stat Error bools don't match : " << IncludeStatError <<
" vs " << other.IncludeStatError << endl;
88 if(! (StatConstraintType==other.StatConstraintType)){
89 cout <<
"Stat Constraint Types don't match : " << StatConstraintType <<
" vs " << other.StatConstraintType << endl;
92 if(! (RelErrorThreshold==other.RelErrorThreshold)){
93 cout <<
"Relative Stat Error Thresholds don't match : " << RelErrorThreshold <<
" vs " << other.RelErrorThreshold << endl;
96 if (relStatError && other.relStatError)
97 if(! CompareHisto( this->relStatError, other.relStatError ) ) {
98 cout <<
"relStatError histo don't match" << endl;
101 if(! (shapeFactorName==other.shapeFactorName)){
102 cout <<
"Shape Factor Names don't match : " << shapeFactorName <<
" vs " << other.shapeFactorName << endl;
109 for( vector<string>::const_iterator itr=systSourceForHist.begin(); itr!=systSourceForHist.end(); ++itr){
110 unsigned int ind = find(other.systSourceForHist.begin(), other.systSourceForHist.end(), *itr) - other.systSourceForHist.begin();
111 if(ind<other.systSourceForHist.size() && systSourceForHist.size() == other.systSourceForHist.size()){
112 if(! (CompareHisto( lowHists[ counter ], other.lowHists[ ind ]))){
113 cout <<
"contents of sys histo low " << *itr <<
" did not match" << endl;
115 else if (!( CompareHisto( highHists[counter], other.highHists[ ind ]) ) ){
116 cout <<
"contents of sys histo high " << *itr <<
" did not match" << endl;
119 cout <<
"mismatch in systSourceForHist : " << systSourceForHist.size() <<
" vs " << other.systSourceForHist.size() << endl;
120 for( vector<string>::const_iterator itr_this=systSourceForHist.begin(); itr_this!=systSourceForHist.end(); ++itr_this){
121 cout <<
" this contains: " << *itr_this << endl;
123 for( vector<string>::const_iterator itr_other=other.systSourceForHist.begin(); itr_other!=other.systSourceForHist.end(); ++itr_other){
124 cout <<
" other contains: " << *itr_other << endl;
131 if( overallSyst.size() != other.overallSyst.size()){
132 cout <<
"mismatch in overallSyst : " << overallSyst.size() <<
" vs " << other.overallSyst.size() << endl;
135 for( map<
string, pair<double, double> >::const_iterator itr=overallSyst.begin(); itr!=overallSyst.end(); ++itr){
136 map<string, pair<double, double> >::const_iterator found=other.overallSyst.find(itr->first);
137 if(found==other.overallSyst.end()){
138 cout <<
"mismatch in overallSyst, didn't find " << itr->first << endl;
141 if(! (itr->second.first==found->second.first && itr->second.second==found->second.second)){
142 cout <<
"mismatch in overall Syst value of " << itr->first << endl;
149 bool EstimateSummary::CompareHisto(
const TH1 * one,
const TH1 * two)
const {
151 if (!one && !two)
return true;
152 if (!one)
return false;
153 if (!two)
return false;
155 for(
int i=1; i<=one->GetNbinsX(); ++i){
156 if(!(one->GetBinContent(i)-two->GetBinContent(i)==0))
return false;