本文整理汇总了C++中TChain::GetV2方法的典型用法代码示例。如果您正苦于以下问题:C++ TChain::GetV2方法的具体用法?C++ TChain::GetV2怎么用?C++ TChain::GetV2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChain
的用法示例。
在下文中一共展示了TChain::GetV2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillGraphFromTreeVar
void fillGraphFromTreeVar(std::string& treedrawspec,int index,wGraph_t *&pwg)
{
// Sample treedrawspec:
// mytree:"TDCwinstart[%d]:runnum","evtnum==1","P"
//
vector<string> v_tokens;
string tid;
TString drawspec;
Tokenize(treedrawspec,v_tokens,":",true);
if( (v_tokens.size() < 2) ||
(!v_tokens[0].size()) ||
(!v_tokens[2].size()) ) {
cerr << "malformed root tree draw spec treeid:\"varexp\",\"selection\",option: " << treedrawspec << endl;
return;
}
tid = v_tokens[0];
for (size_t i=2; i<v_tokens.size(); i++) {
drawspec += v_tokens[i];
}
int fmtcnt = drawspec.CountChar('%');
if (fmtcnt) { // use index for tree array var
switch(fmtcnt) {
case 1: drawspec = Form(drawspec,index); break;
case 2: drawspec = Form(drawspec,index,index); break;
case 3: drawspec = Form(drawspec,index,index,index); break;
case 4: drawspec = Form(drawspec,index,index,index,index); break;
case 5: drawspec = Form(drawspec,index,index,index,index,index); break;
case 6: drawspec = Form(drawspec,index,index,index,index,index,index); break;
default:
cerr << "More than six fmt specifiers in drawspec found, fix me! " << drawspec <<endl;
exit(-1);
}
}
if( gl_verbose)
cout<<"drawspec="<<drawspec<<endl;
TChain *chain = findChain(tid);
assert (chain);
// Expect the user to use commas to delimit the draw options, but
// we can't use comma as delimiter since user may also specify
// histo with binning spec with commas
//
TObjArray *tokens = drawspec.Tokenize("\"");
TString hname;
TString varexp = ((TObjString *)(*tokens)[0])->GetString();
switch(tokens->GetEntriesFast()) {
case 1:
if( gl_verbose)
cout<<"chain->Draw(\""<<varexp<<"\",\"\",\"goff\")"<<endl;
chain->Draw(varexp,"","goff");
break;
case 3:
{
TString cut = ((TObjString *)(*tokens)[2])->GetString();
cout<<"chain->Draw(\""<<varexp<<"\",\""<<cut<<"\",\"goff\")"<<endl;
chain->Draw(varexp,cut,"goff");
}
break;
case 4: // assume the cut string is blank
{
TString gopt = ((TObjString *)(*tokens)[3])->GetString();
gopt = gopt + " goff";
cout<<"chain->Draw(\""<<varexp<<"\",\"\","<<gopt<<"\")"<<endl;
chain->Draw(varexp,"",gopt);
}
break;
case 5:
{
TString cut = ((TObjString *)(*tokens)[2])->GetString();
TString gopt = ((TObjString *)(*tokens)[4])->GetString();
gopt = gopt + " goff";
cout<<"chain->Draw(\""<<varexp<<"\",\""<<cut<<"\",\""<<gopt<<"\")"<<endl;
chain->Draw(varexp,cut,gopt);
}
break;
default:
cerr << "malformed root tree draw spec treeid:varexp,selection,option";
for (int i=0; i<tokens->GetEntriesFast(); i++)
cerr << i<<": "<< ((TObjString *)(*tokens)[i])->GetString() << " ";
cerr << endl;
break;
}
assert(chain->GetSelectedRows());
if (!pwg)
pwg = new wGraph_t();
assert(pwg);
pwg->gr = new TGraph(chain->GetSelectedRows(),
chain->GetV2(), chain->GetV1());
pwg->gr->Sort();
} // fillGraphFromTreeVar