当前位置: 首页>>代码示例>>C++>>正文


C++ HiForest::ResetBooleans方法代码示例

本文整理汇总了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;
}
开发者ID:velicanu,项目名称:UserCode,代码行数:60,代码来源:ppsort.C


注:本文中的HiForest::ResetBooleans方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。