本文整理汇总了C++中HiForest::ResetBooleans方法的典型用法代码示例。如果您正苦于以下问题:C++ HiForest::ResetBooleans方法的具体用法?C++ HiForest::ResetBooleans怎么用?C++ HiForest::ResetBooleans使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HiForest
的用法示例。
在下文中一共展示了HiForest::ResetBooleans方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stdsort
void stdsort(int startline = 0, string flist = "")
{
//! Define the input and output file and HiForest
string buffer;
vector<string> listoffiles;
int nlines = 0;
ifstream infile(flist.data());
if (!infile.is_open()) {
cout << "Error opening file. Exiting." << endl;
return;
} else {
while (!infile.eof()) {
infile >> buffer;
listoffiles.push_back(buffer);
nlines++;
}
}
cout<<" here"<<endl;
HiForest *c = new HiForest(listoffiles[startline].data(),0,0,0,0,true);
TFile * outf = new TFile(Form("sortedHiForest_%d.root",startline),"recreate");
c->outf = outf;
c->SetOutputFile("null",true);
c->LoadNoTrees();
c->hasEvtTree = true;
//! loop through all the events once to construct the cent,vz pair array we'll be sorting over
cout << "Constructing the cent:vz pair array..." << endl;
for (int i=0;i<c->GetEntries();i++)
{
c->GetEntry(i);
pair<int,double> centvz;
centvz.first = c->evt->hiBin;
centvz.second = c->evt->vz;
evtCentVz.push_back(centvz);
if (i%1000==0) cout <<i<<" / "<<c->GetEntries()<<" "<<c->setupOutput<<endl;
}
c->ResetBooleans();
//! Make the index array which will get sorted on first centrality
int evtindecies[c->GetEntries()];
for (int i=0;i<c->GetEntries();i++)
{
evtindecies[i] = i;
}
cout << "Sorting the cent:vz pair array..." << " "<<c->setupOutput<<endl;
//! Sort the index array first on the centrality bin, then on the vz of the entry at that index
qsort (evtindecies, c->GetEntries(), sizeof(int), comparecentvz);
//! Now fill the tree in the new order
cout << "Filling the tree in the sorted order..." << " "<<c->setupOutput<<endl;
for (int i=0;i<c->GetEntries();i++)
{
c->GetEntry(evtindecies[i]);
c->FillOutput();
if (i%1000==0) cout <<i<<" / "<<c->GetEntries()<<" "<<c->setupOutput<<endl;
}
delete c;
}