00001 class StChain;
00002 class StMuEmcCollection;
00003
00004 class StEEmcDb;
00005 class StMuDstMaker;
00006 class TChain;
00007
00008 StEEmcDb *myDb;
00009 StMuDstMaker* muMk;
00010 StChain *chain=0;
00011
00012 int rdMu2histoExample( int nEve=5000 ){
00013
00014 Int_t nFiles = 1;
00015 char* file="st_physics_12108020_raw_1020001.MuDst.root";
00016 char* inDir = "/star/data05/scratch/balewski/mu2011/";
00017 TString fullName=file;
00018
00019 gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
00020 loadSharedLibraries();
00021 cout << " loading done " << endl;
00022 gSystem->Load("StDbLib");
00023 gSystem->Load("StDbBroker");
00024 gSystem->Load("St_db_Maker");
00025 gSystem->Load("StEEmcUtil");
00026 gSystem->Load("StEEmcDbMaker");
00027 gSystem->Load("StEzExample");
00028
00029
00030 chain = new StChain("StChain");
00031
00032 printf("adding muDst from run '%s' ....\n",fullName.Data());
00033
00034
00035 muMk = new StMuDstMaker(0,0,inDir,fullName,".MuDst.root",nFiles);
00036
00037 muMk->SetStatus("*",0);
00038 muMk->SetStatus("MuEvent",1);
00039 muMk->SetStatus("EmcTow",1);
00040
00041 TChain* tree=muMk->chain(); assert(tree);
00042 int nEntries=tree->GetEntries();
00043 printf("total eve in chain =%d\n",nEntries);
00044
00045
00046
00047 St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
00048 new StEEmcDbMaker("eemcDb");
00049 gMessMgr->SwitchOff("D");
00050 gMessMgr->SwitchOff("I");
00051
00052 TObjArray HList;
00053
00054 myMk3=new StEEtowerExampleMaker("eeExample","MuDst");
00055 myMk3->Set(&HList);
00056
00057 chain->ls();
00058 chain->Init();
00059
00060
00061
00062
00063 chain->Clear();
00064 stat = chain->Make();
00065
00066 int eventCounter=0;
00067 int stat=0;
00068 int t1=time(0);
00069
00070 while ( stat==0 ) {
00071 if(eventCounter>=nEve) break;
00072 eventCounter++;
00073 chain->Clear();
00074 stat = chain->Make();
00075 if(eventCounter%500==0)
00076 printf("\n ====================%d processing ============\n", eventCounter);
00077
00078 }
00079 printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
00080
00081 int t2=time(0);
00082 if(t2==t1) t2=t1+1;
00083 float rate=1.*nEve/(t2-t1);
00084 printf("sorting done %d of nEve=%d, CPU rate=%.1f Hz\n",eventCounter,nEntries,rate);
00085
00086 chain->Finish();
00087
00088
00089
00090 HList.ls();
00091 myMk3->saveHisto("aaa");
00092
00093 }