Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <TH1I.h>
  2. void CompareTwoRuns( int s=0, int run1=4648, int run2=3430 ) {
  3. char thi[80];
  4. const int ipOrder[14]={8,9,10,11, 13,12,0,7, 4,1,3,5,6,2};
  5. if( s%2 == 0) sprintf( thi, "ClustX1_%d", ipOrder[s/2]);
  6. else sprintf( thi, "ClustY1_%d", ipOrder[s/2]);
  7.  
  8. TCanvas *c = new TCanvas("c","canvas",10,10,2200,900);
  9. gPad->SetRightMargin(0.001);
  10. gPad->SetLeftMargin(0.04);
  11. gPad->SetTopMargin(0.01);
  12. gPad->SetBottomMargin(0.04);
  13. gPad->SetGridx();
  14.  
  15. double Sum[2];
  16. TFile *hFile= new TFile(Form("bmn_run%d_sidigitthr2all.root", run1));
  17. TH1I *h= (TH1I*)hFile->Get(thi);
  18. h->Draw(); Sum[0]=h->Integral();
  19.  
  20. hFile= new TFile(Form("bmn_run%d_sigemdigitthr2src.root", run2));
  21. //sprintf( thi, "ClustY1_%d", ipOrder[24/2]);
  22. h= (TH1I*)hFile->Get(thi);
  23. h->SetLineColor(2);
  24. Sum[1]=h->Integral();
  25. TH1D *hd= (TH1D*) h->Clone();
  26. hd->Reset();
  27. for( int i=1; i<=h->GetNbinsX(); i++) { double y= h->GetBinContent(i); hd->SetBinContent(i,y*Sum[0]/Sum[1]);}
  28. //hd->Scale(Sum[0]/Sum[1]);
  29. hd->SetMarkerStyle(20); hd->SetMarkerColor(2);
  30. hd->Draw("same");
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement