本文整理汇总了C++中TBranch::GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ TBranch::GetTitle方法的具体用法?C++ TBranch::GetTitle怎么用?C++ TBranch::GetTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBranch
的用法示例。
在下文中一共展示了TBranch::GetTitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aliasname
vector<TString> getAliasNames(TTree *t) {
vector<TString> v_aliasnames;
TList *t_list = t->GetListOfAliases();
for(int i = 0; i < t_list->GetSize(); i++) {
TString aliasname(t_list->At(i)->GetName());
TBranch *branch = t->GetBranch(t->GetAlias(aliasname.Data()));
TString branchname(branch->GetName());
TString branchtitle(branch->GetTitle());
if(branchname.BeginsWith("intss") ||
branchname.BeginsWith("floatss") ||
branchname.BeginsWith("doubless") ||
branchname.Contains("LorentzVectorss") ||
branchname.Contains("timestamp") ) {
cout << "Sorry, I dont know about vector of vectors of objects. "
<< "Will be skipping " << aliasname << endl;
continue;
}
if(branchname.Contains("TString") ) {
cout << "Sorry, I don't know how to graphically represent TStrings in only 3 dimensions"
<< " Put in a feature request. Will be skipping " << aliasname << endl;
continue;
}
v_aliasnames.push_back(aliasname);
}
sort(v_aliasnames.begin(), v_aliasnames.end());
return v_aliasnames;
}
示例2: names
////////////////////////////////////////////////////////////
// names -- get the names of the branches and their details
SEXP RootChainManager::names() const {
// Advance to the first entry
//m_chain->GetEntry(0);
// Above commented out 20090616 - for TMBTrees this crashed root
// on an unresolved symbol for allocator<char>.
// Get the branches
TObjArray* branches = m_chain->GetListOfBranches();
// How many?
unsigned int nBranches = branches->GetEntriesFast();
// Make the R list for returning the list of branch and detail names
SEXP rBranchList, rBranchListNames;
PROTECT(rBranchList = NEW_LIST(nBranches));
PROTECT(rBranchListNames = NEW_CHARACTER(nBranches));
// Loop over the branches in the tree
for ( unsigned int branchIter = 0; branchIter < nBranches; ++branchIter ) {
// Get the branch
TBranch* branch = (TBranch*) branches->UncheckedAt(branchIter);
// Save away the name of this branch for use as an attribute
SET_STRING_ELT(rBranchListNames, branchIter, mkChar(branch->GetName()));
SEXP details = NEW_CHARACTER(1);
SET_ELEMENT(rBranchList, branchIter, details);
SET_STRING_ELT(details, 0, mkChar( branch->GetTitle() ) );
} // for over branches
// Set the names attribute
SET_NAMES(rBranchList, rBranchListNames);
// Release rBranchList and rBranchListNames
UNPROTECT(2);
return rBranchList;
}
示例3: aliasname
vector<std::string> getAliasNames(TTree *t){
//Vector to return results
vector<std::string> v_aliasnames;
//Skip if no entries
if (t->GetEntriesFast() == 0) return v_aliasnames;
//Get list of aliases
TList *t_list = t->GetListOfAliases();
//Loop over list, skip entries that are vectors of vectors, or strings
for(int i = 0; i < t_list->GetSize(); i++) {
std::string aliasname(t_list->At(i)->GetName());
TBranch *branch = t->GetBranch(t->GetAlias(aliasname.c_str()));
std::string branchname(branch->GetName());
std::string branchtitle(branch->GetTitle());
if(branchname.find("intss") == 0 || branchname.find("floatss") == 0 || branchname.find("doubless") == 0 || branchname.find("LorentzVectorss") < branchname.length() || branchname.find("timestamp") < branchname.length() || branchname.find("selectedPatJets") < branchname.length()){
cout << "Sorry, I dont know about vector of vectors of objects. Will be skipping " << aliasname << endl;
continue;
}
if(branchname.find("std::string") < branchname.length() || branchname.find("TStrings") < branchname.length()){
cout << "Sorry, I don't know how to graphically represent std::strings in only 3 dimensions." << " Put in a feature request. Will be skipping " << aliasname << endl;
continue;
}
v_aliasnames.push_back(aliasname);
}
//Sort alias names alphabetically
sort(v_aliasnames.begin(), v_aliasnames.end());
//Return aliases names
return v_aliasnames;
}
示例4: makeHeaderFile
//-------------------------------------------------------------------------------------------------
void makeHeaderFile(TFile *f, const string& treeName, bool paranoid, const string& Classname, const string& nameSpace, const string& objName) {
headerf << "// -*- C++ -*-" << endl;
headerf << "#ifndef " << Classname << "_H" << endl;
headerf << "#define " << Classname << "_H" << endl;
headerf << "#include \"Math/LorentzVector.h\"" << endl;
headerf << "#include \"Math/Point3D.h\"" << endl;
headerf << "#include \"TMath.h\"" << endl;
headerf << "#include \"TBranch.h\"" << endl;
headerf << "#include \"TTree.h\"" << endl;
headerf << "#include \"TH1F.h\"" << endl;
headerf << "#include \"TFile.h\"" << endl;
headerf << "#include \"TBits.h\"" << endl;
headerf << "#include <vector>" << endl;
headerf << "#include <unistd.h>" << endl;
headerf << "typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> > LorentzVector;" << endl << endl;
if (paranoid)
headerf << "#define PARANOIA" << endl << endl;
headerf << "using namespace std; " << endl;
headerf << "class " << Classname << " {" << endl;
headerf << "private: " << endl;
headerf << "protected: " << endl;
headerf << "\tunsigned int index;" << endl;
// TTree *ev = (TTree*)f->Get("Events");
TList* list_of_keys = f->GetListOfKeys();
std::string tree_name = "";
if (treeName.empty()) {
unsigned int ntrees = 0;
for (unsigned int idx = 0; idx < (unsigned int)list_of_keys->GetSize(); idx++) {
const char* obj_name = list_of_keys->At(idx)->GetName();
TObject* obj = f->Get(obj_name);
if (obj->InheritsFrom("TTree")) {
++ntrees;
tree_name = obj_name;
}
}
if (ntrees == 0) {
std::cout << "Did not find a tree. Exiting." << std::endl;
return;
}
if (ntrees > 1) {
std::cout << "Found more than one tree. Please specify a tree to use." << std::endl;
return;
}
}
else
tree_name = treeName;
TTree *ev = (TTree*)f->Get(tree_name.c_str());
TSeqCollection *fullarray = ev->GetListOfAliases();
bool have_aliases = true;
if (!fullarray) {
have_aliases = false;
fullarray = ev->GetListOfBranches();
}
// if (have_aliases && fullarray->GetSize() != ev->GetListOfBranches()->GetSize()) {
// std::cout << "Tree has " << fullarray->GetSize() << " aliases and " << ev->GetListOfBranches()->GetSize() << " branches. Exiting." << std::endl;
// return;
// }
TList *aliasarray = new TList();
for(Int_t i = 0; i < fullarray->GetEntries(); ++i) {
TString aliasname(fullarray->At(i)->GetName());
// TBranch *branch = ev->GetBranch(ev->GetAlias(aliasname.Data()));
TBranch *branch = 0;
if (have_aliases)
branch = ev->GetBranch(ev->GetAlias(aliasname.Data()));
else
branch = (TBranch*)fullarray->At(i);
TString branchname(branch->GetName());
TString branchtitle(branch->GetTitle());
TString branchclass(branch->GetClassName());
if(!branchname.BeginsWith("int") &&
!branchname.BeginsWith("uint") &&
!branchname.BeginsWith("bool") &&
!branchname.BeginsWith("float") &&
!branchname.BeginsWith("double") &&
!branchtitle.EndsWith("/F") &&
!branchtitle.EndsWith("/I") &&
!branchtitle.EndsWith("/i") &&
!branchtitle.EndsWith("/O") &&
!branchtitle.BeginsWith("TString") &&
!branchtitle.BeginsWith("TBits") &&
!branchclass.Contains("LorentzVector") &&
!branchclass.Contains("int") &&
!branchclass.Contains("uint") &&
!branchclass.Contains("bool") &&
!branchclass.Contains("float") &&
!branchclass.Contains("double") &&
!branchclass.Contains("TString"))
continue;
// if (branchclass.Contains("TString"))
//.........这里部分代码省略.........