本文整理汇总了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;
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例8: floatParameters
void Utils::floatParameters(const RooAbsCollection* set)
{
TIterator* it = set->createIterator();
while ( RooRealVar* p = (RooRealVar*)it->Next() ){
p->setConstant(false);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 "";
}
示例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);
}
}
示例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;
}