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


C++ TSystemFile::IsDirectory方法代码示例

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


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

示例1: create_file

void create_file(const char *dirname, TString filename, TString histoname, TString Prefix){
  
  TSystemDirectory dir(dirname, dirname);
  TList *fileslist = dir.GetListOfFiles();
  if (fileslist) {
    TSystemFile *systemfile;
    TString fname;
    TIter next(fileslist);
    while ((systemfile=(TSystemFile*)next())) {
      fname = systemfile->GetName();
      //cout<<fname<<endl;
      if (!systemfile->IsDirectory() && fname.Contains(filename+".root")) {
	cout<<Prefix<<endl;
	TFile* file  = new TFile(dirname+fname,"READ");
	TH1F* h1 = (TH1F*)file->Get(histoname);
	//if(!fname.Contains("Bpb_TW")) h1->Scale(0.25);
	//h1->Scale(15);
	TFile* file2  = new TFile("/nfs/dust/cms/user/multh/RunII_76X_v1/Limit/Tstar_comb.root","UPDATE");
	TString histname = h1->GetName();
	h1->SetName(Prefix+"__"+filename);
	h1->Write();
	file->Close();
	file2->Close();
      }
    }
  }
}
开发者ID:multh,项目名称:TstarSemiLeptonic,代码行数:27,代码来源:limit.C

示例2: AnalyseDirectory

void KVSimDir::AnalyseDirectory()
{
   // Read contents of directory given to ctor.
   // Each ROOT file will be analysed by AnalyseFile().

   Info("AnalyseDirectory", "Analysing %s...", GetDirectory());
   fSimData.Clear();
   fFiltData.Clear();
   //loop over files in current directory
   TSystemDirectory thisDir(".", GetDirectory());
   TList* fileList = thisDir.GetListOfFiles();
   TIter nextFile(fileList);
   TSystemFile* aFile = 0;
   while ((aFile = (TSystemFile*)nextFile())) {

      if (aFile->IsDirectory()) continue;

      KVString fileName = aFile->GetName();
      if (!fileName.EndsWith(".root"))  continue; /* skip non-ROOT files */

      AnalyseFile(fileName);

   }
   delete fileList;
}
开发者ID:GiuseppePast,项目名称:kaliveda,代码行数:25,代码来源:KVSimDir.cpp

示例3: get_filenames

void get_filenames(vector<TString> &names, const char *dirname=".", const char *ext=".root", const char *prefix = "uhh2")
{
  TSystemDirectory dir(dirname, dirname);
  TList *files = dir.GetListOfFiles();
  if (files) {
    TSystemFile *file;
    TString fname;
    TIter next(files);
    while ((file=(TSystemFile*)next())) {
      fname = file->GetName();
      if (!file->IsDirectory() && fname.EndsWith(ext) && fname.BeginsWith(prefix)) {
	names.push_back(TString(fname.Data()));
      }
    }
  }
}
开发者ID:isando3,项目名称:ThetaScripts,代码行数:16,代码来源:write_test_theta_file.C

示例4: BrowseHistograms

void BrowseHistograms(const char* histname) {

    fHistName=histname;

  TSystemDirectory dir(".",".");
  TList *files = dir.GetListOfFiles();
  if (!files) {
    cerr << "Error: No files found in " << fFileDir << endl;
    return;
  }
  files->Sort();


  histograms = new TList();
  saved = new TList();

  c = new TCanvas("canvas","Browse Histograms");

  TSystemFile *file;
  TIter next(files);
  Int_t n=0;
  TString fname;
  while ((file=(TSystemFile*)next())) {
    fname = file->GetName();
    if (!file->IsDirectory() && fname.EndsWith(".root")) {

      histograms->Add(new TObjString(fname));
      n++;
      //if(n>10)
      //	break;
    }
  }

  DrawCurrHistogram();

  TControlBar *bar = new TControlBar("vertical", "Control", 10, 10);
  bar->AddButton("Next","ProcessClick(1);", "Show next run");
  bar->AddButton("Next And Save","NextAndSave();", "Show previous run");
  bar->AddButton("Next And Forget","NextAndForget();", "Show previous run");
  bar->AddButton("Prev","ProcessClick(-1);", "Show previous run");
  bar->AddButton("Print saved","PrintSaved();", "Show previous run");
  bar->SetButtonWidth(90);
  bar->Show();
}
开发者ID:A2-Collaboration-dev,项目名称:ant,代码行数:44,代码来源:BrowseHistograms.C

示例5: dir

vector<TString> list_files(const char *dirname, const char *exp=".*HiForestAOD.*\\.root")
{
  vector<TString> names;
  TSystemDirectory dir(dirname, dirname);
  TList *files = dir.GetListOfFiles();
  if (files) {
    TSystemFile *file;
    TString fname;
    TIter next(files);
    while ((file=(TSystemFile*)next())) {
      fname = file->GetName();
      if (!file->IsDirectory() && fname.Contains(TRegexp(exp))) {
        names.push_back(TString(dirname)+"/"+fname);
      }
    }
  }
  if (names.size()==0) return {dirname};

  return names;
}
开发者ID:Jelov,项目名称:JetEnergy_SR,代码行数:20,代码来源:buildtupledata.C

示例6: addfiles

void addfiles(TChain *ch, const TString dirname=".", const TString ext=".root")
{
	bool verbose(false);
	TSystemDirectory dir(dirname, dirname);
	TList *files = dir.GetListOfFiles();
	if (files) {
		if (verbose) std::cout << "Found files" << std::endl;
		TSystemFile *file;
		TString fname;
		TIter next(files);
		while ((file=(TSystemFile*)next())) {
			fname = file->GetName();
			if (verbose) std::cout << "found fname " << fname << std::endl;
			if (!file->IsDirectory() && fname.BeginsWith(ext)) {
				if (verbose) std::cout << "adding fname " << fname << std::endl;
				ch->Add(fname);
			}
		}
	}
}
开发者ID:cms-tamu,项目名称:MuJetAnalysis,代码行数:20,代码来源:TrigEff.C

示例7: pwd

// Returns list of directorites or files in folder
vector<TString> dirlist(const TString &folder,
                        const TString &inname,
                        const TString &tag) {
    TString pwd(gSystem->pwd());
    vector<TString> v_dirs;
    TSystemDirectory dir(folder, folder);
    TList *files = dir.GetListOfFiles();
    if (files) {
        TSystemFile *file;
        TString fname;
        TIter next(files);
        while ((file=static_cast<TSystemFile*>(next()))) {
            fname = file->GetName();
            if (inname=="dir") {
                if ((file->IsDirectory() && !fname.Contains(".") && fname.Contains(tag))) v_dirs.push_back(fname);
            } else  if(fname.Contains(inname)) v_dirs.push_back(fname);
        }
    } // if(files)
    gSystem->cd(pwd); // The TSystemDirectory object seems to change current folder
    return v_dirs;
}
开发者ID:manuelfs,项目名称:analysis_code,代码行数:22,代码来源:utilities.cpp

示例8: CreateESDChain

TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20, Int_t offset = 0, Bool_t addFileName = kFALSE, Bool_t addFriend = kFALSE, const char* check = 0)
{
  // creates chain of files in a given directory or file containing a list.
  // In case of directory the structure is expected as:
  // <aDataDir>/<dir0>/AliESDs.root
  // <aDataDir>/<dir1>/AliESDs.root
  // ...
  //
  // if addFileName is true the list only needs to contain the directories that contain the AliESDs.root files
  // if addFriend is true a file AliESDfriends.root is expected in the same directory and added to the chain as friend
  // if check is != 0 the files that work are written back into the textfile with the name check

  if (!aDataDir)
    return 0;

  Long_t id, size, flags, modtime;
  if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
  {
    printf("%s not found.\n", aDataDir);
    return 0;
  }

  TChain* chain = new TChain("esdTree");
  TChain* chainFriend = 0;
  
  if (addFriend)
    chainFriend = new TChain("esdFriendTree");

  if (flags & 2)
  {
    TString execDir(gSystem->pwd());
    TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
    TList* dirList            = baseDir->GetListOfFiles();
    Int_t nDirs               = dirList->GetEntries();
    gSystem->cd(execDir);

    Int_t count = 0;

    for (Int_t iDir=0; iDir<nDirs; ++iDir)
    {
      TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
      if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
        continue;

      if (offset > 0)
      {
        --offset;
        continue;
      }

      if (count++ == aRuns)
        break;

      TString presentDirName(aDataDir);
      presentDirName += "/";
      presentDirName += presentDir->GetName();

      chain->Add(presentDirName + "/AliESDs.root/esdTree");
    }
  }
  else
  {
    // Open the input stream
    ifstream in;
    in.open(aDataDir);

    ofstream outfile;
    if (check)
      outfile.open(check);

    Int_t count = 0;

    // Read the input list of files and add them to the chain
    TString line;
    while (in.good())
    {
      in >> line;

      if (line.Length() == 0)
        continue;

      if (offset > 0)
      {
        offset--;
        continue;
      }

      if (count++ == aRuns)
        break;

      TString esdFile(line);

      if (addFileName)
        esdFile += "/AliESDs.root";
        
      TString esdFileFriend(esdFile);
      esdFileFriend.ReplaceAll("AliESDs.root", "AliESDfriends.root");
        
      if (check)
      {
//.........这里部分代码省略.........
开发者ID:alisw,项目名称:AliRoot,代码行数:101,代码来源:runPmdTask.C

示例9: TMVAClassification


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

  if (myMethodList != "") {
    for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;

    std::vector<TString> mlist = TMVA::gTools().SplitString( myMethodList, ',' );
    for (UInt_t i=0; i<mlist.size(); i++) {
      std::string regMethod(mlist[i]);

      if (Use.find(regMethod) == Use.end()) {
        std::cout << "Method \"" << regMethod << "\" not known in TMVA under this name. Choose among the following:" << std::endl;
        for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first << " ";
        std::cout << std::endl;
        return;
      }
      Use[regMethod] = 1;
    }
  }

  // Create a new root output file.
  TString outfileName = "TMVA";
  int toAppNum = 1;
  char name[1024];

  TSystemDirectory dir("",".");
  TList *files = dir.GetListOfFiles();
  vector<string> vfname;
  if (files) {
     TIter next(files);
     TSystemFile *file;
     TString fname;
     
     while ((file=(TSystemFile*)next())) {
        fname = file->GetName();
        if (!file->IsDirectory() && fname.EndsWith(".root") && fname.BeginsWith("TMVA")) {
           vfname.push_back(string(fname));
        }
      }
     delete files;
     if (vfname.size()>0) {
        std::sort(vfname.begin(),vfname.end());
        TString num = TString(vfname[vfname.size()-1]);
        num.ReplaceAll(".root","");
        num.ReplaceAll("TMVA","");
        toAppNum = num.Atoi()+1;
     }
  }
  sprintf(name,"%d",toAppNum);
  outfileName = outfileName + name + ".root";
  //TString outfileName( "TMVA.root" );
  TFile* outputFile = TFile::Open( outfileName, "RECREATE" );

  // Create the factory object. Later you can choose the methods
  // whose performance you'd like to investigate. The factory will
  // then run the performance analysis for you.
  //
  // The first argument is the base of the name of all the
  // weightfiles in the directory weight/ 
  //
  // The second argument is the output file for the training results
  // All TMVA output can be suppressed by removing the "!" (not) in 
  // front of the "Silent" argument in the option string
  TMVA::Factory *factory = new TMVA::Factory( "TMVAClassification", outputFile, 
                                              "!V:!Silent:Color:DrawProgressBar:Transformations=I;D;P;G,D" );

  // If you wish to modify default settings 
  // (please check "src/Config.h" to see all available global options)
开发者ID:aperloff,项目名称:TAMUWW,代码行数:67,代码来源:TMVAClassification.C

示例10: readFiles

void PValueCorrection::readFiles(TString name, int id, bool isPlugin){

	// read coverage test files
	name = "root/"+name;
	TSystemDirectory dir(name,name);
	TList *files = dir.GetListOfFiles();
	TChain *fChain = new TChain("tree");
	int foundFiles=0;
	if (files){
		TSystemFile *file;
		TString fname;
		TIter next(files);
		while ((file=(TSystemFile*)next())) {
			fname = file->GetName();
			if (!file->IsDirectory() && fname.Contains(Form("id%d",id)) && fname.EndsWith(".root")) {
				//cout << fname << endl;
				fChain->Add(name+"/"+fname);
				foundFiles++;
			}
		}
	}

	cout << "PValueCorrector::readFiles() -- found " << foundFiles << " files in " << dir.GetName() << " with total of " << fChain->GetEntries() << " entries" << endl;
	cout << "PValueCorrector::readFiles() -- will apply on the fly correction of type ";
	isPlugin ? cout << " plugin"<< endl : cout << " prob" << endl;

	// fill histogram from tree
	h_pvalue_before = new TH1F("h_pvalue_before","p-value",50,0.,1.);
	h_pvalue_after = new TH1F("h_pvalue_after","p-value",50,0.,1.);


	// set up root tree for reading
  float tSol = 0.0;
  float tChi2free = 0.0;
  float tChi2scan = 0.0;
  float tSolGen = 0.0;
  float tPvalue = 0.0;
  fChain->SetBranchAddress("sol",      &tSol);
  fChain->SetBranchAddress("chi2free", &tChi2free);
  fChain->SetBranchAddress("chi2scan", &tChi2scan);
  fChain->SetBranchAddress("solGen",   &tSolGen);
  fChain->SetBranchAddress("pvalue",   &tPvalue);

	// initialize loop variables
  Long64_t nentries = fChain->GetEntries();
  Long64_t nfailed = 0;
  float n68 =0.;
  float n95 =0.;
  float n99 =0.;

	for (Long64_t i = 0; i < nentries; i++)
	{
		fChain->GetEntry(i);
    // apply cuts (we'll count the failed ones later)
    if ( ! (tChi2free > -1e10 && tChi2scan > -1e10
         && tChi2scan-tChi2free>0
         && tSol != 0.0 ///< exclude some pathological jobs from when tSol wasn't set yet
         && tChi2free < 500 && tChi2scan < 500
      )){
			nfailed++;
      continue;
    }
		float pvalue = -999.;
		if (isPlugin) {
			pvalue = tPvalue;
		}
		else {
			pvalue = TMath::Prob(tChi2scan-tChi2free,1);
		}

		if ( pvalue > TMath::Prob(1,1) ) n68++;
		if ( pvalue > TMath::Prob(4,1) ) n95++;
		if ( pvalue > TMath::Prob(9,1) ) n99++;

		h_pvalue_before->Fill(pvalue);
	}

	fitHist(h_pvalue_before);
	if (verbose) printCoverage(n68,n95,n99,float(nentries-nfailed),"Before Correction");

	n68=0.;
	n95=0.;
	n99=0.;
	for (Long64_t i = 0; i < nentries; i++)
	{
		fChain->GetEntry(i);
    // apply cuts (we'll count the failed ones later)
    if ( ! (tChi2free > -1e10 && tChi2scan > -1e10
         && tChi2scan-tChi2free>0
         && tSol != 0.0 ///< exclude some pathological jobs from when tSol wasn't set yet
         && tChi2free < 500 && tChi2scan < 500
      )){
      continue;
    }
		float pvalue = -999.;
		if (isPlugin) {
			pvalue = transform(tPvalue);
		}
		else {
			pvalue = transform(TMath::Prob(tChi2scan-tChi2free,1));
//.........这里部分代码省略.........
开发者ID:KonstantinSchubert,项目名称:gammacombo,代码行数:101,代码来源:PValueCorrection.cpp

示例11: efficiency

int efficiency(char* path0) {
	char the_path[256];
    getcwd(the_path, 255);

    std::string path(path0);


  	unsigned found = path.find_last_of("/\\", path.size()-2);

    std::string dataPath(path.substr(0,found));
    std::string measurementFolder(path.substr(found+1));

	std::stringstream ss1(measurementFolder);
    std::string moduleName;
    std::getline(ss1, moduleName, '_');

	std::string rootFileName("commander_HREfficiency.root");
	std::string maskFileName("defaultMaskFile.dat");

	const bool FIDUCIAL_ONLY = true;
	const bool VERBOSE = true;

	int nTrigPerPixel = 50;
	int nPixels = 4160;
	int nTrig = nTrigPerPixel * nPixels;
	float pixelArea = 0.01 * 0.015; // cm^2
	float triggerDuration = 25e-9; //s

	int nRocs = 16;
	
	//search for XrarSpectrum folders in elComandante folder structure
    TSystemDirectory dir(path.c_str(), path.c_str());
    TList *files = dir.GetListOfFiles();
    std::vector<std::string> directoryList;
    if (files) {
      TSystemFile *file;
      TString fname;
      TIter next(files);
      while (file=(TSystemFile*)next()) {
         fname = file->GetName();
         if (file->IsDirectory()) {
         	std::string dirname(fname.Data());
         	if (dirname.find("HREfficiency") != std::string::npos) {
         		directoryList.push_back(dirname);
         	}
         }
      }
    }

    std::vector< std::vector< std::pair< int,int > > > maskedPixels;

    //sort!
	std::sort(directoryList.begin(), directoryList.end());

	std::vector< std::vector< double > > efficiencies;
	std::vector< std::vector< double > > efficiencyErrors;
	std::vector< std::vector< double > > rates;
	std::vector< std::vector< double > > rateErrors;


	for (int i=0;i<nRocs;i++) {
		std::vector< double > empty;
		efficiencies.push_back(empty);
		efficiencyErrors.push_back(empty);
		rates.push_back(empty);
		rateErrors.push_back(empty);
	}

	// loop over all commander_HREfficiency.root root files
	for (int i=0;i<directoryList.size();++i) {
		chdir(path.c_str());
		std::cout << "looking in directory <" << directoryList[i] << ">" << std::endl;

		std::ifstream testParameters(Form("%s/testParameters.dat", directoryList[i].c_str()));
		std::string line2;
		while (getline(testParameters, line2)) {
			std::transform(line2.begin(), line2.end(), line2.begin(), ::tolower);
			if (line2.find("highrate") != std::string::npos) {
				while (getline(testParameters, line2)) {
					if (line2.size() < 1) break;
					std::transform(line2.begin(), line2.end(), line2.begin(), ::tolower);
					size_t pos = line2.find("ntrig");
					if (pos != std::string::npos) {
						nTrigPerPixel = atoi(line2.substr(pos+6).c_str());
						nTrig = nTrigPerPixel * nPixels;
						std::cout << ">" << line2 << "< pos:" << pos << std::endl;
						std::cout << "number of triggers per pixel: " << nTrigPerPixel << std::endl;
					}
				}

			}
		}
		testParameters.close();


		// read masked pixels
	    maskedPixels.clear();
		for (int j=0;j<nRocs;j++) {
			std::vector< std::pair<int,int> > rocMaskedPixels;
			maskedPixels.push_back(rocMaskedPixels);
//.........这里部分代码省略.........
开发者ID:piberger,项目名称:pixelScripts,代码行数:101,代码来源:efficiency.cpp

示例12: CreateAODChain

TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)
{
  // creates chain of files in a given directory or file containing a list.
  // In case of directory the structure is expected as:
  // <aDataDir>/<dir0>/AliAOD.root
  // <aDataDir>/<dir1>/AliAOD.root
  // ...

  if (!aDataDir)
    return 0;

  Long_t id, size, flags, modtime;
  if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
  {
    printf("%s not found.\n", aDataDir);
    return 0;
  }

  TChain* chain = new TChain("aodTree");
  TChain* chaingAlice = 0;

  if (flags & 2)
  {
    TString execDir(gSystem->pwd());
    TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
    TList* dirList            = baseDir->GetListOfFiles();
    Int_t nDirs               = dirList->GetEntries();
    gSystem->cd(execDir);

    Int_t count = 0;

    for (Int_t iDir=0; iDir<nDirs; ++iDir)
    {
      TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
      if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
        continue;

      if (offset > 0)
      {
        --offset;
        continue;
      }

      if (count++ == aRuns)
        break;

      TString presentDirName(aDataDir);
      presentDirName += "/";
      presentDirName += presentDir->GetName();
      chain->Add(presentDirName + "/AliAOD.root/aodTree");
      // cerr<<presentDirName<<endl;
    }

  }
  else
  {
    // Open the input stream
    ifstream in;
    in.open(aDataDir);

    Int_t count = 0;

    // Read the input list of files and add them to the chain
    TString aodfile;
    while(in.good())
    {
      in >> aodfile;
      if (!aodfile.Contains("root")) continue; // protection

      if (offset > 0)
      {
        --offset;
        continue;
      }

      if (count++ == aRuns)
        break;

      // add aod file
      chain->Add(aodfile);
    }

    in.close();
  }

  return chain;

} // end of TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)
开发者ID:ktf,项目名称:AliPhysics,代码行数:88,代码来源:runFlowTaskCentralityKinkTrain.C


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