00001
00002 class StMuDstMaker;
00003 class HistMaker;
00004
00005 StMuDstMaker* maker;
00006 HistMaker* myHistMaker;
00007
00008 void TestFilter(const char* indir, const char* infile, const char* outfile)
00009 {
00010 if (gClassTable->GetID("TTable") < 0) gSystem->Load("libTable");
00011 gSystem->Load("St_base");
00012 gSystem->Load("StChain");
00013 gSystem->Load("St_Tables");
00014 gSystem->Load("StMagF");
00015 gSystem->Load("StUtilities");
00016 gSystem->Load("StTreeMaker");
00017 gSystem->Load("StIOMaker");
00018 gSystem->Load("StarClassLibrary");
00019 gSystem->Load("StTpcDb");
00020 gSystem->Load("StDbUtilities");
00021 gSystem->Load("StEvent");
00022 gSystem->Load("StEventUtilities");
00023 gSystem->Load("StMcEvent");
00024 gSystem->Load("StMcEventMaker");
00025 gSystem->Load("StAssociationMaker");
00026 gSystem->Load("StMcAnalysisMaker");
00027 gSystem->Load("StStrangeMuDstMaker");
00028 gSystem->Load("StMuDSTMaker");
00029 gSystem->Load("JetFinder");
00030
00031 cout << " loading done " << endl;
00032
00033 StMuDebug::setLevel(0);
00034
00035 int iret=0;
00036 cout <<" --- Create StMuDstMaker --- "<<endl;
00037 maker = new StMuDstMaker(0,0,indir,"",infile,1);
00038
00039 cout <<" --- Set Cuts ---"<<endl;
00040
00041 AnaCuts cuts;
00042 cuts.ptCut = 1.0;
00043 cuts.pseudoRapidityCutOff = 1.5;
00044 cuts.minNumberOfFitPoints = 22;
00045 cuts.minNumberOfPoints = 25;
00046 cuts.verbose=true;
00047
00048 cout <<" --- Create Filter ---"<<endl;
00049
00050 enum ioType {kWrite=0, kRead=1};
00051
00052 myFilter = new StJetFilter(kWrite,outfile);
00053 myFilter.setCuts(cuts);
00054
00055 cout <<" --- Loop on events ---"<<endl;
00056
00057
00058
00059
00060 int nEvents = 1000;
00061 int iret = 0;
00062
00063 for (int iev=0; iev<nEvents && iret!=4; ++iev) {
00064 iret = maker->Make();
00065 cout <<"iret:\t"<<iret<<endl;
00066 if (iret!=4) {
00067 myFilter->fill(maker);
00068
00069
00070 TClonesArray* tracks = myFilter->event()->tracks();
00071 cout <<"------------ From Macro -------"<<endl;
00072 int nTracks = tracks->GetLast()+1;
00073 for (int i=0; i<nTracks; ++i) {
00074 StMuTrack* track = static_cast<StMuTrack*>(tracks->operator[](i));
00075 cout <<"momentum:\t"<<track->p()<<endl;
00076 }
00077 }
00078 }
00079
00080
00081 int nEntries = myFilter->nEvents();
00082 cout <<"\n\n Wrote file:\t"<<outfile<<"\twith number of entries:\t"<<nEntries<<endl;
00083
00084 delete maker;
00085 maker=0;
00086 delete myFilter;
00087 myFilter=0;
00088
00089
00090 cout <<"tack int onto filename"<<endl;
00091 char* newfile = new char[1000];
00092 sprintf(newfile,"%s_has_%i_events",outfile,nEntries);
00093
00094 cout <<"concat the unix command"<<endl;
00095 char* command = new char[2000];
00096 sprintf(command,"mv %s %s",outfile, newfile);
00097
00098 cout <<"Get TUnixSystem"<<endl;
00099 TUnixSystem* sys = static_cast<TUnixSystem*>(gSystem);
00100
00101 cout <<"copy a file from:\t"<<outfile<<"\t to:\t"<<newfile<<endl;
00102 cout <<"command is:\t"<<command<<endl;
00103 sys->Exec(command);
00104 cout <<"Done"<<endl;
00105 }
00106