00001
00002
00003
00004
00005
00006
00008 #ifndef __CINT__
00009 #include "iostream.h"
00010 #include "TROOT.h"
00011 #include "TSystem.h"
00012 #include "TH2.h"
00013 #include "TH3.h"
00014 #include "TF1.h"
00015 #include "TProfile.h"
00016 #include "TTree.h"
00017 #include "TChain.h"
00018 #include "TCanvas.h"
00019 #include "TClassTable.h"
00020 #include "TFileSet.h"
00021 #include "TDataSetIter.h"
00022 #include "StBFChain.h"
00023 #include "StIOMaker.h"
00024 void bfc (const Int_t Last,
00025 const Char_t *Chain,
00026 const Char_t *infile,
00027 const Char_t *outfile,
00028 const Char_t *TreeFile);
00029
00030 #else
00031 class StBFChain;
00032 class TTree;
00033 StBFChain *chain;
00034 class StFlowSelection;
00035 class StIOMaker;
00036 #endif
00037
00038 void bfcZ(const Int_t First,
00039 const Int_t Last,
00040 const Char_t *Chain="gstar Cy2b tfs -NoHits TpcHitFilter",
00041 const Char_t *infile=0,
00042 const Double_t zmin=-200, const Double_t zmax=-100,
00043 const Char_t *outfile=0,
00044 const Char_t *TreeFile=0){
00045 gROOT->LoadMacro("bfc.C");
00046 bfc(-1,Chain,infile,outfile,TreeFile);
00047 if (chain->GetOption("TpcHitFilter")) {
00048 StTpcHitFilterMaker *filtMk = (StTpcHitFilterMaker *) chain->GetMaker("tpc_hit_filter");
00049 if (filtMk) {
00050
00051 if (zmin < 0 && zmax < 0) filtMk->WestOff();
00052 if (zmin > 0 && zmax > 0) filtMk->EastOff();
00053 filtMk->SetZrange(zmin,zmax);
00054 }
00055 }
00056 {
00057 TDatime t;
00058 printf ("QAInfo:Run is started at Date/Time %i/%i\n",t.GetDate(),t.GetTime());
00059 printf ("QAInfo:Run on %s in %s\n",
00060 gSystem->HostName(),
00061 gSystem->WorkingDirectory());
00062 printf ("QAInfo: with %s\n", chain->GetCVS());
00063 }
00064
00065 Int_t iTotal = 0, iBad = 0;
00066 St_XDFFile *xdf_out = 0;
00067 TBenchmark evnt;
00068 Int_t iMake = 0, i = First;
00069 if (Last >= 0) {
00070 Int_t iInit = chain->Init();
00071 if (iInit >= kStEOF) {
00072 chain->Fatal(iInit,"on init");
00073 goto END;
00074 }
00075 StEvtHddr *hd = (StEvtHddr*)chain->GetDataSet("EvtHddr");
00076 if (hd) hd->SetRunNumber(-2);
00077
00078 if (First > 1) {
00079 if (chain->GetOption("fzin")) {
00080 geant = (St_geant_Maker *) chain->GetMaker("geant");
00081 if (geant) {
00082 if (geant->IsActive()) geant->Skip(First-1);
00083 }
00084 }
00085 else {
00086 StIOMaker *inpMk = (StIOMaker *) chain->GetMaker("inputStream");
00087 if (inpMk) {printf ("Skip %i Events\n",First-1);inpMk->Skip(First-1);}
00088 }
00089 }
00090 }
00091 xdf_out = chain->GetXdfOut();
00092 if (chain->GetOption("Event")) evMk = (StEventMaker *) chain->GetMaker("StEventMaker");
00093 treeMk = chain->GetMaker("OutputStream");
00094 EventLoop: if (i <= Last && iMake != kStEOF && iMake != kStFatal) {
00095 evnt.Reset();
00096 evnt.Start("QAInfo:");
00097 chain->Clear();
00098 iMake = chain->Make(i);
00099 if (iMake <kStEOF) {
00100 if (xdf_out){
00101 St_DataSet *dstSet = chain->GetInputDS("dst");
00102 if (dstSet) xdf_out->NextEventPut(dstSet);
00103 }
00104 iTotal++;
00105 if (treeMk && iMake == kStErr) {treeMk->Make(i); iBad++;}
00106
00107 evnt.Stop("QAInfo:");
00108
00109 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",
00110 i,chain->GetRunNumber(),chain->GetEventNumber(),chain->GetDate(), chain->GetTime(),
00111 iMake,evnt.GetRealTime("QAInfo:"),evnt.GetCpuTime("QAInfo:"));
00112 }
00113 i++; goto EventLoop;
00114 }
00115 END:
00116 fflush(stdout);
00117 printf ("QAInfo:Run completed ");
00118 gSystem->Exec("date");
00119 if (evMk) Event = (StEvent *) chain->GetInputDS("StEvent");
00120 {
00121 TDatime t;
00122 printf ("\nQAInfo:Run is finished at Date/Time %i/%i; Total events processed :%i and not completed: %i\n",
00123 t.GetDate(),t.GetTime(),iTotal,iBad);
00124 }
00125 }
00126
00127 void bfcZ (const Int_t Last,
00128 const Char_t *Chain="gstar Cy2b tfs evout TpcHitFilter -NoHits",
00129 const Char_t *infile=0,
00130 const Double_t zmin=-200, const Double_t zmax=-100,
00131 const Char_t *outfile=0,
00132 const Char_t *TreeFile=0)
00133 {
00134 bfcZ(1,Last,Chain,infile,zmin,zmax,outfile,TreeFile);
00135 }
00136