source: huonglan/ANA2011/SubtractTHF.C

Last change on this file was 6, checked in by huonglan, 13 years ago

first full version of 2011 analysis

File size: 481 bytes
Line 
1void SubtractTHF()
2{
3  TFile *file1 = TFile::Open("res.root");
4 
5  TH1F *h1 = (TH1F*)file1->Get("mjjBest");
6  TH1F *h2 = (TH1F*)file1->Get("mjjBest4leadingjets");
7
8  TH1F *h = new TH1F("h", "", 100, 30, 130);
9
10  int nentries = h1->GetNbinsX();
11
12  cout << "nentries = " << nentries << endl;
13
14  for (int i = 0; i < nentries; i++){
15    int en1 = h1->GetBinContent(i);
16    int en2 = h2->GetBinContent(i);
17
18    int en = en1 - en2;
19   
20    h->SetBinContent(i,en);
21  }
22
23  h->Draw();
24
25}
Note: See TracBrowser for help on using the repository browser.