modified from copyFiles.C in ROOT tutuorial  
More...
#include <string>
#include <iostream>
#include "TROOT.h"
#include "TKey.h"
#include "TFile.h"
#include "TSystem.h"
#include "TTree.h"
Go to the source code of this file.
modified from copyFiles.C in ROOT tutuorial 
- Author
- J.Kirk 
- Date
- Fri 11 Jan 2019 07:41:26 CET
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration 
Definition in file makeSmallRefFile.cxx.
◆ CopyDir()
      
        
          | void CopyDir | ( | TDirectory * | source, | 
        
          |  |  | bool | mkdirFlag | 
        
          |  | ) |  |  | 
      
 
Definition at line 30 of file makeSmallRefFile.cxx.
   32   printf(
"CopyDir called with sourcem mkdirFlag: %s , %d\n",
source->GetName(), mkdirFlag);
 
   37      adir = savdir->mkdir(
source->GetName());
 
   44    TIter nextkey(
source->GetListOfKeys());
 
   45    while ((
key = (TKey*)nextkey())) {
 
   46       const char *classname = 
key->GetClassName();
 
   47       TClass *
cl = gROOT->GetClass(classname);
 
   49       if (
cl->InheritsFrom(TDirectory::Class())) {
 
   51         printf(
"Directory: %s\n",
dirname);
 
   52     if ( (std::string(
dirname).
find(
"EF") !=std::string::npos)) printf (
"Found EF"); 
 
   53     if ( (std::string(
dirname).
find(
"L2") !=std::string::npos)) printf (
"Found L2"); 
 
   54     if ( (std::string(
dirname).
find(
"HLT") !=std::string::npos)) printf (
"Found HLT"); 
 
   55     if ( (std::string(
dirname).
find(
"Fast") !=std::string::npos)) printf (
"Found Fast"); 
 
   56     if ( (std::string(
dirname).
find(
"vs") !=std::string::npos)) printf (
"Found vs"); 
 
   58     if ( (std::string(
dirname).
find(
"EF") !=std::string::npos)   || (std::string(
dirname).
find(
"L2")!=std::string::npos) || (std::string(
dirname).
find(
"HLT")!=std::string::npos) || (std::string(
dirname).
find(
"Fast")!=std::string::npos)  || (std::string(
dirname).
find(
"vs")!=std::string::npos)   ) {
 
   60          printf(
"Directory OK will be copied: %s\n",
dirname);   
 
   67          printf(
"Directory will NOT be copied: %s\n",
dirname);
 
   71       } 
else if (
cl->InheritsFrom(TTree::Class())) {
 
   72          TTree *
T = (TTree*)
source->Get(
key->GetName());
 
   74          TTree *newT = 
T->CloneTree(-1,
"fast");
 
   78          TObject *
obj = 
key->ReadObj();
 
   80      if ( std::string(
key->GetClassName()).find(
"TH1")!=std::string::npos )   
obj->Write();
 
   85   adir->SaveSelf(kTRUE);
 
 
 
 
◆ CopyFile()
      
        
          | void CopyFile | ( | const char * | fname | ) |  | 
      
 
 
◆ main()
      
        
          | int main | ( | int | argc, | 
        
          |  |  | char ** | argv | 
        
          |  | ) |  |  | 
      
 
 
◆ makeSmallRefFile()
      
        
          | void makeSmallRefFile | ( | const std::string & | in, | 
        
          |  |  | const std::string & | out | 
        
          |  | ) |  |  | 
      
 
 
◆ usage()
      
        
          | int usage | ( | int | status = 0 | ) |  | 
      
 
Definition at line 116 of file makeSmallRefFile.cxx.
  117   std::cout << 
"Usage: makeSmallRefFile <intputfile> <outputfile>" << std::endl;