star-travex
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StiScanRatiosHistContainer.cxx
Go to the documentation of this file.
2 
3 #include "TH1.h"
4 #include "TProfile2D.h"
5 #include "StiRootIO/H2D.h"
6 #include "StiRootIO/Profile2D.h"
7 
8 
9 StiScanRatiosHistContainer::StiScanRatiosHistContainer(const char* name, TDirectory* motherDir, Option_t* option) :
10  tvx::HistContainer(name, motherDir, option)
11 {
12 }
13 
14 
15 void StiScanRatiosHistContainer::CreateRatioHist(const TH1* hNumer, const TH1* hDenom)
16 {
17  this->cd();
18 
19  TH1* myRatio = static_cast<TH1*>(hNumer->Clone());
20 
21  myRatio->SetOption("");
22 
23  // Take care of a special case when the objects are of TProfile2D class
24  if ( hNumer->InheritsFrom("TProfile2D") && hDenom->InheritsFrom("TProfile2D") )
25  {
26  delete myRatio;
27  myRatio = new H2D( static_cast<const TProfile2D&>(*hNumer) );
28  myRatio->SetOption("colz whit_zro");
29  }
30 
31  myRatio->Add(hDenom, -1);
32  myRatio->Divide(hDenom);
33 
34  Add(myRatio);
35 }
StiScanRatiosHistContainer(const char *name, TDirectory *motherDir=0, Option_t *option="")
void CreateRatioHist(const TH1 *hNumer, const TH1 *hDenom)
Definition: H2D.h:8