本文整理汇总了C++中RooDataSet::SetNameTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ RooDataSet::SetNameTitle方法的具体用法?C++ RooDataSet::SetNameTitle怎么用?C++ RooDataSet::SetNameTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RooDataSet
的用法示例。
在下文中一共展示了RooDataSet::SetNameTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWorkspace
//.........这里部分代码省略.........
} else {
ptMin = onia::pTRange[iRap][iPT-1];
ptMax = onia::pTRange[iRap][iPT];
}
// output file name and workspace
std::stringstream outfilename;
outfilename << "tmpFiles/backupWorkSpace/ws_createWorkspace_Chi_rap" << iRap << "_pt" << iPT << ".root";
RooWorkspace* ws = new RooWorkspace(workspacename.c_str());
// define pt and y cuts on dataset
std::stringstream cutString;
if(onia::KinParticleChi && !onia::KinParticleChiButJpsiRap) {
cutString << "(chicPt >= " << ptMin << " && chicPt < "<< ptMax << ") && "
<< "(TMath::Abs(chicRap) >= " << yMin << " && TMath::Abs(chicRap) < " << yMax << ")";
}
if(!onia::KinParticleChi) {
cutString << "(JpsiPt >= " << ptMin << " && JpsiPt < "<< ptMax << ") && "
<< "(TMath::Abs(JpsiRap) >= " << yMin << " && TMath::Abs(JpsiRap) < " << yMax << ")";
}
if(onia::KinParticleChi && onia::KinParticleChiButJpsiRap) {
cutString << "(chicPt >= " << ptMin << " && chicPt < "<< ptMax << ") && "
<< "(TMath::Abs(JpsiRap) >= " << yMin << " && TMath::Abs(JpsiRap) < " << yMax << ")";
}
cout << "cutString: " << cutString.str().c_str() << endl;
// get the dataset for the fit
RooDataSet* binData = (RooDataSet*)fullData->reduce(cutString.str().c_str());
std::stringstream name;
name << "jpsi_data_rap" << iRap << "_pt" << iPT;
binData->SetNameTitle(name.str().c_str(), "Data For Fitting");
cout << "numEvents = " << binData->sumEntries() << endl;
double chicMeanPt = binData->mean(*chicPt);
RooRealVar var_chicMeanPt("var_chicMeanPt","var_chicMeanPt",chicMeanPt);
if(!ws->var("var_chicMeanPt")) ws->import(var_chicMeanPt);
else ws->var("var_chicMeanPt")->setVal(chicMeanPt);
cout << "chicMeanPt = " << chicMeanPt << endl;
double jpsiMeanPt = binData->mean(*JpsiPt);
RooRealVar var_jpsiMeanPt("var_jpsiMeanPt","var_jpsiMeanPt",jpsiMeanPt);
if(!ws->var("var_jpsiMeanPt")) ws->import(var_jpsiMeanPt);
else ws->var("var_jpsiMeanPt")->setVal(jpsiMeanPt);
cout << "jpsiMeanPt = " << jpsiMeanPt << endl;
std::stringstream cutStringPosRapChic;
cutStringPosRapChic << "chicRap > 0";
RooDataSet* binDataPosRapChic = (RooDataSet*)binData->reduce(cutStringPosRapChic.str().c_str());
double chicMeanAbsRap = binDataPosRapChic->mean(*chicRap);
cout << "chicMeanAbsRap = " << chicMeanAbsRap << endl;
RooRealVar var_chicMeanAbsRap("var_chicMeanAbsRap","var_chicMeanAbsRap",chicMeanAbsRap);
if(!ws->var("var_chicMeanAbsRap")) ws->import(var_chicMeanAbsRap);
else ws->var("var_chicMeanAbsRap")->setVal(chicMeanAbsRap);
std::stringstream cutStringPosRapJpsi;
cutStringPosRapJpsi << "JpsiRap > 0";
RooDataSet* binDataPosRapJpsi = (RooDataSet*)binData->reduce(cutStringPosRapJpsi.str().c_str());
double jpsiMeanAbsRap = binDataPosRapJpsi->mean(*JpsiRap);
cout << "jpsiMeanAbsRap = " << jpsiMeanAbsRap << endl;
RooRealVar var_jpsiMeanAbsRap("var_jpsiMeanAbsRap","var_jpsiMeanAbsRap",jpsiMeanAbsRap);
if(!ws->var("var_jpsiMeanAbsRap")) ws->import(var_jpsiMeanAbsRap);
else ws->var("var_jpsiMeanAbsRap")->setVal(jpsiMeanAbsRap);
示例2: createWorkspace
//.........这里部分代码省略.........
ptMax = onia::pTRange[iRap][iPT];
}
for(int iCPM = 1; iCPM <= onia::NchBins; iCPM++){
Double_t cpmMin;
Double_t cpmMax;
if(iCPM==0){
cpmMin = onia::cpmRange[0];
cpmMax = onia::cpmRange[onia::NchBins];
} else{
cpmMin = onia::cpmRange[iCPM-1];
cpmMax = onia::cpmRange[iCPM];
}
// output file name and workspace
std::stringstream outfilename;
outfilename << "tmpFiles/backupWorkSpace/fit_Psi" << nState-3 << "S_rap" << iRap << "_pt" << iPT << "_cpm" << iCPM << ".root";
// outfilename << "tmpFiles/fit_Psi" << nState-3 << "S_rap" << iRap << "_pt" << iPT << ".root";
RooWorkspace* ws = new RooWorkspace(workspacename.c_str());
// define pt and y cuts on dataset
std::stringstream cutString;
cutString << "(JpsiCPM > " << cpmMin << " && JpsiCPM < "<< cpmMax << ") && " << "(JpsiPt >= " << ptMin << " && JpsiPt < "<< ptMax << ") && "
<< "(TMath::Abs(JpsiRap) >= " << yMin << " && TMath::Abs(JpsiRap) < " << yMax << ")";
cout << "cutString: " << cutString.str().c_str() << endl;
// get the dataset for the fit
RooDataSet* binData = (RooDataSet*)fullData->reduce(cutString.str().c_str());
std::stringstream name;
name << "data_rap" << iRap << "_pt" << iPT << "_cpm" << iCPM;;
binData->SetNameTitle(name.str().c_str(), "Data For Fitting");
// Import variables to workspace
ws->import(*binData);
ws->writeToFile(outfilename.str().c_str());
}//iCPM
}//iPT
}//iRap
////---------------------------------------------------------------
////--Integrating rapidity and pt bins, in +/- 3*sigma mass window
////---------------------------------------------------------------
if(drawRapPt2D){
double yMin = onia::rapForPTRange[0];
double yMax = onia::rapForPTRange[onia::kNbRapForPTBins];
double ptMin = onia::pTRange[0][0];
double ptMax = onia::pTRange[0][onia::kNbPTBins[0]];
double cpmMin = onia::cpmRange[0];
double cpmMax = onia::cpmRange[onia::NchBins];
std::stringstream cutRapPt;
cutRapPt << "(JpsiCPM > " << cpmMin << " && JpsiCPM < "<< cpmMax << ") && "
<< "(JpsiPt > " << ptMin << " && JpsiPt < "<< ptMax << ") && "
<< "(TMath::Abs(JpsiRap) > " << yMin << " && TMath::Abs(JpsiRap) < " << yMax << ")";
cout<<"cutRapPt: "<<cutRapPt.str().c_str()<<endl;
RooDataSet* rapPtData = (RooDataSet*)fullData->reduce(cutRapPt.str().c_str());
std::stringstream nameRapPt;
nameRapPt << "data_rap0_pt0_cpm0";
rapPtData->SetNameTitle(nameRapPt.str().c_str(), "Data For full rap and pt");
// output file name and workspace