• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TGraphErrors类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TGraphErrors的典型用法代码示例。如果您正苦于以下问题:C++ TGraphErrors类的具体用法?C++ TGraphErrors怎么用?C++ TGraphErrors使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TGraphErrors类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: raaExpOpen_pt

void raaExpOpen_pt(const char* inputDir = "../macro_raa/outRoot", // the place where the input root files, with the histograms are
                   bool bSavePlots      = true,
                   bool bDrawCh         = true,
                   double xMax          = 30 // x-axis range limit (ALICE D has x-range maximum value at 36, CMS has it at 30)
                  )
{
  // set the style
  gSystem->mkdir(Form("./figs/png"), kTRUE);
  gSystem->mkdir(Form("./figs/pdf"), kTRUE);
  setTDRStyle();
  
  // read CMS graphs
  TFile *pgRaaCms_pt   = new TFile(Form("%s/makeRaa_pt.root",inputDir));
  // ##################### HIGH PT ############################
  TGraphErrors *pgCms     = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi");
  TGraphErrors *pgCmsP    = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP");
  TGraphErrors *pgCmsSyst = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst");
  pgCmsSyst->SetFillColorAlpha(kOrange-9,0.5);
  pgCms->SetName("gNonPrJpsi");

  TBox *lumi = (TBox*)pgRaaCms_pt->Get("lumi");
  lumi->SetFillColor(kOrange-9);
  lumi->SetFillStyle(1001);
  lumi->SetX1(xMax-0.75); lumi->SetX2(xMax);
  TBox *lumi_lowpt = (TBox*)lumi->Clone("lumi_lowpt");
  lumi_lowpt->SetFillColor(kViolet-9);
  lumi_lowpt->SetFillStyle(1001);
  lumi_lowpt->SetX1(xMax-1.5); lumi_lowpt->SetX2(xMax-0.75);

  // ##################### LOW PT ############################
  TGraphErrors *pgCms_lowpt     = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsi_pt365y1624");
  TGraphErrors *pgCmsP_lowpt    = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiP_pt365y1624");
  TGraphErrors *pgCmsSyst_lowpt = (TGraphErrors *)pgRaaCms_pt->Get("gNonPrJpsiSyst_pt365y1624");
  pgCmsSyst_lowpt->SetFillColorAlpha(kViolet-9,0.5);
  pgCms_lowpt->SetName("gNonPrJpsi_pt365y1624");

  //-------------------------------------------------------------------- 
  // *********** CMS Charged particle RAA
  TGraphAsymmErrors *p8165_d5x1y1 = new TGraphAsymmErrors(p8165_d5x1y1_numpoints, p8165_d5x1y1_xval, p8165_d5x1y1_yval, p8165_d5x1y1_xerrminus, p8165_d5x1y1_xerrplus, p8165_d5x1y1_ystatminus, p8165_d5x1y1_ystatplus);
  TGraphAsymmErrors *p8165_d5x1y1_syst = new TGraphAsymmErrors(p8165_d5x1y1_numpoints, p8165_d5x1y1_xval, p8165_d5x1y1_yval, p8165_d5x1y1_xerrminus, p8165_d5x1y1_xerrplus, p8165_d5x1y1_yerrminus, p8165_d5x1y1_yerrplus);
  p8165_d5x1y1->SetName("cms_ch_raa");
  // X-axis errors will be discarded
  for (int i=0; i<p8165_d5x1y1_numpoints; i++) {
    p8165_d5x1y1->SetPointEXlow(i,0);
    p8165_d5x1y1->SetPointEXhigh(i,0);
    p8165_d5x1y1_syst->SetPointEXlow(i,0.5);
    p8165_d5x1y1_syst->SetPointEXhigh(i,0.5);
  }
   
  // *********** ALICE D RAA vs. pT
  TGraphAsymmErrors *p9059_d15x1y1 = new TGraphAsymmErrors(p9059_d15x1y1_numpoints, p9059_d15x1y1_xval, p9059_d15x1y1_yval, p9059_d15x1y1_xerrminus, p9059_d15x1y1_xerrplus, p9059_d15x1y1_yerrminus, p9059_d15x1y1_yerrplus);
  TGraphAsymmErrors *p9059_d15x1y1_syst = new TGraphAsymmErrors(p9059_d15x1y1_numpoints, p9059_d15x1y1_xval, p9059_d15x1y1_yval, p9059_d15x1y1_xerrminus, p9059_d15x1y1_xerrplus, p9059_d15x1y1_yerrminus, p9059_d15x1y1_yerrplus);
  p9059_d15x1y1->SetName("alice_d_raa");
  // X-axis errors will be discarded
  for (int i=0; i<p9059_d15x1y1_numpoints; i++) {
    p9059_d15x1y1->SetPointEXlow(i,0);
    p9059_d15x1y1->SetPointEXhigh(i,0);
    p9059_d15x1y1_syst->SetPointEXlow(i,0.5);
    p9059_d15x1y1_syst->SetPointEXhigh(i,0.5);
    if (xMax<=30 && (i+1)==p9059_d15x1y1_numpoints) {
      double x,y;
      p9059_d15x1y1->GetPoint(i,x,y);
      p9059_d15x1y1->SetPoint(i,x+5,y);
      p9059_d15x1y1_syst->GetPoint(i,x,y);
      p9059_d15x1y1_syst->SetPoint(i,x+5,y);
    }
  }

  // Style for graphs
  p9059_d15x1y1->SetMarkerStyle(kOpenSquare);
  p9059_d15x1y1->SetMarkerSize(1.3);
  p9059_d15x1y1->SetMarkerColor(kBlack);
  p9059_d15x1y1->SetLineColor(kBlack);
  p9059_d15x1y1_syst->SetFillColorAlpha(kGray+1,0.5);

  p8165_d5x1y1->SetMarkerStyle(20);
  p8165_d5x1y1->SetMarkerSize(1.3);
  p8165_d5x1y1->SetMarkerColor(kTeal+3);
  p8165_d5x1y1->SetLineColor(kTeal+4);
  p8165_d5x1y1_syst->SetFillColorAlpha(kTeal-1,0.5);



  //---------------------------------------------------------
  TLine *line = new TLine(0.,1,xMax,1);
  line->SetLineStyle(1);
  line->SetLineWidth(1);

  TCanvas *pc = new TCanvas("pc","pc");

  TF1 *f4 = new TF1("f4","1",0,xMax);
  f4->SetLineWidth(1);
  f4->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  f4->GetYaxis()->SetTitle("R_{AA}");
  f4->GetXaxis()->SetRangeUser(0.0,xMax);
  f4->GetYaxis()->SetRangeUser(0.0,1.5);
  f4->GetXaxis()->CenterTitle(kTRUE);
 
  f4->Draw();
  lumi->Draw();
//.........这里部分代码省略.........
开发者ID:CMS-HIN-dilepton,项目名称:DimuonCADIs,代码行数:101,代码来源:raaExpOpen_pt.C


示例2: HwwNoteFigs


//.........这里部分代码省略.........
    	histo1->SetXTitle(XTitle);
    	histo2->SetXTitle(XTitle);
    	histo3->SetXTitle(XTitle);
    	histo4->SetXTitle(XTitle);
    	histo1->SetTitleSize(0.05, "X");
    	histo1->GetXaxis()->SetTitleFont(62);
    	histo1->GetXaxis()->SetLabelFont(61);
    	histo1->GetYaxis()->SetLabelFont(61); 
    	histo1->GetYaxis()->SetTitleOffset(1.3);
    	histo1->SetLabelSize(0.04, "Y");
    	histo1->SetLabelSize(0.04, "X");

	int min = histoBg->FindBin(-1.5);
	int max = histoBg->FindBin(1.5);

	histoBg->GetXaxis()->SetRange(min,max);
	
	histoBg->SetMarkerStyle(20);
	histoBg->SetMarkerSize(1.0);
	histoBg->GetYaxis()->SetTitleOffset(1.40);
	
	histo0->SetMarkerStyle(21);
	histo0->SetMarkerSize(1.0);
	
	histoBg->Rebin(ReBin);
	histo0->Rebin(ReBin);

	histoBg->SetLineColor(4);
	histo0->SetLineColor(1);

	scaleHist(histoBg);
	scaleHist(histo0);
	cout << "bg events: " << histoBg->GetSumOfWeights() << endl;
	cout << "si events: " << histo0->GetSumOfWeights() << endl;

	histoBg->SetYTitle("Events");
    	histo1->SetMinimum(0.01);
	if(ysel == 0)  {
	  histo1->Draw("hist");
	}
	else          {
	  histo0->Draw("E");
	  histo1->Draw("hist,same");
    	}
	histo2->Draw("hist,same");
    	histo3->Draw("hist,same");
    	histo4->Draw("hist,same");
    	histo0->Draw("E, same");
	//histoBg->DrawCopy("hist");
	//histo0->DrawCopy("hist,same");

	TLegend* leg = new TLegend(0.63, 0.75, 0.92, 0.92);
	leg->SetFillColor(0);
	char theSLine[100];
	if(mass != 999)	sprintf(theSLine,"Signal, m_{H}=%d GeV",mass);
	else    	sprintf(theSLine,"WW");
        cout << theSLine << endl;
	leg ->AddEntry(histo0,theSLine);
    	leg ->AddEntry(histo4,"W+Jets, W#gamma","F"); 
    	leg ->AddEntry(histo3,"di-boson","F");  
    	leg ->AddEntry(histo2,"t#bar{t}, tW","F"); 
    	leg ->AddEntry(histo1,"Drell-Yan","F"); 
	leg->Draw("same");
	
        TString fileOutput1(filename.Data());
	TString theLine = "_";
	theLine = theLine + "plot.eps";
        fileOutput1.ReplaceAll(".root",theLine.Data());
        fileOutput1.ReplaceAll("../","");
        fileOutput1.ReplaceAll("rootfiles_fastsim/","");
        fileOutput1.ReplaceAll("rootfiles_fullsim/","");
	c1->SaveAs(fileOutput1.Data());
        //return;
	//--------------------------------
	TCanvas* c3 = new TCanvas("c3","c3",550,-200,500,500);
	c3->SetLogx();
	c3->SetLogy();
	gPad->SetGrid(1,1);
	TGraphErrors* gBDTD = makeGraphFromHists(histo0, histoBg);
	gBDTD->Draw("APXl");
	TH1* zBDTD = gBDTD->GetHistogram();
	zBDTD->SetXTitle("Signal Events");
	zBDTD->SetYTitle("Signal/Background");
	//zBDTD->SetYTitle("Background Events");
	//zBDTD->DrawCopy();

	TLegend* leg3 = new TLegend(0.7, 0.7, 0.9, 0.9);
	leg3->SetFillColor(0);
	leg3->AddEntry(gBDTD,theSLine,"lp");
	leg3->Draw("same");
        TString fileOutput2(filename.Data());
	theLine = "_";
	theLine = theLine + "counts.eps";
        fileOutput2.ReplaceAll(".root",theLine.Data());
        fileOutput2.ReplaceAll("../","");
        fileOutput2.ReplaceAll("rootfiles_fastsim/","");
        fileOutput2.ReplaceAll("rootfiles_fullsim/","");
	c3->SaveAs(fileOutput2.Data());
	
}
开发者ID:GuillelmoGomezCeballos,项目名称:Analysis,代码行数:101,代码来源:HwwNoteFigs.C


示例3: HypoTestInvDemo


//.........这里部分代码省略.........
  for (int i=0; i<nEntries; i++) {
    xArray[i] = r->GetXValue(i);
    yArray[i] = r->GetYValue(i);
    yErrArray[i] = r->GetYError(i);
    std::cout << xArray[i] << " , " << yArray[i] << " err = " << yErrArray[i] << std::endl;
  }
 

   // see expected result (bands)
   TGraph * g0 = new TGraph(nEntries);
   TGraphAsymmErrors * g1 = new TGraphAsymmErrors(nEntries);
   TGraphAsymmErrors * g2l = new TGraphAsymmErrors(nEntries);
   TGraphAsymmErrors * g2u = new TGraphAsymmErrors(nEntries);
   double p[7]; 
   double q[7];
   p[0] = ROOT::Math::normal_cdf(-2);
   p[1] = ROOT::Math::normal_cdf(-1.5);
   p[2] = ROOT::Math::normal_cdf(-1);
   p[3] = 0.5;
   p[4] = ROOT::Math::normal_cdf(1);
   p[5] = ROOT::Math::normal_cdf(1.5);
   p[6] = ROOT::Math::normal_cdf(2);
   for (int i=0; i<nEntries; i++) {
      SamplingDistribution * s = r->GetExpectedDistribution(i);
      // GENA
      //const std::vector<double> & values = s->GetSamplingDistribution();
      const std::vector<Double_t> & cValues = s->GetSamplingDistribution();
      std::vector<Double_t> values;
      for (std::vector<Double_t>::const_iterator val = cValues.begin();
	   val != cValues.end();
	   ++val) values.push_back(*val);
      TMath::Quantiles(values.size(), 7, &values[0],q,p,false);
      double p0 = q[3];
      double p2l =  q[1];
      double p2u =  q[5];
      g0->SetPoint(i, r->GetXValue(i), p0 ) ;
      g1->SetPoint(i, r->GetXValue(i),  p0);
      g2l->SetPoint(i, r->GetXValue(i), p2l);
      g2u->SetPoint(i, r->GetXValue(i), p2u);
      //g2->SetPoint(i, r->GetXValue(i), s->InverseCDF(0.50));
      g1->SetPointEYlow(i, q[3] - q[2]); // -1 sigma errorr   
      g1->SetPointEYhigh(i, q[4] - q[3]);//+1 sigma error

      g2l->SetPointEYlow(i, q[1]-q[0]);   // -2 -- -1 sigma error
      g2l->SetPointEYhigh(i, q[2]-q[1]);

      g2u->SetPointEYlow(i, q[5]-q[4]);
      g2u->SetPointEYhigh(i, q[6]-q[5]);


      if (plotHypoTestResult) { 
         HypoTestResult * hr = new HypoTestResult();
         hr->SetNullDistribution( r->GetBackgroundDistribution() );
         hr->SetAltDistribution( r->GetSignalAndBackgroundDistribution(i) );
         new TCanvas();
         HypoTestPlot * pl = new HypoTestPlot(*hr);
         pl->Draw();
      }
  }

   HypoTestInverterPlot *plot = new HypoTestInverterPlot("result","",r);
   TGraphErrors * g = plot->MakePlot();

   g->Draw("APL");   
   g2l->SetFillColor(kYellow);
   g2l->Draw("3");
   g2u->SetFillColor(kYellow);
   g2u->Draw("3");
   g1->SetFillColor(kGreen);
   g1->Draw("3");
   g0->SetLineColor(kBlue);
   g0->SetLineStyle(2);
   g0->SetLineWidth(2);
   g0->Draw("L");

   //g1->Draw("P");
   //g2->Draw("P");
   g->SetLineWidth(2);
   g->Draw("PL");   

   // GENA: two-sided interval
   //double alpha = 1.-r->ConfidenceLevel();
   // GENA: upper limit
   double alpha = (1.-r->ConfidenceLevel())/2.0;
   double x1 = g->GetXaxis()->GetXmin();
   double x2 = g->GetXaxis()->GetXmax();
   TLine * line = new TLine(x1, alpha, x2,alpha);
   line->SetLineColor(kRed);
   line->Draw();

   // see the expected limit and -1 +1 sigma bands
   // SamplingDistribution * limits = r->GetUpperLimitDistribution();

   // std::cout << " expected limit (median) " << limits->InverseCDF(0.50) << std::endl;
   // std::cout << " expected limit (-1 sig) " << limits->InverseCDF((ROOT::Math::normal_cdf(-1))) << std::endl;
   // std::cout << " expected limit (+1 sig) " << limits->InverseCDF((ROOT::Math::normal_cdf(+1))) << std::endl;
   
   tw.Print();

}
开发者ID:TENorbert,项目名称:SUSY-TOOLS,代码行数:101,代码来源:lorenzo_moneta_HypoTestInvDemo_16jun2011.C


示例4: decovspeak


//.........这里部分代码省略.........
      plotHistsTH2(hduthp[ifile],
                   Form("TIB %s (v+)",types.at(ifile)),"tan(#theta_{trk})-tan(#theta_{L})",
                   "#Delta u [#mum]",-0.3,0.5,-200,200,0,can[idx],ifile+1);
      
      plotHistsTH2(hduthm[ifile],
                   Form("TIB %s (v-)",types.at(ifile)),"tan(#theta_{trk})-tan(#theta_{L})",
                        "#Delta u [#mum]",-0.5,0.3,-200,200,0,can[idx],ifile+2);
      
    }
  
    idx++;

  }
  
  cout << "Plotting du vs. delta tan theta split v+/v- TGraphs... " << endl;

  //TGraph du vs. delta tan theta----------------------------------------

  if(draw("duvsdth_tgraph",cantitles)){

    can[idx]=new TCanvas(cantitles.at(idx),cantitles.at(idx),1200,450);
    can[idx]->Divide(2,1);
  
    vector<float> thetabinsp;
    vector<float> thetabinsm;

    for(int ibin=14;ibin<=30;ibin++)    thetabinsp.push_back(ibin*0.05-1);
    for(int ibin=10;ibin<=26;ibin++)    thetabinsm.push_back(ibin*0.05-1);
    
 
    TLatex *t=new TLatex();
    t->SetNDC();

    TGraphErrors *gduthp[nfiles];
    TGraphErrors *gduthm[nfiles];
        
    TF1 *fduthp[nfiles];
    TF1 *fduthm[nfiles];

    stringstream sduthp1[nfiles];
    stringstream sduthp2[nfiles];
    
    stringstream sduthm1[nfiles];
    stringstream sduthm2[nfiles];

    bool fit = false;

    for(unsigned int ifile = 0 ; ifile < nfiles ; ifile++ ){
      
      can[idx]->cd(1);
      
      hduthp[ifile]->SetName(Form("hduthp_%i",ifile));
      gduthp[ifile] = getTGraphFromTH2(hduthp[ifile],thetabinsp, colors[ifile] );
      fduthp[ifile]=new TF1(Form("fduthp_%i",ifile),"pol1");
      fduthp[ifile]->SetLineColor( colors[ifile] );
      if(fit) gduthp[ifile]->Fit(fduthp[ifile]);
         
      float dwp     = fduthp[ifile]->GetParameter(1);
      float dwperr  = fduthp[ifile]->GetParError(1);
      float bp      = fduthp[ifile]->GetParameter(0);
      float bperr   = fduthp[ifile]->GetParError(0);
      
      sduthp1[ifile] << "#DeltaW = " << fround(dwp,3) << " #pm " << fround(dwperr,3) << " #mum" << endl;
      sduthp2[ifile] << "#Deltatan(LA) = " << fround(bp/(235.-dwp),3) << " #pm " << fround(bperr/(235.-dwp),4) << endl;
      
      gduthp[ifile]->SetTitle("TIB (V+)");
开发者ID:hooberman,项目名称:UserCode,代码行数:67,代码来源:decovspeak_TIB_temp.C


示例5: main

int main(int argc, char** argv) {
  
  gROOT->SetStyle("Plain");
  gStyle->SetPalette(1);

  TApplication* theApp = new TApplication("example",&argc, argv);

  // load ntuple
  TChain *chain = new TChain ("myanalysis/EcalAnalysisTree","EcalAnalysisTree") ;
  //FIXME  EcalTreeContent treeVars;
  //  setBranchAddresses(chain, treeVars);  
  chain->Add("/gwpool/users/deguio/NTUPLES/SpikesCommissioning2010_GOODCOLL_May6_MERGED.root");   //dal run 134520: 7TeV phase 2

  int nEntries = (int)chain->GetEntries() ;
  cout << "FOUND " << nEntries  << " ENTRIES\n" << endl;;
  
 
  //ecalVariables variables
  unsigned int runId;
  unsigned int eventId;
  unsigned int eventNaiveId;
 
  int nEcalRecHits;
  float ecalRecHitType[100];
  float ecalRecHitEnergy[100];
  float ecalRecHitIEta[100];
  float ecalRecHitIPhi[100];
  float ecalRecHitTime[100];
  int ecalRecHitRawId[100];
  float ecalRecHitChi2[100];
  float ecalRecHitOutOfTimeChi2[100];
  int ecalRecHitRecoFlag[100];
  float ecalRecHitMatrixFlag[100][5][5];
  float ecalRecHitMatrix[100][5][5];
  float ecalRecHitR9[100];
  float ecalRecHitS4oS1[100];
  int ecalDigis[100][10];
  int ecalGainId[100][10];
  int techL1Bit[64];
  int algoL1Bit[128];

  // Set branch addresses.
  chain -> SetBranchAddress("runId",                     &runId);
  chain -> SetBranchAddress("eventId",                   &eventId);
  chain -> SetBranchAddress("eventNaiveId",              &eventNaiveId);
  chain -> SetBranchAddress("nEcalRecHits",              &nEcalRecHits);
  chain -> SetBranchAddress("ecalRecHitType",            ecalRecHitType);
  chain -> SetBranchAddress("ecalRecHitEnergy",          ecalRecHitEnergy);
  chain -> SetBranchAddress("ecalRecHitIEta",            ecalRecHitIEta);
  chain -> SetBranchAddress("ecalRecHitIPhi",            ecalRecHitIPhi);
  chain -> SetBranchAddress("ecalRecHitTime",            ecalRecHitTime);
  chain -> SetBranchAddress("ecalRecHitRawId",           ecalRecHitRawId);
  chain -> SetBranchAddress("ecalRecHitChi2",            ecalRecHitChi2);
  chain -> SetBranchAddress("ecalRecHitOutOfTimeChi2",   ecalRecHitOutOfTimeChi2);
  chain -> SetBranchAddress("ecalRecHitRecoFlag",        ecalRecHitRecoFlag);
  chain -> SetBranchAddress("ecalRecHitMatrixFlag",      ecalRecHitMatrixFlag);
  chain -> SetBranchAddress("ecalRecHitMatrix",          ecalRecHitMatrix);
  chain -> SetBranchAddress("ecalRecHitR9",              ecalRecHitR9);
  chain -> SetBranchAddress("ecalRecHitS4oS1",           ecalRecHitS4oS1);
  chain -> SetBranchAddress("ecalDigis",                 ecalDigis);
  chain -> SetBranchAddress("ecalGainId",                ecalGainId);
  chain -> SetBranchAddress("techL1Bit",                 techL1Bit);
  chain -> SetBranchAddress("algoL1Bit",                 algoL1Bit);

  
  char outfileName[100];
  sprintf(outfileName,"6May_fase_0ns.root");
  
  TFile* saving = new TFile (outfileName,"recreate") ;
  saving->mkdir("shapes");
  saving->cd ("shapes") ;

  TGraphErrors* gsample;

  char gname[100];
  char gnameCanvas[100];
  char gtitle[100];
  int ievt=0;  
  float EcalPhase;
  float tau = 43.;

  TH1F* spikeTime = new TH1F("spikeTime","spikeTime",100,-20.,20.);
  TH1F* goodTime = new TH1F("goodTime","goodTime",100,-20.,20);
  TH1F* spikeR9_goodDisc_Time = new TH1F("spikeR9_goodDisc_Time","spikeR9_goodDisc_Time",100,-20.,20);
  TH1F* goodR9_spikeDisc_Time = new TH1F("goodR9_spikeDisc_Time","goodR9_spikeDisc_Time",100,-20.,20);

  TH1F* deltaChi2 = new TH1F("deltaChi2","deltaChi2", 500, -50., 50.);
  TH1F* L_disc_spi = new TH1F("L_disc_spi","L_disc_spi", 200,0.,1.1);
  TH1F* L_disc_sci = new TH1F("L_disc_sci","L_disc_sci", 200,0.,1.1);

  TH2F* L_disc_vsTime_sci = new TH2F("L_disc_vsTime_sci","L_disc_vsTime_sci", 500,-50.,50.,110,0.,1.1);
  TH2F* L_disc_vsR9 = new TH2F("L_disc_vsR9","L_disc_vsR9", 110,0.,1.1,200,-0.5,1.5);
  TH2F* L_disc_vsTime_spi = new TH2F("L_disc_vsTime_spi","L_disc_vsTime_spi", 500,-50.,50.,110,0.,1.1);

  TH1F* sigmaIEtaIEtaDistr = new TH1F("sigmaIEtaIEtaDistr","sigmaIEtaIEtaDistr",10000.,0.,1000.);
  
  TGraph* eff = new TGraph;

  TGraph* effChi2;
  TGraph* effChi2OutOfTime;
//.........这里部分代码省略.........
开发者ID:Bicocca,项目名称:UserCode,代码行数:101,代码来源:SpikeAnalysis.cpp


示例6: scalefactor


//.........这里部分代码省略.........
      else hname = "p_rho_nPV";
  }

  TProfile* data_rho_nPU = (TProfile*) data_root->Get(hname);

  for (int i=1; i<=100; i++)
    cout << i << "\t" << data_rho_nPU->GetBinCenter(i) << "\t" << data_rho_nPU->GetBinContent(i) << endl;

  //int low_bin = 2, high_bin = 30;
  cout << low_bin << "\t" << high_bin << endl;

  TProfile* mc_rho_nPU = (TProfile*) mc_root->Get(hname);

  ofstream writeFile(Form("./plots/scalefactor/Fall15_25nsV1_DataMcSF_L1RC_AK%iPF", Rlabel) + pf_type + ".txt");
  writeFile << "{1   JetEta   1   Rho   [0]+[1]*x+[2]*pow(x,2)   Data/MC   L1FastJet}" << endl;

  TF1* fit = new TF1("fit", "1++x++x*x");
  fit->SetLineColor(1);
  fit->SetLineWidth(2);

  //float rho_start = 4;
  //float rho_end = 12;

  int size;
  if (nPU_derived) size = (rho_end-rho_start+0.5)*2;
  else size = rho_end-rho_start+1;

  for (int i=0; i<ETA_BINS; i++){

    vector<double> rho, scale_factor, sf_error;

    for (int j=0; j<size; j++){

      double data_rho;
      if (nPU_derived) data_rho = rho_start+j/2.0;
      else data_rho = rho_start+j;

//      if (data_rho==9 || data_rho==9.5) continue;

      rho.push_back(data_rho);
      double data_offset = data_p0[i] + data_p1[i]*data_rho + data_p2[i]*data_rho*data_rho;

      int data_mu_bin = 0;
      data_rho_nPU->GetBinWithContent(data_rho, data_mu_bin, low_bin, high_bin, 1);
      double data_mu = data_rho_nPU->GetBinCenter( data_mu_bin );

      double mc_rho = mc_rho_nPU->GetBinContent( mc_rho_nPU->FindBin( data_mu ) );
      double mc_offset = mc_p0[i] + mc_p1[i]*mc_rho + mc_p2[i]*mc_rho*mc_rho;

      scale_factor.push_back( data_offset / mc_offset );
      sf_error.push_back( 0.02*scale_factor.back() );
    }

    TGraphErrors* graph = new TGraphErrors(rho.size(), &rho[0], &scale_factor[0], 0, &sf_error[0]);
    graph->Fit(fit, "Q");

    writeFile << eta1[i] << setw(8) << eta2[i] << setw(8) << 5 << setw(6) << 0 << setw(6) << 200
              << setw(15) << fit->GetParameter(0) << setw(15) << fit->GetParameter(1) << setw(15) << fit->GetParameter(2) << endl;

    TCanvas* c = new TCanvas("c", "c", 600, 600);
    TH1F* h = new TH1F("h", "h", size-1, rho_start, rho_end);
    int topY = 2;

    h->GetXaxis()->SetTitle("#rho_{Data} (GeV)");
    h->GetYaxis()->SetTitle("Scale Factor");
    h->GetYaxis()->SetTitleOffset(1.05);
    h->GetYaxis()->SetRangeUser(0, topY);
    h->Draw();

    graph->SetMarkerStyle(20);
    graph->SetMarkerColor(1);
    graph->Draw("psame");

    TLatex text;
    text.SetNDC();
    text.SetTextSize(0.04);

    if (pf_type.EqualTo("all"))
      text.DrawLatex(0.17, 0.96, Form("AK%i PF %4.3f #leq #eta #leq %4.3f", Rlabel, eta1[i], eta2[i]) );
    else
      text.DrawLatex(0.17, 0.96, Form("AK%i PF%s %4.3f #leq #eta #leq %4.3f", Rlabel, pf_type.Data(), eta1[i], eta2[i]) );

    text.DrawLatex(0.2, 0.88, Form("#chi^{2}/ndof = %4.2f/%i", fit->GetChisquare(), fit->GetNDF() ) );
    text.DrawLatex(0.2, 0.84, Form("p0 = %4.3f #pm %4.3f", fit->GetParameter(0), fit->GetParError(0) ) );
    text.DrawLatex(0.2, 0.8, Form("p1 = %4.3f #pm %4.3f", fit->GetParameter(1), fit->GetParError(1) ) );
    text.DrawLatex(0.2, 0.76, Form("p2 = %4.4f #pm %4.4f", fit->GetParameter(2), fit->GetParError(2) ) );

    text.SetTextSize(0.035);
    text.SetTextColor(1);
    text.SetTextFont(42);
    text.DrawLatex(0.8, 0.96, "#sqrt{s} = 13 TeV");

    cout << fit->GetChisquare() / fit->GetNDF() << endl;

    c->Print("./plots/scalefactor/scalefactor_PF" + pf_type + Form("_eta%4.3f.pdf", eta1[i]) );
    delete h;
    delete c;
  }
  writeFile.close();
}
开发者ID:cihar29,项目名称:OffsetAnalysis,代码行数:101,代码来源:scalefactor.c


示例7: Pythia8_Dijet30_result_JER_akPu4PF_

void Pythia8_Dijet30_result_JER_akPu4PF_((abs(refeta)<2)&&(hiBin>60))&&(refpt>30)_refeta()
{
//=========Macro generated from canvas: Can_result_3/
//=========  (Mon Apr 18 04:08:04 2016) by ROOT version6.02/13
   TCanvas *Can_result_3 = new TCanvas("Can_result_3", "",18,40,700,500);
   gStyle->SetOptFit(1);
   Can_result_3->Range(-2.75,0.1715425,2.75,0.2926317);
   Can_result_3->SetFillColor(0);
   Can_result_3->SetBorderMode(0);
   Can_result_3->SetBorderSize(2);
   Can_result_3->SetFrameBorderMode(0);
   Can_result_3->SetFrameBorderMode(0);
   
   TMultiGraph *multigraph = new TMultiGraph();
   multigraph->SetName("name");
   multigraph->SetTitle("JER_akPu4PF");
   
   Double_t Graph_fx1007[9] = {
   -1.8,
   -1.4,
   -1,
   -0.6,
   -0.2,
   0.2,
   0.6,
   1,
   1.6};
   Double_t Graph_fy1007[9] = {
   0.2213775,
   0.2313726,
   0.212349,
   0.1992318,
   0.2015521,
   0.2047929,
   0.2065286,
   0.2141753,
   0.2298097};
   Double_t Graph_fex1007[9] = {
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.2,
   0.4};
   Double_t Graph_fey1007[9] = {
   0.001529502,
   0.001378741,
   0.001274153,
   0.001286487,
   0.00132694,
   0.001354738,
   0.001397823,
   0.001305814,
   0.001034891};
   TGraphErrors *gre = new TGraphErrors(9,Graph_fx1007,Graph_fy1007,Graph_fex1007,Graph_fey1007);
   gre->SetName("Graph");
   gre->SetTitle("some title_0");
   gre->SetFillColor(1);
   gre->SetFillStyle(0);
   
   TH1F *Graph_Graph1007 = new TH1F("Graph_Graph1007","some title_0",100,-2.4,2.4);
   Graph_Graph1007->SetMinimum(0.1944648);
   Graph_Graph1007->SetMaximum(0.236232);
   Graph_Graph1007->SetDirectory(0);
   Graph_Graph1007->SetStats(0);

   Int_t ci;      // for color index setting
   TColor *color; // for color definition with alpha
   ci = TColor::GetColor("#000099");
   Graph_Graph1007->SetLineColor(ci);
   Graph_Graph1007->GetXaxis()->SetLabelFont(42);
   Graph_Graph1007->GetXaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetXaxis()->SetTitleFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelFont(42);
   Graph_Graph1007->GetYaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetYaxis()->SetTitleFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelFont(42);
   Graph_Graph1007->GetZaxis()->SetLabelSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleSize(0.035);
   Graph_Graph1007->GetZaxis()->SetTitleFont(42);
   gre->SetHistogram(Graph_Graph1007);
   
   multigraph->Add(gre,"");
   
   Double_t Graph_fx1008[20] = {
   -1.9,
   -1.7,
   -1.5,
   -1.2,
   -0.9,
   -0.7,
   -0.5,
   -0.3,
   -0.1,
   0.1,
//.........这里部分代码省略.........
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:101,代码来源:Pythia8_Dijet30_result_JER_akPu4PF_((abs(refeta)<2)&&(hiBin>60))&&(refpt>30)_refeta.C


示例8: minuitFit


//.........这里部分代码省略.........
      pT[ptbin] = (lowpt[ptbin]+highpt[ptbin])/2.;
      RbC[plotCount] = pC1[ptbin];///(p21[ptbin]+p20[ptbin]);
      ebC[plotCount] = eC1[ptbin];
      plotCount++;
    }

  // Get FONLL Calc
  Int_t l=0;
  char line[1000];
  Float_t xF[100],yF[100],minF[100],maxF[100];
  ifstream fp("/Users/zach/Research/pythia/ptHatTemplate/FONLL.txt",ios::in);
  while (!fp.eof()){
    fp.getline(line,1000);
    sscanf(line,"%f %f %f %f",&xF[l],&yF[l],&minF[l],&maxF[l]);
    //  printf("L: %f %f\n",xF[l],yF[l]);
    l++;
  }
  fp.close();

  // Get Previous Analysis 
  Int_t p=0;
  Float_t xP[100],yP[100],dyP[100];
  ifstream fp1("/Users/zach/Research/pythia/ptHatTemplate/run5_6.txt",ios::in);
  while (!fp1.eof()){
    fp1.getline(line,1000);
    sscanf(line,"%f %f %f",&xP[p],&yP[p],&dyP[p]);
    // printf("L: %f %f\n",xF[l],yF[l]);
    p++;
  }
  fp1.close();

  //cout << "at bottom contrib plot" << endl;
  TCanvas* c1 = new TCanvas("c1","Bottom Contribution",150,0,1150,1000);
  TGraphErrors *gr0     = new TGraphErrors(plotCount0-1,ptOFF1,Rb0,dx,eb0);
  TGraphErrors *gr2     = new TGraphErrors(plotCount2-1,ptOFF2,Rb2,dx,eb2);
  TGraphErrors *grC     = new TGraphErrors(plotCount-1,pT,RbC,dx,ebC);
  TGraphErrors *grF     = new TGraphErrors(l-1,xF,yF);
  TGraphErrors *grFmax  = new TGraphErrors(l-1,xF,maxF);
  TGraphErrors *grFmin  = new TGraphErrors(l-1,xF,minF);
  TGraphErrors *grP     = new TGraphErrors(p-1,xP,yP,0,dyP);

  c1->cd(1);

  gr0->SetTitle("Bottom Contribution");
  gr0->GetXaxis()->SetTitle("p_{T,e}");
  gr0->GetYaxis()->SetTitle("#frac{r_{B}}{(r_{B}+r_{C})}");
  gr0->SetMarkerStyle(20);
  gr0->SetMarkerSize(1);
  gr0->SetLineColor(kBlue);
  gr0->SetMarkerColor(kBlue);
  gr2->SetMarkerStyle(22);
  gr2->SetMarkerSize(1);
  gr2->SetLineColor(kRed);
  gr2->SetMarkerColor(kRed);
  grC->SetMarkerStyle(21);
  grC->SetMarkerSize(1);
  grC->SetLineColor(kRed);
  grC->SetMarkerColor(kRed);
  gr0->GetXaxis()->SetLimits(1,14);
  gr0->GetYaxis()->SetRangeUser(0,1);
  grF->SetLineStyle(1);
  grFmax->SetLineStyle(2);
  grFmin->SetLineStyle(2);
  grP->SetMarkerStyle(33);
  grP->SetMarkerColor(kBlack);
  
开发者ID:zaglamir,项目名称:ptHatOffline,代码行数:66,代码来源:minuitFit.C


示例9: DrawClus

void DrawClus(bool Flag_err,TTree* tree,Double_t *errx,char* varToPlot, char* cond, Int_t kColor, Int_t kMarker, char* Title,char* xTitle,char* yTitle, TLegend *leg, char* cLeg,Double_t downlim,Double_t uplim){
  TGraphErrors* g;
  
  tree->Draw(varToPlot, cond,"goff");
  cout << tree->GetSelectedRows() << endl;
  if(tree->GetSelectedRows()){
    if(Flag_err)
      g=new TGraphErrors(tree->GetSelectedRows(),tree->GetV1(),tree->GetV2(),errx,tree->GetV3());
    else
      g=new TGraphErrors(tree->GetSelectedRows(),tree->GetV1(),tree->GetV2(),errx,errx);
    g->SetMarkerStyle(kMarker);
    g->SetMarkerSize(0.9);
    g->SetMarkerColor(kColor);
    g->SetTitle(Title);
    g->GetXaxis()->SetTitle(xTitle);
    g->GetXaxis()->CenterTitle();
    g->GetYaxis()->SetTitle(yTitle);
    g->GetYaxis()->CenterTitle();
    g->GetYaxis()->SetRangeUser(downlim,uplim);
    g->Draw("Ap");
    leg->AddEntry(g, cLeg,"p");
  }else{
    cout << "NO rows selected for leave " << varToPlot << endl;
  }
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:25,代码来源:PlotMacro.cpp


示例10: DY


//.........这里部分代码省略.........
    //----------------------------------------------------------------------------
    if (printLevel > 0) {
        printf("\n [%s] DY values for the note\n", channel.Data());
        printf(" -------------------------------------------------\n");
        printf(" final state   &             R_{MC}  &  N^{control,data}  &     N_{DY}^{data}  &       N_{DY}^{MC}  &  data/MC\n");
        printf(" same flavour  &  %5.3f $\\pm$ %5.3f  &              %4.0f  &  %5.1f $\\pm$ %4.1f  &  %5.1f $\\pm$ %4.1f  &     %4.1f\n\n",
               R[theR],
               errR[theR],
               NinCountedSFData,
               yield,
               statError,
               hExpectedDYSF->GetBinContent(2),
               hExpectedDYSF->GetBinError(2),
               scaleFactor);
        printf("\n [%s] DY relative systematic uncertainties\n", channel.Data());
        printf(" -------------------------------------------------\n");
        printf(" DY normalisation = %.0f (stat.) $\\bigoplus$ %.0f (syst.)\n\n",
               1e2*statError/yield, 1e2*systError/yield);
    }


    // Check
    //----------------------------------------------------------------------------
    Double_t check = hExpectedDYSF->GetBinContent(2) - NoutDYSF[sysR];
    if (check != 0) printf(" WARNING: DY yields do not much by %f\n\n", check);


    // Draw histograms
    //----------------------------------------------------------------------------
    if (drawR) {

        Double_t absoluteMin = 999;

        TGraphErrors* gR     = new TGraphErrors(numberMetCuts-1);
        TGraphErrors* gRdata = new TGraphErrors(numberMetCuts-1);

        for (UInt_t i=0; i<numberMetCuts-1; i++) {

            gR->SetPoint     (i, 0.5 * (MetDraw[i+1] + MetDraw[i]),    R[i]);
            gR->SetPointError(i, 0.5 * (MetDraw[i+1] - MetDraw[i]), errR[i]);

            gRdata->SetPoint     (i, 0.5 * (MetDraw[i+1] + MetDraw[i]),    RData[i]);
            gRdata->SetPointError(i, 0.5 * (MetDraw[i+1] - MetDraw[i]), errRData[i]);

            if (absoluteMin > (R[i]     - errR[i]))     absoluteMin = R[i]     - errR[i];
            if (absoluteMin > (RData[i] - errRData[i])) absoluteMin = RData[i] - errRData[i];
        }

        if (absoluteMin > 0) absoluteMin = 0;


        // Cosmetics
        //--------------------------------------------------------------------------
        gR->SetMarkerSize (0.9);
        gR->SetMarkerStyle(kFullCircle);

        gRdata->SetLineColor  (kRed+1);
        gRdata->SetMarkerColor(kRed+1);
        gRdata->SetMarkerSize (0.9);
        gRdata->SetMarkerStyle(kFullCircle);


        // Draw
        //--------------------------------------------------------------------------
        canvas = new TCanvas();
开发者ID:piedraj,项目名称:usercode,代码行数:66,代码来源:DY.C


示例11: fitwitherr2

void fitwitherr2() {

  fetchpc3dphidz();

  float pt[50];
  float errx[50];

  for (int ipt=0; ipt<50; ipt++) {
    pt[ipt] = ipt*0.1 + 0.05;
    errx[ipt] = 0.0;
  }

  gStyle->SetOptStat(kFALSE);
  //gStyle->SetOptFit(1101);

  ofstream fout("run16dAupc3matchingsmooth.h");
  ofstream fout2("run16dAupc3matchingsmooth2.h");


  for (int iarm=0; iarm<2; iarm++) {
    for (int ich=0; ich<2; ich++) {
    for(int ivz=0; ivz<10; ivz++){
      string arm;
      string ch;
      if (iarm == 0) arm = "east";
      else if (iarm == 1) arm = "west";
      else arm = "err";

      if (ich == 0) ch = "pos";
      else if (ich == 1) ch = "neg";
      else ch = "err";
        string bbcz;
	if (ivz==0) bbcz = "-10 to -8";
        else if (ivz==1) bbcz = "-8 to -6";
	else if (ivz==2) bbcz = "-6 to -4";
	else if (ivz==3) bbcz = "-4 to -2";
	else if (ivz==4) bbcz = "-2 to 0";
	else if (ivz==5) bbcz = "0 to 2";
	else if (ivz==6) bbcz = "2 to 4";
	else if (ivz==7) bbcz = "4 to 6";
	else if (ivz==8) bbcz = "6 to 8";
	else if (ivz==9) bbcz = "8 to 10";
	else bbcz = "err";

      TCanvas *c1 = new TCanvas("c1","c1",500,500);
      c1->SetGridx();
      TGraphErrors* dphisigma = new TGraphErrors(50,pt,pc3dphisigma[iarm][ich][ivz],errx,pc3dphisigmaerr[iarm][ich][ivz]);
      dphisigma->SetTitle(Form("dphisigma_%s_%s_%s",arm,ch,bbcz));
      dphisigma->SetLineColor(1);
      dphisigma->SetMarkerStyle(20);
      dphisigma->SetMarkerSize(0.8);
      dphisigma->GetXaxis()->SetRangeUser(0.2,5.0);
      dphisigma->GetHistogram()->SetMaximum(0.01);
      dphisigma->GetHistogram()->SetMinimum(-0.01);
      dphisigma->GetXaxis()->SetTitle("p_{T}");
      dphisigma->GetYaxis()->SetTitle("dphi sigma");
      dphisigma->Draw("AP");

      TPaveText *p1 = new TPaveText(0.2,0.8,0.9,0.9,"NDC");
      p1->AddText("Fit function: a+bx+cx^{2}+dx^{3}+ex^{4}+fx^{5}+#frac{g}{#sqrt{x}}+#frac{h}{x^{2}}");
      p1->Draw("same");

      TF1 *fdphisigma = new TF1("fdphisigma","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x+[5]*x*x*x*x*x+[6]/TMath::Sqrt(x)+[7]/x/x",0.3,5.0);
      //TF1 *fdphisigma2 = new TF1("fdphisigma2","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x+[5]*x*x*x*x*x+[6]/TMath::Sqrt(x)+[7]/x/x",0.2,5.0);
      dphisigma->Fit("fdphisigma","Q0","",0.4,4.0);
      //double sigma_par[8];
      //fdphisigma->GetParameters(sigma_par);
      //fdphisigma->SetParameters(sigma_par);
      //dphisigma->Fit("fdphisigma2","Q0","",0.3,5.0);
      fdphisigma->Draw("same");
      fout << "fdphisigma->SetParameters(" << fdphisigma->GetParameter(0) << "," << fdphisigma->GetParameter(1) << "," << fdphisigma->GetParameter(2) << "," << fdphisigma->GetParameter(3) << "," << fdphisigma->GetParameter(4) << "," << fdphisigma->GetParameter(5) << "," << fdphisigma->GetParameter(6) << "," << fdphisigma->GetParameter(7) << ");" << endl;
      for(int ipar=0;ipar<8;ipar++){
      fout2 << "PC3_dphisigma[" << iarm <<"][" << ich << "][" << ivz <<"][" << ipar << "] = " << fdphisigma->GetParameter(ipar) << ";" << endl;
      }
      c1->Print(Form("smooth/dphisigma_%d_%d_%d.png",iarm,ich,ivz));
      delete c1;


      TCanvas *c3 = new TCanvas("c3","c3",500,500);
      c3->SetGridx();
      TGraphErrors* dphimean = new TGraphErrors(50,pt,pc3dphimean[iarm][ich][ivz],errx,pc3dphimeanerr[iarm][ich][ivz]);
      dphimean->SetTitle(Form("dphimean_%s_%s_%s",arm,ch,bbcz));
      dphimean->SetLineColor(1);
      dphimean->SetMarkerStyle(20);
      dphimean->SetMarkerSize(0.8);
      dphimean->GetXaxis()->SetRangeUser(0.2,5.0);
      dphimean->GetHistogram()->SetMaximum(0.01);
      dphimean->GetHistogram()->SetMinimum(-0.01);
      dphimean->GetXaxis()->SetTitle("p_{T}");
      dphimean->GetYaxis()->SetTitle("dphi mean");
      dphimean->Draw("AP");

      TPaveText *p3 = new TPaveText(0.2,0.8,0.9,0.9,"NDC");
      p3->AddText("Fit function: a+bx+#frac{c}{x}+#frac{d}{#sqrt{x}}+#frac{e}{x^{2}}+#frac{f}{x^{3}}+#frac{g}{x^{4}}");
      p3->Draw("same");
      TF1 *fdphimean = new TF1("fdphimean","[0]+[1]*x+[2]/x+[3]/TMath::Sqrt(x)+[4]/x/x+[5]/x/x/x+[6]/x/x/x/x",0.3,5.0);
      //TF1 *fdphimean2 = new TF1("fdphimean2","[0]+[1]*x+[2]/x+[3]/TMath::Sqrt(x)+[4]/x/x+[5]/x/x/x+[6]/x/x/x/x",0.2,5.0);
      dphimean->Fit("fdphimean","Q0","",0.4,4.0);
      double mean_par[7];
      //fdphimean->GetParameters(mean_par);
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:fitwitherr2.C


示例12: MakeAmplitudeVsAbsorberThicknessGraph

void MakeAmplitudeVsAbsorberThicknessGraph() {

  //use beam energy for xaxis
  const int nPoints = 5;
  float x[nPoints] = { 0.0, 1.0, 2.0, 4.0, 6.0 };
  float xerr[nPoints] = { 0.1, 0.25, 0.25, 0.25, 0.25 };
  float y_charge[nPoints] = {  6.5, 33, 57.0, 109, 106 }; 
  float yerr_charge[nPoints] = { 1.4, 24, 22, 60, 46 };
  float y_MIP[nPoints] = {  0.0, 0.0, 0.0, 0.0, 0.0 }; 
  float yerr_MIP[nPoints] = { 0.0, 0.0, 0.0, 0.0, 0.0 };

  double chargePerMIP = 6.5;
  for (int i=0; i<nPoints; ++i) {
    y_MIP[i] = y_charge[i] / chargePerMIP;
    yerr_MIP[i] =  yerr_charge[i] / chargePerMIP;
  }

  TGraphErrors *graphChargeVsAbsorber = new TGraphErrors(nPoints,x,y_charge,xerr,yerr_charge);
  graphChargeVsAbsorber->SetLineWidth(3);
  TGraphErrors *graphMIPVsAbsorber = new TGraphErrors(nPoints,x,y_MIP,xerr,yerr_MIP);
  graphMIPVsAbsorber->SetLineWidth(3);

  TCanvas *c = 0;
  TVirtualFitter *fitter = 0;

  c = new TCanvas("c","c",800,600);
  c->SetBottomMargin(0.12);
  graphChargeVsAbsorber->Draw("AP");
  graphChargeVsAbsorber->SetTitle("");
  graphChargeVsAbsorber->GetXaxis()->SetTitle("Tungsten Absorber Thickness [X_{0}]");
  graphChargeVsAbsorber->GetXaxis()->SetTitleSize(0.045);
  graphChargeVsAbsorber->GetXaxis()->SetLabelSize(0.045);
  graphChargeVsAbsorber->GetXaxis()->SetTitleOffset(1.2);
  graphChargeVsAbsorber->GetYaxis()->SetTitle("Integrated Charge [pC]");
  graphChargeVsAbsorber->GetYaxis()->SetTitleOffset(1.0);
  graphChargeVsAbsorber->GetYaxis()->SetTitleSize(0.05);
  graphChargeVsAbsorber->GetYaxis()->SetLabelSize(0.045);
  graphChargeVsAbsorber->GetXaxis()->SetRangeUser(0.0,8.0);
  graphChargeVsAbsorber->GetYaxis()->SetRangeUser(0,200);

  // graphChargeVsAbsorber->Fit("pol2","","");
  // fitter = TVirtualFitter::GetFitter();
  
  c->SaveAs( "ChargeVsAbsorberAt8GeV.gif" );
  c->SaveAs( "ChargeVsAbsorberAt8GeV.pdf" );


  c = new TCanvas("c","c",800,600);
  c->SetBottomMargin(0.12);
  c->SetLeftMargin(0.11);

  graphMIPVsAbsorber->Draw("AP");
  graphMIPVsAbsorber->SetTitle("");
  graphMIPVsAbsorber->GetXaxis()->SetTitle("Tungsten Absorber Thickness [X_{0}]");
  graphMIPVsAbsorber->GetXaxis()->SetTitleSize(0.045);
  graphMIPVsAbsorber->GetXaxis()->SetLabelSize(0.045);
  graphMIPVsAbsorber->GetXaxis()->SetTitleOffset(1.2);
  graphMIPVsAbsorber->GetYaxis()->SetTitle("Integrated Charge [ Q_{MIP} ]");
  graphMIPVsAbsorber->GetYaxis()->SetTitleOffset(0.9);
  graphMIPVsAbsorber->GetYaxis()->SetTitleSize(0.05);
  graphMIPVsAbsorber->GetYaxis()->SetLabelSize(0.045);
  graphMIPVsAbsorber->GetXaxis()->SetRangeUser(0.0, 8.0);
  graphMIPVsAbsorber->GetYaxis()->SetRangeUser(0, 30);

  // graphMIPVsAbsorber->Fit("pol1","","");
  // fitter = TVirtualFitter::GetFitter();
  
  c->SaveAs( "MIPVsAbsorberAt8GeV.gif" );
  c->SaveAs( "MIPVsAbsorberAt8GeV.pdf" );


}
开发者ID:CaltechPrecisionTiming,项目名称:t1065-jun-2016,代码行数:72,代码来源:makeEMShowerEnergyPlots.C


示例13: MakeAmplitudeVsBeamEnergyGraph

void MakeAmplitudeVsBeamEnergyGraph() {

  //use beam energy for xaxis
  const int nPoints = 4;
  float x[nPoints] = { 4.0, 8.0, 16.0, 32.0 };
  float xerr[nPoints] = { 0.027*4.0, 0.023*8.0, 0.045*16.0, 0.05*32.0 };
  float y_charge[nPoints] = {  54.8, 106, 217, 350 }; 
  float yerr_charge[nPoints] = { 19, 46, 46, 92 };
  float y_MIP[nPoints] = {  0.0, 0.0, 0.0, 0.0 }; 
  float yerr_MIP[nPoints] = { 0.0, 0.0, 0.0, 0.0 };

  double chargePerMIP = 6.5;
  for (int i=0; i<nPoints; ++i) {
    y_MIP[i] = y_charge[i] / chargePerMIP;
    yerr_MIP[i] =  yerr_charge[i] / chargePerMIP;
  }

  TGraphErrors *graphChargeVsEnergy = new TGraphErrors(nPoints,x,y_charge,xerr,yerr_charge);
  graphChargeVsEnergy->SetLineWidth(3);
  TGraphErrors *graphMIPVsEnergy = new TGraphErrors(nPoints,x,y_MIP,xerr,yerr_MIP);
  graphMIPVsEnergy->SetLineWidth(3);

  TCanvas *c = 0;
  TVirtualFitter *fitter = 0;

  c = new TCanvas("c","c",800,600);
  graphChargeVsEnergy->Draw("AP");
  graphChargeVsEnergy->SetTitle("");
  graphChargeVsEnergy->GetXaxis()->SetTitle("Electron Beam Energy [GeV/c^{2}]");
  graphChargeVsEnergy->GetXaxis()->SetTitleSize(0.045);
  graphChargeVsEnergy->GetXaxis()->SetLabelSize(0.045);
  graphChargeVsEnergy->GetXaxis()->SetTitleOffset(1.0);
  graphChargeVsEnergy->GetYaxis()->SetTitle("Integrated Charge [pC]");
  graphChargeVsEnergy->GetYaxis()->SetTitleOffset(1.0);
  graphChargeVsEnergy->GetYaxis()->SetTitleSize(0.05);
  graphChargeVsEnergy->GetYaxis()->SetLabelSize(0.045);
  graphChargeVsEnergy->GetXaxis()->SetRangeUser(0,40);
  graphChargeVsEnergy->GetYaxis()->SetRangeUser(0,500);

  graphChargeVsEnergy->Fit("pol1","","");
  fitter = TVirtualFitter::GetFitter();
  
  c->SaveAs( "ChargeVsEnergyAt6X0.gif" );
  c->SaveAs( "ChargeVsEnergyAt6X0.pdf" );


  c = new TCanvas("c","c",800,600);
  c->SetLeftMargin(0.11);
  graphMIPVsEnergy->Draw("AP");
  graphMIPVsEnergy->SetTitle("");
  graphMIPVsEnergy->GetXaxis()->SetTitle("Electron Beam Energy [GeV/c^{2}]");
  graphMIPVsEnergy->GetXaxis()->SetTitleSize(0.045);
  graphMIPVsEnergy->GetXaxis()->SetLabelSize(0.045);
  graphMIPVsEnergy->GetXaxis()->SetTitleOffset(1.0);
  graphMIPVsEnergy->GetYaxis()->SetTitle("Integrated Charge [ Q_{MIP} ]");
  graphMIPVsEnergy->GetYaxis()->SetTitleOffset(0.9);
  graphMIPVsEnergy->GetYaxis()->SetTitleSize(0.05);
  graphMIPVsEnergy->GetYaxis()->SetLabelSize(0.045);
  graphMIPVsEnergy->GetXaxis()->SetRangeUser(0,40);
  graphMIPVsEnergy->GetYaxis()->SetRangeUser(0,80);

  graphMIPVsEnergy->Fit("pol1","","");
  fitter = TVirtualFitter::GetFitter();
  
  c->SaveAs( "MIPVsEnergyAt6X0.gif" );
  c->SaveAs( "MIPVsEnergyAt6X0.pdf" );


}
开发者ID:CaltechPrecisionTiming,项目名称:t1065-jun-2016,代码行数:69,代码来源:makeEMShowerEnergyPlots.C


示例14: MakeAmplitudeVsBiasVoltageGraph


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TH1类代码示例发布时间:2022-05-31
下一篇:
C++ TGraphAsymmErrors类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap