Hi,
I am trying to get the eff. & eff. error from the same function.
But while compiling & running I am getting the following error.
Error: Symbol make_pair is not defined in current scope EffAndError.C:77:
Error: Symbol double is not defined in current scope EffAndError.C:77:
I am putting the code snippet below.
Can anyone help please?
Thanks & regards.
#include
#include
#include
#include
#include
#include
#include
#include <TGraphAsymmErrors.h>
#include <math.h>
#include
using namespace std;
void EffAndError(){
vectorstd::stringinputfile;
inputfile.push_back(“First_file.root”);
inputfile.push_back(“Second_file.root”);
inputfile.push_back(“Third_file.root”);
//and so on
std::pair<double,std::pair<double,double>> getEfficiency(int passed,int total)
{
double theEff = double(passed)/double(total);
double theEffError= sqrt(theEff*(1.-theEff)/double(total));
pair<double,double>theEffErrors = make_pair<double,double>(theEffError,theEffError);
if((theEff + theEffError) >= 1. || (theEff - theEffError <= 0.)){
//do one bin histo && extract bayes eff
TH1F* theNumHisto = new TH1F(“theNumHisto”,“theNumHisto”,1,0,1);
theNumHisto->SetBinContent(1,passed);
theNumHisto->Sumw2();
TH1F* theDenHisto = new TH1F(“theDenHisto”,"",1,0,1);
theDenHisto->SetBinContent(1,total);
theDenHisto->Sumw2();
TGraphAsymmErrors* bayesEff = new TGraphAsymmErrors();
bayesEff->BayesDivide(theNumHisto,theDenHisto,“b”);
double effErrorHigh = bayesEff->GetErrorYhigh(0);
double effErrorLow = bayesEff->GetErrorYlow(0);
theEffErrors = make_pair<double, double>(effErrorLow, effErrorHigh);
delete theNumHisto;
delete theDenHisto;
delete bayesEff;
}
pair<double,pair<double,double> > theEffAndError = make_pair<double,pair<double,double> >(theEff,theEffErrors);
return theEffAndError;
}
//---------------------------------------------------------------------------
for (int i=0;i<inputfile.size();++i){
TFile *h1 = TFile::Open(inputfile[i].c_str());
gDirectory->cd(“analyzeHiMassTau”);
int passed = Events->GetBinContent(2);
int total = Events->GetBinContent(1);
pair<double,pair<double,double> > efficiency = getEfficiency(passed,total);
double Eff = efficiency.first;
pair<double, double> EffErr = efficiency.second;
}
}