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


C++ TIterator::Next方法代码示例

本文整理汇总了C++中TIterator::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ TIterator::Next方法的具体用法?C++ TIterator::Next怎么用?C++ TIterator::Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TIterator的用法示例。


在下文中一共展示了TIterator::Next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convertRooDatasetToTTree

///
/// Converts a RooDataSet to a TTree which then can be
/// browsed.
///
TTree* Utils::convertRooDatasetToTTree(RooDataSet *d)
{
	// set up the TTree based on the content of the first
	// row of the dataset
	map<string,float> variables;  ///< the proxy variables
	TTree* t = new TTree("tree", "tree");
	TIterator* it = d->get(0)->createIterator();
	while ( RooRealVar* p = (RooRealVar*)it->Next() ){
		variables.insert(pair<string,float>(p->GetName(),p->getVal()));
		t->Branch(p->GetName(), &variables[p->GetName()], TString(p->GetName())+"/F");
	}
	delete it;

	// loop over the dataset, filling the tree
	int nEntries = d->sumEntries();
	for ( int i=0; i<nEntries; i++ ){
		it = d->get(i)->createIterator();
		while ( RooRealVar* p = (RooRealVar*)it->Next() ){
			variables[p->GetName()] = p->getVal();
		}
		delete it;
		t->Fill();
	}

	return t;
}
开发者ID:KonstantinSchubert,项目名称:gammacombo,代码行数:30,代码来源:Utils.cpp

示例2: mergeNamedSets

///
/// Merge two named sets of variables inside a RooWorkspace.
/// Duplicate variables will only be contained once.
///
void Utils::mergeNamedSets(RooWorkspace *w, TString mergedSet, TString set1, TString set2)
{
	// 1. fill all variables into a vector
	vector<string> varsAll;
	TIterator* it = w->set(set1)->createIterator();
	while ( RooRealVar* p = (RooRealVar*)it->Next() ) varsAll.push_back(p->GetName());
	delete it;
	it = w->set(set2)->createIterator();
	while ( RooRealVar* p = (RooRealVar*)it->Next() ) varsAll.push_back(p->GetName());
	delete it;

	// 2. remove duplicates
	sort(varsAll.begin(), varsAll.end());
	vector<string> vars;
	vars.push_back(varsAll[0]);
	string previous = varsAll[0];
	for ( int i=1; i<varsAll.size(); i++ ){
		if ( previous==varsAll[i] ) continue;
		vars.push_back(varsAll[i]);
		previous=varsAll[i];
	}

	// 3. make new, combined set on the workspace
	TString varsCommaList = "";
	for ( int i=0; i<vars.size(); i++ ){
		varsCommaList.Append(vars[i]);
		if ( i<vars.size()-1 ) varsCommaList.Append(",");
	}
	w->defineSet(mergedSet, varsCommaList);
}
开发者ID:KonstantinSchubert,项目名称:gammacombo,代码行数:34,代码来源:Utils.cpp

示例3: AnalyseJets

void LHCOWriter::AnalyseJets()
{
  Jet *element;
  Track *track;
  Int_t counter;

  fItJet->Reset();
  while((element = static_cast<Jet*>(fItJet->Next())))
  {
    if(element->TauTag != 0) continue;

    Reset();

    counter = 0;
    fItTrack->Reset();
    while((track = static_cast<Track*>(fItTrack->Next())))
    {
      if(element->P4().DeltaR(track->P4()) < 0.5) ++counter;
    }

    fIntParam[1] = 4;

    fDblParam[0] = element->Eta;
    fDblParam[1] = element->Phi;
    fDblParam[2] = element->PT;
    fDblParam[3] = element->Mass;
    fDblParam[4] = counter;
    fDblParam[5] = element->BTag;
    fDblParam[6] = element->EhadOverEem;

    Write();
  }
}
开发者ID:YoungKwonJo,项目名称:delphes,代码行数:33,代码来源:root2lhco.cpp

示例4: setObservablesTruth

void PDF_GLWADS_DKDpi_K3pi::setObservables(config c)
{
	switch(c)
	{
		case truth:{
					   setObservablesTruth();
					   break;
				   }
		case toy:{
					 setObservablesToy();
					 break;
				 }
		case lumi1fb:{
						 obsValSource = "1fb-1, ExpNll/sept2012K3PIResult.root";
						 TString File = this->dir+"/ExpNll/sept2012K3PIResult.root";
						 TFile *fr = TFile::Open(File);
						 RooFitResult *r = (RooFitResult*)fr->Get("fitresult_model_reducedData_binned");
						 assert(r);
						 TIterator* it = observables->createIterator();
						 while ( RooRealVar* pObs = (RooRealVar*)it->Next() )
						 {
							 RooRealVar* pRes = (RooRealVar*)r->floatParsFinal().find(obsTmkToMalcolm(pObs->GetName()));
							 pObs->setVal(pRes->getVal());
						 }
						 fr->Close();
						 delete r;
						 delete fr;
						 break;
					 }
		case lumi3fb:{
						 obsValSource = "3fb-1 ANA v7 unblind"; // https://twiki.cern.ch/twiki/pub/LHCbPhysics/B2D0K/LHCb-ANA-2014-071-v7.pdf (see Vavas email 04/08/15)

						 // these get transformed over from the new inputs using ExpNll/transportGLWADS_new_to_old.py
						 // in the case of the DK only (robust) combination some of the observables don't exist
						 // usemap as the temp store
						 std::map< TString, double > vals;
						 vals["rkp_k3pi_obs"]      =  0.0793;
						 vals["afav_dk_k3pi_obs"]  =  -0.0004;
						 vals["afav_dpi_k3pi_obs"] =  0.0;
						 vals["rp_dk_k3pi_obs"]    =  0.018369;
						 vals["rm_dk_k3pi_obs"]    =  0.009611;
						 vals["rp_dpi_k3pi_obs"]   =  0.003683;
						 vals["rm_dpi_k3pi_obs"]   =  0.003857;

						 // now can loop the observables and set the values
						 TIterator* it = observables->createIterator();
						 while ( RooRealVar* pObs = (RooRealVar*)it->Next() ){
							 pObs->setVal(vals[pObs->GetName()]);
						 }

						 vals.clear();
						 break;
				}
		default:{
					cout << "PDF_GLWADS_DKDpi_K3pi::setObservables() : ERROR : config "+ConfigToTString(c)+" not found." << endl;
					exit(1);
				}
	}
}
开发者ID:PashaPodolsky,项目名称:pygammacombo,代码行数:59,代码来源:PDF_GLWADS_DKDpi_K3pi.cpp

示例5: FindDOF

int Scheme::FindDOF(QString name, bool& isBase, bool &isExt)
{
	if(Root.IsNull())
	{
		throw NoLabelInicialisationException("Scheme: label do not inicialised.");
	}

//	printf ("Scheme:10\n");

	GetEqvList();
	TIterator eqv = EqvList.GetIterator();
//	printf ("Scheme:11\n");

	int num = 1;
	while (eqv.More())
	{
		bool isOK;
//			printf ("Scheme:------12\n");

		TElement el (eqv.Value());
		TList B (el.GetField ("doflist", isOK));
		TInteger isb (el.GetField ("isBase", isOK));
		TInteger ise (el.GetField ("isExt", isOK));
		
//		if (isOK)		printf ("Scheme:13 OK OK OK\n");


		TIterator dofit = B.GetIterator();

//			printf ("Scheme:14\n");

		while (dofit.More())
		{
			TString dof (dofit.Value());
			if (name == dof.GetValue())
			{
				isBase = (isb.GetValue()!=0);
				isExt = (ise.GetValue()!=0);
				
				return num;
			}
			dofit.Next();
		}
		
		eqv.Next();
		num++;
	}
	
	return -1;	
}
开发者ID:laduga,项目名称:pradis,代码行数:50,代码来源:Scheme.cpp

示例6: SetConstant

void SetConstant(const RooArgSet * vars, Bool_t value ) {
    //
    // Set the constant attribute for all vars in the set
    //

    TIterator * pIter = vars->createIterator(); // we do own this

    for(TObject * pObj = pIter->Next(); pObj; pObj = pIter->Next() ) {
        ((RooRealVar *)pObj)->setConstant(value);
    }

    delete pIter;

    return;
}
开发者ID:maxhorton,项目名称:cls_calculator,代码行数:15,代码来源:workspace_preparer.C

示例7: WriteMergeObjects

void WriteMergeObjects( TFile *target ) {
  cout << "Writing the merged data." << endl;

  TIterator *nextobj = MergeObjects.MakeIterator();
  TObjString *pathname_obj;
  while( (pathname_obj = (TObjString *)nextobj->Next()) ) {
    TString path,name;
    SplitPathName(pathname_obj->String(),&path,&name);

    TObject *obj = MergeObjects.GetValue(pathname_obj);
    target->cd(path);

    obj->Write( name );

    delete obj;
  }
  MergeObjects.Clear();

  target->Write();

  // Temporarily let multiple root files remain if > 2GB
  // Prevent Target_1.root Target_2.root, ... from happening.
  //  long long max_tree_size = 200000000000LL; // 200 GB
  //  if(TTree::GetMaxTreeSize() < max_tree_size ) {
  //    TTree::SetMaxTreeSize(max_tree_size);
  //  }

  nextobj = MergeChains.MakeIterator();
  TObjString *pathname_obj;
  while( (pathname_obj = (TObjString *)nextobj->Next()) ) {
    TString path,name;
    SplitPathName(pathname_obj->String(),&path,&name);

    TChain *ch = (TChain *)MergeChains.GetValue(pathname_obj);
    target->cd(path);
    ch->Merge(target,0,"KEEP");

    delete ch;

	// in case of multiple objects with same pathname, must remove
	// this one from the list so we don't get the same (deleted)
	// one next time we look up the same name
	MergeChains.Remove(pathname_obj);
  }
  MergeChains.Clear();

  InitializedMergeObjects = false;
}
开发者ID:ekfriis,项目名称:farmout,代码行数:48,代码来源:mergeFiles.C

示例8: floatParameters

void Utils::floatParameters(const RooAbsCollection* set)
{
	TIterator* it = set->createIterator();
	while ( RooRealVar* p = (RooRealVar*)it->Next() ){
		p->setConstant(false);
	}
}
开发者ID:KonstantinSchubert,项目名称:gammacombo,代码行数:7,代码来源:Utils.cpp

示例9: GetModelOfValue

af::Model OutValue::GetModelOfValue()
{
	if(Root.IsNull())
	{
		throw NoLabelInicialisationException("OutValue: label do not inicialised.");
	}

	TIterator TITER;

	Model vallr;
	TITER.Init(Root, false);
	while (TITER.More())
	{
		Model val = (Model)TITER.Value();
		QString name = val.GetName();

		if(name == "Model")
		{
			return val;
		}
		TITER.Next();
	}

	TElement e(Root);
	throw NoExistException("OutValue: Model Of Value do not exists.", e);

	return vallr;
}
开发者ID:laduga,项目名称:pradis,代码行数:28,代码来源:OutValue.cpp

示例10: loadParameterLimits

///
/// load Parameter limits
/// by default the "free" limit is loaded, can be changed to "phys" by command line argument
///
void MethodDatasetsProbScan::loadParameterLimits() {
    TString rangeName = arg->enforcePhysRange ? "phys" : "free";
    if ( arg->debug ) cout << "DEBUG in Combiner::loadParameterLimits() : loading parameter ranges: " << rangeName << endl;
    TIterator* it = w->set(pdf->getParName())->createIterator();
    while ( RooRealVar* p = (RooRealVar*)it->Next() ) setLimit(w, p->GetName(), rangeName);
    delete it;
}
开发者ID:gammacombo,项目名称:gammacombo,代码行数:11,代码来源:MethodDatasetsProbScan.cpp

示例11: while

RooFitResult *breakDownFit(RooSimultaneous *m, RooAbsData *d, RooRealVar *mass, bool precondition = false){
	if(precondition){
		 const char *catsName = m->indexCat().GetName();
		 TIterator *it = m->indexCat().typeIterator();
		 while(RooCatType* ci = dynamic_cast<RooCatType*>(it->Next())) {
			 const Text_t *catLabel = ci->GetName();
			 RooAbsPdf *pdf = m->getPdf(Form("%s",catLabel));
			 RooAbsData *reduced = d->reduce(SelectVars(*mass),Cut(Form("%s==%s::%s",catsName, catsName, catLabel)));
			 RooFitResult *r = pdf->fitTo(*reduced,PrintLevel(-1),Save(),
					 Minimizer("Minuit2","migrad"),Strategy(0),Hesse(false),Minos(false),Optimize(false)
					 );
			 cout << catsName << " " << catLabel << " M2migrad0 " << r->status() << endl;
			 if(r->status()!=0){
				 RooFitResult *r = pdf->fitTo(*reduced, PrintLevel(-1), Save());
				 cout << catsName << " " << catLabel << " Mmigrad1 " << r->status() << endl;
			 }
		 }
	}

	RooFitResult *r = m->fitTo(*d, Save(), PrintLevel(-1),
			Strategy(0));
	cout << "Global fit Mmigrad0 " << r->status() << endl;
	if(r->status()!=0){
	 RooFitResult *r = m->fitTo(*d, PrintLevel(-1), Save(),
			 Minimizer("Minuit","minimize"),Strategy(2));
	 cout << "Global fit Mminimize2 " << r->status() << endl;
	 return r;
	}

	return r;
}
开发者ID:h2gglobe,项目名称:UserCode,代码行数:31,代码来源:diySeparation.cpp

示例12: GetIncludeList

af::TList Scheme::GetIncludeList()
{
	if(Root.IsNull())
	{
		throw NoLabelInicialisationException("Scheme: label do not inicialised.");
	}
	
	
//	return IncludeList;
	
	
	TIterator TITER;

	TList valls;
	TITER.Init(Root, false);
	while (TITER.More())
	{
		TList val = (TList)TITER.Value();
		QString name = val.GetName();

		if(name == "IncludeList")
		{
			return val;
		}
		TITER.Next();
	}

	TElement e(Root);
	throw NoExistException("Scheme: Include List do not exists.", e);

	return valls;
}
开发者ID:laduga,项目名称:pradis,代码行数:32,代码来源:Scheme.cpp

示例13: GetFile

QString Include::GetFile()
{
	if(Root.IsNull())
	{
		throw NoLabelInicialisationException("Include: label do not inicialised.");
	}

	if(Root.IsNull())
	{
		throw NoLabelInicialisationException("Include: label do not inicialised.");
	}

	TIterator TITER;

	TITER.Init(Root, false);
	while (TITER.More())
	{
		TElement val = TITER.Value();
		QString name = val.GetName();
		if(name == "File name")
		{
			TString valint = (TString)val;
			return valint.GetValue();
		}
		TITER.Next();
	}

	return "";
}
开发者ID:laduga,项目名称:pradis,代码行数:29,代码来源:Include.cpp

示例14: scaleToRate

void scaleToRate(const char* collectionName, double rateFactor) {
  TRegexp reg(collectionName, kTRUE);
  
  //    gDirectory->ls();
  TList* list = gDirectory->GetList() ;
  TIterator* iter = list->MakeIterator();
  TObject* obj = 0;
  
  while (obj = iter->Next()) {
    if (! obj->InheritsFrom(TH1::Class())) {
      //      cout << "bugger" << endl;
      continue;
    }
    
    
    TString name = obj->GetName();
    cout << "Testing name: " << name << " against " << collectionName << endl;
    
    if (TString(collectionName).MaybeRegexp()) {
      cout << "we have a possible match" << endl;
      cout << "Trying to match to " << TString(obj->GetName()) << endl;
      if (TString(obj->GetName()).Index(reg) < 0 ) {
	cout << "failure here.  Argument returns " << TString(obj->GetName()).Index(reg) << endl;
	continue;
      }
    }
    else if (! name.BeginsWith(collectionName)) continue;
    
    cout << "We're trying to scale" << name << endl;
    ((TH1*)obj)->Scale(rateFactor);
    
  }
  
}
开发者ID:vlimant,项目名称:usercode,代码行数:34,代码来源:rate_histMaker.C

示例15: eff

// Method by name
TH1F* eff(const char* name1, const char* name2, const char* name="eff"){

  // Get a list of object and their iterator
  TList* list = gDirectory->GetList() ;
  TIterator* iter = list->MakeIterator();

  // Loop over objects, set the pointers
  TObject* obj;
  TH1F* h1=0;
  TH1F* h2=0;
  TString str1 = Form("%s",name1);
  TString str2 = Form("%s",name2);
  while(obj=iter->Next()) {
    TString objName = obj->GetName();
    if (objName == str1) h1 = (TH1F*) obj;
    if (objName == str2) h2 = (TH1F*) obj;
  }

  // quit if not found
  if (h1 == 0) {
    cout << "Histogram " << name1 << " not found" << endl;
    return 0;
  }
  if (h2 == 0) {
    cout << "Histogram " << name2 << " not found" << endl;
    return 0;
  }

  // Call the method by pointer
  TH1F* temp = eff(h1, h2, name);
  return temp;
}
开发者ID:cmstas,项目名称:fakeRate,代码行数:33,代码来源:eff.C


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