00001
00002
00003
00004
00005
00006
00007
00008
00009 void MakeMiniMcTree(Int_t nevents=3,
00010 const char* MainFile="hijing_b0_3/rcf0147_01*geant.root",
00011 const char* outDir = "./",
00012 TString filePrefix="rcf")
00013 {
00014 gROOT->Macro("LoadLogger.C");
00015 gSystem->Load("St_base");
00016 gSystem->Load("StChain");
00017 gSystem->Load("St_Tables");
00018 gSystem->Load("StUtilities");
00019 gSystem->Load("StIOMaker");
00020 gSystem->Load("StarClassLibrary");
00021 gSystem->Load("StDetectorDbMaker");
00022 gSystem->Load("StTpcDb");
00023 gSystem->Load("StEvent");
00024 gSystem->Load("StEventMaker");
00025 gSystem->Load("StEmcUtil");
00026 gSystem->Load("StEEmcUtil");
00027 gSystem->Load("StMcEvent");
00028 gSystem->Load("StMcEventMaker");
00029 gSystem->Load("StAssociationMaker");
00030 gSystem->Load("StMcAnalysisMaker");
00031 gSystem->Load("StMiniMcEvent");
00032 gSystem->Load("StMiniMcMaker");
00033
00034 StChain chain;
00035
00036 StIOMaker ioMk("IO","r",MainFile,"bfcTree");
00037 ioMk.SetIOMode("r");
00038 ioMk.SetBranch("*",0,"0");
00039 ioMk.SetBranch("geantBranch",0,"r");
00040 ioMk.SetBranch("eventBranch",0,"r");
00041
00042 StMcEventMaker mcEventMk;
00043
00044 StAssociationMaker assocMk;
00045 assocMk.useInTracker();
00046
00047 TString filename = MainFile;
00048 int fileBeginIndex = filename.Index(filePrefix,0);
00049 filename.Remove(0,fileBeginIndex);
00050
00051 StMiniMcMaker miniMcMk;
00052 miniMcMk.setOutDir(outDir);
00053 miniMcMk.setPtCut(1.5);
00054 miniMcMk.setFileName(filename);
00055 miniMcMk.setFilePrefix(filePrefix);
00056
00057 StMcParameterDB* parameterDB = StMcParameterDB::instance();
00058 parameterDB->setXCutTpc(.5);
00059 parameterDB->setYCutTpc(.5);
00060 parameterDB->setZCutTpc(.5);
00061 parameterDB->setReqCommonHitsTpc(3);
00062
00063 TStopwatch total;
00064 TStopwatch timer;
00065 TMemStat memory;
00066
00067 chain.Init();
00068
00069 int i=0;
00070 while(i<nevents && chain.Make()==kStOk) {
00071 if(i % 500 == 0) {
00072 cout << "done with event " << i
00073 << "\tcpu: " << timer.CpuTime()
00074 << "\treal: " << timer.RealTime()
00075 << "\tratio: " << timer.CpuTime()/timer.RealTime() << endl;
00076 timer.Start();
00077 memory.PrintMem(NULL);
00078 }
00079 ++i;
00080 chain.Clear();
00081 }
00082
00083 chain.Finish();
00084 cout << "my macro processed " << i << " events"
00085 << "\tcpu: " << total.CpuTime()
00086 << "\treal: " << total.RealTime()
00087 << "\tratio: " << total.CpuTime()/total.RealTime() << endl;
00088 }
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098