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


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

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


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

示例1: readroot


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

  //sensor adc for each layer
  double max_sensor_x[2][8][24] = {{{0.}}};
  double max_sensor_y[2][8][24] = {{{0.}}};
  double min_sensor_x[2][8][24] = {{{0.}}};
  double min_sensor_y[2][8][24] = {{{0.}}};
  
  TH1D* hsensor_high[2][8][24];
  TH1D* hsensor_low[2][8][24];
 
  for(int iarm = 0;iarm < 2;iarm++){
    for(int ilayer = 0;ilayer < 8;ilayer++){
      for(int isen = 0;isen < 24;isen++){
        char name[100];
        sprintf(name,"hsensor_arm%d_layer%d_index%d_high",iarm,ilayer,isen);
        hsensor_high[iarm][ilayer][isen] = new TH1D(name,name,300,-40.5,259.5);
        sprintf(name,"hsensor_arm%d_layer%d_index%d_low",iarm,ilayer,isen);
        hsensor_low[iarm][ilayer][isen] = new TH1D(name,name,300,-40.5,259.5);
        max_sensor_x[iarm][ilayer][isen] = -9999;
        max_sensor_y[iarm][ilayer][isen] = -9999;
        min_sensor_x[iarm][ilayer][isen] = 9999;
        min_sensor_y[iarm][ilayer][isen] = 9999;
      }
    }
  }
  
  ifstream sensor_pos("sensor_position.txt");
  string s;
  while(getline(sensor_pos,s)){
    stringstream ss(s);
    int arm = 0;
    int layer = 0;
    int sensor = 0;
    double x0=0;
    double x1=0;
    double y0=0;
    double y1=0;
    ss>>arm>>layer>>sensor>>x0>>x1>>y0>>y1;
//    cout <<arm <<" "<<layer<<" "<<sensor<<" "<<x0<<" "<<x1<<" "<<y0<<" "<<y1<<endl;
    max_sensor_x[arm][layer][sensor] = x1;
    min_sensor_x[arm][layer][sensor] = x0;
    max_sensor_y[arm][layer][sensor] = y1;
    min_sensor_y[arm][layer][sensor] = y0;
  }
 
  MpcExMapper* mapper = MpcExMapper::instance(); 
  for(unsigned int i = 0;i < 50000;i++){
    hkey_adc_high->SetAxisRange(i,i,"X");
    hkey_adc_low->SetAxisRange(i,i,"X");
    TH1D* htemp0 = hkey_adc_high->ProjectionY();
    TH1D* htemp1 = hkey_adc_low->ProjectionY();
    if(htemp0->GetEntries() < 10) continue;
    int arm = mapper->get_arm(i);
    int quadrant = mapper->get_quadrant(i);
    int sensor = mapper->get_sensor_in_quadrant(i);
    int index = 6*quadrant+sensor;
    int layer = mapper->get_layer(i);
    hsensor_high[arm][layer][index]->Add(htemp0);
    hsensor_low[arm][layer][index]->Add(htemp1);
  }
  
  for(int iarm = 0;iarm < 2;iarm++){
    for(int ilayer = 0;ilayer < 8;ilayer++){
      char cname[100];
      sprintf(cname,"csensor_arm%d_layer%d_%d_%d",iarm,ilayer,runnumber,segment);
      TCanvas* c = new TCanvas(cname,cname,1400,800);
      for(int index = 0;index < 24;index++){
        char pname[100];
        sprintf(pname,"sensor_arm%d_layer%d_index%d",iarm,ilayer,index);
        double x0 = min_sensor_x[iarm][ilayer][index];
        double x1 = max_sensor_x[iarm][ilayer][index];
        double y0 = min_sensor_y[iarm][ilayer][index];
        double y1 = max_sensor_y[iarm][ilayer][index];
        if(ilayer%2 == 0){
          y0 = y0 - 0.85;
          y1 = y1 + 0.85;
        }
        if(ilayer%2 == 1){
          x0 = x0 - 0.85;
          x1 = x1 + 0.85;
        }
        TPad* pad = new TPad(pname,pname,0.5+x0/40.,0.5+y0/40.,0.5+x1/40.,0.5+y1/40.);
        pad->cd();
        pad->SetLogy();
	hsensor_high[iarm][ilayer][index]->Draw("");
	hsensor_low[iarm][ilayer][index]->SetLineColor(kRed);
        hsensor_low[iarm][ilayer][index]->Draw("");
        c->cd();
        pad->DrawClone("same");
        delete pad;
      }
      sprintf(cname,"%d/csensor_arm%d_layer%d_%d_%d.gif",runnumber,iarm,ilayer,runnumber,segment);
      c->Print(cname,"gif"); 
      delete c;
    }
  }
}
开发者ID:liankun,项目名称:origin,代码行数:101,代码来源:readroot.C


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