C   83

trim c

Guest on 26th June 2022 03:55:39 AM

  1. void trim() {
  2.   gROOT->SetStyle("Plain");
  3.  
  4.   TCanvas *c1;
  5.   c1=new TCanvas("c1","Canvas",600,600);
  6.  
  7.   const unsigned ne(16);
  8.   double e[ne]={  3.9, 10.5, 16.6, 23.3, 33.8, 41.4, 47.7, 55.8,
  9.                  63.9, 72.2, 80.2, 90.0,105.3,117.7,129.7,145.2};
  10.  
  11.   TF1 *func=new TF1("func","sqrt([0]*[0]+[1]*[1]*x*x)",0.0,2.0);
  12.   func->SetParameters(0.01,0.2);
  13.  
  14.   TGraph *tg;
  15.   tg=new TGraph(ne);
  16.   tg->SetTitle(";Trim value;Pedestal (DTU)");
  17.  
  18.   for(int j(0);j<(int)ne;j++) {
  19.     tg->SetPoint(j,j,e[j]);
  20.   }
  21.    
  22.   tg->SetMarkerStyle(20);
  23.   tg->SetMarkerSize(1.5);
  24.   tg->SetMarkerColor(2);
  25.   tg->SetLineColor(2);
  26.    
  27.   tg->Fit("pol2");
  28.   tg->GetFunction("pol2")->SetLineColor(2);
  29.    
  30.   //tg->GetYaxis()->SetRangeUser(0,15);
  31.   tg->GetXaxis()->SetRangeUser(0,15);
  32.   tg->GetYaxis()->SetTitleOffset(1.3);
  33.    
  34.   tg->Draw("AP");
  35.    
  36.   c1->Update();
  37.   c1->Print("../trim.png");
  38. }

Raw Paste


Login or Register to edit or fork this paste. It's free.