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


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

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


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

示例1: R_scin_eff

void R_scin_eff(){

  TString gDir = "/w/halla-2/e08014/Rootfiles/";
  Int_t  run_number;    TString filename;

  ofstream myfile; myfile.open("R_Scin_Eff.txt");
  ifstream runfile("../../runsample.txt"); const int NUMR = 1000;
 
  TString GeneralCut = "abs(R.tr.x)<0.75 && abs(R.tr.y)<0.55 && abs(R.tr.th)<0.15 && abs(R.tr.ph)<0.045";
  TString TriggerCut1 = "((DBB.evtypebits>>1)&1)";
  TString TriggerCut2 = "((DBB.evtypebits>>2)&1)";
  TString TriggerCut6 = "((DBB.evtypebits>>6)&1)";
  
  TFile *geocut = new TFile(Form("R_Geo_Cut_%d.root",run_number), "UPDATE");
  
  TCutG* phi_y_cut = (TCutG*) gROOT->FindObject("phi_y_cut"); //looking for old cut definition
  TCutG* theta_dp_cut = (TCutG*) gROOT->FindObject("theta_dp_cut"); //looking for old cut definition
  
  if(!phi_y_cut || !theta_dp_cut){
    
    TCanvas *c1= new TCanvas("c1","c1",1000,600);
    c1->Divide(2,1); 
    TPad *bpad = gPad;

    //    runfile >> run_number;
    TString file1 = gDir + Form("e08014_less_%d.root",3590);
    TChain *T1 = new TChain("T");
    T1->Add(file1);

    cerr <<"========= Create Acceptance CutG ..."<<endl;
    c1->cd(1);
    T1->Draw("R.tr.tg_ph:R.tr.tg_y>>gc1(300,-0.05,0.05,300,-0.05,0.05)",GeneralCut,"colz");
    gc1->SetXTitle("R.tr.tg_y"); gc1->SetYTitle("R.tr.tg_ph");  c1->Update();
    phi_y_cut = (TCutG*) (bpad->WaitPrimitive("CUTG", "CutG"));c1->Update();
    phi_y_cut->SetName("phi_y_cut"); phi_y_cut->SetVarX("R.tr.tg_y"); phi_y_cut->SetVarY("R.tr.tg_ph");
    cerr <<"Phi vs Y Done!"<<endl;

    c1->cd(2);
    T1->Draw("R.tr.tg_th:R.tr.tg_dp>>gc2(300,-0.05,0.05,300,-0.15,0.15)",GeneralCut,"colz");
    gc2->SetXTitle("R.tr.tg_dp"); gc2->SetYTitle("R.tr.tg_th");  c1->Update()
    theta_dp_cut = (TCutG*) (bpad->WaitPrimitive("CUTG", "CutG"));c1->Update();
    theta_dp_cut->SetName("theta_dp_cut"); theta_dp_cut->SetVarX("R.tr.tg_dp"); theta_dp_cut->SetVarY("R.tr.tg_th");
    cerr <<"Theta vs Dp Done!"<<endl;

    geocut->cd();
    phi_y_cut->Write("", TObject::kOverwrite); // Overwrite old cut
    theta_dp_cut->Write("", TObject::kOverwrite); // Overwrite old cut

    T1->Delete();
  }
  
  TCutG* electron_cut = (TCutG*) gROOT->FindObject("electron_cut"); //looking for old cut definition
   
  if(!electron_cut ){
    
    //    runfile >> run_number;
    TString file2 = gDir + Form("e08014_less_%d.root",3590);
    TChain *T2 = new TChain("T");
    T2->Add(file2);

    TCanvas *c2= new TCanvas("c2","c2",800,800);
    //  c2->Divide(2,1); 
    TPad *cpad = gPad;

    cerr <<"========= Create Electron and Pion CutG On Calorimeter ..."<<endl;
    c2->cd(1);
    T2->Draw("R.sh.asum_c:R.ps.asum_c>>gc3(300,-100.,6000.0,300,-100.0,6000.0)",GeneralCut,"colz");c2->Update();
    electron_cut = (TCutG*) (cpad->WaitPrimitive("CUTG", "CutG"));c2->Update();
    electron_cut->SetName("electron_cut"); electron_cut->SetVarX("R.ps.asum_c"); electron_cut->SetVarY("R.sh.asum_c");
    cerr <<"Electron Done!"<<endl;

     geocut->cd();
     electron_cut->Write("", TObject::kOverwrite); // Overwrite old cut

     T2->Delete();
  }
 
   TString cut_t1 = TriggerCut1+"&&" + GeneralCut + "&&phi_y_cut && theta_dp_cut "+ "&&electron_cut";
   TString cut_t2 = TriggerCut2+"&&" + GeneralCut + "&&phi_y_cut && theta_dp_cut "+ "&&electron_cut";  
   TString cut_t6 = TriggerCut6+"&&" + GeneralCut + "&&phi_y_cut && theta_dp_cut "+ "&&electron_cut";
  
  // TString cut_t1 = TriggerCut1+"&&" + GeneralCut +  "&&electron_cut";
  // TString cut_t2 = TriggerCut2+"&&" + GeneralCut +  "&&electron_cut";
  // TString cut_t6 = TriggerCut6+"&&" + GeneralCut +  "&&electron_cut";
  
//   TString cut_t1 = TriggerCut1+"&&" + GeneralCut;
//   TString cut_t2 = TriggerCut2+"&&" + GeneralCut;
//   TString cut_t6 = TriggerCut6+"&&" + GeneralCut;

  float rnum[NUMR]; 
  float T1eff[NUMR], T6eff[NUMR];

  int jj;  float evt,evt0,evt1,evt2,evt6;
  int ps1=1,ps2=1, ps3=1,ps4=1,ps6=1,ps7=1;

  while(!(runfile.eof())){
    runfile >> run_number; rnum[jj] = run_number;
    filename = gDir + Form("e08014_less_%d.root",run_number);
    //   TChain *T = new TChain("T");
    //   T->Add(filename);
//.........这里部分代码省略.........
开发者ID:TJHague,项目名称:XGT2,代码行数:101,代码来源:R_scin_eff_old.C


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