00001 class StGammaEvent;
00002 class StGammaTreeReader;
00003 class StGammaCandidate;
00004
00005 #define __TEST__
00006
00007 TFile *file = 0;
00008 TTree *tree = 0;
00009 TChain *chain = 0;
00010
00011 StGammaEvent *event = 0;
00012 StGammaTreeReader *reader = 0;
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 void runGammaTreeReader( int nevents=-1,
00027 const Char_t *fname = "/auto/pdsfdv34/starspin/jwebb/2008/02-29-2008-gammas-with-preshower/7864/7136073/",
00028 const Char_t *oname = "testgammas.root" )
00029 {
00030
00031 gROOT->LoadMacro("StRoot/StGammaMaker/macros/loadGammaLibs.C");
00032 loadGammaLibs();
00033
00034
00035 reader = new StGammaTreeReader("gammas","GammaEvent");
00036 reader -> Init();
00037
00038
00039 chainFiles( "/auto/pdsfdv34/starspin/jwebb/2008/02-29-2008-gammas-with-preshower/7864/7136073/");
00040 chainFiles( "/auto/pdsfdv34/starspin/jwebb/2008/02-29-2008-gammas-with-preshower/7864/7136080/");
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 Int_t tryRuns[] = { 7136073, 7136073, 7136073, 7136080, 7136080, 7136080 };
00069 Int_t tryEvents[] = { 2721, 3548, 25769, 81133, 81155, 81198 };
00070
00071 for ( Int_t ii=0;ii< sizeof(tryRuns)/sizeof(Int_t);ii++ )
00072 {
00073
00074 if ( !reader->getEvent( tryRuns[ii], tryEvents[ii] ) )
00075 {
00076 std::cout << Form("run %i event %i does not seem to exist",tryRuns[ii], tryEvents[ii]) << std::endl;
00077 }
00078 else
00079 {
00080 std::cout << Form("run %i event %i exists and is ready to be used ",tryRuns[ii], tryEvents[ii]) << std::endl;
00081 StGammaEvent *event = reader->event();
00082
00083 }
00084
00085 }
00086
00087 }
00088
00089
00090
00091
00092
00093
00094
00095
00096 void chainFiles(const Char_t *path, const Char_t *filt=".root")
00097 {
00098 std::cout << std::endl;
00099 std::cout << "*************************************************************************" << std::endl;
00100 std::cout << std::endl;
00101 std::cout << "Chaining: " << path << std::endl;
00102 std::cout << std::endl;
00103 std::cout << "*************************************************************************" << std::endl;
00104 std::cout << std::endl;
00105 TString pwd = gSystem->pwd();
00106 TSystemDirectory dir("dir",path);
00107 TIter next( dir.GetListOfFiles() );
00108 Int_t nn=0;
00109 TObject *file = 0;
00110 while ( file = (TObject*)next() )
00111 {
00112 TString name=path;name+=file->GetName();
00113 if ( name.Contains(filt) ) {
00114 reader->chainFile( name );
00115 nn++;
00116 }
00117
00118 }
00119 gSystem->cd(pwd.Data());
00120 }
00121