本文整理汇总了C++中RooRealVar::SetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ RooRealVar::SetTitle方法的具体用法?C++ RooRealVar::SetTitle怎么用?C++ RooRealVar::SetTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RooRealVar
的用法示例。
在下文中一共展示了RooRealVar::SetTitle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_data_mgg
void draw_data_mgg(TString folderName,bool blind=true,float min=103,float max=160)
{
TFile inputFile(folderName+"/data.root");
const int nCat = 5;
TString cats[5] = {"HighPt","Hbb","Zbb","HighRes","LowRes"};
TCanvas cv;
for(int iCat=0; iCat < nCat; iCat++) {
RooWorkspace *ws = (RooWorkspace*)inputFile.Get(cats[iCat]+"_mgg_workspace");
RooFitResult* res = (RooFitResult*)ws->obj("fitresult_pdf_data");
RooRealVar * mass = ws->var("mgg");
mass->setRange("all",min,max);
mass->setRange("blind",121,130);
mass->setRange("low",106,121);
mass->setRange("high",130,160);
mass->setUnit("GeV");
mass->SetTitle("m_{#gamma#gamma}");
RooAbsPdf * pdf = ws->pdf("pdf");
RooPlot *plot = mass->frame(min,max,max-min);
plot->SetTitle("");
RooAbsData* data = ws->data("data")->reduce(Form("mgg > %f && mgg < %f",min,max));
double nTot = data->sumEntries();
if(blind) data = data->reduce("mgg < 121 || mgg>130");
double nBlind = data->sumEntries();
double norm = nTot/nBlind; //normalization for the plot
data->plotOn(plot);
pdf->plotOn(plot,RooFit::NormRange( "low,high" ),RooFit::Range("Full"),RooFit::LineWidth(0.1) );
plot->Print();
//add the fix error band
RooCurve* c = plot->getCurve("pdf_Norm[mgg]_Range[Full]_NormRange[Full]");
const int Nc = c->GetN();
//TGraphErrors errfix(Nc);
//TGraphErrors errfix2(Nc);
TGraphAsymmErrors errfix(Nc);
TGraphAsymmErrors errfix2(Nc);
Double_t *x = c->GetX();
Double_t *y = c->GetY();
double NtotalFit = ws->var("Nbkg1")->getVal()*ws->var("Nbkg1")->getVal() + ws->var("Nbkg2")->getVal()*ws->var("Nbkg2")->getVal();
for( int i = 0; i < Nc; i++ )
{
errfix.SetPoint(i,x[i],y[i]);
errfix2.SetPoint(i,x[i],y[i]);
mass->setVal(x[i]);
double shapeErr = pdf->getPropagatedError(*res)*NtotalFit;
//double totalErr = TMath::Sqrt( shapeErr*shapeErr + y[i] );
//total normalization error
double totalErr = TMath::Sqrt( shapeErr*shapeErr + y[i]*y[i]/NtotalFit );
if ( y[i] - totalErr > .0 )
{
errfix.SetPointError(i, 0, 0, totalErr, totalErr );
}
else
{
errfix.SetPointError(i, 0, 0, y[i] - 0.01, totalErr );
}
//2sigma
if ( y[i] - 2.*totalErr > .0 )
{
errfix2.SetPointError(i, 0, 0, 2.*totalErr, 2.*totalErr );
}
else
{
errfix2.SetPointError(i, 0, 0, y[i] - 0.01, 2.*totalErr );
}
/*
std::cout << x[i] << " " << y[i] << " "
<< " ,pdf get Val: " << pdf->getVal()
<< " ,pdf get Prop Err: " << pdf->getPropagatedError(*res)*NtotalFit
<< " stat uncertainty: " << TMath::Sqrt(y[i]) << " Ntot: " << NtotalFit << std::endl;
*/
}
errfix.SetFillColor(kYellow);
errfix2.SetFillColor(kGreen);
//pdf->plotOn(plot,RooFit::NormRange( "low,high" ),RooFit::FillColor(kGreen),RooFit::Range("Full"), RooFit::VisualizeError(*res,2.0,kFALSE));
//pdf->plotOn(plot,RooFit::NormRange( "low,high" ),RooFit::FillColor(kYellow),RooFit::Range("Full"), RooFit::VisualizeError(*res,1.0,kFALSE));
//pdf->plotOn(plot,RooFit::NormRange( "low,high" ),RooFit::FillColor(kGreen),RooFit::Range("Full"), RooFit::VisualizeError(*res,2.0,kTRUE));
//pdf->plotOn(plot,RooFit::NormRange( "low,high" ),RooFit::FillColor(kYellow),RooFit::Range("Full"), RooFit::VisualizeError(*res,1.0,kTRUE));
plot->addObject(&errfix,"4");
plot->addObject(&errfix2,"4");
plot->addObject(&errfix,"4");
data->plotOn(plot);
TBox blindBox(121,plot->GetMinimum()-(plot->GetMaximum()-plot->GetMinimum())*0.015,130,plot->GetMaximum());
blindBox.SetFillColor(kGray);
if(blind) {
plot->addObject(&blindBox);
pdf->plotOn(plot,RooFit::NormRange( "low,high" ),RooFit::FillColor(kGreen),RooFit::Range("Full"), RooFit::VisualizeError(*res,2.0,kTRUE));
pdf->plotOn(plot,RooFit::NormRange( "low,high" ),RooFit::FillColor(kYellow),RooFit::Range("Full"), RooFit::VisualizeError(*res,1.0,kTRUE));
}
//plot->addObject(&errfix,"4");
//.........这里部分代码省略.........
示例2: rf208_convolution
void rf208_convolution()
{
// S e t u p c o m p o n e n t p d f s
// ---------------------------------------
// Construct observable
RooRealVar t("t","t",-10,30) ;
// Construct landau(t,ml,sl) ;
RooRealVar ml("ml","mean bw",5.,-20,20) ;
RooRealVar sl("sl","sigma bw",1,0.1,10) ;
RooBreitWigner bw("bw","bw",t,ml,sl) ;
// Construct gauss(t,mg,sg)
RooRealVar mg("mg","mg",0) ;
RooRealVar sg("sg","sg",2,0.1,10) ;
RooGaussian gauss("gauss","gauss",t,mg,sg) ;
// C o n s t r u c t c o n v o l u t i o n p d f
// ---------------------------------------
// Set #bins to be used for FFT sampling to 10000
t.setBins(10000,"cache") ;
// Construct landau (x) gauss
RooFFTConvPdf lxg("lxg","bw (X) gauss",t,bw,gauss) ;
// S a m p l e , f i t a n d p l o t c o n v o l u t e d p d f
// ----------------------------------------------------------------------
// Sample 1000 events in x from gxlx
RooDataSet* data = lxg.generate(t,10000) ;
// Fit gxlx to data
lxg.fitTo(*data) ;
// Plot data, landau pdf, landau (X) gauss pdf
RooPlot* frame = t.frame(Title("landau (x) gauss convolution")) ;
data->plotOn(frame) ;
lxg.plotOn(frame) ;
bw.plotOn(frame,LineStyle(kDashed)) ;
// Draw frame on canvas
new TCanvas("rf208_convolution","rf208_convolution",600,600) ;
gPad->SetLeftMargin(0.15) ; frame->GetYaxis()->SetTitleOffset(1.4) ; frame->Draw() ;
//add a variable to the dataset
RooFormulaVar *r_formula = new RooFormulaVar("r_formula","","@0",t);
RooRealVar* r = (RooRealVar*) data->addColumn(*r_formula);
r->SetName("r");
r->SetTitle("r");
RooDataSet* data_r =(RooDataSet*) data->reduce(*r, "");
r->setRange("sigrange",-10.,30.);
RooPlot* r_frame = r->frame(Range("sigRange"),Title(" r (x) gauss convolution")) ;
data_r->plotOn(r_frame, MarkerColor(kRed));
r_frame->GetXaxis()->SetRangeUser(-10., 30.);
r_frame->Draw() ;
}
示例3: eregtraining_fixalpha
void eregtraining_fixalpha(bool dobarrel, bool doele) {
// gSystem->Setenv("OMP_WAIT_POLICY","PASSIVE");
//candidate to set fixed alpha values (0.9,3.8)
//TString dirname = TString::Format("/afs/cern.ch/work/b/bendavid/bare/eregtesteleJul30_sig5_01_alphafloat5_%i/",int(minevents));
TString dirname = "/afs/cern.ch/work/b/bendavid/bare/eregAug10RCalphafix/";
gSystem->mkdir(dirname,true);
gSystem->cd(dirname);
std::vector<std::string> *varsf = new std::vector<std::string>;
varsf->push_back("ph.scrawe");
varsf->push_back("ph.sceta");
varsf->push_back("ph.scphi");
varsf->push_back("ph.r9");
varsf->push_back("ph.scetawidth");
varsf->push_back("ph.scphiwidth");
varsf->push_back("ph.scnclusters");
varsf->push_back("ph.hoveretower");
varsf->push_back("rho");
varsf->push_back("nVtx");
varsf->push_back("ph.etaseed-ph.sceta");
varsf->push_back("atan2(sin(ph.phiseed-ph.scphi),cos(ph.phiseed-ph.scphi))");
varsf->push_back("ph.eseed/ph.scrawe");
varsf->push_back("ph.e3x3seed/ph.e5x5seed");
varsf->push_back("ph.sigietaietaseed");
varsf->push_back("ph.sigiphiphiseed");
varsf->push_back("ph.covietaiphiseed");
varsf->push_back("ph.emaxseed/ph.e5x5seed");
varsf->push_back("ph.e2ndseed/ph.e5x5seed");
varsf->push_back("ph.etopseed/ph.e5x5seed");
varsf->push_back("ph.ebottomseed/ph.e5x5seed");
varsf->push_back("ph.eleftseed/ph.e5x5seed");
varsf->push_back("ph.erightseed/ph.e5x5seed");
varsf->push_back("ph.e2x5maxseed/ph.e5x5seed");
varsf->push_back("ph.e2x5topseed/ph.e5x5seed");
varsf->push_back("ph.e2x5bottomseed/ph.e5x5seed");
varsf->push_back("ph.e2x5leftseed/ph.e5x5seed");
varsf->push_back("ph.e2x5rightseed/ph.e5x5seed");
std::vector<std::string> *varseb = new std::vector<std::string>(*varsf);
std::vector<std::string> *varsee = new std::vector<std::string>(*varsf);
varseb->push_back("ph.e5x5seed/ph.eseed");
varseb->push_back("ph.ietaseed");
varseb->push_back("ph.iphiseed");
varseb->push_back("ph.ietaseed%5");
varseb->push_back("ph.iphiseed%2");
varseb->push_back("(abs(ph.ietaseed)<=25)*(ph.ietaseed%25) + (abs(ph.ietaseed)>25)*((ph.ietaseed-25*abs(ph.ietaseed)/ph.ietaseed)%20)");
varseb->push_back("ph.iphiseed%20");
varseb->push_back("ph.etacryseed");
varseb->push_back("ph.phicryseed");
varsee->push_back("ph.scpse/ph.scrawe");
std::vector<std::string> *varslist;
if (dobarrel) varslist = varseb;
else varslist = varsee;
RooArgList vars;
for (unsigned int ivar=0; ivar<varslist->size(); ++ivar) {
RooRealVar *var = new RooRealVar(TString::Format("var_%i",ivar),varslist->at(ivar).c_str(),0.);
vars.addOwned(*var);
}
RooArgList condvars(vars);
// RooRealVar *tgtvar = new RooRealVar("tgtvar","ph.scrawe/ph.gene",1.);
// if (!dobarrel) tgtvar->SetTitle("(ph.scrawe + ph.scpse)/ph.gene");
RooRealVar *tgtvar = new RooRealVar("tgtvar","ph.gene/ph.scrawe",1.);
if (!dobarrel) tgtvar->SetTitle("ph.gene/(ph.scrawe + ph.scpse)");
//tgtvar->setRange(0.,5.);
vars.addOwned(*tgtvar);
//varstest.add(*tgtvar);
RooRealVar weightvar("weightvar","",1.);
//TFile *fdin = TFile::Open("/home/mingyang/cms/hist/hgg-2013Moriond/merged/hgg-2013Moriond_s12-diphoj-3-v7a_noskim.root");
// TFile *fdin = TFile::Open("root://eoscms.cern.ch//eos/cms/store/cmst3/user/bendavid/trainingtreesJul1/hgg-2013Final8TeV_s12-zllm50-v7n_noskim.root");
// TDirectory *ddir = (TDirectory*)fdin->FindObjectAny("PhotonTreeWriterSingleInvert");
// TTree *dtree = (TTree*)ddir->Get("hPhotonTreeSingle");
/* TFile *fdinsig = TFile::Open("root://eoscms.cern.ch//eos/cms/store/cmst3/user/bendavid/trainingtreesJul1/hgg-2013Moriond_s12-h125gg-gf-v7a_noskim.root");
TDirectory *ddirsig = (TDirectory*)fdinsig->FindObjectAny("PhotonTreeWriterPreselNoSmear");
TTree *dtreesig = (TTree*)ddirsig->Get("hPhotonTreeSingle"); */
TString treeloc;
if (doele) {
treeloc = "RunLumiSelectionMod/MCProcessSelectionMod/HLTModP/GoodPVFilterMod/PhotonIDModPreselInvert/PhotonTreeWriterSingleInvert/hPhotonTreeSingle";
}
//.........这里部分代码省略.........
示例4: fitbkgdataCard
void fitbkgdataCard(TString configCard="template.config",
bool dobands = true, // create baerror bands for BG models
bool dosignal = false, // plot the signal model (needs to be present)
bool blinded = true, // blind the data in the plots?
bool verbose = true ) {
gROOT->Macro("MitStyle.C");
gStyle->SetErrorX(0);
gStyle->SetOptStat(0);
gROOT->ForceStyle();
TString projectDir;
std::vector<TString> catdesc;
std::vector<TString> catnames;
std::vector<int> polorder;
double massmin = -1.;
double massmax = -1.;
double theCMenergy = -1.;
bool readStatus = readFromConfigCard( configCard,
projectDir,
catnames,
catdesc,
polorder,
massmin,
massmax,
theCMenergy
);
if( !readStatus ) {
std::cerr<<" ERROR: Could not read from card > "<<configCard.Data()<<" <."<<std::endl;
return;
}
TFile *fdata = new TFile(TString::Format("%s/CMS-HGG-data.root",projectDir.Data()),"READ");
if( !fdata ) {
std::cerr<<" ERROR: Could not open file "<<projectDir.Data()<<"/CMS-HGG-data.root."<<std::endl;
return;
}
if( !gSystem->cd(TString::Format("%s/databkg/",projectDir.Data())) ) {
std::cerr<<" ERROR: Could not change directory to "<<TString::Format("%s/databkg/",projectDir.Data()).Data()<<"."<<std::endl;
return;
}
// ----------------------------------------------------------------------
// load the input workspace....
RooWorkspace* win = (RooWorkspace*)fdata->Get("cms_hgg_workspace_data");
if( !win ) {
std::cerr<<" ERROR: Could not load workspace > cms_hgg_workspace_data < from file > "<<TString::Format("%s/CMS-HGG-data.root",projectDir.Data()).Data()<<" <."<<std::endl;
return;
}
RooRealVar *intLumi = win->var("IntLumi");
RooRealVar *hmass = win->var("CMS_hgg_mass");
if( !intLumi || !hmass ) {
std::cerr<<" ERROR: Could not load needed variables > IntLumi < or > CMS_hgg_mass < forom input workspace."<<std::endl;
return;
}
//win->Print();
hmass->setRange(massmin,massmax);
hmass->setBins(4*(int)(massmax-massmin));
hmass->SetTitle("m_{#gamma#gamma}");
hmass->setUnit("GeV");
hmass->setRange("fitrange",massmin,massmax);
hmass->setRange("blind1",100.,110.);
hmass->setRange("blind2",150.,180.);
// ----------------------------------------------------------------------
// some auxiliray vectro (don't know the meaning of all of them ... yet...
std::vector<RooAbsData*> data_vec;
std::vector<RooAbsPdf*> pdfShape_vec; // vector to store the NOT-EXTENDED PDFs (aka pdfshape)
std::vector<RooAbsPdf*> pdf_vec; // vector to store the EXTENDED PDFs
std::vector<RooAbsReal*> normu_vec; // this holds the normalization vars for each Cat (needed in bands for combined cat)
RooArgList normList; // list of range-limityed normalizations (needed for error bands on combined category)
//std::vector<RooRealVar*> coeffv;
//std::vector<RooAbsReal*> normu_vecv; // ???
// ----------------------------------------------------------------------
// define output works
RooWorkspace *wOut = new RooWorkspace("wbkg","wbkg") ;
// util;ities for the combined fit
RooCategory finalcat ("finalcat", "finalcat") ;
RooSimultaneous fullbkgpdf("fullbkgpdf","fullbkgpdf",finalcat);
RooDataSet datacomb ("datacomb", "datacomb", RooArgList(*hmass,finalcat)) ;
RooDataSet *datacombcat = new RooDataSet("data_combcat","",RooArgList(*hmass)) ;
// add the 'combcat' to the list...if more than one cat
if( catnames.size() > 1 ) {
//.........这里部分代码省略.........
示例5: main
int main(int argc, char *argv[]){
OptionParser(argc,argv);
TStopwatch sw;
sw.Start();
TFile *inFile = TFile::Open(filename_.c_str());
RooWorkspace *inWS = (RooWorkspace*)inFile->Get("cms_hgg_workspace");
RooRealVar *mass = (RooRealVar*)inWS->var("CMS_hgg_mass");
mass->SetTitle("m_{#gamma#gamma}");
mass->setUnit("GeV");
RooRealVar *intLumi = (RooRealVar*)inWS->var("IntLumi");
RooRealVar *MH = new RooRealVar("MH","m_{H}",mhLow_,mhHigh_);
MH->setUnit("GeV");
RooRealVar *MH_SM = new RooRealVar("MH_SM","m_{H} (SM)",mhLow_,mhHigh_);
RooRealVar *DeltaM = new RooRealVar("DeltaM","#Delta m_{H}",0.,-10.,10.);
DeltaM->setUnit("GeV");
RooAddition *MH_2 = new RooAddition("MH_2","m_{H} (2)",RooArgList(*MH,*DeltaM));
RooRealVar *higgsDecayWidth = new RooRealVar("HiggsDecayWidth","#Gamma m_{H}",0.,0.,10.);
TFile *outFile = new TFile(outfilename_.c_str(),"RECREATE");
RooWorkspace *outWS = new RooWorkspace("wsig_8TeV");
transferMacros(inFile,outFile);
// run fits for each line in datfile
ifstream datfile;
datfile.open(datfilename_.c_str());
if (datfile.fail()) exit(1);
while (datfile.good()){
string line;
getline(datfile,line);
if (line=="\n" || line.substr(0,1)=="#" || line==" " || line.empty()) continue;
vector<string> els;
split(els,line,boost::is_any_of(" "));
assert(els.size()==4);
string proc = els[0];
int cat = boost::lexical_cast<int>(els[1]);
int nGaussiansRV = boost::lexical_cast<int>(els[2]);
int nGaussiansWV = boost::lexical_cast<int>(els[3]);
cout << "-----------------------------------------------------------------" << endl;
cout << Form("Running fits for proc:%s - cat:%d with nGausRV:%d nGausWV:%d",proc.c_str(),cat,nGaussiansRV,nGaussiansWV) << endl;
cout << "-----------------------------------------------------------------" << endl;
// get datasets for each MH here
map<int,RooDataSet*> datasetsRV;
map<int,RooDataSet*> datasetsWV;
map<int,RooDataSet*> datasets;
for (int mh=mhLow_; mh<=mhHigh_; mh+=5){
RooDataSet *dataRV = (RooDataSet*)inWS->data(Form("sig_%s_mass_m%d_rv_cat%d",proc.c_str(),mh,cat));
RooDataSet *dataWV = (RooDataSet*)inWS->data(Form("sig_%s_mass_m%d_wv_cat%d",proc.c_str(),mh,cat));
RooDataSet *data = (RooDataSet*)inWS->data(Form("sig_%s_mass_m%d_cat%d",proc.c_str(),mh,cat));
datasetsRV.insert(pair<int,RooDataSet*>(mh,dataRV));
datasetsWV.insert(pair<int,RooDataSet*>(mh,dataWV));
datasets.insert(pair<int,RooDataSet*>(mh,data));
}
// these guys do the fitting
// right vertex
InitialFit initFitRV(mass,MH,mhLow_,mhHigh_);
initFitRV.setVerbosity(verbose_);
initFitRV.buildSumOfGaussians(Form("%s_cat%d",proc.c_str(),cat),nGaussiansRV);
initFitRV.setDatasets(datasetsRV);
initFitRV.runFits(1);
initFitRV.saveParamsToFileAtMH(Form("dat/in/%s_cat%d_rv.dat",proc.c_str(),cat),125);
initFitRV.loadPriorConstraints(Form("dat/in/%s_cat%d_rv.dat",proc.c_str(),cat),constraintValue_);
initFitRV.runFits(1);
initFitRV.plotFits(Form("plots/%s_cat%d/rv",proc.c_str(),cat));
map<int,map<string,RooRealVar*> > fitParamsRV = initFitRV.getFitParams();
// wrong vertex
InitialFit initFitWV(mass,MH,mhLow_,mhHigh_);
initFitWV.setVerbosity(verbose_);
initFitWV.buildSumOfGaussians(Form("%s_cat%d",proc.c_str(),cat),nGaussiansWV,recursive_);
initFitWV.setDatasets(datasetsWV);
initFitWV.runFits(1);
initFitWV.saveParamsToFileAtMH(Form("dat/in/%s_cat%d_wv.dat",proc.c_str(),cat),125);
initFitWV.loadPriorConstraints(Form("dat/in/%s_cat%d_wv.dat",proc.c_str(),cat),constraintValue_);
initFitWV.runFits(1);
initFitRV.plotFits(Form("plots/%s_cat%d/wv",proc.c_str(),cat));
map<int,map<string,RooRealVar*> > fitParamsWV = initFitWV.getFitParams();
//these guys do the interpolation
// right vertex
LinearInterp linInterpRV(MH,mhLow_,mhHigh_,fitParamsRV,doSecondaryModels_);
linInterpRV.setVerbosity(verbose_);
linInterpRV.setSecondaryModelVars(MH_SM,DeltaM,MH_2,higgsDecayWidth);
linInterpRV.interpolate(nGaussiansRV);
map<string,RooSpline1D*> splinesRV = linInterpRV.getSplines();
// wrong vertex
LinearInterp linInterpWV(MH,mhLow_,mhHigh_,fitParamsWV,doSecondaryModels_);
linInterpWV.setVerbosity(verbose_);
linInterpWV.setSecondaryModelVars(MH_SM,DeltaM,MH_2,higgsDecayWidth);
linInterpWV.interpolate(nGaussiansWV);
map<string,RooSpline1D*> splinesWV = linInterpWV.getSplines();
//.........这里部分代码省略.........
示例6: eregtest_flextest
void eregtest_flextest(bool dobarrel, bool doele) {
TString dirname = "/afs/cern.ch/work/b/bendavid/bare/eregtestoutalphafix2_float/";
gSystem->mkdir(dirname,true);
gSystem->cd(dirname);
TString fname;
if (doele && dobarrel)
fname = "wereg_ele_eb.root";
else if (doele && !dobarrel)
fname = "wereg_ele_ee.root";
else if (!doele && dobarrel)
fname = "wereg_ph_eb.root";
else if (!doele && !dobarrel)
fname = "wereg_ph_ee.root";
//TString infile = TString::Format("/afs/cern.ch/work/b/bendavid/bare/eregAug10RCalphafixphiblind//%s",fname.Data());
TString infile = TString::Format("/data/bendavid/regflextesting/%s",fname.Data());
TFile *fws = TFile::Open(infile);
RooWorkspace *ws = (RooWorkspace*)fws->Get("wereg");
//RooGBRFunction *func = static_cast<RooGBRFunction*>(ws->arg("func"));
RooGBRTargetFlex *sigmeant = (RooGBRTargetFlex*)ws->function("sigmeant");
RooRealVar *tgtvar = ws->var("tgtvar");
//tgtvar->removeRange();
//tgtvar->setRange(0.98,1.02);
RooRealVar *rawptvar = new RooRealVar("rawptvar","ph.scrawe/cosh(ph.eta)",1.);
if (!dobarrel) rawptvar->SetTitle("(ph.scrawe+ph.scpse)/cosh(ph.eta)");
RooRealVar *rawevar = new RooRealVar("rawevar","ph.scrawe",1.);
if (!dobarrel) rawevar->SetTitle("(ph.scrawe+ph.scpse)");
RooRealVar *nomevar = new RooRealVar("nomevar","ph.e",1.);
RooArgList vars;
vars.add(sigmeant->FuncVars());
vars.add(*tgtvar);
vars.add(*rawptvar);
vars.add(*rawevar);
vars.add(*nomevar);
RooArgList condvars;
condvars.add(sigmeant->FuncVars());
RooRealVar weightvar("weightvar","",1.);
TTree *dtree;
if (doele) {
TFile *fdin = TFile::Open("/data/bendavid/regTreesAug1/hgg-2013Final8TeV_reg_s12-zllm50-v7n_noskim.root");
TDirectory *ddir = (TDirectory*)fdin->FindObjectAny("PhotonTreeWriterSingleInvert");
dtree = (TTree*)ddir->Get("hPhotonTreeSingle");
}
else {
TFile *fdin = TFile::Open("/data/bendavid/idTreesAug1/hgg-2013Final8TeV_ID_s12-h124gg-gf-v7n_noskim.root");
//TFile *fdin = TFile::Open("/data/bendavid/idTrees_7TeV_Sept17/hgg-2013Final7TeV_ID_s11-h125gg-gf-lv3_noskim.root");
TDirectory *ddir = (TDirectory*)fdin->FindObjectAny("PhotonTreeWriterPreselNoSmear");
dtree = (TTree*)ddir->Get("hPhotonTreeSingle");
}
// if (0)
// {
//
// TFile *fdin = TFile::Open("/data/bendavid/8TeVFinalTreesSept17/hgg-2013Final8TeV_s12-diphoj-v7n_noskim.root");
// TDirectory *ddir = (TDirectory*)fdin->FindObjectAny("PhotonTreeWriterPresel");
// dtree = (TTree*)ddir->Get("hPhotonTreeSingle");
//
// }
if (0)
{
TFile *fdin = TFile::Open("/data/bendavid/diphoTrees8TeVOct6/hgg-2013Final8TeV_s12-h123gg-gf-v7n_noskim.root");
TDirectory *ddir = (TDirectory*)fdin->FindObjectAny("PhotonTreeWriterPreselNoSmear");
dtree = (TTree*)ddir->Get("hPhotonTreeSingle");
}
// //TFile *fdin = TFile::Open("/home/mingyang/cms/hist/hgg-2013Moriond/merged/hgg-2013Moriond_s12-diphoj-3-v7a_noskim.root");
// //TFile *fdin = TFile::Open("root://eoscms.cern.ch//eos/cms/store/cmst3/user/bendavid/trainingtreesJul1/hgg-2013Final8TeV_s12-zllm50-v7n_noskim.root");
// TFile *fdin = TFile::Open("root://eoscms.cern.ch///eos/cms/store/cmst3/user/bendavid/idTreesAug1/hgg-2013Final8TeV_ID_s12-h124gg-gf-v7n_noskim.root");
// //TFile *fdin = TFile::Open("root://eoscms.cern.ch//eos/cms/store/cmst3/user/bendavid/regTreesAug1/hgg-2013Final8TeV_reg_s12-zllm50-v7n_noskim.root");
// //TDirectory *ddir = (TDirectory*)fdin->FindObjectAny("PhotonTreeWriterSingleInvert");
// TDirectory *ddir = (TDirectory*)fdin->FindObjectAny("PhotonTreeWriterPreselNoSmear");
// TTree *dtree = (TTree*)ddir->Get("hPhotonTreeSingle");
/* TFile *fdinsig = TFile::Open("/home/mingyang/cms/hist/hgg-2013Moriond/merged/hgg-2013Moriond_s12-h125gg-gf-v7a_noskim.root");
TDirectory *ddirsig = (TDirectory*)fdinsig->FindObjectAny("PhotonTreeWriterPreselNoSmear");
TTree *dtreesig = (TTree*)ddirsig->Get("hPhotonTreeSingle"); */
TCut selcut;
if (dobarrel) {
//.........这里部分代码省略.........