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


C++ RooDataSet::isWeighted方法代码示例

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


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

示例1: fitDebug


//.........这里部分代码省略.........

  //binning variables
  //std::cout<<"Binning variables for eventual binned fit"<<std::endl;
  //combinedPfIsoFPR03Phot.setBins(121);
  //etaPhot.setBins(120);
  //mvaIdPhot.setBins(180);
  //isIsolatedGenPhot.setBins(3);
  //ptPhot.setBins(1200);
  //weight_times_isoWeight.setBins(10000000);

  //creating complete dataset
  std::cout<<"Reading trees of MC into a complete general dataset"<<std::endl;
  RooDataSet* allSet;
  if(isFPR){
    if(isoWeight==0)
      allSet = new RooDataSet("allSet", "allSet", argSet, WeightVar("isoFPRW_EB"), RooFit::Import(data));
    if(isoWeight==1)
      allSet = new RooDataSet("allSet", "allSet", argSet, WeightVar("isoFPRW1_EB"), RooFit::Import(data));
    if(isoWeight==2)
      allSet = new RooDataSet("allSet", "allSet", argSet, WeightVar("isoFPRW2_EB"), RooFit::Import(data));
  }
  else{
    if(isoWeight==0)
      allSet = new RooDataSet("allSet", "allSet", argSet, WeightVar("isoW_EB"), RooFit::Import(data));
    if(isoWeight==1)
      allSet = new RooDataSet("allSet", "allSet", argSet, WeightVar("isoW1_EB"), RooFit::Import(data));
    if(isoWeight==2)
      allSet = new RooDataSet("allSet", "allSet", argSet, WeightVar("isoW2_EB"), RooFit::Import(data));
  }
  //allSet.setWeightVar(weight_times_isoWeight);

  std::cout<<"Complete dataset "<<allSet->GetName()<<" created"<<std::endl<<std::endl;
  std::cout<<"******************** "<<std::endl;
  std::cout<<" isWeighted =  " <<  allSet->isWeighted() <<std::endl;
  std::cout<<"******************** "<<std::endl<<std::endl;

  //reducing complete dataset to interesting ones
  
  RooDataSet* d_r = (RooDataSet*)allSet->reduce((cut+" && mvaIdPhot<0.6 && mvaIdPhot>-0.6").c_str());
  d_r->SetName("d_r");
  std::cout<<"Reduced dataset "<<d_r->GetName()<<" created with cut "<<cut<<" && -0.6 < mvaIdPhot < 0.6"<<std::endl;
    std::cout<<"d_r entries: "<<d_r->sumEntries()<<std::endl;
  
  //models for fit
  //gaussian
  RooRealVar gaussmean("gaussmean","gaussmean", -1., -10., 20.);
  RooRealVar gausssigma("gausssigma", "gausssigma", 1., 0., 20.);

  RooGaussian* my_gauss;
  if(isFPR)
    my_gauss = new RooGaussian("my_gauss", "my_gauss", combinedPfIsoFPR03Phot, gaussmean, gausssigma);
  else
    my_gauss = new RooGaussian("my_gauss", "my_gauss", combinedPfIso03Phot, gaussmean, gausssigma);
  

  //crystalBall
  RooRealVar cbmean("cbmean", "cbmean", -1., -5., 15.);
  RooRealVar cbsigma("cbsigma", "cbsigma", 1., 0., 20.);

  RooRealVar cbalpha("cbalpha", "cbaplha", -1., -1000., 0.);
  RooRealVar cbn("cbn","cbn",10., 0., 1000.);

  RooCBShape* my_cb;
  if(isFPR)
    my_cb = new RooCBShape("my_cb", "my_cb",  combinedPfIsoFPR03Phot, cbmean, cbsigma, cbalpha, cbn);
  else
开发者ID:gdimperi,项目名称:GammaJets,代码行数:67,代码来源:fitDebug_weightedDataCS.C

示例2: makefit


//.........这里部分代码省略.........
    else if (ele1pt < 40) Ele1PtBin = 1;
    else if (ele1pt < 50) Ele1PtBin = 2;
    else Ele1PtBin = 3;
    if (ele2pt > 20 && ele2pt < 30) Ele2PtBin = 0;
    else if (ele2pt < 40) Ele2PtBin = 1;
    else if (ele2pt < 50) Ele2PtBin = 2;
    else Ele2PtBin = 3;
    if (fabs(zeeTree->l1sceta) < 1.479) Ele1EtaBin = 0;
    else Ele1EtaBin = 1;
    if (fabs(zeeTree->l2sceta) < 1.479) Ele2EtaBin = 0;
    else Ele2EtaBin = 1;
    if (zeeTree->l1r9 > 0.94) Ele1R9Bin = 0;
    else Ele1R9Bin = 1;
    if (zeeTree->l2r9 > 0.94) Ele2R9Bin = 0;
    else Ele2R9Bin = 1;

    if (!(Ele1PtBin == ptBin || Ele2PtBin == ptBin)) continue; 
    if (!(Ele1EtaBin == etaBin && Ele2EtaBin == etaBin)) continue; 
    if (!(Ele1R9Bin == R9Bin && Ele2R9Bin == R9Bin)) continue; 
    
    //*************************************************************************
    // restrict range of mass
    //*************************************************************************
    double zMass = (ele1FourVector+ele2FourVector).M();
    if (zMass < minMass || zMass > maxMass) continue;

    //*************************************************************************
    //set mass variable
    //*************************************************************************
    zMassArgSet.setRealValue("zmass", zMass);    
    
    data->add(zMassArgSet,puW);
  }
  cout << "data->isWeighted() = " << data->isWeighted() << endl;

  // do binned fit to gain time...
  mass.setBins(nbins);
  RooDataHist *bdata = new RooDataHist("data_binned","data_binned", zMassArgSet, *data);
  cout << "bdata->isWeighted() = " << bdata->isWeighted() << endl;

  cout << "dataset size: " << data->numEntries() << endl;

//   // Closing file
//   treeFile->Close();
  //====================== Parameters===========================

  //Crystal Ball parameters
//   RooRealVar cbBias ("#Deltam_{CB}", "CB Bias", -.01, -10, 10, "GeV/c^{2}");
//   RooRealVar cbSigma("sigma_{CB}", "CB Width", 1.7, 0.8, 5.0, "GeV/c^{2}");
//   RooRealVar cbCut  ("a_{CB}","CB Cut", 1.05, 1.0, 3.0);
//   RooRealVar cbPower("n_{CB}","CB Order", 2.45, 0.1, 20.0);
  RooRealVar cbBias ("#Deltam_{CB}", "CB Bias", -.01, -10, 10, "GeV/c^{2}");
  RooRealVar cbSigma("#sigma_{CB}", "CB Width", 1.5, 0.8, 5.0, "GeV/c^{2}");
  RooRealVar cbCut  ("a_{CB}","CB Cut", 1.0, 1.0, 3.0);
  RooRealVar cbPower("n_{CB}","CB Order", 2.5, 0.1, 20.0);
  cbCut.setVal(cutoff_cb);
  cbPower.setVal(power_cb);
  //  if(!isMC && !(ptBin==0 && etaBin==1 && R9Bin==0)) {
  //    cbCut.setConstant(kTRUE);
  //    cbPower.setConstant(kTRUE);
  //  }

  // Just checking
  //cbCut.Print();
  //cbPower.Print();
开发者ID:VecbosApp,项目名称:VecbosApp2,代码行数:66,代码来源:FitZMassScaleAndResolution.C


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