本文整理汇总了C++中TFile::GetObjectChecked方法的典型用法代码示例。如果您正苦于以下问题:C++ TFile::GetObjectChecked方法的具体用法?C++ TFile::GetObjectChecked怎么用?C++ TFile::GetObjectChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFile
的用法示例。
在下文中一共展示了TFile::GetObjectChecked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_ntuple_from_file
void read_ntuple_from_file(){
int i,j,k,n;
TFile *in = new TFile("ntupleoutputsample.root");
TNtuple *data = (TNtuple*) in->GetObjectChecked("data","TNtuple");
double pot,cur,temp,pres;
float *row_content; //Must necessarily be float and not a double... WHY?
TH1D *histo = new TH1D("histo","HISTO",100,0,10);
cout << "Potential\tCurrent\tTemperature\tPressure" << endl;
for(i=0;i<data->GetEntries();++i){
data->GetEntry(i);
row_content = data->GetArgs();
pot = row_content[0];
cur = row_content[1];
temp = row_content[2];
pres = row_content[3];
cout << pot << "\t" << cur << "\t" << temp << "\t" << pres << endl;
histo->Fill(pot);
}
histo->Draw();
}
示例2: Step3_Convert
void Step3_Convert(const TString filename)
{
TFile* file = new TFile(filename, "READ");
std::vector<TString> hists;
// No bracket enclosed initializer list in root 5
hists.push_back("NeulandDigiMon/hDepth");
hists.push_back("NeulandDigiMon/hForemostEnergy");
hists.push_back("NeulandDigiMon/hEtot");
//for (const TString& hist : hists)
for(Int_t i = 0; i < hists.size(); i++)
{
const TString hist = hists.at(i);
std::cout << hist << std::endl;
TH1D* h = (TH1D*)file->GetObjectChecked(hist, "TH1D");
const TString outfile = (TString(filename).ReplaceAll("digi.root", TString(hist).ReplaceAll("NeulandDigiMon/", "") + ".dat"));
ofstream outstream(outfile);
SingleExportAscii(h, outstream);
outstream.close();
}
}