ColdWarm.C
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 
4 #include "TFile.h"
5 #include "TH1.h"
6 
7 TH1* ColdWarm(TFile&, TFile&, std::string, bool=false, std::string="ChannelPlotsAna");
8 
9 TH1* ColdWarm(TFile& warm, TFile& cold, std::string hname, bool rescale,
11 {
12 
13 
14  TH1* hist=(TH1*)(warm.GetDirectory(dir.c_str()))->Get(hname.c_str());
15  if (!hist ) {
16  std::cout<<"Could not find warm histogram"<<std::endl;
17  return 0;
18  }
19  TH1* hwarm=(TH1*)hist->Clone(Form("%s_Warm",hname.c_str()));
20 
21  hist=(TH1*)(cold.GetDirectory(dir.c_str()))->Get(hname.c_str());
22  if (!hist ) {
23  std::cout<<"Could not find cold histogram"<<std::endl;
24  return 0;
25  }
26  TH1* hcold=(TH1*)hist->Clone(Form("%s_Cold",hname.c_str()));
27 
28  hwarm->SetLineColor(kRed);
29  hcold->SetLineColor(kBlue);
30  if (rescale) {
31  double scale=hwarm->Integral()/hcold->Integral();
32  hcold->Scale(scale);
33  }
34  hcold->Draw();
35  hwarm->Draw("sames");
36 
37  return hcold;
38 
39 }
Double_t scale
Definition: plot.C:25
TH1 * ColdWarm(TFile &, TFile &, std::string, bool=false, std::string="ChannelPlotsAna")
Definition: ColdWarm.C:9
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
TDirectory * dir
Definition: macro.C:5