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


C++ TCanvas::DrawClonePad方法代码示例

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


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

示例1: assert

void
dumpToPDF(string inName, string fitName){
  TFile *fin = TFile::Open(inName.c_str(), "read"); assert(fin);


  string outName = inName;
  outName.replace(outName.find(".root"), 5, ".pdf");

  //fitName = "HLT_10LS_delivered_vs_rate_Run190949-191090.root";
  TFile *fFit = TFile::Open(fitName.c_str(), "read"); assert(fFit);

  TCanvas c1;
  c1.Print(Form("%s[", outName.c_str()), "pdf"); //Open .pdf

  //get list of keys
  int nplots = fin->GetNkeys(); 
  int nfits = fFit->GetNkeys(); 
  printf("nplots: %i, nfits: %i\n", nplots, nfits);
  if(nplots != nfits){
    cout<<" PDF output will be wrong since different number of triggers in fit and current run"<<endl;
    abort();
  }
  TList* plots = fin->GetListOfKeys();  
  TList* fits  = fFit->GetListOfKeys();
  for(int i=0; i<nplots; ++i){
    TKey* plot = (TKey*) plots->At(i);
    TKey* fit = (TKey*) fits->At(i);//assume they're in the same order for now

    if(!fin->GetKey(plot->GetName())){
      cout<<"Didn't find "<<plot<<". Removing."<<endl;
      abort();
    }
    if(!fFit->GetKey(fit->GetName())){
      cout<<"Didn't find "<<fit<<". Removing."<<endl;
      abort();
    }
    TCanvas* c = new TCanvas();
    c->Divide(1,2);

    TCanvas* cPlot = (TCanvas*) fin->Get(plot->GetName());
    c->cd(1);
    cPlot->DrawClonePad();

    TCanvas* cFit  = (TCanvas*) fFit->Get(fit->GetName());
    c->cd(2);
    cFit->DrawClonePad();

    string bookmarkName = "Title: ";
    bookmarkName += plot->GetName();

    c->Print(outName.c_str(), bookmarkName.c_str());
  }

  c1.Print(Form("%s]", outName.c_str()), "pdf"); //Close .pdf

}
开发者ID:drankincms,项目名称:RateMon,代码行数:56,代码来源:dumpToPDF.C

示例2: delay25macro

void delay25macro(const int run) {

TFile * f = new TFile(Form("DATA/Run_%i/delay25.root",run));
TCanvas * c = new TCanvas("c","Delay25",1);
TCanvas * g = new TCanvas("g","Empty",1);

c->Divide(3,2);
c->Print(Form("DATA/Run_%i/delay25.ps[",run));

//Go into BPix dir
TDirectory *first_dir = BPix;
first_dir->cd();


//Go into the quadrant dir (BmI, BmO, BpI, BpO)
TList* list = first_dir->GetListOfKeys();
for (int i = 0; i < list->GetSize(); i++) 
{
	TKey *key = dynamic_cast<TKey*>(list->At(i));
	TObject* obj = key->ReadObj();
	if (obj->InheritsFrom("TDirectory")) 
	{
		TDirectory *curr_dir = dynamic_cast<TDirectory*>(obj);
		curr_dir->cd();

		//Go into sector dir
		TList* list1 = curr_dir->GetListOfKeys();
		for (int j = 0; j < list1->GetSize(); j++) 
		{
			TKey *key1 = dynamic_cast<TKey*>(list1->At(j));
			TObject* obj1 = key1->ReadObj();
			if(obj1->InheritsFrom("TDirectory"))
			{
				TDirectory *curr_dir1 = dynamic_cast<TDirectory*>(obj1);
				curr_dir1->cd();

				//Go into portcard dir
				TList* list2 = curr_dir1->GetListOfKeys();
				for (int k = 0; k < list2->GetSize(); k++) 
				{
					TKey *key2 = dynamic_cast<TKey*>(list2->At(k));
					TObject* obj2 = key2->ReadObj();
					if (obj2->InheritsFrom("TDirectory"))
					{
						TDirectory * curr_dir2 = dynamic_cast<TDirectory*>(obj2);
						curr_dir2->cd();
						
						
						//Get canvases
						int pad, counter = 0;
						TList* list3 = curr_dir2->GetListOfKeys();

						for (int k = 0; k < list3->GetSize(); k++) 
						{
							TKey *key3 = dynamic_cast<TKey*>(list3->At(k));
							TObject* obj3 = key3->ReadObj();
							g = (TCanvas *)obj3;
							if (k < 6)
							{
								//cout << "k = " << k << endl;
								pad = k+1;
								//cout << "Drawing to pad " << pad << endl;
							}
							if (k >=6 && k<12)
							{
								//cout << "k = " << k << endl;
								pad = k-5;
								//cout << "Drawing to pad " << pad << endl;
							}
							c->cd(pad);
							g->DrawClonePad();
							if (k == 5 || k == 11) 
							{
								c->Print(Form("DATA/Run_%i/delay25.ps",run));
								if (k == 5)
								{
									c->Clear();
									c->Divide(3,2);
								}
							}
						}
					}
				}
			}
		}
	}
}

c->Print(Form("DATA/Run_%i/delay25.ps]",run));

}
开发者ID:MengyaoShi,项目名称:POSOverlay,代码行数:91,代码来源:delay25macro.C


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