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


C++ TPad::GetPrimitive方法代码示例

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


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

示例1: getHistograms

/**
 * Helper function to extract the histograms from the canvas file. <br>
 * Takes references to pointers in order to fill them.
 */
void getHistograms(const TString canvasName, TH1F * & histo1, TH1D * & histo2, const TString & resonance)
{
  std::cout << "canvasName = " << canvasName << std::endl;
  TFile * inputFile = new TFile("plotMassOutput.root");
  TCanvas * canvas = (TCanvas*)inputFile->Get(canvasName);
  TString resonanceNum("_1");
  if( resonance == "Upsilon3S" ) resonanceNum = "_2";
  if( resonance == "Upsilon2S" ) resonanceNum = "_3";
  if( resonance == "Upsilon" ) resonanceNum = "_4";
  if( resonance == "Psi2S" ) resonanceNum = "_5";
  if( resonance == "JPsi" ) resonanceNum = "_6";

  if( resonance == "Psis" ) resonanceNum = "_1";
  if( resonance == "Upsilons" ) resonanceNum = "_2";
  if( resonance == "LowPtResonances" ) resonanceNum = "_3";
  if( resonance == "AllResonances" ) resonanceNum = "_4";

  TPad * pad = (TPad*)canvas->GetPrimitive(canvasName+resonanceNum);
  histo1 = (TH1F*)pad->GetPrimitive("hRecBestResAllEvents_Mass");
  if( resonance == "Z" || resonance == "AllResonances" ) histo2 = (TH1D*)pad->GetPrimitive("Mass_PProf");
  else histo2 = (TH1D*)pad->GetPrimitive("Mass_fine_PProf");
  // if( resonance == "Z" || resonance == "AllResonances" ) histo2 = (TH1D*)pad->GetPrimitive("Mass_Probability");
  // else histo2 = (TH1D*)pad->GetPrimitive("Mass_fine_Probability");

  // cout << "histo1 = " << histo1 << ", histo2 = " << histo2 << endl;
  // cout << "histo1 = " << histo1->GetEntries() << ", histo2 = " << histo2->GetEntries() << endl;
}
开发者ID:tuos,项目名称:cmssw,代码行数:31,代码来源:ShowMassComparison.C

示例2: GetData

//----------  Retrieve data histo  -----------------
TH1F* GetData(TFile* fin, string region, string varname)
{
    string cname = CHANNEL_NAME+string("/")+region+"/"+varname;
    TCanvas* c = (TCanvas*) fin->Get(cname.c_str());
    TList* l = c->GetListOfPrimitives();
    TPad* pad = (TPad*) l->At(0);
    string hname = "v:"+varname+"|r:"+region+string("|c:")+CHANNEL_NAME+string("|t:1DSumData");
    TH1F* h = (TH1F*) pad->GetPrimitive(hname.c_str());
    return (TH1F*) h->Clone();
}
开发者ID:oneLeptonStopAt13TeV,项目名称:StopAF,代码行数:11,代码来源:MTTailCorrectionClosureTests.C

示例3: GetHisto

TH1F* GetHisto(TFile* fin, string region, string process, string varname, float& norm, bool do_norm, float input_norm)
{
    string cname = CHANNEL_NAME+string("/")+region+"/"+varname;
    TCanvas* c = (TCanvas*) fin->Get(cname.c_str());
    string hname = "v:"+varname+"|p:"+process+"|r:"+region+string("|c:")+CHANNEL_NAME+string("|t:1DEntries");
    TH1F* h = 0;
    if(VERBOSE>0){
 	 cerr<<"cname :"<<cname<<endl;
   	 cerr<<"histo name: "<<hname<<endl;
   	 cerr<<"pointer: "<<c<<endl;
    } 
    TList* l = c->GetListOfPrimitives();
    TPad* pad = (TPad*) l->At(0);
    THStack* stack = (THStack*) pad->GetPrimitive("");
    h = (TH1F*) stack->GetHists()->FindObject(hname.c_str());
    if(do_norm) h->Scale(input_norm/h->Integral());
    norm = h->Integral();
    return (TH1F*) h->Clone();
}
开发者ID:oneLeptonStopAt13TeV,项目名称:StopAF,代码行数:19,代码来源:MTTailCorrectionClosureTests.C


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