00001
00002
00003
00004
00005
00006
00007 int total=0;
00008
00009 void rdMu2binL2eve( int nevents = 100,
00010 int flagMC=0,
00011 char *file="R9067013.lis")
00012 {
00013
00014 if (flagMC) file="mit0029.lis";
00015
00016
00017 int nFiles = 100;
00018
00019 char *eemcSetupPath="/star/institutions/mit/balewski/StarTrigSimuSetup2008/";
00020 TString outDir="./out2/";
00021 char *dirIn ="./";
00022
00023
00024 gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
00025 loadSharedLibraries();
00026 assert( !gSystem->Load("StDetectorDbMaker"));
00027 assert( !gSystem->Load("StDbUtilities"));
00028 assert( !gSystem->Load("StDbBroker"));
00029 assert( !gSystem->Load("St_db_Maker"));
00030 assert( !gSystem->Load("StEEmcUtil"));
00031 assert( !gSystem->Load("StEEmcDbMaker"));
00032 assert( !gSystem->Load("StDaqLib"));
00033 assert( !gSystem->Load("StEmcRawMaker"));
00034 assert( !gSystem->Load("StEmcADCtoEMaker"));
00035 if (flagMC) {
00036 assert( !gSystem->Load("StMcEvent"));
00037 assert( !gSystem->Load("StMcEventMaker"));
00038 assert( !gSystem->Load("StEmcSimulatorMaker"));
00039 assert( !gSystem->Load("StEpcMaker"));
00040 }
00041 assert( !gSystem->Load("StTriggerUtilities"));
00042
00043 gROOT->Macro("LoadLogger.C");
00044 cout << " loading done " << endl;
00045
00046 StChain *chain= new StChain("StChain");
00047
00048
00049 printf(" dirIn=%s= file=%s=\n",dirIn,file);
00050 StMuDstMaker* muDstMaker =new StMuDstMaker(0,0,dirIn,file,"MuDst.root",nFiles);
00051
00052 TChain* tree=muDstMaker->chain(); assert(tree); int nEntries=(int) tree->GetEntries();
00053 cout << "Avaliable number of events " << nEntries << endl;
00054
00055
00056 St_db_Maker* dbMk = new St_db_Maker("StarDb","MySQL:StarDb","MySQL:StarDb","$STAR/StarDb");
00057
00058
00059
00060 if(flagMC) {
00061 dbMk->SetDateTime(20080307, 83000);
00062 }
00063
00064
00065 new StEEmcDbMaker("eemcDb");
00066
00067
00068 StEmcADCtoEMaker *a2eMk = new StEmcADCtoEMaker();
00069 a2eMk->saveAllStEvent(true);
00070
00071
00072
00073
00074
00075
00076
00077 StGenericL2Emulator* simL2Mk=new StL2_2008EmulatorMaker;
00078 assert(simL2Mk);
00079 simL2Mk->setSetupPath(eemcSetupPath);
00080 simL2Mk->setOutPath(outDir.Data());
00081 if (flagMC) simL2Mk->setMC();
00082
00083
00084
00085 new StJanEventMaker;
00086
00087 chain->ls(3);
00088 chain->Init();
00089
00090 int t1=time(0);
00091
00092 for (Int_t iev=0;iev<nevents; iev++) {
00093 cout << "\n****************************************** " << endl;
00094 cout << "Working on eventNumber:\t" << iev <<"\tof:\t"<<nevents<<endl;
00095 cout << "****************************************** " << endl;
00096 chain->Clear();
00097 int iret = chain->Make(iev);
00098 total++;
00099 if (iret % 10 == kStEOF || iret % 10 == kStFatal) {
00100 cout << "Bad return code!" << endl;
00101 break;
00102 }
00103 }
00104 int t2=time(0);
00105 if(t2==t1) t2=t1+1;
00106 float tMnt=(t2-t1)/60.;
00107 float rate=1.*total/(t2-t1);
00108
00109 chain->Finish();
00110 cout << "****************************************** " << endl;
00111 cout << "total number of events " << total << endl;
00112 cout << "****************************************** " << endl;
00113
00114
00115 TString fileMu=file;
00116 printf("=%s=\n",fileMu.Data());
00117 if(fileMu.Contains(".lis")) fileMu.ReplaceAll(".lis",".trgSim");
00118 if(fileMu.Contains(".MuDst.root")) fileMu.ReplaceAll(".MuDst.root",".trgSim");
00119 cout <<Form("sorting done %d of nEve=%d, CPU rate=%.1f Hz, total time %.1f minute(s) \n\n",total,nEntries,rate,tMnt)<<endl;
00120
00121 }
00122