00001
00002
00003
00004
00005
00006
00007
00008
00010 #if !defined(__CINT__) || defined(__MAKECINT__)
00011 #include "Stiostream.h"
00012 #include "TSystem.h"
00013 #include "TClassTable.h"
00014 #include "TApplication.h"
00015 #include "TInterpreter.h"
00016 #include "TBenchmark.h"
00017 #include "StBFChain.h"
00018
00019
00020 #include "StIOMaker/StIOMaker.h"
00021
00022 #include "StMixerMaker/StMixerMaker.h"
00023 #include "StEvtHddr.h"
00024 #include "StTrsMaker/StTrsMaker.h"
00025 #else
00026 class StMaker;
00027 class StChain;
00028 class StBFChain;
00029 class StEvent;
00030
00031 class StIOMaker;
00032 class StEventMaker;
00033 class StMixerMaker;
00034 class StEvtHddr;
00035 class StMixerMaker;
00036
00037 class StTrsMaker;
00038 #endif
00039 StChain *chain=0;
00040 StMaker *treeMk=0;
00041 StBFChain *chain1, *chain2, *chain3;
00042
00043
00044
00045 void Load(){
00046 gSystem->Load("St_base");
00047 Bool_t needLogger = gSystem->Load("liblog4cxx.so") <= 0;
00048 if (needLogger) {
00049 gSystem->Load("StStarLogger.so");
00050
00051 gROOT->ProcessLine("StLoggerManager::StarLoggerInit();");
00052 }
00053 gSystem->Load("StChain");
00054 gSystem->Load("StUtilities");
00055 gSystem->Load("StBFChain");
00056
00057 #if 0
00058 gSystem->Load("StarClassLibrary");
00059 #endif
00060 gSystem->Load("StAnalysisUtilities");
00061
00062 if (chain) delete chain;
00063 }
00064
00065 void bfcMixer(const Int_t Nevents=100,
00066 const Char_t *file1="/star/data03/daq/2004/090/st_physics_adc_5090009_raw_2060002.daq",
00067 const Char_t *file2="./gtest.fz",
00068 const Char_t *file3="./st_physics_adc_5090009_raw_2060002.vertices.dat",
00069 const Float_t zvertex_low=-175.0,
00070 const Float_t zvertex_high=175.0,
00071 const Char_t *mode="strange",
00072 const Char_t *acc_mode="off" )
00073 {
00074
00075 if (gClassTable->GetID("StBFChain") < 0) Load();
00076 Int_t iV0Acc = 0;
00077 if (! strcmp(mode,"strange") && !strcmp(acc_mode,"on") && gSystem->DynamicPathName("StV0AccMaker",1)) {
00078 gSystem->Load("StV0AccMaker.so");
00079 iV0Acc = 1;
00080 }
00081
00082 chain = new StChain("Embedding");
00083
00084 StMaker *saveMk = 0;
00085
00086
00087 chain1 = new StBFChain("One");
00088 saveMk = chain1->cd();
00089
00090
00091
00092 chain1->SetFlags("in Physics DbV20050515 MagF NoDefault");
00093 chain1->Set_IO_Files(file1);
00094 chain1->Load();
00095 chain1->Instantiate();
00096
00097 saveMk->cd();
00098
00099
00100 chain2 = new StBFChain("Two");
00101 saveMk = chain2->cd();
00102
00103 chain2->SetFlags("fzin DbV20050515 gen_T geomT sim_T trs -tpc_daq");
00104 chain2->Set_IO_Files(file2);
00105 chain2->Load();
00106 chain2->Instantiate();
00107 StMaker *geantMk = chain2->GetMaker("geant");
00108 if (geantMk) geantMk->SetMode(1);
00109
00110 if (chain2->GetOption("TRS")){
00111 StTrsMaker *trsMk = (StTrsMaker *) chain2->GetMaker("Trs");
00112 trsMk->setNormalFactor(1.22);
00113 }
00114
00115 if (iV0Acc) {
00116 Char_t *extraMaker = "StV0AccMaker";
00117 if (gClassTable->GetID(extraMaker) < 0) gSystem->Load(extraMaker);
00118 StMaker *extraMk = (StMaker *)chain1->GetMaker(extraMaker);
00119 if(extraMk) delete extraMk;
00120 extraMk = chain->New(extraMaker,"before");
00121 if (extraMk) {
00122 Char_t *before = "Trs";
00123 StMaker *trsmk = chain1->GetMaker(before);
00124 if (trsmk) chain1->AddBefore(before,extraMk);
00125 StV0AccCuts *cuts = ((StV0AccMaker *)extraMk)->GetCutsPtr();
00126 cuts->SetFilter();
00127 cuts->SetV0MinDecayLen(0.);
00128 cuts->SetV0DaughterMinImpact(0);
00129 cuts->SetV0DaughterMinHit(10.);
00130 cuts->SetXiV0MaxImpact(5);
00131 cuts->SetXiMinDecayLen(2.);
00132 cuts->SetXiV0PiMinImpact(0.);
00133 cuts->SetXiDaughterMinHit(10.);
00134 cuts->SetKinkMinDecayRad(128.);
00135 cuts->SetKinkMaxDecayRad(184.);
00136 }
00137 }
00138
00139
00140 saveMk->cd();
00141
00142
00143 gSystem->Load("StMixerMaker");
00144 StMixerMaker *mixer = new StMixerMaker("Mixer","daq","trs");
00145 chain1->SetInput("Input1","StDAQReader");
00146 chain2->SetInput("Input2","Event");
00147 mixer->writeFile("mixer.trs",Nevents);
00148
00149
00150
00151
00152
00153 chain3 = new StBFChain("Three");
00154 saveMk = chain3->cd();
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164 chain3->SetFlags("Simu NoDefault NoInput onlraw -onlcl DbV20050515 ry2005b tpc_daq tpc emcDY2 global dst Kalman event evout QA Tree GeantOut fcf ctf -Prevtx -nohits CMuDST ZDCvtx tofDat Xi2 Kink2 EST ToF svt_daq SvtD svtdEdx xiSvt l3onl fpd eemcD pmdRaw analysis ");
00165
00166
00167
00168
00169
00170 TString OutputFileName(gSystem->BaseName(file1));
00171 OutputFileName.ReplaceAll("*","");
00172 OutputFileName.ReplaceAll(".daq","");
00173 OutputFileName.Append(".root");
00174 chain3->Set_IO_Files(0,OutputFileName.Data());
00175 chain3->Load();
00176 chain3->Instantiate();
00177 #if 0
00178 geantMk = chain->GetMaker("geant");
00179 geantMk->SetActive(kTRUE);
00180 #endif
00181 StMaker *tpcdaqMk = chain3->GetMaker("tpc_raw");
00182 tpcdaqMk->SetMode(1);
00183 tpcdaqMk->SetInput("Event","MixerEvent");
00184
00185
00186
00187
00188 saveMk->cd();
00189 {
00190 TDatime t;
00191 printf ("QAInfo:Run is started at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
00192 }
00193 printf ("QAInfo:Run on %s in %s\n",
00194 gSystem->HostName(),
00195 gSystem->WorkingDirectory());
00196 printf ("QAInfo: with %s\n", chain->GetCVS());
00197
00198
00199 if (Nevents >= 0) {
00200 chain->Init();
00201 }
00202
00203 treeMk = chain->GetMaker("tree");
00204 TBenchmark evnt;
00205 Int_t iMake = 0, i = 1, iBad = 0;
00206
00207 StIOMaker *inpMk = (StIOMaker *)chain1->GetMaker("inputStream");
00208 FILE *fp = fopen(file3,"r");
00209 Float_t x, y, z;
00210 Int_t ncols, eventnumber, mult, skip=0, oldskip = 0, skiptest=0;
00211 printf("zvertex_low = %f zvertex_high = %f\n",zvertex_low, zvertex_high);
00212
00213
00214
00215 EventLoop: if (i <= Nevents && iMake != kStEOF && iMake != kStFatal) {
00216 evnt.Reset();
00217 evnt.Start("QAInfo:");
00218 printf ("ELH3\n");
00219 chain->Clear();
00220 printf ("ELH4\n");
00221
00222 ncols = fscanf(fp,"%d %d %d %f %f %f",&eventnumber,&skip,&mult,&x,&y,&z);
00223 if(ncols<0) goto EndLoop;;
00224
00225 printf("\nEvent number: %d Multiplicity = %d\n",eventnumber,mult);
00226 printf("vertex in bfcMixer: %16f %16f %16f\n",x,y,z);
00227
00228
00229
00230
00231
00232
00233 printf ("bfcMixer: i = %i\n",i);
00234 printf ("bfcMixer: skip = %i\n",skip);
00235 printf ("bfcMixer: oldskip = %i\n",oldskip);
00236 if (inpMk && skip>0) {
00237 if(i == 1) {skip++;}
00238 skiptest = inpMk->Skip(skip-oldskip-1);
00239 printf("bfcMixer: skiptest1 = %i\n",skiptest);
00240 skiptest = inpMk->Skip();
00241 printf("bfcMixer: skiptest2 = %i\n",skiptest);
00242 if(i == 1) {skip--;}
00243 }
00244 oldskip = skip;
00245
00246
00247
00248
00249 iMake = chain->Make(i);
00250 if (treeMk && iMake == kStErr) {treeMk->Make(); iBad++;}
00251 StEvtHddr *fEvtHddr = (StEvtHddr*)chain->GetDataSet("EvtHddr");
00252 StEvtHddr *fEvtHddrDaq = (StEvtHddr*)chain1->GetDataSet("EvtHddr");
00253 *fEvtHddr = *fEvtHddrDaq;
00254
00255 evnt.Stop("QAInfo:");
00256
00257 printf ("QAInfo: Done with Event [no. %d/run %d/evt. %d/Date.Time%d.%d/sta %d] Real Time = %10.2f seconds Cpu Time = %10.2f seconds \n", i,chain->GetRunNumber(),chain->GetEventNumber(),chain->GetDate(), chain->GetTime(),
00258 iMake,evnt.GetRealTime("QAInfo:"),evnt.GetCpuTime("QAInfo:"));
00259
00260
00261
00262 if(eventnumber == chain->GetEventNumber()){
00263 printf("bfcMixer: Event number %d found in both .fz file and .daq file\n",eventnumber);
00264 }else{
00265 printf("bfcMixer: Error! Event number from .fz file: %d\n",eventnumber);
00266 printf("bfcMixer: Error! Event number from .daq file: %d\n",chain->GetEventNumber());
00267 printf("bfcMixer: Error! Events are out-of-sync, exiting!\n");
00268 goto EndLoop;;
00269 }
00270 i++;
00271 goto EventLoop;
00272 }
00273 EndLoop:
00274 fflush(stdout);
00275 printf ("QAInfo:Run completed ");
00276 gSystem->Exec("date");
00277
00278 {
00279 TDatime t;
00280 printf ("\nQAInfo:Run is finished at Date/Time%i/%i\n",t.GetDate(),t.GetTime());
00281 }
00282 }
00283