本文整理汇总了C++中TH2D::GetEffectiveEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ TH2D::GetEffectiveEntries方法的具体用法?C++ TH2D::GetEffectiveEntries怎么用?C++ TH2D::GetEffectiveEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TH2D
的用法示例。
在下文中一共展示了TH2D::GetEffectiveEntries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plotXY
void plotXY(){
gROOT->Reset();
gROOT->SetStyle("Plain");
gStyle->SetHistMinimumZero(kFALSE);
Int_t status = gSystem->Load("../rootils_C.so");
std::cout << "status: " << status << std::endl;
// TString dir("allStat_6hits/");
// TString dir("allStat_noWeiBug/");
TString dir("./");
//Agguanta gli istogrammi
TFile * SimF = new TFile(dir+"Sim_XY.root");
TH2D * SimH = (TH2D*) SimF->Get("Sim_XY");;
//
TFile * MCF = new TFile(dir+"MC_XY.root");
TH2D * MCH = (TH2D*) MCF->Get("MC_XY");;
//
// TFile * MCFsF = new TFile(dir+"rMCFs_XY.root");
// TH2D * MCFsH = (TH2D*) MCFsF->Get("rMCFs_XY");;
//
TFile * FakeF = new TFile(dir+"MCFake_XY.root");
TH2D * FakeH = (TH2D*) FakeF->Get("MCFake_XY");;
//
TFile * DataF = new TFile(dir+"Data_XY.root");
TH2D * DataH = (TH2D*) DataF->Get("Data_XY");;
//
// TFile * DataFsF = new TFile(dir+"rDataFs_XY.root");
// TH2D * DataFsH = (TH2D*) DataFsF->Get("rDataFs_XY");;
//
cout << MCH->GetEntries() << " " << MCH->GetEffectiveEntries() << " " << MCH->Integral() << endl;
cout << DataH->GetEntries() << " " << DataH->GetEffectiveEntries() << " " << DataH->Integral() << endl;
//Normalize to plot entries
SimH->Scale(1./SimH->Integral());
MCH->Scale(1./MCH->Integral());
FakeH->Scale(1./FakeH->Integral());
DataH->Scale(1./DataH->Integral());
cout << MCH->GetEntries() << " " << MCH->GetEffectiveEntries() << " " << MCH->Integral() << endl;
cout << DataH->GetEntries() << " " << DataH->GetEffectiveEntries() << " " << DataH->Integral() << endl;
//Max
Double_t simMax=SimH->GetMaximum();
Double_t simPxlMax=GetMaxWithinRadius(SimH, 15.);
Double_t simPxlInt=GetIntWithinRZ(SimH, 15., 0.);
Double_t MCMax=MCH->GetMaximum();
Double_t MCPxlMax=GetMaxWithinRadius(MCH, 15.);
Double_t MCPxlInt=GetIntWithinRZ(MCH, 15., 0.);
Double_t DataMax=DataH->GetMaximum();
Double_t DataPxlMax=GetMaxWithinRadius(DataH, 15.);
Double_t DataPxlInt=GetIntWithinRZ(DataH, 15., 0.);
Double_t mAx=max(MCMax,DataMax);
std::cout << " max >>>> mc " << MCMax << " data " << DataMax << " Sim " << simMax << std::endl;
std::cout << " pxl max >>>> mc " << MCPxlMax << " data " << DataPxlMax << " Sim " << simPxlMax << std::endl;
std::cout << " pxl int >>>> mc " << MCPxlInt << " data " << DataPxlInt << " Sim " << simPxlInt << std::endl;
// This would be need to normalize SimH to the pixel region material (taking into account that SimH and DataH/MCH have different binning!)
//
// SimH->Scale(DataPxlInt*(DataH->GetXaxis()->GetBinWidth(1)*DataH->GetYaxis()->GetBinWidth(1))/simPxlInt/(SimH->GetXaxis()->GetBinWidth(1)*SimH->GetYaxis()->GetBinWidth(1)));
// I prefer to have Sim plots and Data/MC plot to look similar by appropriately scaling the SimH range, not by scaling the histo
mAx=0.001;
// mAx=0.011;
// mAx=0.15*0.5*(MCPxlMax+DataPxlMax);
Double_t simRangeScale = 1./(DataPxlInt*(DataH->GetXaxis()->GetBinWidth(1)*DataH->GetYaxis()->GetBinWidth(1))/simPxlInt/(SimH->GetXaxis()->GetBinWidth(1)*SimH->GetYaxis()->GetBinWidth(1)));
std::cout << simRangeScale << endl;
std::cout << (DataH->GetXaxis()->GetBinWidth(1)*DataH->GetYaxis()->GetBinWidth(1)) << endl;
std::cout << (SimH->GetXaxis()->GetBinWidth(1)*SimH->GetYaxis()->GetBinWidth(1)) << endl;
SimH->SetMaximum(mAx*simRangeScale);
MCH->SetMaximum(mAx);
DataH->SetMaximum(mAx);
//
makeColorTable();
Plot2D(SimH, "#gamma conv., MC Truth", dir);
Plot2D(MCH, "#gamma conv., MC Reco #sqrt{s}=8TeV", dir);
Plot2D(DataH, "#gamma conv., Data #sqrt{s}=8TeV", dir);
//
/*
TH2D *MCCoarse = MCH->Rebin2D(2,2,"MCCoarse");
TH2D *DataCoarse = DataH->Rebin2D(2,2,"DataCoarse");
*/
/*
cout << MCCoarse->GetEntries() << " " << MCCoarse->GetEffectiveEntries() << endl;
cout << DataCoarse->GetEntries() << " " << DataCoarse->GetEffectiveEntries() << endl;
*/
//.........这里部分代码省略.........