00001 class StChain;
00002 class StMuEmcCollection;
00003
00004 class StEEmcDbMaker;
00005 class StMuDstMaker;
00006 class TChain;
00007
00008 StEEmcDbMaker *myDb;
00009 StMuDstMaker* muMk;
00010 StChain *chain=0;
00011
00012
00013 int rdDb( char *outH="F7327", int idat=20050624, int itim=91958 ) {
00014
00015
00016 char* inDir = "/star/data05/scratch/balewski/2005-bXing-muDst4/171/";
00017 char* Rrun ="st_physics_6171021_raw_2020001.MuDst.root";
00018 Int_t nFiles = 1;
00019 int nEve=1;
00020
00021 char *outPath="iterF/";
00022
00023 gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
00024 loadSharedLibraries();
00025 cout << " loading done " << endl;
00026
00027 gSystem->Load("StDbLib");
00028 gSystem->Load("StDbBroker");
00029 gSystem->Load("St_db_Maker");
00030 gSystem->Load("StSpinDbMaker");
00031
00032
00033 chain = new StChain("StChain");
00034
00035 printf("adding muDst from '%s' ....\n",Rrun);
00036
00037 muMk = new StMuDstMaker(0,0,inDir,Rrun,"MuDst.root",nFiles);
00038 TChain* tree=muMk->chain(); assert(tree);
00039 int nEntries=(int)tree->GetEntries();
00040 printf("total eve in chain =%d\n",nEntries);
00041
00042 St_db_Maker *stDb = new St_db_Maker("StarDb", "MySQL:StarDb");
00043
00044 stDb->SetDateTime(idat,itim);
00045
00046 spDb=new StSpinDbMaker("spinDb");
00047
00048 gMessMgr->SwitchOff("D");
00049 gMessMgr->SwitchOn("I");
00050 hbxI=new TH1F("bXI","Intended fill pattern vs. STAR bXing; bXing at STAR IP",120,-0.5,119.5);
00051
00052
00053 int t1=time(0);
00054 chain->Init();
00055 int t2=time(0);
00056 printf("%d seconds used to Init() the chain\n",t2-t1);
00057
00058 chain->ls(3);
00059
00060 int eventCounter=0;
00061 int stat=0;
00062 t1=time(0);
00063
00064
00065 while ( 1 ) {
00066 if(eventCounter>=nEve) break;
00067 chain->Clear();
00068 stat = chain->Make();
00069 if(stat) break;
00070 eventCounter++;
00071 }
00072
00073 if(eventCounter>0) printf("sorting done, nEve=%d of :%d :%d :is missing\n",eventCounter, nEntries,-eventCounter+nEntries);
00074 t2=time(0);
00075 if(t2==t1) t2=t1+1;
00076 float rate=1.*eventCounter/(t2-t1);
00077 float nMnts=(t2-t1)/60.; printf("sorting done %d of nEve=%d, CPU rate=%.1f Hz tot %.1f minutes\n",eventCounter,nEntries,rate,nMnts);
00078
00079 TString fileH=outPath; fileH+=outH; fileH+=".hist.root";
00080 printf(" saving -->%s\n",fileH.Data());
00081 new TFile(fileH,"recreate");
00082
00083
00084
00085 const int * spin8bits=spDb->getSpin8bits();
00086 for(int bx=0;bx<120;bx++){
00087 bool isFilled=(spin8bits[bx] & 0x11)==0x11;
00088 if(isFilled) hbxI->Fill(bx);
00089 }
00090 hbxI->Write();
00091
00092 chain->Finish();
00093
00094
00095 }