00001
00002
00003
00004
00005
00006
00007 class StChain;
00008 StChain *chain=0;
00009
00010 void StTofAssociator(Int_t nevents=1,
00011 const char *MainFile="/afs/rhic/star/data/samples/*.geant.root",
00012 const char* histoFile="embedTOFp.root",
00013 const char* dirHistoFile="/auto/u/geurts/Embedding/tofp")
00014 {
00015
00016
00017 gSystem->Load("St_base");
00018 gSystem->Load("StChain");
00019
00020 gSystem->Load("St_Tables");
00021 gSystem->Load("StUtilities");
00022 gSystem->Load("StIOMaker");
00023 gSystem->Load("StarClassLibrary");
00024 gSystem->Load("StDetectorDbMaker");
00025
00026 gSystem->Load("StTpcDb");
00027 gSystem->Load("StEvent");
00028 gSystem->Load("StEventMaker");
00029 gSystem->Load("StEmcUtil");
00030
00031 gSystem->Load("StMcEvent");
00032 gSystem->Load("StMcEventMaker");
00033 gSystem->Load("StAssociationMaker");
00034 gSystem->Load("StTofpMcAnalysisMaker");
00035
00036
00037 gSystem->Load("StTofUtil");
00038 gSystem->Load("StDbLib");
00039 gSystem->Load("StDbBroker");
00040 gSystem->Load("St_db_Maker");
00041
00042
00043
00044 chain = new StChain("StChain");
00045
00046
00047
00048
00049 StIOMaker* ioMaker = new StIOMaker("IO","r",MainFile,"bfcTree");
00050
00051 ioMaker->SetIOMode("r");
00052 ioMaker->SetBranch("*",0,"0");
00053 ioMaker->SetBranch("geantBranch",0,"r");
00054
00055 ioMaker->SetBranch("dstBranch",0,"r");
00056 ioMaker->SetBranch("runcoBranch",0,"r");
00057
00058
00059
00060 StEventMaker* eventReader = new StEventMaker("events","title");
00061 eventReader->doPrintMemoryInfo = kFALSE;
00062 StMcEventMaker* mcEventReader = new StMcEventMaker;
00063 mcEventReader->doPrintMemoryInfo = false;
00064 mcEventReader->doUseTpc = true;
00065 mcEventReader->doUseSvt = false;
00066 mcEventReader->doUseFtpc = false;
00067 mcEventReader->doUseRich = false;
00068 mcEventReader->doUseBemc = false;
00069 mcEventReader->doUseBsmd = false;
00070
00071 StAssociationMaker* associator = new StAssociationMaker;
00072 associator->doPrintMemoryInfo = false;
00073
00074
00075
00076
00077
00078 StTofpMcAnalysisMaker* examples = new StTofpMcAnalysisMaker;
00079 examples->SetDebug();
00080
00081
00082
00083 StMcParameterDB* parameterDB = StMcParameterDB::instance();
00084
00085 parameterDB->setXCutTpc(.5);
00086 parameterDB->setYCutTpc(.5);
00087 parameterDB->setZCutTpc(.5);
00088 parameterDB->setReqCommonHitsTpc(3);
00089
00090 parameterDB->setRCutFtpc(.3);
00091 parameterDB->setPhiCutFtpc(5*(3.1415927/180.0));
00092 parameterDB->setReqCommonHitsFtpc(3);
00093
00094 parameterDB->setXCutSvt(.08);
00095 parameterDB->setYCutSvt(.08);
00096 parameterDB->setZCutSvt(.08);
00097 parameterDB->setReqCommonHitsSvt(1);
00098
00099
00100 char *db2 = "StarDb";
00101 if (gSystem->AccessPathName(db2) !=0) {
00102 printf("File %s does not exist\n",db2);
00103 db2 = "";
00104 }
00105 St_db_Maker *dbMk = new St_db_Maker("dbName","MySQL:StarDb","$STAR/StarDb",db2);
00106 dbMk->SetDateTime(010102,000);
00107
00108
00109
00110
00111 chain->PrintInfo();
00112 Int_t initStat = chain->Init();
00113 if (initStat) chain->Fatal(initStat, "during Init()");
00114
00115 int istat=0,iev=1;
00116 EventLoop: if (iev<=nevents && istat!=2) {
00117 chain->Clear();
00118 cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl;
00119 istat = chain->Make(iev);
00120 if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; }
00121 if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; }
00122 iev++; goto EventLoop;
00123 }
00124
00125
00126 char histfile[200];
00127 sprintf(histfile,"%s%s",dirHistoFile,histoFile);
00128 TFile file(histfile,"RECREATE");
00129
00130 TOrdCollection *histograms = new TOrdCollection;
00131 histograms->AddLast(examples->hMcElectron);
00132 histograms->AddLast(examples->hRcElectron);
00133 histograms->AddLast(examples->hMatchElectron);
00134 histograms->AddLast(examples->hMomResPtPion);
00135 histograms->AddLast(examples->hMultRef);
00136 histograms->AddLast(examples->hMcPionPlus);
00137 histograms->AddLast(examples->hRcPionPlus);
00138 histograms->AddLast(examples->hMatchPionPlus);
00139 histograms->AddLast(examples->hMcPionMin);
00140 histograms->AddLast(examples->hRcPionMin);
00141 histograms->AddLast(examples->hMatchPionMin);
00142 histograms->AddLast(examples->hMcKaonPlus);
00143 histograms->AddLast(examples->hRcKaonPlus);
00144 histograms->AddLast(examples->hMatchKaonPlus);
00145 histograms->AddLast(examples->hMcKaonMin);
00146 histograms->AddLast(examples->hRcKaonMin);
00147 histograms->AddLast(examples->hMatchKaonMin);
00148 histograms->AddLast(examples->hMcProton);
00149 histograms->AddLast(examples->hRcProton);
00150 histograms->AddLast(examples->hMatchProton);
00151 histograms->AddLast(examples->hMcAntiProton);
00152 histograms->AddLast(examples->hRcAntiProton);
00153 histograms->AddLast(examples->hMatchAntiProton);
00154 histograms->AddLast(examples->hTofpSlatIdA0);
00155 histograms->AddLast(examples->hTofpSlatIdA1);
00156 histograms->AddLast(examples->hTofpSlatIdB1);
00157 histograms->AddLast(examples->hTofpSlatIdD1);
00158 histograms->AddLast(examples->hTofpSlatIdD2);
00159 histograms->AddLast(examples->hTofpSlatIdE1);
00160 histograms->AddLast(examples->hTofpSlatIdE2);
00161 histograms->AddLast(examples->hTofpSlatIdE3);
00162 histograms->AddLast(examples->hTofpSlatIdE4);
00163 histograms->AddLast(examples->hTofpSlatIdE5);
00164 histograms->AddLast(examples->hTofpSlatIdF1);
00165 histograms->AddLast(examples->hTofpSlatHitVecSize);
00166
00167 histograms->Write();
00168
00169 file.Close();
00170
00171
00172
00173 if(iev>200) chain->Finish();
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184 }
00185