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


C++ TObjArray::Contains方法代码示例

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


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

示例1: OnStartElement

void TBDataParser::OnStartElement(const char *element, const TList *attributes)
{
	TXMLAttr *attr;
	TIter next(attributes);

	char *name = element;
	_currentElement = new TString(element);
	
	char *method = NULL;

	while ((attr = (TXMLAttr*) next())) {
		char *attrName = attr->GetName();
		char *attrValue = attr->GetValue();

		if(!strcmp(attrName, "name")) {
			name = attrValue; 
		}
		
		if(!strcmp(attrName, "method")) {
			method = attrValue;	
			_currentMethod = new TString(method);
		}
		
	}

	TFolder *currentFolder = _foldersStack->Last();

	if(!strcmp(element, "vector")) {
		TString *nameString = new TString(name);
		vector<float> *values = new vector<float>;
		_values = values;

		nameString->ReplaceAll(" ","_");

		TObjString *currentVector = new TObjString(nameString->Data());

		TObjArray *vectorsStack = _vectorsStack;
		vectorsStack->AddLast(currentVector);

		TString *joinedName = new TString(((TObjString *) vectorsStack->First())->GetString().Data());

		for(Int_t i = 1; i < vectorsStack->GetEntries(); i++) {
			joinedName->Append("_");
			joinedName->Append(((TObjString *) vectorsStack->At(i))->GetString().Data());
		}
		
		TObjString *joinedNameObj = new TObjString(joinedName->Data());
		TObjArray *joinedNameStack = _joinedNameStack;
		
		TNtuple *vector = new TNtuple(joinedName->Data(),joinedName->Data(),"values");
		_vector = vector;
		currentFolder->Add(vector);

		if(joinedNameStack->Contains(joinedName->Data()))
			cout << joinedName->Data() << "Error: " << "vector already exists. Be sure that in your XML file every vector has a unique path + name combination" << endl;
			
		joinedNameStack->Add(joinedNameObj);
			
			
		return;
	}

	_foldersStack->AddLast(currentFolder->AddFolder(name, name));
}
开发者ID:matteodepalo,项目名称:l-zero-trigger-board,代码行数:64,代码来源:TBDataParser.C

示例2: CheckESD


//.........这里部分代码省略.........
	if (particle->Pt() > cutPtV0) {
	  nGenV0s++;
	  selV0s.Add(particle);
	}
	break;
      }
      case kXiMinus:
      case kOmegaMinus: {
	if (particle->Pt() > cutPtCascade) {
	  nGenCascades++;
	  selCascades.Add(particle);
	}
	break;
      }
      default: break;
      }
    }

    // get the event summary data
    tree->GetEvent(iEvent);
    if (!esd) {
      Error("CheckESD", "no ESD object found for event %d", iEvent);
      return kFALSE;
    }

    // loop over tracks
    for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {
      AliESDtrack* track = esd->GetTrack(iTrack);

      // select tracks of selected particles
      Int_t label = TMath::Abs(track->GetLabel());
      if (label > stack->GetNtrack()) continue;     // background
      TParticle* particle = stack->Particle(label);
      if (!selParticles.Contains(particle)) continue;
      if ((track->GetStatus() & AliESDtrack::kITSrefit) == 0) continue;
      if (track->GetConstrainedChi2() > 1e9) continue;
      selParticles.Remove(particle);   // don't count multiple tracks

      nRec++;
      hRec->Fill(particle->Pt());
      if (track->GetLabel() < 0) nFake++;

      // resolutions
      hResPtInv->Fill(100. * (TMath::Abs(track->GetSigned1Pt()) - 1./particle->Pt()) * 
		      particle->Pt());
      hResPhi->Fill(1000. * (track->Phi() - particle->Phi()));
      hResTheta->Fill(1000. * (track->Theta() - particle->Theta()));

      // PID
      if ((track->GetStatus() & AliESDtrack::kESDpid) == 0) continue;
      Int_t iGen = 5;
      for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
	if (TMath::Abs(particle->GetPdgCode()) == partCode[i]) iGen = i;
      }
      Double_t probability[AliPID::kSPECIES];
      track->GetESDpid(probability);
      Double_t pMax = 0;
      Int_t iRec = 0;
      for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
	probability[i] *= partFrac[i];
	if (probability[i] > pMax) {
	  pMax = probability[i];
	  iRec = i;
	}
      }
      identified[iGen][iRec]++;
开发者ID:catalinristea,项目名称:test,代码行数:67,代码来源:CheckESD.C


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