00001 TChain *mTree = 0;
00002 TCanvas *c = 0;
00003
00004 void anachain( const Char_t *ddname = "/star/data05/scratch/jwebb/checkin/",
00005 const Char_t *pref="R5",
00006 const Char_t *ffname = ".root",
00007 Int_t nmax=50000
00008 )
00009 {
00010
00011 gROOT->LoadMacro("macros/loadlibs.C");
00012 loadlibs();
00013
00014 c = new TCanvas("c","A canvas",500,500);
00015
00016 mTree = new TChain("mTree","A pi0 tree");
00017
00018 TSystemDirectory *dir = new TSystemDirectory("pwd",ddname);
00019 TList *files = dir->GetListOfFiles();
00020 TIter next( files );
00021 TSystemFile *file = 0;
00022 Int_t nf = 0;
00023
00024 TList *listOfEmpties=new TList();
00025
00026 while ( (file = (TSystemFile *)next() ) ) {
00027
00028
00029
00030 TString fname = file -> GetName();
00031 if ( !fname.Contains(ffname) ) continue;
00032 if ( !fname.Contains(pref) ) continue;
00033 Bool_t pi0tree = 0;
00034
00037 TFile pfile( fname );
00038 TTree *mytree = (TTree *)pfile.Get("mTree");
00039 if ( mytree ) pi0tree = 1;
00040 pfile.Close();
00041
00042
00043 if ( pi0tree ) {
00044 std::cout << "Adding " << fname
00045 << " npi0tree=" << mTree->GetEntries()
00046 << std::endl;
00047
00048 mTree -> Add(fname+"/mTree");
00049 nf++;
00050 }
00051
00052 if ( nf > nmax ) break;
00053 }
00054
00055 std::cout << "-- anachain -----------------------------------" << std::endl;
00056 std::cout << std::endl;
00057 std::cout << "loaded " << nf << " files" << std::endl;
00058 }
00059
00060
00061
00062