00001 #include <iostream>
00002
00003
00004 #include "StHbtMaker.h"
00005 #include "StHbtManager.h"
00006 #include "StHbtAnalysis.h"
00007 #include "franksTrackCut.h"
00008 #include "trackCutMonitor_P_vs_Dedx.h"
00009 #include "mikesEventCut.h"
00010 #include "mikesPairCut.h"
00011 #include "StHbtAsciiReader.h"
00012 #include "StHbtBinaryReader.h"
00013 #include "MinvCorrFctn.h"
00014
00015 void wait(int n=1) {
00016 for ( int i=0; i<n*1e6; i++) { }
00017 }
00018 void mess(const char* c="alive") {
00019 for ( int i=0; i<10; i++) { cout << c << endl; }
00020 }
00021
00022
00023
00024 #ifdef __ROOT__
00025 int hbt(int argc, char* argv[]) {
00026 #else
00027 int main(int argc, char* argv[]) {
00028 #endif
00029
00030 int nevents;
00031 char* fileType;
00032 char* fileName;
00033
00034 switch (argc) {
00035 case 4:
00036 nevents = atoi(argv[1]);
00037 fileType=argv[2];
00038 fileName=argv[3];
00039 break;
00040 default:
00041 cout << "usage: hbt nevents asc/bin filename" << endl;
00042 return -1;
00043 }
00044 cout << " nevents = " << nevents << endl;
00045 cout << " fileType = " << fileType << endl;
00046 cout << " fileName = " << fileName << endl;
00047
00048 char* fileAppendix = fileName+strlen(fileName) -4 ;
00049 cout << " fileAppendix = " << fileAppendix << endl;
00050
00051
00052
00053 StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
00054 cout << "StHbtMaker instantiated"<<endl;
00055
00056 cout << "StHbtMaker::Init - setting up Reader and Analyses..." << endl;
00057 StHbtManager* TheManager = hbtMaker->HbtManager();
00058
00059
00060
00061
00062 StHbtAsciiReader* ascReader;
00063 StHbtBinaryReader* binReader;
00064 if ( !strcmp(fileType,"asc") ) {
00065 ascReader = new StHbtAsciiReader;
00066 ascReader->SetFileName(fileName);
00067 TheManager->SetEventReader(ascReader);
00068 }
00069 else if ( !strcmp(fileType,"bin") ) {
00070 binReader = new StHbtBinaryReader(0,fileName,0);
00071 cout << " now parse files " << endl;
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 TheManager->SetEventReader(binReader);
00083 }
00084 else {
00085 cout << "unknown fileType : " << fileType << endl;
00086 return -2;
00087 }
00088 cout << "READER SET UP.... " << endl;
00089
00090
00091
00092 franksTrackCut* aParticleCut = new franksTrackCut;
00093 aParticleCut->SetNSigmaPion(+3.0,1.e5);
00094 aParticleCut->SetNSigmaKaon(-2.,2.);
00095 aParticleCut->SetNSigmaProton(-1.e5,-1.0);
00096 aParticleCut->SetNHits(5,50);
00097 aParticleCut->SetP(0.23,1.0);
00098 aParticleCut->SetPt(0.0,2.0);
00099 aParticleCut->SetRapidity(-1.5,1.5);
00100 aParticleCut->SetDCA(0,2.);
00101 aParticleCut->SetCharge(+1);
00102 aParticleCut->SetMass(0.494);
00103
00104 trackCutMonitor_P_vs_Dedx* aDedxMoniPos = new trackCutMonitor_P_vs_Dedx(+1,"P_vs_Dedx +","Momentum (GeV/c) vs Energy loss (a.u.)",
00105 100,0.,1.2,100,0.,1e-5);
00106 trackCutMonitor_P_vs_Dedx* aDedxMoniNeg = new trackCutMonitor_P_vs_Dedx(-1,"P_vs_Dedx -","Momentum (GeV/c) vs Energy loss (a.u.)",
00107 100,0.,1.2,100,0.,1e-5);
00108
00109
00110
00111
00112
00113
00114 StHbtAnalysis* phiAnal = new StHbtAnalysis;
00115 phiAnal = new StHbtAnalysis;
00116
00117 mikesEventCut* phiEvcut = new mikesEventCut;
00118 phiEvcut->SetEventMult(000,100000);
00119 phiEvcut->SetVertZPos(-35.0,35.0);
00120
00121
00122
00123 phiAnal->SetEventCut(phiEvcut);
00124
00125 franksTrackCut* kaonTrkcut = new franksTrackCut( *aParticleCut );
00126
00127 trackCutMonitor_P_vs_Dedx* dedxMoniPosPass = new trackCutMonitor_P_vs_Dedx( *aDedxMoniPos);
00128 trackCutMonitor_P_vs_Dedx* dedxMoniPosFail = new trackCutMonitor_P_vs_Dedx( *aDedxMoniPos);
00129 kaonTrkcut->AddCutMonitor( dedxMoniPosPass, dedxMoniPosFail);
00130 phiAnal->SetFirstParticleCut(kaonTrkcut);
00131
00132 franksTrackCut* antikaonTrkcut = new franksTrackCut( *((franksTrackCut*)phiAnal->FirstParticleCut()) );
00133 antikaonTrkcut->SetCharge(-1);
00134 phiAnal->SetSecondParticleCut(antikaonTrkcut);
00135
00136 trackCutMonitor_P_vs_Dedx* dedxMoniNegPass = new trackCutMonitor_P_vs_Dedx( *aDedxMoniNeg);
00137 trackCutMonitor_P_vs_Dedx* dedxMoniNegFail = new trackCutMonitor_P_vs_Dedx( *aDedxMoniNeg);
00138 antikaonTrkcut->AddCutMonitor( dedxMoniNegPass, dedxMoniNegFail);
00139
00140 mikesPairCut* phiPairCut = new mikesPairCut;
00141
00142 phiAnal->SetPairCut(phiPairCut);
00143
00144 phiAnal->SetNumEventsToMix(5);
00145
00146
00147
00148
00149 MinvCorrFctn* MinvCF = new MinvCorrFctn("Minv",150,0.95,1.25);
00150 phiAnal->AddCorrFctn(MinvCF);
00151
00152 TheManager->AddAnalysis(phiAnal);
00153
00154
00155 int iret=0;
00156 iret = hbtMaker->Init();
00157 for (int iev=0;iev<nevents; iev++) {
00158 hbtMaker->Clear();
00159 iret = hbtMaker->Make();
00160 cout << "StHbtExample -- Working on eventNumber " << iev << endl;
00161 }
00162 iret = hbtMaker->Finish();
00163
00164 ((MinvCorrFctn*)((StHbtAnalysis*)hbtMaker->HbtManager()->Analysis(0))->CorrFctn(0))->Difference()->Draw();
00165
00166 return 0;
00167 }
00168
00169