本文整理汇总了C++中TDirectory::GetPath方法的典型用法代码示例。如果您正苦于以下问题:C++ TDirectory::GetPath方法的具体用法?C++ TDirectory::GetPath怎么用?C++ TDirectory::GetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDirectory
的用法示例。
在下文中一共展示了TDirectory::GetPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: efficiencies
void efficiencies( TString fin = "TMVA.root", Int_t type = 2, Bool_t useTMVAStyle = kTRUE )
{
// argument: type = 1 --> plot efficiency(B) versus eff(S)
// type = 2 --> plot rejection (B) versus efficiency (S)
// set style and remove existing canvas'
TMVAGlob::Initialize( useTMVAStyle );
// checks if file with name "fin" is already open, and if not opens one
TFile* file = TMVAGlob::OpenFile( fin );
// check if multi-cut MVA or only one set of MVAs
Bool_t multiMVA=kFALSE;
TIter nextDir(file->GetListOfKeys());
TKey *key;
// loop over all directories and check if
// one contains the key word 'multicutMVA'
while ((key = (TKey*)nextDir())) {
TClass *cl = gROOT->GetClass(key->GetClassName());
if (!cl->InheritsFrom("TDirectory")) continue;
TDirectory *d = (TDirectory*)key->ReadObj();
TString path(d->GetPath());
if (path.Contains("multicutMVA")){
multiMVA=kTRUE;
plot_efficiencies( file, type, d );
}
}
plot_efficiencies( file, type, gDirectory );
return;
}
示例2: cmpLRD
void cmpLRD(TFile* f1, TFile* f2, const char* dName, const char* patt = 0, unsigned int logmod=0, unsigned int dOpt=1){
// std::cout<<"cmpLRD In "<< dName<<std::endl;
TDirectory* td = gROOT->GetDirectory(dName);
if (td){
TList* tkl = td->GetListOfKeys();
unsigned int tklSize = tkl->GetEntries();
// std::cout<<"\t size "<<tklSize<<std::endl;
for (unsigned int iK=0; iK< tklSize; ++iK){
// std::cout<<"at "<<iK<<"\t " <<tkl->At(iK)->GetName()<<std::endl;
if (TClass(((TKey*)tkl->At(iK))->GetClassName()).InheritsFrom("TDirectory")){
TDirectory* tdc = (TDirectory*)((TKey*)tkl->At(iK))->ReadObj();
if (tdc ==0) continue;
TString tdcPFull(tdc->GetPath());
TString pRel(tdcPFull.Tokenize(":")->At(1)->GetName());
// std::cout<<tdcPFull.Data()<<std::endl;
//now execute compare
// if(pRel.Index("/SiStrip/")>=0) continue; //this takes a huge time in alcareco and is irrelevant
///DQMData/Run 1/Btag
if (patt==0 || (patt!=0 && pRel.Index(patt)>=0)){
// std::cout<<"Comparing in " <<pRel.Data()<<std::endl;
compareInDir(f1, f2, pRel.Data(),logmod,dOpt);
}
cmpLRD(f1, f2, tdcPFull.Data(), patt,logmod,dOpt);
}
}
}
}
示例3: dataMgr
//-----------------------------------------------------------------------------
/// Switch to object directory (=Parent directory)
TDirectory* RootHistCnv::RConverter::changeDirectory(DataObject* pObject)
//-----------------------------------------------------------------------------
{
if ( pObject ) {
IRegistry* pReg = pObject->registry();
if ( pReg ) {
SmartIF<IDataManagerSvc> dataMgr(dataProvider());
if ( dataMgr.isValid() ) {
IRegistry* pParentReg = 0;
StatusCode status = dataMgr->objectParent(pReg, pParentReg);
if ( status.isSuccess() ) {
IOpaqueAddress* pParAddr = pParentReg->address();
if ( pParAddr ) {
TDirectory* pParentDir = (TDirectory*)pParAddr->ipar()[0];
if ( pParentDir ) {
gDirectory->cd(pParentDir->GetPath());
return pParentDir;
}
}
}
}
}
}
return 0;
}
示例4: bbtt_upg_em
void bbtt_upg_em(std::string var,int nbins, double xmin, double xmax,std::string xtitle, std::string ytitle, double sigscale=1)
{
TFile *outDC = new TFile("hh_em_inputs.root","RECREATE");
SetStyle(); gStyle->SetLineStyleString(11,"20 10");
TH1::SetDefaultSumw2(1);
//std::string dir = "/data/blue/Bacon/029a/Upgrade/merged_talk_jun30/";
std::string dir = "/afs/cern.ch/work/j/jlawhorn/public/ntuples/";
std::stringstream scale; scale << sigscale;
//Cut definitions
double luminosity = 3000;
std::stringstream lumi; lumi << luminosity;
std::string objcut = "(tauCat1==3 && tauCat2==2 && ptTau1>20 && ptTau2>20 && tauIso2<0.4 && tauIso1<0.4 && (bTag1==2||bTag1==3||bTag1==6||bTag1==7) && (bTag2==1||bTag2==3||bTag2==6||bTag2==7) && ptB1>20 && ptB2>20 && sqrt( (etaTau1-etaTau2)**2 + (phiTau1-phiTau2)**2 )>0.4)";
std::string jetcut = objcut+"*(mTT>20 && mTT<90)*(mBB1>70 && mBB1<140)*(mt2pileup>100)*(bdtVal>-0.05)";
//signal region
std::string mccut = jetcut+"*eventWeight*"+lumi.str();
std::string sigcut = jetcut+"*eventWeight*"+lumi.str();
std::string zjetcut = jetcut+"*eventWeight*(eventType==4)*"+lumi.str();
std::string wjetcut = jetcut+"*eventWeight*(eventType==3)*"+lumi.str();
std::string ewkcut = jetcut+"*eventWeight*(eventType!=1)*"+lumi.str();
//--------------------------------------------------------------------------
//Get the trees
TTree *hhtree = load(dir+"HHToTTBB_14TeV.root");
TTree *tttree = load(dir+"tt.root");
//TTree *vbfhtree = load(dir+"VBFToTT_14TeV_phase2.root");
//TTree *gfhtree = load(dir+"H.root");
//TTree *vjettree = load(dir+"Vjets.root");
//TTree *ewktree = load(dir+"diboson.root");
//-------------------------------------------------------------------------
//Get histograms
TCanvas *canv0 = MakeCanvas("canv", "histograms", 600, 600);
canv0->cd();
std::string vardraw;
/* TH1F *Ztt = new TH1F("DY","",nbins,xmin,xmax);
vardraw = var+">>"+"DY";
vjettree->Draw(vardraw.c_str(),zjetcut.c_str());
InitHist(Ztt , xtitle.c_str(), ytitle.c_str(), TColor::GetColor(248,206,104), 1001);*/
TH1F *ttbar = new TH1F("TTbar","",nbins,xmin,xmax);
vardraw = var+">>"+"TTbar";
tttree->Draw(vardraw.c_str(),mccut.c_str());
InitHist(ttbar, xtitle.c_str(), ytitle.c_str(), TColor::GetColor(155,152,204), 1001);
/* TH1F *wjets = new TH1F("Wjets","",nbins,xmin,xmax);
vardraw = var+">>"+"Wjets";
vjettree->Draw(vardraw.c_str(),wjetcut.c_str());
InitHist(wjets, xtitle.c_str(), ytitle.c_str(), TColor::GetColor(222,90,106), 1001);
TH1F *ewk = new TH1F("Ewk","",nbins,xmin,xmax);
vardraw = var+">>"+"Ewk";
ewktree->Draw(vardraw.c_str(),ewkcut.c_str());
InitHist(ewk, xtitle.c_str(), ytitle.c_str(), TColor::GetColor(222,90,106), 1001);
TH1F *vbfh = new TH1F("VBFH","",nbins,xmin,xmax);
vardraw = var+">>"+"VBFH";
vbfhtree->Draw(vardraw.c_str(),mccut.c_str());
InitHist(vbfh, xtitle.c_str(), ytitle.c_str(), TColor::GetColor(250,202,255), 1001);
TH1F *ggh = new TH1F("GGH","",nbins,xmin,xmax);
vardraw = var+">>"+"GGH";
gfhtree->Draw(vardraw.c_str(),mccut.c_str());
InitHist(ggh, xtitle.c_str(), ytitle.c_str(), TColor::GetColor(250,202,255), 1001);*/
TH1F *smhh = new TH1F("SMhh","",nbins,xmin,xmax);
vardraw = var+">>"+"SMhh";
hhtree->Draw(vardraw.c_str(),sigcut.c_str());
InitSignal(smhh);
smhh->SetLineColor(kBlack);
delete canv0;
//---------------------------------------------------------------------------
//Print out the yields
Double_t error=999;
//ofstream outfile;
//outfile.open("yields.txt");
//outfile << "Yields for the signal region." << std::endl;
cout << "SM hh " << smhh->IntegralAndError(0,smhh->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
/* outfile << "SM h " << smhh->IntegralAndError(0,smhh->GetNbinsX(),error) << "+/-" << error << endl;
outfile << "Ztt " << Ztt->IntegralAndError(0,Ztt->GetNbinsX(),error) << "+/-" << error << endl;*/
cout << "ttbar " << ttbar->IntegralAndError(0,ttbar->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
/* outfile << "ewk " << ewk->IntegralAndError(0,ewk->GetNbinsX(),error) << "+/-" << error << endl;
outfile << "wjets " << wjets->IntegralAndError(0,wjets->GetNbinsX(),error) << "+/-" << error << endl;*/
//--------------------------------------------------------------------------
//outfile.close();
outDC->cd();
TDirectory* lTD = outDC->mkdir("emu");
outDC->cd(lTD->GetPath());
ttbar->SetName("data_obs");
ttbar->SetTitle("data_obs");
ttbar->Write();
/*Ztt->SetName("ZTT");
Ztt->SetTitle("ZTT");
Ztt->Write();*/
ttbar->SetName("TT");
ttbar->SetTitle("TT");
ttbar->Write();
/*wjets->SetName("W");
wjets->SetTitle("W");
//.........这里部分代码省略.........
示例5: bbtt_upg_mt
//.........这里部分代码省略.........
cout << " VBF HH " << hh_vbf->IntegralAndError(0,hh_vbf->GetNbinsX(),error) << "+/-";
sigN+=smhh->IntegralAndError(0,smhh->GetNbinsX(),error);
sigSig+=error;
cout << error << endl; error=999;
cout << "ttbar " << ttbar->IntegralAndError(0,ttbar->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
bgdN+=ttbar->IntegralAndError(0,ttbar->GetNbinsX(),error);bgdSig+=error*error;
cout << "Ztt " << Ztt->IntegralAndError(0,Ztt->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
bgdN+=Ztt->IntegralAndError(0,Ztt->GetNbinsX(),error);bgdSig+=error*error;
cout << "ewk " << ewk->IntegralAndError(0,ewk->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
bgdN+=ewk->IntegralAndError(0,ewk->GetNbinsX(),error);bgdSig+=error*error;
cout << "wjets " << wjets->IntegralAndError(0,wjets->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
bgdN+=wjets->IntegralAndError(0,wjets->GetNbinsX(),error);bgdSig+=error*error;
cout << "ggH " << ggh->IntegralAndError(0,ggh->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
bgdN+=ggh->IntegralAndError(0,ggh->GetNbinsX(),error);bgdSig+=error*error;
cout << "vbfH " << vbfh->IntegralAndError(0,vbfh->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
bgdN+=vbfh->IntegralAndError(0,vbfh->GetNbinsX(),error);bgdSig+=error*error;
cout << "vH/ttH " << assoh->IntegralAndError(0,assoh->GetNbinsX(),error) << "+/-";
cout << error << endl; error=999;
bgdN+=assoh->IntegralAndError(0,assoh->GetNbinsX(),error); bgdSig+=error*error;
cout << "S = " << sigN << "+/-" << sigSig << endl;
cout << "B = " << bgdN << "+/-" << TMath::Sqrt(bgdSig) << endl;
cout << "S/sqrt(B) = " << sigN/TMath::Sqrt(bgdN) << endl;
//--------------------------------------------------------------------------
//outfile.close();
outDC->cd();
TDirectory* lTD = outDC->mkdir("mutau");
outDC->cd(lTD->GetPath());
ttbar->SetName("data_obs");
ttbar->SetTitle("data_obs");
ttbar->Write();
Ztt->SetName("ZTT");
Ztt->SetTitle("ZTT");
Ztt->Write();
ttbar->SetName("TT");
ttbar->SetTitle("TT");
ttbar->Write();
wjets->SetName("W");
wjets->SetTitle("W");
wjets->Write();
ewk->SetName("VV");
ewk->SetTitle("VV");
ewk->Write();
vbfh->SetName("qqH");
vbfh->SetTitle("qqH");
vbfh->Write();
ggh->SetName("ggH");
ggh->SetTitle("ggH");
ggh->Write();
assoh->SetName("assoH");
assoh->SetTitle("assoH");
assoh->Write();
smhh->SetName("ggHH");
smhh->SetTitle("ggHH");
smhh->Write();
hh_0->SetName("lam0");
hh_0->SetTitle("lam0");
hh_0->Write();
hh_m5->SetName("lamm5");
hh_m5->SetTitle("lamm5");