Example #1
0
void Plots2D::allPlots(AllSamples samples){

	folder = "MuonMET/patType1CorrectedPFMet/";
	bins.push_back(25);
	bins.push_back(45);
	bins.push_back(70);
	bins.push_back(100);
	bins.push_back(150);
//  Variable::Variable(TString name_temp, TString xTitle_temp, double minX_temp, double maxX_temp, int rebinFact_temp)
	Variable met("GenMET_vs_RecoMET", "E_{T}^{miss} [GeV]", 0, 200, 2);;
	savePlot(samples, met);

	folder = "MuPlusJets/";
	bins.clear();
	bins.push_back(350);
	bins.push_back(400);
	bins.push_back(450);
	bins.push_back(500);
	bins.push_back(580);
	bins.push_back(700);
	Variable st("GenHT_lep_met_vs_RecoHT_lep_met", "S_{T} [GeV]", 200, 900, 1);
	savePlot(samples, st);

	bins.clear();
	bins.push_back(40);
	bins.push_back(70);
	bins.push_back(100);
	bins.push_back(130);
	bins.push_back(170);
	Variable wpt("Gen_WPT_vs_Reco_WPT", "p_{T}^{W} [GeV]", 0, 250, 5);
	savePlot(samples, wpt);

	bins.clear();
	bins.push_back(30);
	bins.push_back(50);
	bins.push_back(80);
	bins.push_back(100);
	Variable mt("Gen_MT_vs_Reco_MT", "M_{T}^{W} [GeV]", 0, 120, 5);
	savePlot(samples, mt);

	bins.clear();
	bins.push_back(240);
	bins.push_back(280);
	bins.push_back(330);
	bins.push_back(380);
	bins.push_back(450);
	bins.push_back(600);
	Variable ht("GenHT_vs_RecoHT", "H_{T} [GeV]", 150, 800, 1);
	savePlot(samples, ht);

}
///
/// Save all parameter evolution plots that were created so far.
///
void ParameterEvolutionPlotter::saveEvolutionPlots()
{
	for ( int i=0; i<m_canvases.size(); i++ ) {
		TString fName = "parEvolution_"+name+"_"+scanVar1;
		fName += Form("_%i",i+1);
		savePlot(m_canvases[i], fName);
	}
}
///
/// Save the plot.
///
void OneMinusClPlotAbs::save()
{
	if ( m_mainCanvas==0 ){
		cout << "OneMinusClPlotAbs::save() : ERROR : Empty canvas. Call Draw() or DrawFull() before saving!" << endl;
		return;
	}
	savePlot(m_mainCanvas, name + arg->plotext);
}
/////////////////////////////////////////////
// Have a nice plotting functiong
//
/////////////////////////////////////////////
void MethodDatasetsProbScan::plotFitRes(TString fName) {

  for (int i=0; i<pdf->getFitObs().size(); i++) {
    TString fitVar = pdf->getFitObs()[i];
    TCanvas *fitCanv = newNoWarnTCanvas( getUniqueRootName(), Form("S+B and B only fits to the dataset for %s",fitVar.Data()) );
    TLegend *leg = new TLegend(0.6,0.7,0.92,0.92);
    leg->SetFillColor(0);
    leg->SetLineColor(0);
    RooPlot *plot = w->var(fitVar)->frame();
    // data invisible for norm
    w->data(pdf->getDataName())->plotOn( plot, Invisible() );
    // bkg pdf
    if( pdf->getBkgPdf() ){
        if ( !bkgOnlyFitResult ) {
          cout << "MethodDatasetsProbScan::plotFitRes() : ERROR : bkgOnlyFitResult is NULL" << endl;
          exit(1);
        }
        setParameters(w, bkgOnlyFitResult);
        if ( !w->pdf(pdf->getBkgPdfName()) ) {
          cout << "MethodDatasetsProbScan::plotFitRes() : ERROR : No background pdf " << pdf->getBkgPdfName() << " found in workspace" << endl;
          exit(1);
        }
        w->pdf(pdf->getBkgPdfName())->plotOn( plot, LineColor(kRed) );
        leg->AddEntry( plot->getObject(plot->numItems()-1), "Background Only Fit", "L");
    }
    else cout << "MethodDatasetsProbScan::plotFitRes() : WARNING : No background pdf is given. Will only plot S+B hypothesis." << std::endl;
    // free fit
    if ( !dataFreeFitResult ) {
      cout << "MethodDatasetsProbScan::plotFitRes() : ERROR : dataFreeFitResult is NULL" << endl;
      exit(1);
    }
    setParameters(w, dataFreeFitResult);
    if ( !w->pdf(pdf->getPdfName()) ) {
      cout << "MethodDatasetsProbScan::plotFitRes() : ERROR : No pdf " << pdf->getPdfName() << " found in workspace" << endl;
      exit(1);
    }
    w->pdf(pdf->getPdfName())->plotOn(plot);
    leg->AddEntry( plot->getObject(plot->numItems()-1), "Free Fit", "L");
    // data unblinded if needed
    map<TString,TString> unblindRegs = pdf->getUnblindRegions();
    if ( unblindRegs.find( fitVar ) != unblindRegs.end() ) {
      w->data(pdf->getDataName())->plotOn( plot, CutRange(pdf->getUnblindRegions()[fitVar]) );
      leg->AddEntry( plot->getObject(plot->numItems()-1), "Data", "LEP");
    }
    plot->Draw();
    leg->Draw("same");
    savePlot(fitCanv, fName);
  }

}
///
/// Plot the discrepancy between the observable and the predicted
/// observable when making predictions about observables by scanning
/// them. This checks if the chi2 term of the observable is tight enough.
/// This only works for 1D scans for now.
///
void ParameterEvolutionPlotter::plotObsScanCheck()
{
	vector<RooSlimFitResult*> results = curveResults;

	cout << "ParameterEvolutionPlotter::plotObsScanCheck() : plotting ..." << endl;
	TCanvas *c2 = newNoWarnTCanvas("plotObsScanCheck"+getUniqueRootName(), title, 800,600);
	c2->SetLeftMargin(0.2);

	// get observable
	TGraphErrors *g = new TGraphErrors(results.size());
	int iGraph = 0;

	for ( int i=0; i<results.size(); i++ ){
		assert(results[i]);
		// get value of observable
		float obsValue = results[i]->getParVal(scanVar1);
		float obsError = w->var(scanVar1)->getError();

		// get value of theory prediction
		setParameters(w,parsName,results[i]);
		TString thName = scanVar1;
		thName.ReplaceAll("_obs","_th");
		if ( !w->function(thName) ){
			cout << "ParameterEvolutionPlotter::plotObsScanCheck() : ERROR : theory value not found: " << thName << endl;
			continue;
		}
		float thValue = w->function(thName)->getVal();
		g->SetPoint(iGraph, iGraph, obsValue-thValue);
		g->SetPointError(iGraph, 0., obsError);
		iGraph++;
	}

	g->SetTitle(scanVar1);
	g->GetXaxis()->SetTitle("scan step");
	g->GetYaxis()->SetTitleSize(0.06);
	g->GetYaxis()->SetLabelSize(0.04);
	g->GetYaxis()->SetTitleOffset(1.5);
	g->GetYaxis()->SetTitle(scanVar1);
	Int_t ci = 927;
	TColor *col = new TColor(ci, 0, 0, 1, " ", 0.5);
	g->SetFillColor(ci);
	g->SetFillStyle(1001);
	g->Draw("a3");
	g->Draw("lxsame");
	c2->Update();

	savePlot(c2, "parEvolutionObsSanCheck_"+name+"_"+scanVar1);
}
Example #6
0
///
/// run GammaComboEngine, main steering function
///
void GammaComboEngine::run()
{
    if ( arg->usage ) usage(); // print usage and exit
    checkCombinationArg();
    checkColorArg();
    checkAsimovArg();
    //scaleDownErrors();
    if ( arg->nosyst ) disableSystematics();
    makeAddDelCombinations();
    if ( arg->nbatchjobs>0 ) writebatchscripts();
    defineColors();
    customizeCombinerTitles();
    setUpPlot();
    scan();
    if (!arg->isAction("pluginbatch")) savePlot();
    cout << endl;
    t.Stop();
    t.Print();
    runApplication();
}
void DiLepton::allPlots(AllSamples samples){

	//  Variable::Variable(TString name_temp, TString xTitle_temp, double minX_temp, double maxX_temp, int rebinFact_temp)
	Variable pt_lead("LeadLepton_Pt", "lead #mu p_{T}", 0, 300, 5);

	setSelectionAndChannel("TTbarDiLeptonAnalysis", "MuMu");
	savePlot(samples, pt_lead);

	setChannel("EE");
	savePlot(samples, pt_lead);

	setChannel("EMu");
	savePlot(samples, pt_lead);

	setSelectionAndChannel("TTbarPhotonAnalysis", "MuMu");
	savePlot(samples, pt_lead);

	setChannel("EE");
	savePlot(samples, pt_lead);

	setChannel("EMu");
	savePlot(samples, pt_lead);

}
Example #8
0
void Plot::FitSignal(int mode, int fitMode) {

	const int nPar = 6;
	TRandom ran;

	if(mode==0) {
		gStyle->SetOptLogy(1);
	} else {
		gStyle->SetOptLogy(0);
	}
	gStyle->SetOptStat(0);
	gStyle->SetOptTitle(0);
	const float limitBinSize = 2.0; // **** bin size here
	TCanvas* c = NewCanvas();
	c->Divide(1,2);

	gROOT->cd();
	TH1F* cc = new TH1F("CCSignal","CC Signal",500,0.0,1000.0);
	TH1F* ccBg = new TH1F("CCBgFit","CC Bg Fit",500,0.0,1000.0);
	TH1F* ccBgErr = new TH1F("CCBgErr","CC Bg Err",500,0.0,1000.0);
	TH1F* ccBgP = new TH1F("CCBgPlus","CC Bg Plus",500,0.0,1000.0);
	TH1F* ccBgM = new TH1F("CCBgMinus","CC Bg Minus",500,0.0,1000.0);
	TH1F* cp = new TH1F("CPSignal","CP Signal",500,0.0,1000.0);
	TH1F* cpBg = new TH1F("CPBgFit","CP Bg Fit",500,0.0,1000.0);
	TH1F* cpBgErr = new TH1F("CPBgErr","CP Bg Err",500,0.0,1000.0);
	TH1F* cpBgP = new TH1F("CPBgPlus","CP Bg Plus",500,0.0,1000.0);
	TH1F* cpBgM = new TH1F("CPBgMinus","CP Bg Minus",500,0.0,1000.0);
	TMatrixD matrix(nPar,nPar);

	fd->cd();

	TH1F* hInt,*hBgInt;
	char fitname[100];
	for(int ind=0; ind<2; ind++) {
		if(debug) printf("starting ind %i\n",ind);
		c->cd(ind+1);
		gStyle->SetOptLogy(1);
		printf("Starting %i ######################################\n",ind);

		TH1F* h;
		//char cind[20];
		//char handle[100];
		//sprintf(handle,"side_1exp_%02i_%02i_%02i",ind,mode,fitMode);
		TF1* fits[4];
		//TF1* dpx[4];
		if(debug) printf("looking for h %i\n",int(fd));
		if(ind==0) {
			h = (TH1F*)fd->FindObjectAny("pair_mass_2GeV1");
		} else if(ind==1) {
			h = (TH1F*)fd->FindObjectAny("pair_mass_2GeV3");
		}
		if(debug) printf("new h %i\n",int(h));

		if(debug) printf("new fit\n");
		sprintf(fitname,"hfit_%1i",ind);
		fits[ind] = new TF1(fitname,"([0]*pow((x-30.0),[1])+[3]*pow((x-30.0),0.2))*([2]*exp(-[2]*(x-30.0))+[4]*[5]*exp(-[5]*(x-30.0)))",30.0,500.0);
		//fits[ind] = new TF1(fitname,"([0]*((1-[3])*pow((x-30.0),[1])+[3]*pow((x-30.0),0.2)))*(exp(-[2]*(x-30.0))+[4]*exp(-[5]*(x-30.0)))",30.0,500.0);
		fits[ind]->SetParameter(0,0.0004);
		fits[ind]->SetParameter(1,2);
		fits[ind]->SetParameter(2,0.02);
		fits[ind]->SetParameter(3,0.005);
		//fits[ind]->SetParameter(3,0.5);
		fits[ind]->SetParameter(4,1.005);
		fits[ind]->SetParameter(5,0.05);

		float llim = 30.0;
		h->Fit(fits[ind],"LN","",llim,1000.0);

		double par[20],parMin[20],fval,fvalMin;
		for(int i=0; i<nPar; i++) parMin[i] = fits[ind]->GetParameter(i);

		gMinuit->Eval(nPar,0,fvalMin,parMin,0);
		//printf("got back %10.5f\n",fvalMin);

		// save the fit results in a histogram, for limit program
		for(int ibin=16; ibin<250; ibin++) {
			float xx = h->GetBinCenter(ibin);
			float yy = fits[ind]->Eval(xx);
			if(ind==0) {
				cc->SetBinContent(ibin,h->GetBinContent(ibin));
				ccBg->SetBinContent(ibin,yy);
				ccBgErr->SetBinContent(ibin,0.0);
				ccBgP->SetBinContent(ibin,0.0);
				ccBgM->SetBinContent(ibin,99999.0);
			} else {
				cp->SetBinContent(ibin,h->GetBinContent(ibin));
				cpBg->SetBinContent(ibin,yy);
				cpBgErr->SetBinContent(ibin,0.0);
				cpBgP->SetBinContent(ibin,0.0);
				cpBgM->SetBinContent(ibin,99999.0);
			}
		}

		//vary the parameters to find an error envelope
		double par2[20],fval2=1e10;
		int pslim = (ind==0?25000:150000);
		for(int ips=0; ips<pslim; ips++) {
			if(ips%10000==0) printf("Processing %d\n",ips);
			for(int i=0; i<nPar; i++) {
				par[i] = parMin[i];
			}
			for(int i=0; i<nPar; i++) {
				//int i = (ips%2==0?0:3);
				par[i] = parMin[i]+(2.0*(ran.Uniform()-0.5))*fits[ind]->GetParError(i);
			}
			fval = 0.0;
			gMinuit->Eval(nPar,0,fval,par,0);
			if((fval-fvalMin)<1.0) {
				printf("Found nearby min %10.5f\n",fval-fvalMin);
				float eOld,eNew;
				for(int ibin=16; ibin<250; ibin++) {
					float xx = h->GetBinCenter(ibin);
					for(int i=0; i<nPar; i++) fits[ind]->SetParameter(i,par[i]);
					float yy = fits[ind]->Eval(xx);
					for(int i=0; i<nPar; i++) fits[ind]->SetParameter(i,parMin[i]);
					float yyMin = fits[ind]->Eval(xx);
					TH1F *hBgErr,*hBgP,*hBgM;
					if(ind==0) {
						hBgErr = ccBgErr; hBgP = ccBgP; hBgM = ccBgM;
					} else {
						hBgErr = cpBgErr; hBgP = cpBgP; hBgM = cpBgM;
					}

					eOld = hBgErr->GetBinContent(ibin);
					eNew = yy - yyMin;
					if(eOld>fabs(eNew)) hBgErr->SetBinContent(ibin,fabs(eNew));
					eOld = hBgP->GetBinContent(ibin);
					if(yy>eOld)  hBgP->SetBinContent(ibin,yy);
					eOld = hBgM->GetBinContent(ibin);
					if(yy<eOld)  hBgM->SetBinContent(ibin,yy);
				}

			} // end if near maximum

			/*
				if(fval<fval2) {
				for(int i=0; i<nPar; i++) par2[i] = par[i];
				fval2 = fval;
				}
				*/
		}

		/*
			printf("forcing new fit..\n");
			for(int i=0; i<nPar; i++) {
			printf("old,new = %10.5f %10.5f\n",parMin[i],par2[i]);
			fits[ind]->SetParameter(i,par2[i]);
			}
			*/

		// restore original fit
		fval = 0.0;
		gMinuit->Eval(nPar,0,fval,parMin,0);
		for(int i=0; i<nPar; i++) fits[ind]->SetParameter(i,parMin[i]);



		//extract fit error matrix
		gMinuit->mnemat(matrix.GetMatrixArray(),nPar);
		matrix.Print();

		for(int i=0; i<nPar; i++) {
			for(int j=0; j<nPar; j++) {
				printf("%10.5f",matrix(i,j)/sqrt(matrix(i,i)*matrix(j,j)));
			}
			printf("\n");
		}
		//matrix.Draw("text");

		float hm = h->GetMaximum();
		if(mode==0) {
			//TAxis* ax = h->GetXaxis();
			//ax->SetRangeUser(24.1,199.9);
			h->SetMaximum(1.2*hm);
			//h->SetMinimum(0.0);
		} else if(mode==1) {
			TAxis* ax = h->GetXaxis();
			ax->SetRangeUser(20.0,500.0);
			h->SetMaximum(1.15*hm);
			h->SetMinimum(0.0);
		}


		h->Draw();
		fits[ind]->SetLineColor(1);
		fits[ind]->SetLineWidth(2.0);
		fits[ind]->Draw("SAME");
		// find chi2's and KS's
		//AnaChiKs(h,fits[ind]);



		TAxis* ax,*ay;
		ax = h->GetXaxis(); 
		ay = h->GetYaxis();
		ax->SetTitle("m(#gamma#gamma) (GeV/c^{2})"); 
		ay->SetTitle("Entries/2 GeV/c^{2}");
		ax->CenterTitle(); ay->CenterTitle();
		ax->SetTitleOffset(0.9);
		ay->SetTitleOffset(1.0);
		ax->SetTitleSize(0.08);
		ay->SetTitleSize(0.07);
		ax->SetLabelSize(0.07);
		ay->SetLabelSize(0.07);

		gPad->SetLeftMargin(0.16);
		gPad->SetBottomMargin(0.16);

		TText* text;
		text = new TLatex(0.5,0.8,"Diphoton Data");
		text->SetNDC(true);
		text->SetTextSize(0.06);
		text->Draw();
		if(ind==0)      text = new TLatex(0.5,0.72,"Central-Central");
		else if(ind==1) text = new TLatex(0.5,0.72,"Central-Plug");
		text->SetNDC(true);
		text->SetTextSize(0.06);
		text->Draw();
		if(ind==0) {
			text = new TLatex(0.15,0.92,"W/Z H#rightarrow X(#gamma#gamma)");
			text->SetNDC(true);
			text->SetTextSize(0.08);
			text->Draw();

			text = new TLatex(0.5,0.92,"CDF Run II Preliminary, 2.0 fb^{-1}");
			text->SetNDC(true);
			text->SetTextSize(0.06);
			text->Draw();
		}    

		/*
			if(debug) printf("start loop\n");
			int ibin;
			for(ibin=16; ibin<=250; ibin++) {
			if(debug) printf("start bin            %i\n",ibin);
			float xx = (ibin-0.5)*2.0; // *** bin width here
			if(debug) printf("-1 test ibin %i\n",ibin);
			float yy = fits[ind]->Eval(xx);
		//printf("%f  yy= %f \n",xx,yy);
		// the derivative of this yield wrt parameters
		if(debug) printf("0 test ibin %i\n",ibin);
		double y0 = yy;
		if(debug) printf("1 test ibin %i\n",ibin);
		TMatrixD vv(nPar,1);
		float dirSize = 0.5;
		for(int i=0; i<nPar; i++){
		int ipar = i;
		double par = fits[ind]->GetParameter(ipar);
		double spar = fits[ind]->GetParError(ipar);
		double parp = par + dirSize*spar;
		fits[ind]->SetParameter(ipar,parp);
		double yp = fits[ind]->Eval(xx);
		vv(i,0) = limitBinSize*(yp-y0)/(dirSize*spar);
		fits[ind]->SetParameter(ipar,par);
		//printf("%f %f %f\n",yp,y0,spar);
		}
		//vv.Print();
		if(debug) printf("start matrix %i\n",ibin);
		TMatrixD tempM(matrix, TMatrixDBase::kMult, vv);
		//matrix.Print();
		TMatrixD tempN(vv, TMatrixDBase::kTransposeMult, tempM);
		//tempN.Print();
		float bgSig = 0.0;
		if(tempN(0,0)>0.0) bgSig = sqrt(tempN(0,0));
		// ****** hack temp  **********
		bgSig = 0.3*y0;


		// file hists to be saved
		if(debug) printf("start fill %i\n",ibin);
		if(ind==0) {
		//printf("filling cc %i %f\n",ibin,h->GetBinContent(ibin));
		cc->SetBinContent(ibin,h->GetBinContent(ibin));
		//printf("getting cc %i %f\n",ibin,cc->GetBinContent(ibin));
		ccBg->SetBinContent(ibin,yy);
		ccBgErr->SetBinContent(ibin,bgSig);
		ccBgP->SetBinContent(ibin,yy+bgSig);
		ccBgM->SetBinContent(ibin,TMath::Max(yy-bgSig,float(0.0)));
		//if(ibin==27) {
		//printf("bg %f %f \n",yy,bgSig);
		//}
		} else {
		cp->SetBinContent(ibin,h->GetBinContent(ibin));
		cpBg->SetBinContent(ibin,yy);
		cpBgErr->SetBinContent(ibin,bgSig);
		cpBgP->SetBinContent(ibin,yy+bgSig);
		cpBgM->SetBinContent(ibin,TMath::Max(yy-bgSig,float(0.0)));
		}
		if(debug) printf("end fill %i\n",ibin);
		}
		*/

	}

	printf("cc plus  BG=%f\n",ccBgP->GetSum());
	printf("cc minus BG=%f\n",ccBgM->GetSum());
	printf("cp plus  BG=%f\n",cpBgP->GetSum());
	printf("cp minus BG=%f\n",cpBgM->GetSum());

	char fn[100];
	if(mode==0) {
		sprintf(fn,"FitSignal_%d",fitMode);
		savePlot(c,fn);
	} else if(mode==1) {
		sprintf(fn,"FitSignalLin_%d",fitMode);
		savePlot(c,fn);
	}

	//if(mode!=0) return;

	// plot of fit results
	gStyle->SetOptLogy(0);
	c = NewCanvas();
	c->Divide(1,2);

	c->cd(1);
	cc->Draw();
	ccBg->Draw("SAME");
	c->cd(2);
	ccBgErr->SetMinimum(0.0); ccBgErr->SetMaximum(4.0); 
	ccBgErr->Draw();
	ccBgP->SetLineStyle(2); ccBgP->Draw("SAME");
	ccBgM->SetLineStyle(2); ccBgM->Draw("SAME");

	savePlot(c,"FitSignalResultsCC");

	c = NewCanvas();
	c->Divide(1,2);

	c->cd(1);
	cp->Draw();
	cpBg->Draw("SAME");
	c->cd(2);
	cpBgErr->SetMinimum(0.0); cpBgErr->SetMaximum(4.0); 
	cpBgErr->Draw();
	cpBgP->SetLineStyle(2); cpBgP->Draw("SAME");
	cpBgM->SetLineStyle(2); cpBgM->Draw("SAME");

	savePlot(c,"FitSignalResultsCP");

	char title[100];
	if(name) {
		sprintf(title,"TPeaksHiggs_FitSignalHist_%s.root",name);
		TFile* ff = new TFile(title,"RECREATE");
		gROOT->GetList()->Write();
		ff->Close();
	}

}
void Investigate_ETA_StaMuonHits_2015() {

    // Title
    // -----
    std::string title = "Stand Alone Muons Investigation";


    // Main Comparison
    // ---------------
    std::string label1 = "All Stand Alone Muons (Sta Mu)"; 
    std::string label2 = "Sta Mu (1.7 < |#eta| < 2.5 && 2 const hits)"; 

    // Additional Information
    // ----------------------
    std::string info1 = "Hits used in Stand Alone Muon Fit";
    std::string info2 = "these are Segments (CSC,DT) and Rechits (RPC)";
    std::string info3 = "Sample used: RelValZmumuJets_Pt_20_300";

    // double y_range_1 = 00.00;
    // double y_range_2 = 01.00;
    double y_range_1 = 1E-5;
    double y_range_2 = 1E0;
    double x_title_offset = 0.75;
    double y_title_offset = 0.75;
    double z_title_offset = 0.75;

    std::string xaxislabel = "STA Muon #eta";
    std::string yaxislabel = "Fraction";
    // std::string zaxislabel = "Percentage";

    // Reading the filename from command line
    // --------------------------------------
    // std::string RootFileName = gFile->GetName();
    
    // Filename hardcoded
    // ------------------
    std::string RootFileName1 = "STAMuon_62X_2023.root";
    std::string RootFileName2 = "STAMuon_70X_2015.root";

    // Filename base
    // -------------
    std::string Histo_StandAlone_PT_All = "StandAloneMuon_Eta";
    std::string Histo_StandAlone_PT_Sel = "StandAloneMuon_1p8To2p5_2Hit_Eta";


    
    gROOT->SetStyle("Plain");
    gStyle->SetPalette(1,0);
    gStyle->SetOptStat(000000);
    gStyle->SetOptTitle(0);
    gStyle->SetGridStyle(1);    // grid
    gROOT->UseCurrentStyle();

    // TFile * infile1             = new TFile((RootFileName1).c_str(),"READ");     std::cout<<"File 1  = "<<infile1<<std::endl;     
    TFile * infile2             = new TFile((RootFileName2).c_str(),"READ");     std::cout<<"File 2  = "<<infile2<<std::endl; 


    TH2F * Sta_histo1          = (TH2F*) infile2->Get(Histo_StandAlone_PT_All.c_str());  std::cout<<"Histo  = "<<Histo_StandAlone_PT_All<<std::endl; 
    TH2F * Sta_histo2          = (TH2F*) infile2->Get(Histo_StandAlone_PT_Sel.c_str());  std::cout<<"Histo  = "<<Histo_StandAlone_PT_Sel<<std::endl; 


    Sta_histo1->SetLineColor(kBlue);  Sta_histo1->SetFillColor(kBlue);  Sta_histo1->SetFillStyle(3005);
    Sta_histo1->SetLineWidth(1);

    Sta_histo2->SetLineColor(kRed);   Sta_histo2->SetFillColor(kRed); Sta_histo2->SetFillStyle(3004);
    Sta_histo2->SetLineWidth(1);

    std::string Xaxis = "#eta";
    std::string Yaxis = "Fraction";

    Sta_histo1->SetTitle("All");  Sta_histo1->GetXaxis()->SetTitle(Xaxis.c_str()); Sta_histo1->GetYaxis()->SetTitle(Yaxis.c_str());

    int Sta_1_entries = Sta_histo1->GetEntries();                    int Sta_2_entries = Sta_histo2->GetEntries();
    std::stringstream ss_Sta_1_label; ss_Sta_1_label << label1;      std::stringstream ss_Sta_2_label; ss_Sta_2_label << label2;
    std::string Sta_1_label = ss_Sta_1_label.str();                  std::string Sta_2_label = ss_Sta_2_label.str();

    Sta_histo1->Scale(1.0/Sta_1_entries);     Sta_histo2->Scale(1.0/Sta_2_entries); 


    double leg_x1 = 0.55, leg_x2 = 0.85, leg_y1 = 0.700, leg_y2 = 0.850; 
    TLegend * l1 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l1->SetLineColor(1);    l1->SetLineStyle(1);  l1->SetLineWidth(1);  l1->SetFillColor(4000); l1->SetBorderSize(1);
    l1->AddEntry(Sta_histo1, Sta_1_label.c_str(), "F");     l1->AddEntry(Sta_histo2, Sta_2_label.c_str(), "F");

    double leg_x3 = 0.15, leg_x4 = 0.45, leg_y3 = 0.150, leg_y4 = 0.300; 
    TLegend * l2 = new TLegend(leg_x3, leg_y3, leg_x4, leg_y4, NULL,"brNDC"); l2->SetLineColor(1);    l2->SetLineStyle(1);  l2->SetLineWidth(1);  l2->SetFillColor(4000); l2->SetBorderSize(1);
    l2->AddEntry(Sta_histo1, Sta_1_label.c_str(), "F");     l2->AddEntry(Sta_histo2, Sta_2_label.c_str(), "F");

    TLatex latex_cmslab; latex_cmslab.SetNDC(); latex_cmslab.SetTextSize(0.035); latex_cmslab.SetTextAlign(11);
    TLatex latex_info;   latex_info.SetNDC();   latex_info.SetTextSize(0.025);    latex_info.SetTextAlign(31);

    // double infoX_x_right = 0.6275; 
    // double info1_y = 0.80, info2_y = 0.75, info3_y = 0.70;

    y_range_2 = 0.30;    
    std::stringstream pdfname1ss; pdfname1ss<<"STAMuonEtaSpectrum_2015_"<<"StaMuInvestigation"<<"_Lin"; std::string pdfname1 = pdfname1ss.str(); 
    TCanvas * c1 = new TCanvas(pdfname1.c_str(), "", 600, 400); c1->cd(); c1->SetTicks(1,1); c1->SetLeftMargin(0.05); c1->SetRightMargin(0.10); gStyle->SetPaintTextFormat("3.0f");
    Sta_histo1->Draw(); Sta_histo2->Draw("same");           Sta_histo1->GetYaxis()->SetRangeUser(y_range_1,y_range_2); // Sta_histo2->GetZaxis()->SetRangeUser(0,100); 
    Sta_histo1->GetXaxis()->SetTitleOffset(x_title_offset); Sta_histo1->GetYaxis()->SetTitleOffset(y_title_offset);    // Sta_histo2->GetZaxis()->SetTitleOffset(z_title_offset);
    Sta_histo1->GetXaxis()->SetTitle(xaxislabel.c_str());   Sta_histo1->GetYaxis()->SetTitle(yaxislabel.c_str());      // Sta_histo2->GetZaxis()->SetTitle(zaxislabel.c_str());
    latex_cmslab.DrawLatex(0.05, 0.925,"CMS Simulation #sqrt{s} = 13 TeV"); latex_cmslab.DrawLatex(0.70, 0.925, "Stand Alone Muons"); gPad->RedrawAxis(); latex_cmslab.DrawLatex(0.125, 0.85, "All");
    // latex_info.DrawLatex(infoX_x_right, info1_y, info1.c_str()); latex_info.DrawLatex(infoX_x_right, info2_y, info2.c_str()); latex_info.DrawLatex(infoX_x_right, info3_y, info3.c_str());
    l1->Draw();
    c1->Update();
    savePlot(c1, pdfname1.c_str());

    y_range_2 = 1.00;
    std::stringstream pdfname2ss; pdfname2ss<<"STAMuonEtaSpectrum_2015_"<<"StaMuInvestigation"<<"_Log"; std::string pdfname2 = pdfname2ss.str(); 
    TCanvas * c2 = new TCanvas(pdfname2.c_str(), "", 600, 400); c2->cd(); c2->SetTicks(1,1); c2->SetLeftMargin(0.05); c2->SetRightMargin(0.10); gStyle->SetPaintTextFormat("3.0f");
    Sta_histo1->Draw(); Sta_histo2->Draw("same");           Sta_histo1->GetYaxis()->SetRangeUser(y_range_1,y_range_2); // Sta_histo2->GetZaxis()->SetRangeUser(0,100); 
    Sta_histo1->GetXaxis()->SetTitleOffset(x_title_offset); Sta_histo1->GetYaxis()->SetTitleOffset(y_title_offset);    // Sta_histo2->GetZaxis()->SetTitleOffset(z_title_offset);
    Sta_histo1->GetXaxis()->SetTitle(xaxislabel.c_str());   Sta_histo1->GetYaxis()->SetTitle(yaxislabel.c_str());      // Sta_histo2->GetZaxis()->SetTitle(zaxislabel.c_str());
    latex_cmslab.DrawLatex(0.05, 0.925,"CMS Simulation #sqrt{s} = 13 TeV"); latex_cmslab.DrawLatex(0.70, 0.925, "Stand Alone Muons"); gPad->RedrawAxis(); latex_cmslab.DrawLatex(0.125, 0.85, "All");
    // latex_info.DrawLatex(infoX_x_right, info1_y, info1.c_str()); latex_info.DrawLatex(infoX_x_right, info2_y, info2.c_str()); latex_info.DrawLatex(infoX_x_right, info3_y, info3.c_str());
    l2->Draw();
    c2->SetLogy();
    // c2->SetLogx();
    c2->Update();
    savePlot(c2, pdfname2.c_str());


}
Example #10
0
///
/// Make a plot for the CLs stuff.
/// The strategy is to convert the hCLExp and hCLErr histogrms
/// into TGraphs and TGraphAsymmErrors
/// We can then provide some smoothing options as well
///
/// \param s The scanner to plot.
/// \param smooth
///
void OneMinusClPlot::scan1dCLsPlot(MethodAbsScan *s, bool smooth, bool obsError)
{
  if ( arg->debug ){
    cout << "OneMinusClPlot::scan1dCLsPlot() : plotting ";
    cout << s->getName() << " (" << s->getMethodName() << ")" << endl;
  }
  m_mainCanvas->cd();

  s->checkCLs();

  TH1F *hObs    = (TH1F*)s->getHCLsFreq()->Clone(getUniqueRootName());
  TH1F *hExp    = (TH1F*)s->getHCLsExp()->Clone(getUniqueRootName());
  TH1F *hErr1Up = (TH1F*)s->getHCLsErr1Up()->Clone(getUniqueRootName());
  TH1F *hErr1Dn = (TH1F*)s->getHCLsErr1Dn()->Clone(getUniqueRootName());
  TH1F *hErr2Up = (TH1F*)s->getHCLsErr2Up()->Clone(getUniqueRootName());
  TH1F *hErr2Dn = (TH1F*)s->getHCLsErr2Dn()->Clone(getUniqueRootName());

  if ( !hObs ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hObs" << endl;
  if ( !hExp ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hExp" << endl;
  if ( !hErr1Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr1Up" << endl;
  if ( !hErr1Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr1Dn" << endl;
  if ( !hErr2Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr2Up" << endl;
  if ( !hErr2Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - can't find histogram hErr2Dn" << endl;

  // convert obs to graph
  TGraph *gObs = convertTH1ToTGraph(hObs,obsError);

  // convert others to raw graphs
  TGraph *gExpRaw    = convertTH1ToTGraph(hExp);
  TGraph *gErr1UpRaw = convertTH1ToTGraph(hErr1Up);
  TGraph *gErr1DnRaw = convertTH1ToTGraph(hErr1Dn);
  TGraph *gErr2UpRaw = convertTH1ToTGraph(hErr2Up);
  TGraph *gErr2DnRaw = convertTH1ToTGraph(hErr2Dn);

  // smoothing if needed
  TGraph *gExp;
  TGraph *gErr1Up;
  TGraph *gErr1Dn;
  TGraph *gErr2Up;
  TGraph *gErr2Dn;

  TGraphSmooth *smoother = new TGraphSmooth();
  if (smooth) {
    if ( arg->debug ) cout << "OneMinusClPlot::scan1dCLsPlot() : smoothing graphs" << endl;
    gExp    = (TGraph*)smoother->SmoothSuper( gExpRaw    )->Clone("gExp");
    gErr1Up = (TGraph*)smoother->SmoothSuper( gErr1UpRaw )->Clone("gErr1Up");
    gErr1Dn = (TGraph*)smoother->SmoothSuper( gErr1DnRaw )->Clone("gErr1Dn");
    gErr2Up = (TGraph*)smoother->SmoothSuper( gErr2UpRaw )->Clone("gErr2Up");
    gErr2Dn = (TGraph*)smoother->SmoothSuper( gErr2DnRaw )->Clone("gErr2Dn");
    if ( arg->debug ) cout << "OneMinusClPlot::scan1dCLsPlot() : done smoothing graphs" << endl;
  }
  else {
    gExp    = gExpRaw;
    gErr1Up = gErr1UpRaw;
    gErr1Dn = gErr1DnRaw;
    gErr2Up = gErr2UpRaw;
    gErr2Dn = gErr2DnRaw;
  }

  if ( !gObs ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gObs" << endl;
  if ( !gExp ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gExp" << endl;
  if ( !gErr1Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr1Up" << endl;
  if ( !gErr1Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr1Dn" << endl;
  if ( !gErr2Up ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr2Up" << endl;
  if ( !gErr2Dn ) cout << "OneMinusClPlot::scan1dCLsPlot() : problem - null graph gErr2Dn" << endl;

  gObs->SetName("gObs");
  gExp->SetName("gExp");
  gErr1Up->SetName("gErr1Up");
  gErr1Dn->SetName("gErr1Dn");
  gErr2Up->SetName("gErr2Up");
  gErr2Dn->SetName("gErr2Dn");

  // now make the graphs for the error bands
  TGraphAsymmErrors *gErr1 = new TGraphAsymmErrors( gExp->GetN() );
  gErr1->SetName("gErr1");
  TGraphAsymmErrors *gErr2 = new TGraphAsymmErrors( gExp->GetN() );
  gErr2->SetName("gErr2");

  double x,y,yerrUp,yerrDn;
  double xerr = (hExp->GetBinCenter(2)-hExp->GetBinCenter(1))/2.;

  // protect against smoothing over 1
  for (int i=0; i<gExp->GetN(); i++) {
    gExp->GetPoint(i,x,y); gExp->SetPoint(i,x,TMath::Min(y,1.));
    gErr1Up->GetPoint(i,x,y); gErr1Up->SetPoint(i,x,TMath::Min(y,1.));
    gErr1Dn->GetPoint(i,x,y); gErr1Dn->SetPoint(i,x,TMath::Min(y,1.));
    gErr2Up->GetPoint(i,x,y); gErr2Up->SetPoint(i,x,TMath::Min(y,1.));
    gErr2Dn->GetPoint(i,x,y); gErr2Dn->SetPoint(i,x,TMath::Min(y,1.));
  }

  for (int i=0; i<gExp->GetN(); i++) {
    gExp->GetPoint(i,x,y);
    gErr1->SetPoint(i,x,y);
    gErr2->SetPoint(i,x,y);

    gErr1Up->GetPoint(i,x,yerrUp);
    gErr1Dn->GetPoint(i,x,yerrDn);
    gErr1->SetPointError(i, xerr, xerr, y-yerrDn, yerrUp-y );

    gErr2Up->GetPoint(i,x,yerrUp);
    gErr2Dn->GetPoint(i,x,yerrDn);
    gErr2->SetPointError(i, xerr, xerr, y-yerrDn, yerrUp-y );
  }

  gErr2->SetFillColor( TColor::GetColor("#3182bd") );
  gErr2->SetLineColor( TColor::GetColor("#3182bd") );
  gErr1->SetFillColor( TColor::GetColor("#9ecae1") );
  gErr1->SetLineColor( TColor::GetColor("#9ecae1") );
  gExp->SetLineColor(kRed);
  gExp->SetLineWidth(3);
  gObs->SetLineColor(kBlack);
  gObs->SetMarkerColor(kBlack);
  gObs->SetLineWidth(3);
  gObs->SetMarkerSize(1);
  gObs->SetMarkerStyle(20);

	float min = arg->scanrangeMin == arg->scanrangeMax ? hObs->GetXaxis()->GetXmin() : arg->scanrangeMin;
	float max = arg->scanrangeMin == arg->scanrangeMax ? hObs->GetXaxis()->GetXmax() : arg->scanrangeMax;
	TH1F *haxes = new TH1F("haxes"+getUniqueRootName(), "", 100, min, max);
	haxes->SetStats(0);
	haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
	haxes->GetYaxis()->SetTitle("CL_{S}");
	haxes->GetXaxis()->SetLabelFont(font);
	haxes->GetYaxis()->SetLabelFont(font);
	haxes->GetXaxis()->SetTitleFont(font);
	haxes->GetYaxis()->SetTitleFont(font);
	haxes->GetXaxis()->SetTitleOffset(0.9);
	haxes->GetYaxis()->SetTitleOffset(0.85);
	haxes->GetXaxis()->SetLabelSize(labelsize);
	haxes->GetYaxis()->SetLabelSize(labelsize);
	haxes->GetXaxis()->SetTitleSize(titlesize);
	haxes->GetYaxis()->SetTitleSize(titlesize);
	int xndiv = arg->ndiv==-1 ? 407 : abs(arg->ndiv);
	bool optimizeNdiv = arg->ndiv<0 ? true : false;
	haxes->GetXaxis()->SetNdivisions(xndiv, optimizeNdiv);
	haxes->GetYaxis()->SetNdivisions(407, true);
  haxes->GetYaxis()->SetRangeUser(0.,1.);

  // Legend:
	// make the legend short, the text will extend over the boundary, but the symbol will be shorter
  float legendXmin = 0.68 ;
  float legendYmin = 0.58 ;
  float legendXmax = legendXmin + 0.25 ;
  float legendYmax = legendYmin + 0.22 ;
	TLegend* leg = new TLegend(legendXmin,legendYmin,legendXmax,legendYmax);
	leg->SetFillColor(kWhite);
	leg->SetFillStyle(0);
	leg->SetLineColor(kWhite);
	leg->SetBorderSize(0);
	leg->SetTextFont(font);
	leg->SetTextSize(legendsize*0.75);

  if (obsError) leg->AddEntry( gObs, "Observed", "LEP" );
  else          leg->AddEntry( gObs, "Observed", "LP"  );
  leg->AddEntry( gExp, "Expected", "L" );
  leg->AddEntry( gErr1, "#pm 1#sigma", "F");
  leg->AddEntry( gErr2, "#pm 2#sigma", "F");

  haxes->Draw("AXIS+");
  gErr2->Draw("E3same");
  gErr1->Draw("E3same");
  gExp->Draw("Lsame");
  if (obsError) gObs->Draw("LEPsame");
  else          gObs->Draw("LPsame");
  leg->Draw("same");

  drawCLguideLine(0.1);

  double yGroup = 0.83;
  if ( arg->plotprelim || arg->plotunoff ) yGroup = 0.8;
  drawGroup(yGroup);

  m_mainCanvas->SetTicks();
  m_mainCanvas->RedrawAxis();
  m_mainCanvas->Update();
  m_mainCanvas->Modified();
  m_mainCanvas->Show();
  savePlot( m_mainCanvas, name+"_cls"+arg->plotext );
  m_mainCanvas->SetTicks(false);
}
Example #11
0
  /**
   * Set up the menus for the ScatterPlotWindow.
   * Called from the constructor.
   */
  void ScatterPlotWindow::setupMenus(){
    p_menubar = p_scatterPlotWindow->menuBar();
    p_toolBar = new QToolBar(p_scatterPlotWindow);

    p_scatterPlotWindow->addToolBar(Qt::TopToolBarArea,p_toolBar);

    QAction *fitLine = new QAction(p_plot);
    fitLine->setText("Line Fit");
    fitLine->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/linefit.png"));
    QObject::connect(fitLine, SIGNAL(activated()), this, SLOT(showContour()));

    p_colorize = new QAction(p_plot);
    p_colorize->setText("Colorize");
    p_colorize->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/rgb.png"));
    QString text  =
      "Colorize";
    p_colorize->setWhatsThis(text);
    QObject::connect(p_colorize,SIGNAL(activated()),this,SLOT(colorPlot()));

    QAction *save = new QAction(p_plot);
    save->setText("&Save Plot As");
    save->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/filesaveas.png"));
    text  =
      "<b>Function:</b>  Save the plot as a png, jpg, or tif file.";
    save->setWhatsThis(text);
    QObject::connect(save,SIGNAL(activated()),this,SLOT(savePlot()));

    QAction *prt = new QAction(p_plot);
    prt->setText("&Print Plot");
    prt->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/fileprint.png"));
    text  =
      "<b>Function:</b>  Sends the plot image to the printer";
    prt->setWhatsThis(text);
    QObject::connect(prt,SIGNAL(activated()),this,SLOT(printPlot()));

    QAction *track = new QAction(p_plot);
    track->setText("Show Mouse &Tracking");
    track->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/goto.png"));
    track->setCheckable(true);
    text  =
      "<b>Function:</b>  Displays the x,y coordinates as the cursor moves \
      around on the plot.";
    track->setWhatsThis(text);
    QObject::connect(track,SIGNAL(activated()),this,SLOT(trackerEnabled()));

    QAction *changeLabels = new QAction(p_plot);
    changeLabels->setText("Rename Plot &Labels");
    changeLabels->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/plot_renameLabels.png"));
    text  =
      "<b>Function:</b>  Edit the plot title, x and y axis labels.";
    changeLabels->setWhatsThis(text);
    QObject::connect(changeLabels,SIGNAL(activated()),this,SLOT(reLabel()));

    QAction *changeScale = new QAction(p_plot);
    changeScale->setText("Set &Display Range");
    changeScale->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/plot_setScale.png"));
    text  =
      "<b>Function:</b>  Adjust the scale for the x and y axis on the plot.";
    changeScale->setWhatsThis(text);
    QObject::connect(changeScale,SIGNAL(activated()),this, SLOT(setDisplayRange()));

    QAction *resetScaleButton = new QAction(p_plot);
    resetScaleButton->setText("Reset Scale");
    resetScaleButton->setIcon(QPixmap("/usgs/cpkgs/isis3/data/base/icons/plot_resetscale.png"));
    text  =
      "<b>Function:</b>  Reset the plot's scale.";
    resetScaleButton->setWhatsThis(text);
    QObject::connect(resetScaleButton, SIGNAL(activated()),this, SLOT(resetScale()));

    QAction *close = new QAction(p_plot);
    close->setText("Close");
    QObject::connect(close,SIGNAL(activated()),p_scatterPlotWindow, SLOT(close()));

    /*setup menus*/
    QMenu *options = new QMenu("&Options");
    options->addAction(track);
    options->addAction(changeLabels);
    options->addAction(changeScale);

    QMenu *file = new QMenu("&File");
    file->addAction(save);
    file->addAction(prt);
    file->addAction(close);

     p_menubar->addMenu(file);
     p_menubar->addMenu(options);
     
     p_toolBar->addAction(track);
     p_toolBar->addAction(changeLabels);
     p_toolBar->addAction(changeScale);
     p_toolBar->addAction(p_colorize);
     p_toolBar->addAction(fitLine);
  }
void Percentage_2D_StaMuonHits_2015() {

    // Title
    // -----
    std::string title = "62Xvs71X";


    // Main Comparison
    // ---------------
    std::string label1 = "CMSSW 62X SLHC (2023 Geometry)"; 
    std::string label2 = "CMSSW 71X (2015 Geometry)"; 

    // Additional Information
    // ----------------------
    std::string info1 = "Hits used in Stand Alone Muon Fit";
    std::string info2 = "these are Segments (CSC,DT) and Rechits (RPC)";
    std::string info3 = "Sample used: RelValZmumuJets_Pt_20_300";

    double y_range_1 = 00.00;
    double y_range_2 = 15.00;
    double x_title_offset = 0.75;
    double y_title_offset = 0.75;
    double z_title_offset = 0.75;

    std::string xaxislabel = "#eta_{STA Muon}";
    std::string yaxislabel = "\# Hits used in fit";
    std::string zaxislabel = "Percentage";

    // Reading the filename from command line
    // --------------------------------------
    // std::string RootFileName = gFile->GetName();
    
    // Filename hardcoded
    // ------------------
    std::string RootFileName1 = "STAMuon_62X_2023.root";
    std::string RootFileName2 = "STAMuon_70X_2015.root";

    // Filename base
    // -------------
    std::string Histo_RPCb = "SegmentsAndHits/Rechits_All_Eta_2D";
    std::string Histo_RPCf = "SegmentsAndHits/Rechits_RPC_Eta_2D";
    std::string Histo_CSC  = "SegmentsAndHits/Rechits_CSC_Eta_2D";
    std::string Histo_DT   = "SegmentsAndHits/Rechits_DT_Eta_2D";

    std::string Histo_All  = "Muon_All";

    
    gROOT->SetStyle("Plain");
    gStyle->SetPalette(1,0);
    gStyle->SetOptStat(000000);
    gStyle->SetOptTitle(0);
    gStyle->SetGridStyle(1);    // grid
    gROOT->UseCurrentStyle();
    
    TFile * infile1             = new TFile((RootFileName1).c_str(),"READ");     std::cout<<"File 1  = "<<infile1<<std::endl; 
    TFile * infile2             = new TFile((RootFileName2).c_str(),"READ");     std::cout<<"File 2  = "<<infile2<<std::endl; 

    TH2F * RPCb_histo1          = (TH2F*) infile1->Get(Histo_RPCb.c_str());  std::cout<<"Histo  = "<<RPCb_histo1<<std::endl; 
    TH2F * RPCb_histo2          = (TH2F*) infile2->Get(Histo_RPCb.c_str());  std::cout<<"Histo  = "<<RPCb_histo2<<std::endl; 
    TH2F * RPCf_histo1          = (TH2F*) infile1->Get(Histo_RPCf.c_str());  std::cout<<"Histo  = "<<RPCf_histo1<<std::endl; 
    TH2F * RPCf_histo2          = (TH2F*) infile2->Get(Histo_RPCf.c_str());  std::cout<<"Histo  = "<<RPCf_histo2<<std::endl; 
    TH2F * CSC_histo1           = (TH2F*) infile1->Get(Histo_CSC.c_str());   std::cout<<"Histo  = "<<CSC_histo1<<std::endl; 
    TH2F * CSC_histo2           = (TH2F*) infile2->Get(Histo_CSC.c_str());   std::cout<<"Histo  = "<<CSC_histo2<<std::endl; 
    TH2F * DT_histo1            = (TH2F*) infile1->Get(Histo_DT.c_str());    std::cout<<"Histo  = "<<DT_histo1<<std::endl; 
    TH2F * DT_histo2            = (TH2F*) infile2->Get(Histo_DT.c_str());    std::cout<<"Histo  = "<<DT_histo2<<std::endl; 

    TH1F * All_histo1            = (TH1F*) infile1->Get(Histo_All.c_str());    std::cout<<"Histo  = "<<All_histo1<<std::endl; 
    TH1F * All_histo2            = (TH1F*) infile2->Get(Histo_All.c_str());    std::cout<<"Histo  = "<<All_histo2<<std::endl; 

    RPCb_histo1->SetLineColor(kGray+2); RPCb_histo1->SetLineWidth(1);         RPCb_histo2->SetLineColor(kRed); RPCb_histo2->SetLineWidth(1); 
    RPCb_histo1->SetFillColor(kBlue-7); /*RPCb_histo1->SetFillStyle(4050);*/  RPCb_histo2->SetFillColor(kRed); RPCb_histo2->SetFillStyle(3002); 
    RPCf_histo1->SetLineColor(kGray+2); RPCf_histo1->SetLineWidth(1);         RPCf_histo2->SetLineColor(kRed); RPCf_histo2->SetLineWidth(1); 
    RPCf_histo1->SetFillColor(kBlue-7); /*RPCf_histo1->SetFillStyle(4050);*/  RPCf_histo2->SetFillColor(kRed); RPCf_histo2->SetFillStyle(3002); 
    CSC_histo1->SetLineColor(kGray+2);  CSC_histo1->SetLineWidth(1);          CSC_histo2->SetLineColor(kRed);  CSC_histo2->SetLineWidth(1); 
    CSC_histo1->SetFillColor(kBlue-7);  /*CSC_histo1->SetFillStyle(4050);*/   CSC_histo2->SetFillColor(kRed);  CSC_histo2->SetFillStyle(3002); 
    DT_histo1->SetLineColor(kGray+2);   DT_histo1->SetLineWidth(1);           DT_histo2->SetLineColor(kRed);   DT_histo2->SetLineWidth(1); 
    DT_histo1->SetFillColor(kBlue-7);   /*DT_histo1->SetFillStyle(4050);*/    DT_histo2->SetFillColor(kRed);   DT_histo2->SetFillStyle(3002); 
    // std::string Xaxis = "log_{10} TOF (ns)";
    std::string Xaxis = "#eta";
    std::string Yaxis = "\# Hits";

    RPCb_histo1->SetTitle("All");  RPCb_histo1->GetXaxis()->SetTitle(Xaxis.c_str()); RPCb_histo1->GetYaxis()->SetTitle(Yaxis.c_str());
    RPCf_histo1->SetTitle("RPC");  RPCf_histo1->GetXaxis()->SetTitle(Xaxis.c_str()); RPCf_histo1->GetYaxis()->SetTitle(Yaxis.c_str());
    CSC_histo1->SetTitle("CSC");   CSC_histo1->GetXaxis()->SetTitle(Xaxis.c_str());  CSC_histo1->GetYaxis()->SetTitle(Yaxis.c_str());
    DT_histo1->SetTitle("DT");     DT_histo1->GetXaxis()->SetTitle(Xaxis.c_str());   DT_histo1->GetYaxis()->SetTitle(Yaxis.c_str());

    double denominator, numerator;
    for(int i=0; i<RPCb_histo2->GetXaxis()->GetNbins(); ++i) {
      denominator = All_histo2->GetBinContent(i+1);
      for(int j=0; j<RPCb_histo2->GetYaxis()->GetNbins(); ++j) {
	numerator = RPCb_histo2->GetBinContent(i+1,j+1);
	if (numerator > 0.0 && denominator > 0.0) RPCb_histo2->SetBinContent(i+1,j+1, numerator/denominator*100);
	numerator = RPCf_histo2->GetBinContent(i+1,j+1);
	if (numerator > 0.0 && denominator > 0.0) RPCf_histo2->SetBinContent(i+1,j+1, numerator/denominator*100);
	numerator = CSC_histo2->GetBinContent(i+1,j+1);
	if (numerator > 0.0 && denominator > 0.0) CSC_histo2->SetBinContent(i+1,j+1, numerator/denominator*100);
	numerator = DT_histo2->GetBinContent(i+1,j+1);
	if (numerator > 0.0 && denominator > 0.0) DT_histo2->SetBinContent(i+1,j+1, numerator/denominator*100);
      }
    }


    int RPCb_1_entries = RPCb_histo1->GetEntries();       int RPCb_2_entries = RPCb_histo2->GetEntries();
    int RPCf_1_entries = RPCf_histo1->GetEntries();       int RPCf_2_entries = RPCf_histo2->GetEntries();
    int CSC_1_entries  = CSC_histo1->GetEntries();        int CSC_2_entries  = CSC_histo2->GetEntries();
    int DT_1_entries   = DT_histo1->GetEntries();         int DT_2_entries   = DT_histo2->GetEntries();

    std::stringstream ss_RPC_b_1_label; ss_RPC_b_1_label << label1;      std::stringstream ss_RPC_b_2_label; ss_RPC_b_2_label << label2;
    std::stringstream ss_RPC_f_1_label; ss_RPC_f_1_label << label1;      std::stringstream ss_RPC_f_2_label; ss_RPC_f_2_label << label2;
    std::stringstream ss_CSC_1_label;   ss_CSC_1_label   << label1;      std::stringstream ss_CSC_2_label;   ss_CSC_2_label   << label2;
    std::stringstream ss_DT_1_label;    ss_DT_1_label    << label1;      std::stringstream ss_DT_2_label;    ss_DT_2_label    << label2;

    std::string RPC_b_1_label = ss_RPC_b_1_label.str();    std::string RPC_b_2_label = ss_RPC_b_2_label.str();
    std::string RPC_f_1_label = ss_RPC_f_1_label.str();    std::string RPC_f_2_label = ss_RPC_f_2_label.str();
    std::string CSC_1_label   = ss_CSC_1_label.str();      std::string CSC_2_label = ss_CSC_2_label.str();
    std::string DT_1_label    = ss_DT_1_label.str();       std::string DT_2_label = ss_DT_2_label.str();

    /*
    RPCb_histo1->Scale(1.0/RPCb_1_entries); RPCb_histo2->Scale(1.0/RPCb_2_entries);
    RPCf_histo1->Scale(1.0/RPCf_1_entries); RPCf_histo2->Scale(1.0/RPCf_2_entries);
    CSC_histo1->Scale(1.0/CSC_1_entries);   CSC_histo2->Scale(1.0/CSC_2_entries);
    DT_histo1->Scale(1.0/DT_1_entries);     DT_histo2->Scale(1.0/DT_2_entries);
    */

    double leg_x1 = 0.55, leg_x2 = 0.85, leg_y1 = 0.700, leg_y2 = 0.850; 

    TLegend * l1 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l1->SetLineColor(1);    l1->SetLineStyle(1);  l1->SetLineWidth(1);  l1->SetFillColor(4000); l1->SetBorderSize(1);
    TLegend * l2 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l2->SetLineColor(1);    l2->SetLineStyle(1);  l2->SetLineWidth(1);  l2->SetFillColor(4000); l2->SetBorderSize(1);
    TLegend * l3 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l3->SetLineColor(1);    l3->SetLineStyle(1);  l3->SetLineWidth(1);  l3->SetFillColor(4000); l3->SetBorderSize(1);
    TLegend * l4 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l4->SetLineColor(1);    l4->SetLineStyle(1);  l4->SetLineWidth(1);  l4->SetFillColor(4000); l4->SetBorderSize(1);

    l1->AddEntry(RPCb_histo1, RPC_b_1_label.c_str(), "F");     l1->AddEntry(RPCb_histo2, RPC_b_2_label.c_str(), "F");
    l2->AddEntry(RPCf_histo1, RPC_f_1_label.c_str(), "F");     l2->AddEntry(RPCf_histo2, RPC_f_2_label.c_str(), "F");
    l3->AddEntry(CSC_histo1,  CSC_1_label.c_str(),   "F");     l3->AddEntry(CSC_histo2,  CSC_2_label.c_str(),   "F");
    l4->AddEntry(DT_histo1,   DT_1_label.c_str(),    "F");     l4->AddEntry(DT_histo2,   DT_2_label.c_str(),    "F");

    TLatex latex_cmslab; latex_cmslab.SetNDC(); latex_cmslab.SetTextSize(0.035); latex_cmslab.SetTextAlign(11);
    TLatex latex_info;   latex_info.SetNDC();   latex_info.SetTextSize(0.025);    latex_info.SetTextAlign(31);

    double infoX_x_right = 0.6275; 
    double info1_y = 0.80, info2_y = 0.75, info3_y = 0.70;

    /*
    TLegend * l5 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l5->SetLineColor(1);    l5->SetLineStyle(1);  l5->SetLineWidth(1);  l5->SetFillColor(4000); l5->SetBorderSize(1);
    TLegend * l6 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l6->SetLineColor(1);    l6->SetLineStyle(1);  l6->SetLineWidth(1);  l6->SetFillColor(4000); l6->SetBorderSize(1);
    TLegend * l7 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l7->SetLineColor(1);    l7->SetLineStyle(1);  l7->SetLineWidth(1);  l7->SetFillColor(4000); l7->SetBorderSize(1);
    TLegend * l8 = new TLegend(leg_x1, leg_y1, leg_x2, leg_y2, NULL,"brNDC"); l8->SetLineColor(1);    l8->SetLineStyle(1);  l8->SetLineWidth(1);  l8->SetFillColor(4000); l8->SetBorderSize(1);

    l5->AddEntry(RPCb_histo1, RPC_b_1_label.c_str(), "F");     l5->AddEntry(RPCb_histo2, RPC_b_2_label.c_str(), "F");
    l6->AddEntry(RPCf_histo1, RPC_f_1_label.c_str(), "F");     l6->AddEntry(RPCf_histo2, RPC_f_2_label.c_str(), "F");
    l7->AddEntry(CSC_histo1,  CSC_1_label.c_str(),   "F");     l7->AddEntry(CSC_histo2,  CSC_2_label.c_str(),   "F");
    l8->AddEntry(DT_histo1,   DT_1_label.c_str(),    "F");     l8->AddEntry(DT_histo2,   DT_2_label.c_str(),    "F");
    */

    // Save the Other Canvasses
    y_range_2 = 15.00;
    std::stringstream pdfname2ss; pdfname2ss<<"STAMuonHits_2D_2015_"<<"Percentage"<<"_All"; std::string pdfname2 = pdfname2ss.str(); 
    TCanvas * c2 = new TCanvas(pdfname2.c_str(), "", 800, 400); c2->cd(); c2->SetTicks(1,1); c2->SetLeftMargin(0.05); c2->SetRightMargin(0.10); gStyle->SetPaintTextFormat("3.0f");
    RPCb_histo2->Draw("textcolz"); /*l5->Draw();*/ RPCb_histo2->GetYaxis()->SetRangeUser(y_range_1,y_range_2); RPCb_histo2->GetZaxis()->SetRangeUser(0,100); 
    RPCb_histo2->GetXaxis()->SetTitleOffset(x_title_offset); RPCb_histo2->GetYaxis()->SetTitleOffset(y_title_offset);   RPCb_histo2->GetZaxis()->SetTitleOffset(z_title_offset);
    RPCb_histo2->GetXaxis()->SetTitle(xaxislabel.c_str());   RPCb_histo2->GetYaxis()->SetTitle(yaxislabel.c_str());     RPCb_histo2->GetZaxis()->SetTitle(zaxislabel.c_str());
    latex_cmslab.DrawLatex(0.05, 0.925,"CMS Simulation #sqrt{s} = 13 TeV"); latex_cmslab.DrawLatex(0.70, 0.925, label2.c_str()); gPad->RedrawAxis(); latex_cmslab.DrawLatex(0.125, 0.85, "All");
    latex_info.DrawLatex(infoX_x_right, info1_y, info1.c_str()); latex_info.DrawLatex(infoX_x_right, info2_y, info2.c_str()); latex_info.DrawLatex(infoX_x_right, info3_y, info3.c_str());
    savePlot(c2, pdfname2.c_str());

    y_range_2 = 10.00;
    std::stringstream pdfname3ss; pdfname3ss<<"STAMuonHits_2D_2015_"<<"Percentage"<<"_RPC"; std::string pdfname3 = pdfname3ss.str(); 
    TCanvas * c3 = new TCanvas(pdfname3.c_str(), "", 800, 400); c3->cd(); c3->SetTicks(1,1); c3->SetLeftMargin(0.05); c3->SetRightMargin(0.10); gStyle->SetPaintTextFormat("3.0f");
    RPCf_histo2->Draw("textcolz"); /*l6->Draw();*/ RPCf_histo2->GetYaxis()->SetRangeUser(y_range_1,y_range_2); RPCf_histo2->GetZaxis()->SetRangeUser(0,100);
    RPCf_histo2->GetXaxis()->SetTitleOffset(x_title_offset); RPCf_histo2->GetYaxis()->SetTitleOffset(y_title_offset);   RPCf_histo2->GetZaxis()->SetTitleOffset(z_title_offset);
    RPCf_histo2->GetXaxis()->SetTitle(xaxislabel.c_str());   RPCf_histo2->GetYaxis()->SetTitle(yaxislabel.c_str());     RPCf_histo2->GetZaxis()->SetTitle(zaxislabel.c_str());
    latex_cmslab.DrawLatex(0.05, 0.925,"CMS Simulation #sqrt{s} = 13 TeV"); latex_cmslab.DrawLatex(0.70, 0.925, label2.c_str()); gPad->RedrawAxis(); latex_cmslab.DrawLatex(0.125, 0.85, "RPC");
    latex_info.DrawLatex(infoX_x_right, info1_y, info1.c_str()); latex_info.DrawLatex(infoX_x_right, info2_y, info2.c_str()); latex_info.DrawLatex(infoX_x_right, info3_y, info3.c_str());
    savePlot(c3, pdfname3.c_str());

    y_range_2 = 10.00;
    std::stringstream pdfname4ss; pdfname4ss<<"STAMuonHits_2D_2015_"<<"Percentage"<<"_DT"; std::string pdfname4 = pdfname4ss.str(); 
    TCanvas * c4 = new TCanvas(pdfname4.c_str(), "", 800, 400); c4->cd(); c4->SetTicks(1,1); c4->SetLeftMargin(0.05); c4->SetRightMargin(0.10); gStyle->SetPaintTextFormat("3.0f");
    DT_histo2->Draw("textcolz"); /*l8->Draw();*/ DT_histo2->GetYaxis()->SetRangeUser(y_range_1,y_range_2); DT_histo2->GetZaxis()->SetRangeUser(0,100); 
    DT_histo2->GetXaxis()->SetTitleOffset(x_title_offset); DT_histo2->GetYaxis()->SetTitleOffset(y_title_offset);   DT_histo2->GetZaxis()->SetTitleOffset(z_title_offset);
    DT_histo2->GetXaxis()->SetTitle(xaxislabel.c_str());   DT_histo2->GetYaxis()->SetTitle(yaxislabel.c_str());     DT_histo2->GetZaxis()->SetTitle(zaxislabel.c_str());
    latex_cmslab.DrawLatex(0.05, 0.925,"CMS Simulation #sqrt{s} = 13 TeV"); latex_cmslab.DrawLatex(0.70, 0.925, label2.c_str()); gPad->RedrawAxis(); latex_cmslab.DrawLatex(0.125, 0.85, "DT");
    latex_info.DrawLatex(infoX_x_right, info1_y, info1.c_str()); latex_info.DrawLatex(infoX_x_right, info2_y, info2.c_str()); latex_info.DrawLatex(infoX_x_right, info3_y, info3.c_str());
    savePlot(c4, pdfname4.c_str());

    y_range_2 = 10.00;
    std::stringstream pdfname5ss; pdfname5ss<<"STAMuonHits_2D_2015_"<<"Percentage"<<"_CSC"; std::string pdfname5 = pdfname5ss.str(); 
    TCanvas * c5 = new TCanvas(pdfname5.c_str(), "", 800, 400); c5->cd(); c5->SetTicks(1,1); c5->SetLeftMargin(0.05); c5->SetRightMargin(0.10); gStyle->SetPaintTextFormat("3.0f");
    CSC_histo2->Draw("textcolz"); /*l7->Draw();*/ CSC_histo2->GetYaxis()->SetRangeUser(y_range_1,y_range_2); CSC_histo2->GetZaxis()->SetRangeUser(0,100);
    latex_cmslab.DrawLatex(0.05, 0.925,"CMS Simulation #sqrt{s} = 13 TeV"); latex_cmslab.DrawLatex(0.70, 0.925, label2.c_str()); gPad->RedrawAxis(); latex_cmslab.DrawLatex(0.125, 0.85, "CSC");
    CSC_histo2->GetXaxis()->SetTitleOffset(x_title_offset); CSC_histo2->GetYaxis()->SetTitleOffset(y_title_offset);   CSC_histo2->GetZaxis()->SetTitleOffset(z_title_offset);
    CSC_histo2->GetXaxis()->SetTitle(xaxislabel.c_str());   CSC_histo2->GetYaxis()->SetTitle(yaxislabel.c_str());     CSC_histo2->GetZaxis()->SetTitle(zaxislabel.c_str());
    latex_info.DrawLatex(infoX_x_right, info1_y, info1.c_str()); latex_info.DrawLatex(infoX_x_right, info2_y, info2.c_str()); latex_info.DrawLatex(infoX_x_right, info3_y, info3.c_str());
    savePlot(c5, pdfname5.c_str());



}
Example #13
0
void Photons::allPlots(AllSamples samples){

	Variable photon_pt("Photon_ET", "Photon E_{T} [GeV]", 0, 150, 2);
	Variable photon_eta("Photon_Eta", "Photon #eta", -3., 3., 10);
	Variable photon_abseta("Photon_AbsEta", "Photon |#eta|", 0., 3., 10);
	Variable photon_sigmaietaieta_barrel("Photon_sigma_ietaieta_barrel", "#sigmai#etai#eta(barrel)", 0., 0.1, 10);
	Variable photon_sigmaietaieta_endcap("Photon_sigma_ietaieta_endcap", "#sigmai#etai#eta(endcap)", 0., 0.1, 12);
	Variable photon_rhocorrchargediso_barrel("Photon_RhoCorrectedPFChargedHadronIso_barrel", "RhoCorrPFChargedHadronIso(barrel)", 0., 10., 2);
	Variable photon_rhocorrchargediso_endcap("Photon_RhoCorrectedPFChargedHadronIso_endcap", "RhoCorrPFChargedHadronIso(endcap)", 0., 10., 2);
	Variable photon_chargediso_barrel("Photon_PFChargedHadronIso_barrel", "PFChargedHadronIso(barrel)", 0., 10., 2);
	Variable photon_chargediso_endcap("Photon_PFChargedHadronIso_endcap", "PFChargedHadronIso(endcap)", 0., 10., 2);
	Variable photon_rhocorrneutraliso_barrel("Photon_RhoCorrectedPFNeutralHadronIso_barrel", "RhoCorrPFNeutralHadronIso(barrel)", 0., 10., 2);
	Variable photon_rhocorrneutraliso_endcap("Photon_RhoCorrectedPFNeutralHadronIso_endcap", "RhoCorrPFNeutralHadronIso(endcap)", 0., 10., 2);	
	Variable photon_neutraliso_barrel("Photon_PFNeutralHadronIso_barrel", "PFNeutralHadronIso(barrel)", 0., 10., 2);
	Variable photon_neutraliso_endcap("Photon_PFNeutralHadronIso_endcap", "PFNeutralHadronIso(endcap)", 0., 10., 2);   
	Variable photon_rhocorrphotoniso_barrel("Photon_RhoCorrectedPFPhotonIso_barrel", "RhoCorrPFPhotonIso(barrel)", 0., 10., 2);
	Variable photon_rhocorrphotoniso_endcap("Photon_RhoCorrectedPFPhotonIso_endcap", "RhoCorrPFPhotonIso(endcap)", 0., 10., 2);
	Variable photon_photoniso_barrel("Photon_PFPhotonIso_barrel", "PFPhotonIso(barrel)", 0., 10., 2);
	Variable photon_photoniso_endcap("Photon_PFPhotonIso_endcap", "PFPhotonIso(endcap)", 0., 10., 2);
	Variable photon_htowoe("Photon_HtowoE", "H/E", 0., 5., 2);
	Variable photon_numberofphotons("Number_Of_Photons", "N(#gamma)", -0.5, 6.5, 1);


	setSelectionAndChannel("TTbarDiLeptonAnalysis", "MuMu");
	setPhotonSel("AllPhotons");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
	savePlot(samples, photon_abseta);
	savePlot(samples, photon_sigmaietaieta_barrel);
	savePlot(samples, photon_sigmaietaieta_endcap);
	savePlot(samples, photon_rhocorrchargediso_barrel);
	savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
	savePlot(samples, photon_numberofphotons);
	
	photon_sigmaietaieta_endcap.rebinFact *= 2;
	
	setChannel("EE");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
	savePlot(samples, photon_abseta);
	savePlot(samples, photon_sigmaietaieta_barrel);
	savePlot(samples, photon_sigmaietaieta_endcap);
	savePlot(samples, photon_rhocorrchargediso_barrel);
	savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
	savePlot(samples, photon_numberofphotons);
	
	setChannel("EMu");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
	savePlot(samples, photon_abseta);
	savePlot(samples, photon_sigmaietaieta_barrel);
	savePlot(samples, photon_sigmaietaieta_endcap);
	savePlot(samples, photon_rhocorrchargediso_barrel);
	savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
	savePlot(samples, photon_numberofphotons);

	photon_pt.rebinFact *= 2;
	photon_eta.rebinFact *= 2;

	setSelectionAndChannel("TTbarPhotonAnalysis", "MuMu");
	setPhotonSel("SignalPhotons");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
	savePlot(samples, photon_abseta);
        savePlot(samples, photon_sigmaietaieta_barrel);
        savePlot(samples, photon_sigmaietaieta_endcap);
        savePlot(samples, photon_rhocorrchargediso_barrel);
        savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
        savePlot(samples, photon_numberofphotons);
	
	photon_abseta.rebinFact *= 2;
	photon_sigmaietaieta_barrel.rebinFact *= 2;
//	photon_sigmaietaieta_endcap.rebinFact *= 2;

	setChannel("EE");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
        savePlot(samples, photon_abseta);
        savePlot(samples, photon_sigmaietaieta_barrel);
        savePlot(samples, photon_sigmaietaieta_endcap);
        savePlot(samples, photon_rhocorrchargediso_barrel);
        savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
        savePlot(samples, photon_numberofphotons);

	setChannel("EMu");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
        savePlot(samples, photon_abseta);
        savePlot(samples, photon_sigmaietaieta_barrel);
        savePlot(samples, photon_sigmaietaieta_endcap);
        savePlot(samples, photon_rhocorrchargediso_barrel);
        savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
        savePlot(samples, photon_numberofphotons);

	setPhotonSel("NminusOnePhotons");
	setChannel("MuMu");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
        savePlot(samples, photon_abseta);
        savePlot(samples, photon_sigmaietaieta_barrel);
        savePlot(samples, photon_sigmaietaieta_endcap);
        savePlot(samples, photon_rhocorrchargediso_barrel);
        savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
//        savePlot(samples, photon_numberofphotons);

	setChannel("EE");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
        savePlot(samples, photon_abseta);
        savePlot(samples, photon_sigmaietaieta_barrel);
        savePlot(samples, photon_sigmaietaieta_endcap);
        savePlot(samples, photon_rhocorrchargediso_barrel);
        savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
//        savePlot(samples, photon_numberofphotons);

	setChannel("EMu");
	savePlot(samples, photon_pt);
	savePlot(samples, photon_eta);
        savePlot(samples, photon_abseta);
        savePlot(samples, photon_sigmaietaieta_barrel);
        savePlot(samples, photon_sigmaietaieta_endcap);
        savePlot(samples, photon_rhocorrchargediso_barrel);
        savePlot(samples, photon_rhocorrchargediso_endcap);
	savePlot(samples, photon_chargediso_barrel);
	savePlot(samples, photon_chargediso_endcap);
	savePlot(samples, photon_rhocorrneutraliso_barrel);
	savePlot(samples, photon_rhocorrneutraliso_endcap);
	savePlot(samples, photon_neutraliso_barrel);
	savePlot(samples, photon_neutraliso_endcap);
	savePlot(samples, photon_rhocorrphotoniso_barrel);
	savePlot(samples, photon_rhocorrphotoniso_endcap);
	savePlot(samples, photon_photoniso_barrel);
	savePlot(samples, photon_photoniso_endcap);
	savePlot(samples, photon_htowoe);
//        savePlot(samples, photon_numberofphotons);
}