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


C++ TTree::SetLineColor方法代码示例

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


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

示例1: evtTime

void evtTime()
{
   TFile *inf = new TFile("output.root");
   TTree *data = (TTree*)inf->FindObjectAny("data");
   data->Draw("evtTime","");
   data->SetLineColor(2);
   data->Draw("evtTime","min[0]<-10&&min[1]<-10&&min[2]<-10&&min[3]<-10&&min[4]<-10&&min[5]<-10&&min[6]<-10&&min[7]<-10","same");
   cout <<data->GetEntries("min[0]<-10&&min[1]<-10&&min[2]<-10&&min[3]<-10&&min[4]<-10&&min[5]<-10&&min[6]<-10&&min[7]<-10")<<" / "<<data->GetEntries()<<endl;
}
开发者ID:yenjie,项目名称:usercode,代码行数:9,代码来源:evtTime.C

示例2: P_vs_r

void P_vs_r(void)
{
	gROOT->Reset();
	
	TFile *f = new TFile("hd_root.root");
	TTree *geant = (TTree*)gROOT->FindObject("geant");
	TTree *dana = (TTree*)gROOT->FindObject("dana");

	TCanvas *c1 = new TCanvas("c1");
	c1->SetTicks();
	c1->SetGrid();

	geant->SetMarkerStyle(6);
	geant->SetMarkerSize(0.1);

	geant->Draw("P:sqrt(x*x+y*y)", "P>0.95");
	dana->Draw("P:sqrt(x*x+y*y)", "", "same");
	
	TLatex *lab = new TLatex(400.0, 1.005, "single 1GeV/c proton #theta=5^{o} #phi=180^{o}");
	lab->SetTextSize(0.03);
	lab->Draw();
	
	geant->SetLineColor(geant->GetMarkerColor());
	dana->SetLineColor(dana->GetMarkerColor());
	geant->SetLineWidth(4.0);
	dana->SetLineWidth(4.0);
	
	TLegend *leg = new TLegend(0.5, 0.5, 0.7, 0.7);
	leg->SetFillColor(kWhite);
	leg->AddEntry(geant, "GEANT");
	leg->AddEntry(dana, "DANA");
	leg->Draw();

	c1->SaveAs("P_vs_r.pdf");
	c1->SaveAs("P_vs_r.gif");
}
开发者ID:JeffersonLab,项目名称:sim-recon,代码行数:36,代码来源:P_vs_r.C

示例3: pulseConvert

void pulseConvert(const char* ifname)
{
   TFile* ifile = TFile::Open(ifname);
   if (!ifile) {
      cout<< "File not found: " << ifname <<endl;
      return;
   }
   TTree* itree = (TTree*) ifile->Get("pulse");
   if (!itree) {
      cout<< "Error: could not find tree \"pulse\"" <<endl;
      return;
   }

   Int_t event, tc1, tc2;
   Float_t b1_t[1024], b1_c[4096], b2_t[1024], b2_c[4096];

   Float_t* b1_c1 = b1_c;
   Float_t* b1_c2 = b1_c + 1024;
   Float_t* b1_c3 = b1_c + 2048;
   Float_t* b1_c4 = b1_c + 3072;
   Float_t* b2_c1 = b2_c;
   Float_t* b2_c2 = b2_c + 1024;
   Float_t* b2_c3 = b2_c + 2048;
   Float_t* b2_c4 = b2_c + 3072;

   itree->SetBranchAddress("event", &event);
   itree->SetBranchAddress("tc1", &tc1);
   itree->SetBranchAddress("tc2", &tc2);
   itree->SetBranchAddress("b1_t", &b1_t);
   itree->SetBranchAddress("b2_t", &b2_t);
   itree->SetBranchAddress("b1_c", &b1_c);
   itree->SetBranchAddress("b2_c", &b2_c);

   TFile* ofile = TFile::Open(Form("%s.pulse.root",ifname), "recreate");

   // TTree* otree = new TTree("pulse", "old pulse tree");
   TTree* otree = new TTree("p", "new pulse tree");
   otree->SetMarkerStyle(6);
   otree->SetMarkerColor(2);
   otree->SetLineColor(2);

   // otree->Branch("event", &event, "event/I");
   // otree->Branch("tc1", &tc1, "tc1/I");
   // otree->Branch("b1_t",  b1_t, "b1_t[1024]/F");
   // otree->Branch("b1_c1", b1_c1, "b1_c1[1024]/F");
   // otree->Branch("b1_c2", b1_c2, "b1_c2[1024]/F");
   // otree->Branch("b1_c3", b1_c3, "b1_c3[1024]/F");
   // otree->Branch("b1_c4", b1_c4, "b1_c4[1024]/F");
   // otree->Branch("tc2", &tc2, "tc2/I");
   // otree->Branch("b2_t",  b2_t, "b2_t[1024]/F");
   // otree->Branch("b2_c1", b2_c1, "b2_c1[1024]/F");
   // otree->Branch("b2_c2", b2_c2, "b2_c2[1024]/F");
   // otree->Branch("b2_c3", b2_c3, "b2_c3[1024]/F");
   // otree->Branch("b2_c4", b2_c4, "b2_c4[1024]/F");

   otree->Branch("event", &event, "event/I");
   otree->Branch("tc1", &tc1, "tc1/I");
   otree->Branch("t1",  b1_t, "t1[1024]/F");
   otree->Branch("c1", b1_c1, "c1[1024]/F");
   otree->Branch("c2", b1_c2, "c2[1024]/F");
   otree->Branch("c3", b1_c3, "c3[1024]/F");
   otree->Branch("c4", b1_c4, "c4[1024]/F");
   otree->Branch("tc2", &tc2, "tc2/I");
   otree->Branch("t2",  b2_t, "t2[1024]/F");
   otree->Branch("c5", b2_c1, "c5[1024]/F");
   otree->Branch("c6", b2_c2, "c6[1024]/F");
   otree->Branch("c7", b2_c3, "c7[1024]/F");
   otree->Branch("c8", b2_c4, "c8[1024]/F");

   for (Long64_t jentry=0; jentry<itree->GetEntries(); jentry++)
   {
      if (jentry % 1000 == 0) cout<< "jentry = " << jentry <<endl;
      itree->LoadTree(jentry);
      itree->GetEntry(jentry);

      otree->Fill();
   }

   cout<< "Write " << otree->GetEntries() << " events into file " << ofile->GetName() <<endl;
   ofile->Write();
}
开发者ID:CaltechPrecisionTiming,项目名称:DRS4DAQ,代码行数:81,代码来源:ConvertBoard2Root.C


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