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


C++ TNtuple::SetAlias方法代码示例

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


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

示例1: Example2

void Example2(){
    gROOT->Reset();
    gROOT->Clear();
    gROOT->SetStyle("Plain");

    gStyle->SetTextSize(0.01908148);
    gStyle->SetTitleFontSize(0.07);
    gStyle->SetOptTitle(1);
    gStyle->SetOptStat(1110);
    gStyle->SetOptFit(1111);
    gStyle->SetTitleXOffset(1.1);
    gStyle->SetTitleYOffset(1.55);
    gStyle->SetPadTopMargin(0.15);
    gStyle->SetPadBottomMargin(0.15);
    gStyle->SetPadLeftMargin(0.15);

    // select the one of the versus : Hf energy, Centrality, # Charged , # Tracks
    int Vselect = 1;

    // number of Trigger you will use , 
    const int Ntr = 2; 
    //if you want to use more than two trigger please specify the Ntr2 for dividivg the canvas
    const int Ntr2 = 1;
    TFile* inf = new TFile("openhlt2.root");

    string triggers[6] = {"L1Tech_BSC_minBias_threshold1.v0","L1Tech_BSC_minBias_threshold2.v0","L1_SingleJet30","L1_TripleJet30","L1_QuadJet15","L1_DoubleJet70"};
    string vers[4] = {"hiHF","hiBin","Ncharged","hiNtracks"};

    double bins [4] = {170,40,240,140};
    double limits[4] = {170000,40,24000,1400};

    TCanvas* c1 = new TCanvas("c1","c1",800,400);
    c1->Divide(Ntr,Ntr2);

    TNtuple* nt = (TNtuple*)inf->Get("HltTree");

    TProfile* p1[Ntr];

    for(unsigned int i =0; i<Ntr ; i++){
        c1->cd(i+1);

        p1[i] = new TProfile("p1",Form(";%s;%s",vers[Vselect].data(),triggers[i].data()),bins[1],0,limits[1]);
        nt->SetAlias("trigger",triggers[i].data());

        nt->SetAlias("versus",vers[Vselect].data());
        nt->Draw("trigger:versus>>p1","","prof");

    }

    c1->Print(Form("%s_vsCent.gif",triggers[Vselect].data()));

}
开发者ID:kurtejung,项目名称:PurdueForest,代码行数:52,代码来源:Example2.C

示例2: PFcorr

void PFcorr(bool isMC=false) {
  
  gStyle->SetOptStat(0);
  gStyle->SetTitleOffset(1.8,"Y");

  TString filename = "../test/pftuple";
  if(isMC) filename += "MC";
  filename += ".root";

  TFile *f = new TFile(filename.Data());
  TNtuple *nt = (TNtuple*) f->Get("pfCandidateAnalyzer/nt");
  
  TCanvas *c1 = new TCanvas("c1","c1",800,800);
  c1->Divide(2,2);

  TString hadron = "tkptmax>10";
  //hadron += " && type==1";
  nt->SetAlias("trksel","(algo<=7 && nhits>=5 && relpterr<=0.05 && abs(nd0)<3 && abs(ndz)<3)");
  TString seltrk = " && trksel";
  TString fakehadron = hadron + " && fake";

  Float_t axisrange=500.;
  if(!isMC) axisrange=350.;

  c1->cd(1);
  nt->Draw(Form("tkptsum:eetsum+hetsum>>h1(50,0,%f,50,0,%f)",axisrange,axisrange),hadron.Data(),"goff");
  h1->SetTitle("PF candidate with p_{T}>10 GeV/c track element; PF calo cluster E_{T} sum (ECAL+HCAL); Track p_{T} sum");
  h1->Draw("colz");
  if(isMC) {
    nt->Draw(Form("tkptsum:eetsum+hetsum>>h1f(50,0,%f,50,0,%f)",axisrange,axisrange),fakehadron.Data(),"goff");
    TH2F* h1 = h1;
    h1f->Divide(h1); h1f->Scale(100.);
    h1f->Draw("boxsame");
  }
  gPad->SetLogz();

  c1->cd(2);
  nt->Draw(Form("tkptsum:eetsum+hetsum>>h2(50,0,%f,50,0,%f)",axisrange,axisrange),(hadron+seltrk).Data(),"goff");
  h2->SetTitle("PF candidate with p_{T}>10 GeV/c track element; PF calo cluster E_{T} sum (ECAL+HCAL); SELECTED Track p_{T} sum");
  h2->Draw("colz");
  if(isMC) {
    nt->Draw(Form("tkptsum:eetsum+hetsum>>h2f(50,0,%f,50,0,%f)",axisrange,axisrange),(fakehadron+seltrk).Data(),"goff");
    h2f->Draw("boxsame");
  }
  gPad->SetLogz();

  c1->cd(3);
  nt->Draw(Form("tkptmax:eetsum+hetsum>>h3(50,0,%f,50,0,%f)",axisrange,axisrange),hadron.Data(),"goff");
  h3->SetTitle("PF candidate with p_{T}>10 GeV/c track element; PF calo cluster E_{T} sum (ECAL+HCAL); Track with MAX p_{T}");
  h3->Draw("colz");
  if(isMC) {
    nt->Draw(Form("tkptmax:eetsum+hetsum>>h3f(50,0,%f,50,0,%f)",axisrange,axisrange),fakehadron.Data(),"goff");
    h3f->Draw("boxsame");
  }
  gPad->SetLogz();

  c1->cd(4);
  nt->Draw(Form("tkptmax:eetsum+hetsum>>h4(50,0,%f,50,0,%f)",axisrange,axisrange),(hadron+seltrk).Data(),"goff");
  h4->SetTitle("PF candidate with p_{T}>10 GeV/c track element; PF calo cluster E_{T} sum (ECAL+HCAL); SELECTED Track with MAX p_{T}");
  h4->Draw("colz");
  if(isMC) {
    nt->Draw(Form("tkptmax:eetsum+hetsum>>h4f(50,0,%f,50,0,%f)",axisrange,axisrange),(fakehadron+seltrk).Data(),"goff");
    h4f->Draw("boxsame");
  }
  gPad->SetLogz();

}
开发者ID:CmsHI,项目名称:CVS_edwenger,代码行数:67,代码来源:PFcorr.C


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