本文整理汇总了C++中TNtuple::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ TNtuple::Delete方法的具体用法?C++ TNtuple::Delete怎么用?C++ TNtuple::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TNtuple
的用法示例。
在下文中一共展示了TNtuple::Delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
PHI_MIN = (Double_t) std::stod(argv[2]);
PHI_MAX = (Double_t) std::stod(argv[3]);
N_PHI = (Int_t) std::stoi(argv[4]);
if(argc >= 6) Metal = argv[5];
dataSL = dataLoc.Length();
if(dataLoc(dataSL-1, 1) != "/"){
dataLoc = dataLoc + "/";
}
std::cout << "The following settings are being used" << std::endl;
std::cout << "Data Directory = " << dataLoc << std::endl;
std::cout << PHI_MIN << " < PHI < " << PHI_MAX << ", N_PHI = " << N_PHI << std::endl;
if(argc == 6) std::cout << "Running only for Metal "<< Metal << std::endl;
else std::cout << "Running all Metals" << std::endl;
Float_t Q2, Xb, Zh, Pt, Phi, Val, Err;
Float_t A, Ac, Acc;
Float_t AErr, AcErr, AccErr;
Float_t ChiSQ;
Int_t nentries, empty;
if(Metal == "") N_METAL = 6;
else N_METAL = 1;
for(Int_t met = 0; met < N_METAL; met++){
if(Metal == ""){
if(met == 0) Metal = "C";
else if(met == 1) Metal = "Fe";
else if(met == 2) Metal = "Pb";
else if(met == 3) Metal = "D_C";
else if(met == 4) Metal = "D_Fe";
else if(met == 5) Metal = "D_Pb";
}
if(dataLoc == "")
f = new TFile("../Gen5DimData/" + Metal + "_5_dim_dist.root", "READ");
else
f = new TFile(dataLoc + Metal + "_5_dim_dist.root", "READ");
ntuple = (TNtuple*) f->Get("fit_data");
nentries = ntuple->GetEntries();
ntuple->SetBranchAddress("Xb", &Xb);
ntuple->SetBranchAddress("Q2", &Q2);
ntuple->SetBranchAddress("Xb", &Xb);
ntuple->SetBranchAddress("Zh", &Zh);
ntuple->SetBranchAddress("Pt", &Pt);
ntuple->SetBranchAddress("Phi", &Phi);
ntuple->SetBranchAddress("Val", &Val);
ntuple->SetBranchAddress("Err", &Err);
newntuple = new TNtuple("AAcAcc_data", "AAcAcc_data", "Q2:Xb:Zh:Pt:A:AErr:Ac:AcErr:Acc:AccErr:ChiSQ");
func = new TF1("fit", "[0]+TMath::Cos(x*TMath::Pi()/180)*[1]+TMath::Cos(2*x*TMath::Pi()/180)*[2]");
newf = new TFile(Metal + "newphihist.root", "RECREATE");
newf->cd();
for(Int_t i = 0; i < nentries; i = i + N_PHI){
ntuple->GetEntry(i);
h1 = new TH1F((const char*) Form("PhiDist Q2=%.3f Xb=%.3f Zh=%.3f Pt=%.3f", Q2, Xb, Zh, Pt),
(const char*) Form("PhiDist Q2=%.3f Xb=%.3f Zh=%.3f Pt=%.3f", Q2, Xb, Zh, Pt), N_PHI, PHI_MIN, PHI_MAX);
empty = 0;
for(Int_t j = 1; j <= N_PHI; j++){
ntuple->GetEntry(i+j-1);
h1->SetBinContent(j, Val);
if(h1->GetBinContent(j) == 0)
empty++;
h1->SetBinError(j, Err*1.04);
}
if(empty <= (N_PHI - MIN_BIN)){
h1->Fit(func, "q");
h1->Write();
if(func->GetNDF() != 0){
ChiSQ = func->GetChisquare();
A = func->GetParameter(0);
AErr = func->GetParError(0);
Ac = func->GetParameter(1);
AcErr = func->GetParError(1);
Acc = func->GetParameter(2);
AccErr = func->GetParError(2);
newntuple->Fill(Q2, Xb, Zh, Pt, A, AErr, Ac, AcErr, Acc, AccErr, ChiSQ);
}
}
h1->Delete();
}
Metal = "";
delete ntuple;
newf->cd();
newntuple->Write();
newntuple->Delete();
newf->Close();
delete newf;
f->Close();
delete f;
}
return 0;
}