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


C++ TProfile::SetName方法代码示例

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


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

示例1: getPlot

TProfile* getPlot(TProfile *h1, char *var, TCut cut, char *filename, char* treeName)
{
  TFile *inf = new TFile(filename);
  TTree *t = (TTree*)inf->FindObjectAny(treeName);
  TProfile * tmp = (TProfile*)h1->Clone();
  tmp->SetName("tmp");
  t->Draw(Form("%s>>tmp",var),cut);  
  return tmp;
}
开发者ID:ramankhurana,项目名称:usercode,代码行数:9,代码来源:plotPhotonType.C

示例2: plotQApid

void plotQApid(Int_t ic,Float_t pt,Int_t addbin){
  char name[100];
  char stringa[200];
  LoadLib();

  snprintf(name,100,"AnalysisResults.root");
  if(!fo) fo = new TFile(name);
  snprintf(name,100,"contVZEROv2");
  TList *cont = (TList *) fo->Get(name);
  AliFlowVZEROResults *pidqa = cont->FindObject("qaPID");
  Float_t xval[2] = {2.,pt+0.00001};
  Float_t xval2[2] = {2.+addbin,pt+0.00001};

  TProfile *proTPCpi = pidqa->GetV2(0,xval,xval2);
  TProfile *proTOFpi = pidqa->GetV2(1,xval,xval2);
  TProfile *proTPCka = pidqa->GetV2(2,xval,xval2);
  TProfile *proTOFka = pidqa->GetV2(3,xval,xval2);
  TProfile *proTPCpr = pidqa->GetV2(4,xval,xval2);
  TProfile *proTOFpr = pidqa->GetV2(5,xval,xval2);

  proTPCpi->SetName("hPiTPC");
  proTOFpi->SetName("hPiTOF");
  proTPCka->SetName("hKaTPC");
  proTOFka->SetName("hKaTOF");
  proTPCpr->SetName("hPrTPC");
  proTOFpr->SetName("hPrTOF");
  
  proTPCpi->GetXaxis()->SetTitle("dE/dx - dE/dx_{calc}^{#pi} (a.u)");
  proTOFpi->GetXaxis()->SetTitle("t_{tof} - t_{calc}^{#pi} (ps)");
  proTPCka->GetXaxis()->SetTitle("dE/dx - dE/dx_{calc}^{K} (a.u)");
  proTOFka->GetXaxis()->SetTitle("t_{tof} - t_{calc}^{K} (ps)");
  proTPCpr->GetXaxis()->SetTitle("dE/dx - dE/dx_{calc}^{p} (a.u)");
  proTOFpr->GetXaxis()->SetTitle("t_{tof} - t_{calc}^{p} (ps)");

  TCanvas *c = new TCanvas("cVproj","cVproj");
  c->Divide(2,3);
  c->cd(1);
  proTPCpi->Draw();
  c->cd(2);
  proTOFpi->Draw();
  c->cd(3);
  proTPCka->Draw();
  c->cd(4);
  proTOFka->Draw();
  c->cd(5);
  proTPCpr->Draw();
  c->cd(6);
  proTOFpr->Draw();
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:49,代码来源:extractFlowVZERO.C

示例3: TCanvas


//.........这里部分代码省略.........
  eres2 = sqrt(1./eres2);
  eres3 = sqrt(1./eres3);

  AliFlowVZEROResults *a = (AliFlowVZEROResults *) cont->At(0);
  AliFlowVZEROResults *b = (AliFlowVZEROResults *) cont->At(1);
  TProfile *pp,*pp2;
  if(kNUAcorr){ // with NUA corrections
    pp = a->GetV2reweight(spec,xMin,xMax,3,NUAcorrA);
    pp2 = b->GetV2reweight(spec,xMin,xMax,3,NUAcorrC);
  }
  else{
    pp = a->GetV2(spec,xMin,xMax);
    pp2 = b->GetV2(spec,xMin,xMax);
  }
  
  Float_t scaling = sqrt(res1*res3/res2);
  if(kVZEROrescorr){
    pp->Scale(1./scaling);
  }

  Float_t err1_2 = eres1*eres1/res1/res1/4 +
    eres2*eres2/res2/res2/4 +
    eres3*eres3/res3/res3/4;
  Float_t err2_2 = err1_2;
  err1_2 /= scaling*scaling;
  printf("resolution V0A = %f +/- %f\n",scaling,err1_2);
  scaling = sqrt(res2*res3/res1);
  err2_2 /= scaling*scaling;
  if(kVZEROrescorr){
    pp2->Scale(1./scaling);
  }
  printf("resolution V0C =%f +/- %f\n",scaling,err2_2);

  pp->SetName("V0A");
  pp2->SetName("V0C");

  if(! kCleanMemory){
    new TCanvas();  
    pp->Draw();
    pp2->Draw("SAME");
  }

  TProfile *pData = new TProfile(*pp);
  pData->Add(pp2);
  snprintf(stringa,100,"%sData",nameSp);
  pData->SetName(stringa);

  TProfile *pMc = NULL;
  
  TProfile *ppMC;
  TProfile *ppMC2;
  
  if(isMC){
    snprintf(name,100,"contVZEROmc");
    cont = (TList *) fo->Get(name);
    cont->ls();
    if(arm == 2){
      AliFlowVZEROResults *c = (AliFlowVZEROResults *) cont->At(0);
      if(! kCleanMemory) c->GetV2(spec,xMin,xMax)->Draw("SAME");
    }
    AliFlowVZEROResults *cA;
    if(fo->Get("contVZEROv2")) cA = (AliFlowVZEROResults *) cont->At(1+2*(arm==3));
    else cA = (AliFlowVZEROResults *) cont->At(0);
    AliFlowVZEROResults *cC;
    if(fo->Get("contVZEROv2")) cC = (AliFlowVZEROResults *) cont->At(2+2*(arm==3));
    else cC = (AliFlowVZEROResults *) cont->At(1);
开发者ID:ktf,项目名称:AliPhysics,代码行数:67,代码来源:extractFlowVZERO.C

示例4: main


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

    AliGenPythiaEventHeader *pHeadPy = (AliGenPythiaEventHeader*)pHeader->GenEventHeader();

    if (!pHeadPy) continue;
    hPtHat->Fill(pHeadPy->GetPtHard());
//=============================================================================

    for (Int_t i=0; i<pStack->GetNtrack(); i++) if (pStack->IsPhysicalPrimary(i)) {
      TParticle *pTrk = pStack->Particle(i); if (!pTrk) continue;
      if (TMath::Abs(pTrk->Eta())>dCutEtaMax) { pTrk = 0; continue; }
//    TParticlePDG *pPDG = pTrk->GetPDG(); if (!pPDG) { pTrk = 0; continue; }

      fjInput.push_back(fastjet::PseudoJet(pTrk->Px(), pTrk->Py(), pTrk->Pz(), pTrk->P()));

//    pPDG = 0;
      pTrk = 0;
    }
//=============================================================================

    fastjet::ClusterSequenceArea clustSeq(fjInput, jetsDef, areaDef);
    std::vector<fastjet::PseudoJet> includJets = clustSeq.inclusive_jets(dJetsPtMin);
//  std::vector<fastjet::PseudoJet> subtedJets = bkgSubtractor(includJets);
    std::vector<fastjet::PseudoJet> selectJets = selectJet(includJets);
//  std::vector<fastjet::PseudoJet> sortedJets = fastjet::sorted_by_pt(selectJets);

    for (int j=0; j<selectJets.size(); j++) {
      double dJet = selectJets[j].pt();

      hJet->Fill(dJet);
//=============================================================================

      fastjet::Filter trimmer(subjDef, fastjet::SelectorPtFractionMin(0.));
      fastjet::PseudoJet trimmdJet = trimmer(selectJets[j]);
      std::vector<fastjet::PseudoJet> trimmdSj = trimmdJet.pieces();

      double nIsj = 0.;
      double d1sj = -1.; int k1sj = -1;
      double d2sj = -1.; int k2sj = -1;
      for (int i=0; i<trimmdSj.size(); i++) {
        double dIsj = trimmdSj[i].pt(); if (dIsj<0.001) continue;

        hJetIsj->Fill(dJet, dIsj);
        hJetIsz->Fill(dJet, dIsj/dJet);

        if (dIsj>d1sj) {
          d2sj = d1sj; k2sj = k1sj;
          d1sj = dIsj; k1sj = i;
        } else if (dIsj>d2sj) {
          d2sj = dIsj; k2sj = i;
        } nIsj += 1.;
      }

      hJetNsj->Fill(dJet, nIsj);
      if (d1sj>0.) { hJet1sj->Fill(dJet, d1sj); hJet1sz->Fill(dJet, d1sj/dJet); }
      if (d2sj>0.) { hJet2sj->Fill(dJet, d2sj); hJet2sz->Fill(dJet, d2sj/dJet); }

      if ((d1sj>0.) && (d2sj>0.)) {
        double dsj = d1sj - d2sj;
        double dsz = dsj / dJet;

        hJetDsj->Fill(dJet, dsj);
        hJetDsz->Fill(dJet, dsz);
      }
    }
//=============================================================================

    pStack  = 0;
    pHeadPy = 0;
    pHeader = 0;
  }
//=============================================================================

  rl->UnloadgAlice();
  rl->UnloadHeader();
  rl->UnloadKinematics();
  rl->RemoveEventFolder();
//=============================================================================

  TFile *file = TFile::Open(Form("%s/pyxsec_hists.root",sPath.Data()), "READ");
  TList *lXsc = (TList*)file->Get("cFilterList");
  file->Close();

  TH1D     *hWeightSum = (TH1D*)lXsc->FindObject("h1Trials");   hWeightSum->SetName("hWeightSum");
  TProfile *hSigmaGen  = (TProfile*)lXsc->FindObject("h1Xsec"); hSigmaGen->SetName("hSigmaGen");
//=============================================================================

  file = TFile::Open(Form("%s.root",sFile.Data()), "NEW");
  hPtHat->Write();
  hWeightSum->Write();
  hSigmaGen->Write();
  list->Write();
  file->Close();
//=============================================================================

  cout << "DONE" << endl;
//=============================================================================

  return 0;
}
开发者ID:xcheung,项目名称:AnaSubjetsMC,代码行数:101,代码来源:AnaSjeQpy_sAntikT.C

示例5: plotPhotonType

void plotPhotonType(char* var="(ecalRecHitSumEtConeDR04+hcalTowerSumEtConeDR04):genCalIsoDR04")
{
  
  TCut allCut = simpleCut + hardScatterCut;
   
  TProfile *hTemplate;
  TProfile *htmp= new TProfile("htmp","",100,0,20);
  htmp->SetXTitle("genCalIso [GeV]");
  htmp->SetYTitle("recCalIso [GeV]");

  hTemplate= getPlot(htmp,var,allCut,"MPA_PhotonJetPt15_31X.root","Analysis");
  hTemplate->SetName("hTemplate");
  hTemplate->Draw();
  gStyle->SetOptFit(11111);
  hTemplate->Fit("pol1","","");
  TF1* f1 = hTemplate->GetFunction("pol1");

  float p0 = f1->GetParameter(0);
  float p1 = f1->GetParameter(1);

  char tempName[1000];
  sprintf(tempName,
 	  "((ecalRecHitSumEtConeDR04+hcalTowerSumEtConeDR04)-genCalIsoDR04*%f):((ecalRecHitSumEtConeDR04+hcalTowerSumEtConeDR04)-genCalIsoDR04*(%f))",p1,-1.0/p1);
  cout << tempName << endl;

  TProfile *hTemplate_decompos;
  const int nbin=50;
  const float min = 0.0;
  const float max = 10.0;
  TProfile *htmp2= new TProfile("htmp2","",nbin,min,max);
  hTemplate_decompos= getPlot(htmp2,tempName,allCut,"MPA_PhotonJetPt15_31X.root","Analysis");
  hTemplate_decompos->SetName("hTemplate_decompos");
  hTemplate_decompos->Draw();  
  hTemplate_decompos->SetYTitle(Form("recCalIso-genCalIso*%.2f",p1));
  hTemplate_decompos->SetXTitle(Form("recCalIso+genCalIso*%.2f",1.0/p1));
  gStyle->SetOptFit(11111);
//   hTemplate_decompos->Fit("pol1");
  
  
  TCanvas* c1 = new TCanvas("c1","",500,1000);
  c1->Divide(1,2);
  c1->cd(1);
  hTemplate->Draw("");
  c1->cd(2);
  hTemplate_decompos->SetErrorOption("S");
  hTemplate_decompos->Draw("");
  c1->Print("bestGenCalIsoDR04.eps");
  c1->Print("bestGenCalIsoDR04.gif");
 
  TCanvas* c2 = new TCanvas("c2","",500,1000);
  c2->Divide(1,2);
  c2->cd(1);
  TH1F* hMean = new TH1F("hMean","",nbin,min,max);
  hMean->SetXTitle(Form("recCalIso+genCalIso*%.2f",1.0/p1));
  hMean->SetTitleSize(0.06,"Y");
  hMean->SetTitleOffset(1.2,"Y");
  hMean->SetYTitle(Form("Mean of recCalIso-genCalIso*%.2f",p1));
  for(int i=1; i <= nbin; i++)
    hMean->SetBinContent(i,hTemplate_decompos->GetBinContent(i));
  hMean->Draw();
  c2->cd(2);
  TH1F* hRMS = new TH1F("hRMS","",nbin,min,max);
  hRMS->SetXTitle(Form("recCalIso+genCalIso*%.2f",1.0/p1));
  hRMS->SetTitleSize(0.06,"Y");
  hRMS->SetTitleOffset(1.2,"Y");
  hRMS->SetYTitle(Form("RMS of recCalIso-genCalIso*%.2f",p1));
  for(int i=1; i <= nbin; i++)
    hRMS->SetBinContent(i,hTemplate_decompos->GetBinError(i));
  hRMS->Draw();
  c2->Print("bestGenCalIsoDR04_sup.eps");
  c2->Print("bestGenCalIsoDR04_sup.gif");


  int bestDeComposXBin = 11;
  
  float bestDeComposX = hMean->GetBinCenter(bestDeComposXBin);
  float bestDeComposY = hMean->GetBinContent(bestDeComposXBin);

  cout << "bestDeComposX = " << bestDeComposX << endl;
  cout << "bestDeComposY = " << bestDeComposY << endl;
  float bestGenIso = (bestDeComposX - bestDeComposY)/((1.0)/p1 + p1);
  float bestRecIso =  bestDeComposX - (1.0/p1) * bestGenIso;

  cout << "bestGenIso = " << bestGenIso << endl;
  cout << "bestRecIso = " << bestRecIso << endl;


}
开发者ID:ramankhurana,项目名称:usercode,代码行数:88,代码来源:plotPhotonType.C

示例6: drawFracs


//.........这里部分代码省略.........
      h2->GetXaxis()->SetMoreLogLabels();
      h2->GetXaxis()->SetNoExponent();
      h2->GetXaxis()->SetRangeUser(37,3832);
    }
    h2->SetMaximum(_vspu ? +6+10-1e-5 : +4-1e-5 +6);
    h2->SetMinimum(_vspu ? -6+1e-5 : -4+1e-5 -6);

    //lumi_13TeV = "2.1 fb^{-1}";
    lumi_13TeV = plot_title.c_str();
    TCanvas *c1 = tdrDiCanvas("c1",h,h2,4,0);

    c1->cd(1);
    TLegend *leg = tdrLeg(0.20,0.23-0.05,0.50,0.53-0.05);

    for (int jfrac = 0; jfrac != nfrac; ++jfrac) {

      string sf = fracs[jfrac];
      const char *cf = fracs[jfrac].c_str();
      const char *ctp = stp.c_str();

      string spu = (_vspu ? "_vsnpv" : "");
      const char *cpu = spu.c_str();
      string spudt = (_vspu ? (all_MC ? "mc/" : "jt40/") : "");
      const char *cpudt = spudt.c_str();
      string spumc = (_vspu ? (all_DT ? "jt40/" : "mc/") : "");
      const char *cpumc = spumc.c_str();

      assert(ddt->cd(Form("Eta_%1.1f-%1.1f",y1,y2)));
      const char *hname1 = Form("%sp%s%s%s",cpudt,cf,ctp,cpu);
      TProfile *pdt = (TProfile*)gDirectory->Get(hname1);
      if (!pdt) cout << hname1 << " not found in "
                     << gDirectory->GetName() << endl << flush;
      assert(pdt);
      pdt->SetName(Form("%s_dt",pdt->GetName()));

      assert(dmc->cd(Form("Eta_%1.1f-%1.1f",y1,y2)));
      const char *hname2 = Form("%sp%s%s%s",cpumc,cf,ctp,cpu);
      TProfile *pmc = (TProfile*)gDirectory->Get(hname2);
      if (!pmc) cout << hname2 << " not found in "
                     << gDirectory->GetName() << endl << flush;
      assert(pmc);
      pmc->SetName(Form("%s_mc",pmc->GetName()));

      // Rebin histogram
      TH1D *href = new TH1D("href","", nx, &x[0]);
      //TH1D *hmc = (_vspu ? pmc->ProjectionX() : tools::Rebin(pmc, href));
      //TH1D *hdt = (_vspu ? pdt->ProjectionX() : tools::Rebin(pdt, href));
      TH1D *hmc = tools::Rebin(pmc, href);
      TH1D *hdt = tools::Rebin(pdt, href);

      // Scale data by response to MC-equivalent energy fractions
      if (_shiftJES) {
        for (int i = 1; i != hdt->GetNbinsX()+1; ++i) {

          //double jec = 1.02;
          double jec = jesShift(hdt->GetBinCenter(i));
          hdt->SetBinContent(i, hdt->GetBinContent(i)/jec);
        } // for i
      } // _shiftJES
      
      // For cef, add muf
      if (sf=="cef") {
        assert(ddt->cd(Form("Eta_%1.1f-%1.1f",y1,y2)));
        TProfile *pdt2 = (TProfile*)gDirectory->Get(Form("%spmuf%s%s",
                                                         cpudt,ctp,cpu));
        assert(pdt2);
开发者ID:miquork,项目名称:jetphys,代码行数:67,代码来源:drawFracs.C


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