00001 class StChain;
00002 StChain *chain;
00003 int total=0;
00004 TObjArray *HList=0;
00005 TFile *fd=0;
00006
00007 void RunJetSimuSkimReader(int nevents=100,
00008 const char* jetInFile = "/star/institutions/uky/jettrees/jets_pt35_01.root",
00009 const char* skimInFile = "/star/institutions/uky/jettrees/skim_pt35_01.root",
00010 const char* histfile = "pt35.hist.root")
00011 {
00012
00013
00014
00015
00016
00017
00018 gROOT->Macro("loadMuDst.C");
00019 gSystem->Load("StTpcDb");
00020 gSystem->Load("StDetectorDbMaker");
00021 gSystem->Load("StDbUtilities");
00022 gSystem->Load("StMcEvent");
00023 gSystem->Load("StMcEventMaker");
00024 gSystem->Load("StDaqLib");
00025 gSystem->Load("StEmcRawMaker");
00026 gSystem->Load("StEmcADCtoEMaker");
00027 gSystem->Load("StEpcMaker");
00028 gSystem->Load("StEmcSimulatorMaker");
00029 gSystem->Load("StDbBroker");
00030 gSystem->Load("St_db_Maker");
00031 gSystem->Load("StEEmcUtil");
00032 gSystem->Load("StEEmcDbMaker");
00033 gSystem->Load("StSpinDbMaker");
00034 gSystem->Load("StEmcTriggerMaker");
00035 gSystem->Load("StTriggerUtilities");
00036 gSystem->Load("StMCAsymMaker");
00037 gSystem->Load("StJetFinder");
00038 gSystem->Load("StJetSkimEvent");
00039 gSystem->Load("StJets");
00040 gSystem->Load("StJetMaker");
00041
00042 double pi = atan(1.0)*4.0;
00043 cout << " loading done " << endl;
00044
00045 chain= new StChain("StChain");
00046 chain->SetDebug(1);
00047 gMessMgr->SwitchOn("D");
00048 gMessMgr->SwitchOff("I");
00049
00050
00051 StJetSimuReader* jetReader = new StJetSimuReader("JetReader",0);
00052
00053 chain->Init();
00054
00055
00056
00057 jetReader->InitFile(jetInFile);
00058 jetReader->InitJetSkimFile(skimInFile);
00059 int ready = jetReader->preparedForDualRead();
00060 HList=new TObjArray ;
00061
00062
00063
00064 chain->PrintInfo();
00065
00066 for (Int_t iev=0;iev<nevents; iev++) {
00067 cout << "****************************************** " << endl;
00068 cout << "Working on eventNumber " << iev << endl;
00069 cout << "*************************1***************** " << endl;
00070 chain->Clear();
00071 int iret = chain->Make(iev);
00072 total++;
00073 if (iret) {
00074 cout << "Bad return code!" << endl;
00075 break;
00076 }
00077
00078
00079 }
00080 chain->Finish();
00081 cout << "****************************************** " << endl;
00082 cout << "total number of events " << total << endl;
00083 cout << "****************************************** " << endl;
00084
00085
00086 fd=new TFile(histfile,"recreate");
00087 cout<<"Opening "<<histfile<<endl;
00088 assert(fd->IsOpen());
00089 cout<<"Open Baby!"<<endl;
00090 HList->Write();
00091 printf("%d histos are written to '%s' ...\n",HList->GetEntries(),fd->GetName());
00092 fd->Close();
00093
00094 }
00095
00096 void setMacroPath()
00097 {
00098 TString path(gROOT->GetMacroPath());
00099 path = TString(gSystem->Getenv("STAR")) + "/StRoot/StJetMaker/macros:" + path;
00100 path = "./StRoot/StJetMaker/macros:" + path;
00101 path = "./StJetMaker/macros:" + path;
00102 path = "./macros:" + path;
00103 path = "../macros:" + path;
00104 path = ".:" + path;
00105 gROOT->SetMacroPath(path);
00106 }
00107
00108