本文整理汇总了C++中Holder::Print方法的典型用法代码示例。如果您正苦于以下问题:C++ Holder::Print方法的具体用法?C++ Holder::Print怎么用?C++ Holder::Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Holder
的用法示例。
在下文中一共展示了Holder::Print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readFile
void readFile(const char * filename = "stlinnerevo.root") {
TFile *f = TFile::Open(filename,"READ");
std::cout << "Reading a Track.\n";
Track *tr = 0;
f->GetObject("val",tr);
if (tr) Print(*tr);
else std::cout << "Value not read\n";
std::cout << "Reading a vector<int> into a vector<float>.\n";
vector<float> *vecint = 0;
f->GetObject("vecint",vecint);
if (vecint) Print(*vecint);
else std::cout << "vector of float/int not read\n";
std::cout << "Reading a vector<Values> into a vector<Track>.\n";
vector<Track> *vec = 0;
f->GetObject("vec",vec);
if (vec) Print(*vec);
else std::cout << "vector not read\n";
std::cout << "Reading a map<string,int> into a map<string,long>.\n";
map<string,long> *dict = 0;
f->GetObject("dict",dict);
if (dict) Print(*dict);
else std::cout << "map not read\n";
if (1) {
std::cout << "Reading a Holder object.\n";
Holder *h = 0;
f->GetObject("holder",h);
if(h) h->Print();
delete h; h = 0;
}
if (1) {
TTree *t; f->GetObject("T",t);
Holder *h = 0;
std::vector<Track> *vecbr = 0;
vector<float> *vecintbr = 0;
t->SetBranchAddress("vec",&vecbr);
// t->GetBranch("vec")->GetEntry(0);
// Print(*vecbr);
// return;
t->SetBranchAddress("vecint",&vecintbr);
t->SetBranchAddress("vec",&vecbr);
t->SetBranchAddress("holder",&h);
for(Long64_t e = 0; e < 2 ; ++e) {
t->GetEntry(e);
std::cout << "Reading from TTree entry #" << e << ".\n";
std::cout << "Reading a vector<int> into a vector<float>.\n";
if (vecintbr) Print(*vecintbr);
std::cout << "Reading a vector<Values> into a vector<Track>.\n";
if (vecbr) Print(*vecbr);
std::cout << "Reading a Holder object.\n";
if (h) h->Print();
}
delete h;
}
delete f;
}