当前位置: 首页>>代码示例>>C++>>正文


C++ TGraph::Clone方法代码示例

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


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

示例1: collectContours

void collectContours(map<string,TGraph2D *>& m_graphs,
		     const vector<string>&  keys,
		     map<string,double>& m_contourlevels,
		     map<string,TList *>& m_contours)
{
  cout << "CollectContours" << endl;

  TCanvas *canv = new TCanvas("dummy","dummy",100,100);
  //canv->Divide(3,2);

  std::cout << "keys.size() = " << keys.size() << std::endl;

  //process TGraph2Ds into contours at levels m_contourlevels
  for (size_t i=0; i<keys.size(); i++) {
    double clev = m_contourlevels[keys[i]];
    TGraph2D *gr2d = m_graphs[keys[i]];
    std::cout << "gr2d = " << gr2d << std::endl;
    std::cout << "gr2d->GetN() = " << gr2d->GetN() << std::endl;


    if (gr2d && (gr2d->GetN() > 0)) {
      gr2d->GetHistogram()->SetContour(1, &clev);
      //canv->cd(i+1);
      cout << "drawing... " << endl;

      gr2d->Draw("CONT LIST"); // it's stupid, but only "CONT" will generate the list
      gPad->Update();

      TObjArray *contours = (TObjArray *)gROOT->GetListOfSpecials()->FindObject("contours");
      assert(contours);

      TList *newlist = 0;
      for (int ci=0; ci<contours->GetEntriesFast(); ci++) {
	TList *contLevel = (TList*)contours->At(ci);
	printf("%s: Contour %d has %d Graphs\n", keys[i].c_str(), ci, contLevel->GetSize());

	if (contLevel->GetSize()) {
	  assert(contLevel->First());
	  if (!newlist) newlist = new TList();
	  TGraph *curv = (TGraph*)(contLevel->First());

	  for (int j=0; j<contLevel->GetSize(); j++) {
	    newlist->Add((TGraph *)(curv->Clone()));
	    curv=(TGraph *)(contLevel->After(curv));
	  }
	}
      } // contour loop

      cout << "Inserting contour list for "<< keys[i] << " newlist="<<newlist<<endl;
      m_contours[keys[i]] = newlist;

    } // if (gr2d)
  } // key loop

  //delete canv;
}                                                     // collectContours
开发者ID:senka,项目名称:CombinedEWKAnalysis_forMingshui,代码行数:56,代码来源:atgcplotLimit.C

示例2: GetContour

TGraph* GetContour(TGraph2D *g, TString name){
  TGraph *gnew;
  //cout << g->GetName() << " " << g->GetN() << endl;
  TH2D *temp = (TH2D*)g->GetHistogram();//need this for list to work?
  //g->Draw("alp");//need this for list to work?
  TList *glist = (TList*)g->GetContourList(1.0);
  if(glist == nullptr) return gnew;
  int max_points = -1;
  int nn = glist->GetSize();
  //cout << "number of entries in list " << nn << endl;
  for(int i = 0; i<glist->GetSize(); ++i){
    TGraph *gtemp = (TGraph*)glist->At(i);
    int Npoints = gtemp->GetN();
    if(Npoints>max_points){
      gnew = (TGraph*)gtemp->Clone(name);
      max_points = Npoints;
    }
  }
  return gnew;
}
开发者ID:haweber,项目名称:StopAnalysis,代码行数:20,代码来源:Make2DSignifHistos.C

示例3: Draw

//______________________________________________________________________________
void Draw(TFile* f, const char* gname, TLegend* l, Bool_t normalized)
{
  if (!f) return;

  TGraph* g = static_cast<TGraph*>(f->Get(gname));

  if (!g) return;

  if ( normalized )
  {
    g = static_cast<TGraph*>(g->Clone());
    for ( Int_t i = 0; i < g->GetN(); ++i )
    {
      Double_t y = g->GetY()[i];
      g->SetPoint(i,g->GetX()[i],y/NTOTALNUMBEROFPADS);
    }
  }

  g->Draw("lp");
  g->GetXaxis()->SetNdivisions(505);
  g->GetXaxis()->SetNoExponent();

  if (l) l->AddEntry(g,gname,"LP");
}
开发者ID:ktf,项目名称:AliRoot,代码行数:25,代码来源:MUONStatusMap.C

示例4: main

int main (int argc, char* argv[] )
{
	cout << endl << "Really, REALLY stupid plotter for producing comparative plots between Edinburgh fit outputs." << endl;
	cout << endl << "USAGE: merge_plot Output_1.root Output_2.root \"Title 1\" \"Title 2\" " << endl;
	gStyle->SetCanvasColor(0);
	gStyle->SetFillColor(0);
	gROOT->SetStyle("Plain");
	if( argc != 5) exit(-1);
	TCanvas* c3 = new TCanvas("throw2","throw");
	TFile* input_1 = new TFile( argv[1], "READ" );
	gDirectory->ls();
	TH2D* hist_1 = (TH2D*)gDirectory->Get("pllhist");//"Graph2D");//pllhist");//Graph2D_from_nllhist");
	TGraph2D* graph_1 = (TGraph2D*)gDirectory->Get("pllhist");//"Graph2D");//pllhist");//Graph2D_from_nllhist");
	graph_1->Draw();
	c3->Update();
	TFile* input_2 = new TFile( argv[2], "READ" );
	gDirectory->ls();
	TH2D* hist_2 = (TH2D*)gDirectory->Get("pllhist");//"fcnew");//pllhist");//lr_data");
	TGraph2D* graph_2 = (TGraph2D*)gDirectory->Get("pllhist");//"fcnew");//pllhist");//lr_data");
	graph_2->Draw();
	hist_2->Draw();
	c3->Update();

	TString Plot_Title_1( argv[3] );
	TString Plot_Title_2( argv[4] );

	TCanvas* c1 = new TCanvas("Output_Plot","Output_Plot",1680,1050);
	double pllconts[3] = {1.15,2.305,3.0};//,4.61};
	//double pll2[3] = {2.3,4.61,6};//,9.62};
	//double pll2[3] = {0.68,0.9,0.95};
	double confs[3] = {68.0,90.0,95.0};//,99.0};
	TList* contLevel = NULL;
	TGraph* curv     = NULL;
	TGraph* gc    = NULL;
	//gStyle->SetCanvasColor(0);
	//gStyle->SetPalette(1);
	//gROOT->SetStyle("Plain");
	//gROOT->ForceStyle();
//	gStyle->SetFrameBorderMode(0);
//	gStyle->SetCanvasBorderMode(0);
//	gStyle->SetPadBorderMode(0);
//	gStyle->SetPadColor(0);
//	gStyle->SetCanvasColor(0);
//	gStyle->SetStatColor(0);
//	gStyle->SetTitleFillColor(0);
//	gStyle->SetFillColor(0);
//	gStyle->SetFrameFillColor(0);
	//gStyle->SetFillStyle(0);
	//gROOT->ForceStyle();

	hist_1->SetContour(3,pllconts);
	hist_1->SetLineWidth(1);
	c1->cd();
	hist_1->Draw("cont2");
//	hist_1->GetXaxis()->SetRangeUser(-3.1,2);
	hist_1->SetContour(3,pllconts);
//	c1->cd();
	hist_1->Draw("cont2");
	//	StyleTH2D(hist_2);
//	c3->cd();
	hist_2->Draw();
//	hist_2->GetXaxis()->SetRangeUser(-3.1,2);
//	hist_2->Draw();
	hist_1->Draw("cont2");
//	hist_2->Draw("SAME");//cont2");
	hist_2->SetContour(3,pllconts);//pll2);//pllconts);//pll2);
	hist_2->SetLineColor(2);
	hist_2->SetLineWidth(1);
//	c3->cd();
	c1->Update();
//	hist_2->Draw("SAMEcont2");
//	hist_2->GetXaxis()->SetRangeUser(-3.1,1);
//	hist_2->SetContour(3,pll2);//pllconts);//pll2);
//	c1->cd();
//	hist_2->Draw("SAMEcont2");
//	c1->Update();

	TCanvas* c2 = new TCanvas( "Throw","Throw" );
	hist_1->Draw("CONT LIST");
	c2->Update();

	//addLHCbLabel("NLL Scan")->Draw();
	TObjArray *contObjArr = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
	int TotalConts = contObjArr->GetSize();
	c1->cd();
	TLegend *leg = new TLegend(0.65,0.7,1.1,0.9);
	leg->SetHeader( Plot_Title_1 );
	leg->SetBorderSize(0);
	leg->SetFillStyle(0);
	for(int i = 0; i < TotalConts; i++){
		TString confname = "";
		double cl = confs[i];
		confname +=cl;
		confname += "% C.L.";
		contLevel = (TList*)contObjArr->At(i);
		for(int j =0; j<contLevel->GetSize(); j++){
			curv = (TGraph*)contLevel->At(j);
			gc = (TGraph*)curv->Clone();
			if( i!=3 ) gc->SetLineColor(Color_t(i+2));
			else gc->SetLineColor(Color_t(i+3));
//.........这里部分代码省略.........
开发者ID:kgizdov,项目名称:RapidFit,代码行数:101,代码来源:merge_plot.C

示例5: plotMSSM


//.........这里部分代码省略.........

  //return;
  // Get Contours
   TObjArray *conts = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
   TList* contLevel = NULL;
   TGraph* curv     = NULL;
   TGraph* gc       = NULL;

   Int_t nGraphs    = 0;
   Int_t TotalConts = 0;

   if (conts == NULL){
      printf("*** No Contours Were Extracted!\n");
      TotalConts = 0;
      return;
   } else {
      TotalConts = conts->GetSize();
   }

   printf("TotalConts = %d\n", TotalConts);

   for(i = 0; i < TotalConts; i++){
      contLevel = (TList*)conts->At(i);
      printf("Contour %d has %d Graphs\n", i, contLevel->GetSize());
      nGraphs += contLevel->GetSize();
   }

   nGraphs = 0;

   TH2F *hr = new TH2F("hr", ";m_{A};tan#beta", 2, 225, 600, 2, 0.1, 100);

   hr->GetXaxis()->SetTitleOffset(1.1);
   hr->GetXaxis()->SetRangeUser(200,650);
   hr->GetYaxis()->SetTitleOffset(1.2);
   hr->GetYaxis()->SetNdivisions(110,kFALSE);
   hr->GetXaxis()->SetNdivisions(20205,kFALSE);
   hr->Draw();
   Double_t x0, y0, z0;
   TLatex l;
   l.SetTextSize(0.03);
   l.SetTextAlign(32);
   char val[20];

   for(i = 0; i < TotalConts; i++){
      contLevel = (TList*)conts->At(i);
      z0 = level[i];
      printf("Z-Level Passed in as:  Z = %f\n", z0);

      // Get first graph from list on curves on this level
      curv = (TGraph*)contLevel->First();
      for(j = 0; j < contLevel->GetSize(); j++){
        // last point
         //curv->GetPoint(curv->GetN()-1, x0, y0);
        // first point
         curv->GetPoint(2, x0, y0);

         // if (z0<0) curv->SetLineColor(kRed);
         // if (z0>0) curv->SetLineColor(kBlue);
         nGraphs ++;
         printf("\tGraph: %d  -- %d Elements\n", nGraphs,curv->GetN());

	 // Draw clones of the graphs to avoid deletions in case the 1st
	 // pad is redrawn.
         gc = (TGraph*)curv->Clone();
         gc->Draw("C");

         if (z0>=.01) sprintf(val,"%0.2f",z0);
         if (z0>=.1) sprintf(val,"%0.2f",z0);
         if (z0>=1) sprintf(val,"%0.0f",z0);
         l.DrawLatex(x0*0.99,y0,val);
         curv = (TGraph*)contLevel->After(curv); // Get Next graph
      }
   }
   gPad->SetLogy();
   gPad->SetGridx();
   gPad->SetGridy();
   gPad->SetRightMargin(0.05);
   gPad->SetTopMargin(0.10);
   c2->Update();
   printf("\n\n\tExtracted %d Contours and %d Graphs \n", TotalConts, nGraphs );



  tl.SetTextAlign(31);
  tl.DrawLatex(0.8,0.85,goodName);

  tl.SetTextAlign(31);
  tl.DrawLatex(0.8,0.77,goodType);


  pCan(c2,cname+"_BW");

   c1->cd(1);
   gPad->SetLogy();
   gPad->SetLogz();
   c1->cd(2);
   gPad->SetLogy();
   c1->Update();
  pCan(c1,cname);
}
开发者ID:lacaprara,项目名称:usercode,代码行数:101,代码来源:plotMSSM.C

示例6: alicePlots

void alicePlots(){
    
    TFile* alice = new TFile("~/Downloads/HEPData-ins1288320-v1-root.root");
    alice->cd("Table 16");
    TGraph* aliceData = Graph1D_y1;
    TH1F* hist = Hist1D_y1;
    TH1F* stat = Hist1D_y1_e1;
    TH1F* syst = Hist1D_y1_e2;
    TGraphAsymmErrors* graph2 = (TGraphAsymmErrors*)aliceData->Clone("graph2");

    Int_t numPts = aliceData->GetN();
    Double_t x, y;
    for(int i = 0; i<numPts; i++){
        aliceData->GetPoint(i, x, y);
        aliceData->SetPoint(i, x, (y - 0.89581));
        graph2->SetPoint(i, x, (y- 0.89581));
        hist->SetBinContent(i+1, hist->GetBinContent(i+1) - 0.89581);
        hist->SetBinError(i+1, stat->GetBinContent(i+1));
        graph2->SetPointEXhigh(i, 0.1);
        graph2->SetPointEXlow(i, 0.1);
    }

    graph2->SetLineColor(kBlue-10);
    graph2->SetLineWidth(2);
    graph2->SetMarkerColor(kBlue-10);
    graph2->SetFillColor(kBlue-10);
    hist->SetLineColor(kBlue-2);
    hist->SetLineWidth(2);

    aliceData->SetTitle("");
    aliceData->GetYaxis()->SetTitle("Mass - Vacuum Mass (GeV/c^{2})");
    aliceData->GetYaxis()->SetTitleSize(0.06);
    aliceData->GetYaxis()->SetLabelSize(0.04);
    aliceData->GetYaxis()->SetTitleOffset(1.65);
    aliceData->GetYaxis()->SetTitleFont(42);
    aliceData->GetYaxis()->SetLabelFont(42);
    aliceData->GetXaxis()->SetTitle("p_{T} (GeV/c)");
    aliceData->GetXaxis()->SetTitleSize(0.06);
    aliceData->GetXaxis()->SetLabelSize(0.05);
    aliceData->GetXaxis()->SetTitleFont(42);
    aliceData->GetXaxis()->SetLabelFont(42);
    aliceData->SetMarkerStyle(29);
    aliceData->SetMarkerSize(2.5);
    aliceData->SetMarkerColor(kBlue-2);
    aliceData->SetLineColor(kBlue-2);

    aliceData->GetYaxis()->SetRangeUser(-0.02, 0.015);
    aliceData->GetXaxis()->SetRangeUser(0, 5);

    TFile* phsd = new TFile("~/utaustin/resonancefits/finalplotting/20170721_KKbarAdded2_fixedwidth42_recon_pf100_scaled_error05.root");
    TH1D* mass = phsd->Get("kstar0mass");
    mass->SetName("mass");
    mass->SetMarkerStyle(26);
    mass->SetMarkerSize(2.5);
    mass->SetMarkerColor(2);
    mass->SetLineColor(2);

    TF1* line = new TF1("line", "[0]", 0.0, 5.0);
    line->SetParameter(0, 0.0);
    line->SetLineColor(1);
    line->SetLineStyle(7);
    line->SetLineWidth(3);

    for(int j = 0; j<mass->GetNbinsX(); j++){
        mass->SetBinContent(j+1, (mass->GetBinContent(j+1) - 0.892));
    }


    TFile* phsd2 = new TFile("~/utaustin/resonancefits/finalplotting/20170616_KKbarAdded2_fixedwidth_recon_pf100_scaled_error05.root");
    TH1D* mass2 = phsd2->Get("kstar0mass");
    mass2->SetName("mass2");
    mass2->SetMarkerStyle(22);
    mass2->SetMarkerSize(2.5);
    mass2->SetMarkerColor(2);
    mass2->SetLineColor(2);
    for(int j = 0; j<mass2->GetNbinsX(); j++){
        mass2->SetBinContent(j+1, (mass2->GetBinContent(j+1) - 0.892));
    }



    TExec *exec1 = new TExec("exec1", "gStyle->SetErrorX(0.1)");
    TExec *exec2 = new TExec("exec2", "gStyle->SetErrorX(0.5)");
    
    TCanvas *c = new TCanvas ("c", "c", 50, 50, 650, 600);
    c->cd()->SetMargin(0.1997, 0.0369, 0.1396, 0.0681);
    aliceData->Draw("APX");
    //exec1->Draw();
    graph2->Draw("SAME P2");
    //exec2->Draw();
    hist->Draw("SAME E1");
    line->Draw("SAME");
    mass2->Draw("SAME P E1");
    mass->Draw("SAME P E1");
    aliceData->Draw("SAME PX");
    

    TLegend* legend = new TLegend(0.5836, 0.1815, 0.9489, 0.3438);
    legend->SetMargin(0.2);
    legend->SetTextSizePixels(20);
//.........这里部分代码省略.........
开发者ID:gyronaut,项目名称:utaustin,代码行数:101,代码来源:alicePlots.C

示例7: z


//.........这里部分代码省略.........
   TH2D *HistStreamFn = new TH2D("HstreamFn",
   "#splitline{Histogram with negative and positive contents. Six contours are defined.}{It is plotted with options CONT LIST to retrieve the contours points in TGraphs}",
   nZsamples, z[0], z[nZsamples-1], nPhiSamples, phi[0], phi[nPhiSamples-1]);

   // Load Histogram Data
   for (Int_t i = 0; i < nZsamples; i++) {
      for(Int_t j = 0; j < nPhiSamples; j++){
         HistStreamFn->SetBinContent(i,j, HofZ[i]*FofPhi[j]);
      }
   }

   gStyle->SetPalette(1);
   gStyle->SetOptStat(0);
   gStyle->SetTitleW(0.99);
   gStyle->SetTitleH(0.08);

   Double_t contours[6];
   contours[0] = -0.7;
   contours[1] = -0.5;
   contours[2] = -0.1;
   contours[3] =  0.1;
   contours[4] =  0.4;
   contours[5] =  0.8;

   HistStreamFn->SetContour(6, contours);

   // Draw contours as filled regions, and Save points
   HistStreamFn->Draw("CONT Z LIST");
   c->Update(); // Needed to force the plotting and retrieve the contours in TGraphs

   // Get Contours
   TObjArray *conts = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
   TList* contLevel = NULL;
   TGraph* curv     = NULL;
   TGraph* gc       = NULL;

   Int_t nGraphs    = 0;
   Int_t TotalConts = 0;

   if (conts == NULL){
      printf("*** No Contours Were Extracted!\n");
      TotalConts = 0;
      return;
   } else {
      TotalConts = conts->GetSize();
   }

   printf("TotalConts = %d\n", TotalConts);

   for(i = 0; i < TotalConts; i++){
      contLevel = (TList*)conts->At(i);
      printf("Contour %d has %d Graphs\n", i, contLevel->GetSize());
      nGraphs += contLevel->GetSize();
   }

   nGraphs = 0;

   TCanvas* c1 = new TCanvas("c1","Contour List",610,0,600,600);
   c1->SetTopMargin(0.15);
   TH2F *hr = new TH2F("hr",
   "#splitline{Negative contours are returned first (highest to lowest). Positive contours are returned from}{lowest to highest. On this plot Negative contours are drawn in red and positive contours in blue.}",
   2, -2, 2, 2, 0, 6.5);

   hr->Draw();
   Double_t x0, y0, z0;
   TLatex l;
   l.SetTextSize(0.03);
   char val[20];

   for(i = 0; i < TotalConts; i++){
      contLevel = (TList*)conts->At(i);
      if (i<3) z0 = contours[2-i];
      else     z0 = contours[i];
      printf("Z-Level Passed in as:  Z = %f\n", z0);

      // Get first graph from list on curves on this level
      curv = (TGraph*)contLevel->First();
      for(j = 0; j < contLevel->GetSize(); j++){
         curv->GetPoint(0, x0, y0);
         if (z0<0) curv->SetLineColor(kRed);
         if (z0>0) curv->SetLineColor(kBlue);
         nGraphs ++;
         printf("\tGraph: %d  -- %d Elements\n", nGraphs,curv->GetN());

	 // Draw clones of the graphs to avoid deletions in case the 1st
	 // pad is redrawn.
         gc = (TGraph*)curv->Clone();
         gc->Draw("C");

         sprintf(val,"%g",z0);
         l.DrawLatex(x0,y0,val);
         curv = (TGraph*)contLevel->After(curv); // Get Next graph
      }
   }
   c1->Update();
   printf("\n\n\tExtracted %d Contours and %d Graphs \n", TotalConts, nGraphs );
   gStyle->SetTitleW(0.);
   gStyle->SetTitleH(0.);
   return c1;
}
开发者ID:My-Source,项目名称:root,代码行数:101,代码来源:contours.C

示例8: RemoveDiagonal


//.........这里部分代码省略.........
  TH2F* nhExpOrgPass   = (TH2F*)RemoveHistoDiagonal(hExpOrgPass);
  TH2F* nhObsOrgPass   = (TH2F*)RemoveHistoDiagonal(hObsOrgPass);
  TH2F* nhObs1mOrgPass = (TH2F*)RemoveHistoDiagonal(hObs1mOrgPass);
  TH2F* nhObs1pOrgPass = (TH2F*)RemoveHistoDiagonal(hObs1pOrgPass);
  TH2F* nhExp1mOrgPass = (TH2F*)RemoveHistoDiagonal(hExp1mOrgPass);
  TH2F* nhExp2mOrgPass = (TH2F*)RemoveHistoDiagonal(hExp2mOrgPass);
  TH2F* nhExp1pOrgPass = (TH2F*)RemoveHistoDiagonal(hExp1pOrgPass);
  TH2F* nhExp2pOrgPass = (TH2F*)RemoveHistoDiagonal(hExp2pOrgPass);
  TH2F* nhExp   = (TH2F*)RemoveHistoDiagonal(hExp);
  TH2F* nhObs   = (TH2F*)RemoveHistoDiagonal(hObs);
  TH2F* nhObs1m = (TH2F*)RemoveHistoDiagonal(hObs1m);
  TH2F* nhObs1p = (TH2F*)RemoveHistoDiagonal(hObs1p);
  TH2F* nhExp1m = (TH2F*)RemoveHistoDiagonal(hExp1m);
  TH2F* nhExp2m = (TH2F*)RemoveHistoDiagonal(hExp2m);
  TH2F* nhExp1p = (TH2F*)RemoveHistoDiagonal(hExp1p);
  TH2F* nhExp2p = (TH2F*)RemoveHistoDiagonal(hExp2p);
  TH2F* nhExpXsec   = (TH2F*)RemoveHistoDiagonal(hExpXsec);
  TH2F* nhObsXsec   = (TH2F*)RemoveHistoDiagonal(hObsXsec);
  TH2F* nhObs1mXsec = (TH2F*)RemoveHistoDiagonal(hObs1mXsec);
  TH2F* nhObs1pXsec = (TH2F*)RemoveHistoDiagonal(hObs1pXsec);
  TH2F* nhExp1mXsec = (TH2F*)RemoveHistoDiagonal(hExp1mXsec);
  TH2F* nhExp2mXsec = (TH2F*)RemoveHistoDiagonal(hExp2mXsec);
  TH2F* nhExp1pXsec = (TH2F*)RemoveHistoDiagonal(hExp1pXsec);
  TH2F* nhExp2pXsec = (TH2F*)RemoveHistoDiagonal(hExp2pXsec);
  TH2F* nhExpPass   = (TH2F*)RemoveHistoDiagonal(hExpPass);
  TH2F* nhObsPass   = (TH2F*)RemoveHistoDiagonal(hObsPass);
  TH2F* nhObs1mPass = (TH2F*)RemoveHistoDiagonal(hObs1mPass);
  TH2F* nhObs1pPass = (TH2F*)RemoveHistoDiagonal(hObs1pPass);
  TH2F* nhExp1mPass = (TH2F*)RemoveHistoDiagonal(hExp1mPass);
  TH2F* nhExp2mPass = (TH2F*)RemoveHistoDiagonal(hExp2mPass);
  TH2F* nhExp1pPass = (TH2F*)RemoveHistoDiagonal(hExp1pPass);
  TH2F* nhExp2pPass = (TH2F*)RemoveHistoDiagonal(hExp2pPass);

  TGraph2D *ng2Exp   = (TGraph2D*)g2Exp->Clone("Graph2D_from_hExpOrg");
  TGraph2D *ng2Obs   = (TGraph2D*)g2Obs->Clone("Graph2D_from_hObsOrg");
  TGraph2D *ng2Obs1m = (TGraph2D*)g2Obs1m->Clone("Graph2D_from_hObs1mOrg");
  TGraph2D *ng2Obs1p = (TGraph2D*)g2Obs1p->Clone("Graph2D_from_hObs1pOrg");
  TGraph2D *ng2Exp1m = (TGraph2D*)g2Exp1m->Clone("Graph2D_from_hExp1mOrg");
  TGraph2D *ng2Exp2m = (TGraph2D*)g2Exp2m->Clone("Graph2D_from_hExp2mOrg");
  TGraph2D *ng2Exp1p = (TGraph2D*)g2Exp1p->Clone("Graph2D_from_hExp1pOrg");
  TGraph2D *ng2Exp2p = (TGraph2D*)g2Exp2p->Clone("Graph2D_from_hExp2pOrg");
  TGraph *ngExp   = (TGraph*)gExp->Clone("gExp");
  TGraph *ngObs   = (TGraph*)gObs->Clone("gObs");
  TGraph *ngObs1m = (TGraph*)gObs1m->Clone("gObs1m");
  TGraph *ngObs1p = (TGraph*)gObs1p->Clone("gObs1p");
  TGraph *ngExp1m = (TGraph*)gExp1m->Clone("gExp1m");
  TGraph *ngExp2m = (TGraph*)gExp2m->Clone("gExp2m");
  TGraph *ngExp1p = (TGraph*)gExp1p->Clone("gExp1p");
  TGraph *ngExp2p = (TGraph*)gExp2p->Clone("gExp2p");
  TGraph *ngEmpty= (TGraph*)gExp2p->Clone("gEmpty");

  fout->cd();
  nhExpOrg   ->Write();
  nhObsOrg   ->Write();
  nhObs1mOrg ->Write();
  nhObs1pOrg ->Write();
  nhExp1mOrg ->Write();
  nhExp2mOrg ->Write();
  nhExp1pOrg ->Write();
  nhExp2pOrg ->Write();
  nhExpOrgXsec   ->Write();
  nhObsOrgXsec   ->Write();
  nhObs1mOrgXsec ->Write();
  nhObs1pOrgXsec ->Write();
  nhExp1mOrgXsec ->Write();
  nhExp2mOrgXsec ->Write();
开发者ID:mialiu149,项目名称:AnalysisLoopers2015,代码行数:67,代码来源:RemoveDiagonal_dontuse.C

示例9: Polarization

void Polarization(){

    TGraph *gObs;
    TGraph *gExp;
    TGraph *gObsL;
    TGraph *gExpL;
    TGraph *gObsR;
    TGraph *gExpR;
    
    TFile *fc = TFile::Open("Limits2DHistograms_T2tt_postfit.root");
    TFile *fl = TFile::Open("Limits2DHistograms_T2tt_lefthanded_postfit.root");
    TFile *fr = TFile::Open("Limits2DHistograms_T2tt_righthanded_postfit.root");
    
    TGraph *g;
    fc->cd();
    g = (TGraph*)fc->Get("gObs");
    gObs = (TGraph*)g->Clone("Obs");
    g = (TGraph*)fc->Get("gExp");
    gExp = (TGraph*)g->Clone("Exp");
    fl->cd();
    g = (TGraph*)fl->Get("gObs_2");
    gObsL = (TGraph*)g->Clone("ObsL");
    g = (TGraph*)fl->Get("gExp_2");
    gExpL = (TGraph*)g->Clone("ExpL");
    fr->cd();
    g = (TGraph*)fr->Get("gObs");
    gObsR = (TGraph*)g->Clone("ObsR");
    g = (TGraph*)fr->Get("gExp");
    gExpR = (TGraph*)g->Clone("ExpR");
    
    gObs->SetLineWidth(4);
    gExp->SetLineWidth(4);
    gObsL->SetLineWidth(2);
    gExpL->SetLineWidth(2);
    gObsR->SetLineWidth(2);
    gExpR->SetLineWidth(2);
    gObs->SetLineStyle(1);
    gExp->SetLineStyle(7);
    gObsL->SetLineStyle(1);
    gExpL->SetLineStyle(7);
    gObsR->SetLineStyle(1);
    gExpR->SetLineStyle(7);
    gObs->SetLineColor(kBlack);
    gExp->SetLineColor(kBlack);
    gObsL->SetLineColor(kBlue);
    gExpL->SetLineColor(kBlue);
    gObsR->SetLineColor(kRed);
    gExpR->SetLineColor(kRed);
    if(killlowdiag){
    for( int i = gObs->GetN()-1; i>=0;--i){
        double x,y;
        gObs->GetPoint(i,x,y);
        if(x-y<172.5) gObs->RemovePoint(i);
    }
    for( int i = gExp->GetN()-1; i>=0;--i){
        double x,y;
        gExp->GetPoint(i,x,y);
        if(x-y<172.5) gExp->RemovePoint(i);
    }
    }
    for( int i = gObsL->GetN()-1; i>=0;--i){
        double x,y;
        gObsL->GetPoint(i,x,y);
        if(x-y<172.5) gObsL->RemovePoint(i);
    }
    for( int i = gObsR->GetN()-1; i>=0;--i){
        double x,y;
        gObsR->GetPoint(i,x,y);
        if(x-y<172.5) gObsR->RemovePoint(i);
    }
    for( int i = gExpL->GetN()-1; i>=0;--i){
        double x,y;
        gExpL->GetPoint(i,x,y);
        if(x-y<172.5) gExpL->RemovePoint(i);
    }
    for( int i = gExpR->GetN()-1; i>=0;--i){
        double x,y;
        gExpR->GetPoint(i,x,y);
        if(x-y<172.5) gExpR->RemovePoint(i);
    }

    
   TCanvas *c1 = new TCanvas("c1", "c1",50,50,600,600);
   gStyle->SetOptFit(1);
   gStyle->SetOptStat(0);
   gStyle->SetOptTitle(0);
   gStyle->SetErrorX(0.5); 
   //c1->Range(-6.311689,-1.891383,28.75325,4.56342);
   c1->SetFillColor(0);
   c1->SetBorderMode(0);
   c1->SetBorderSize(2);
   //c1->SetLogy();
   c1->SetTickx(1);
   c1->SetTicky(1);
   c1->SetLeftMargin(0.15);
   c1->SetRightMargin(0.05);
   c1->SetTopMargin(0.07);
   c1->SetBottomMargin(0.15);
   c1->SetFrameFillStyle(0);
   c1->SetFrameBorderMode(0);
//.........这里部分代码省略.........
开发者ID:haweber,项目名称:OneLepStop,代码行数:101,代码来源:Polarization.C


注:本文中的TGraph::Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。