00001 #include <iostream>
00002
00003
00004 #include "StHbtMaker.h"
00005 #include "StHbtManager.h"
00006 #include "StHbtVertexAnalysis.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 "QinvCorrFctn.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(-2.0,+2.0);
00094 aParticleCut->SetNSigmaAntiElectron(-2.0,+2.0);
00095 aParticleCut->SetNHits(5,50);
00096 aParticleCut->SetP(0.23,1.0);
00097 aParticleCut->SetPt(0.0,2.0);
00098 aParticleCut->SetRapidity(-1.5,1.5);
00099 aParticleCut->SetDCA(0,2.);
00100 aParticleCut->SetCharge(+1);
00101 aParticleCut->SetMass(0.494);
00102
00103 trackCutMonitor_P_vs_Dedx* aDedxMoniPos = new trackCutMonitor_P_vs_Dedx(+1,"P_vs_Dedx +","Momentum (GeV/c) vs Energy loss (a.u.)",
00104 100,0.,1.2,100,0.,1e-5);
00105 trackCutMonitor_P_vs_Dedx* aDedxMoniNeg = new trackCutMonitor_P_vs_Dedx(-1,"P_vs_Dedx -","Momentum (GeV/c) vs Energy loss (a.u.)",
00106 100,0.,1.2,100,0.,1e-5);
00107
00108
00109
00110
00111
00112
00113 StHbtVertexAnalysis* phiAnal = new StHbtVertexAnalysis(80,-40.,40.);
00114 phiAnal = new StHbtVertexAnalysis;
00115
00116 mikesEventCut* phiEvcut = new mikesEventCut;
00117 phiEvcut->SetEventMult(000,100000);
00118 phiEvcut->SetVertZPos(-40.0,40.0);
00119
00120 phiAnal->SetEventCut(phiEvcut);
00121
00122 franksTrackCut* kaonTrkcut = new franksTrackCut( *aParticleCut );
00123
00124 trackCutMonitor_P_vs_Dedx* dedxMoniPosPass = new trackCutMonitor_P_vs_Dedx( *aDedxMoniPos);
00125 trackCutMonitor_P_vs_Dedx* dedxMoniPosFail = new trackCutMonitor_P_vs_Dedx( *aDedxMoniPos);
00126 kaonTrkcut->AddCutMonitor( dedxMoniPosPass, dedxMoniPosFail);
00127 phiAnal->SetFirstParticleCut(kaonTrkcut);
00128 phiAnal->SetSecondParticleCut(kaonTrkcut);
00129
00130 mikesPairCut* phiPairCut = new mikesPairCut;
00131
00132 phiAnal->SetPairCut(phiPairCut);
00133
00134 phiAnal->SetNumEventsToMix(10);
00135
00136
00137
00138
00139 QinvCorrFctn* QinvCF = new QinvCorrFctn("Qinv",25,0,0.25);
00140 phiAnal->AddCorrFctn(QinvCF);
00141
00142 TheManager->AddAnalysis(phiAnal);
00143
00144
00145 int iret=0;
00146 iret = hbtMaker->Init();
00147 for (int iev=0;iev<nevents; iev++) {
00148 hbtMaker->Clear();
00149 iret = hbtMaker->Make();
00150 cout << "StHbtExample -- Working on eventNumber " << iev << endl;
00151 }
00152 iret = hbtMaker->Finish();
00153
00154 ((QinvCorrFctn*)((StHbtVertexAnalysis*)hbtMaker->HbtManager()->Analysis(0))->CorrFctn(0))->Ratio()->Draw();
00155
00156 return 0;
00157 }
00158
00159