00001
00002
00003
00004
00005
00006
00008 class StBFChain;
00009 class StMessMgr;
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 "StBFChain.h"
00017 #include "StMessMgr.h"
00018 #else
00019 #endif
00020 #define UseLogger
00021 StBFChain *chain=0;
00022
00023
00024 void Usage();
00025 void Load(const Char_t *options="");
00026 TString defChain("y2005e,Test.default.ITTF");
00027 void bfc(Int_t First, Int_t Last,const Char_t *Chain = defChain + ",Display",
00028 const Char_t *infile=0, const Char_t *outfile=0, const Char_t *TreeFile=0);
00029
00030 void bfc(Int_t Last, const Char_t *Chain = defChain,
00031 const Char_t *infile=0, const Char_t *outfile=0, const Char_t *TreeFile=0);
00032
00033
00034 void Load(const Char_t *options){
00035 cout << "Load system libraries" << endl;
00036 if ( gClassTable->GetID("TGiant3") < 0) {
00037 cout << endl << "Load ";
00038 if (!TString(options).Contains("nodefault",TString::kIgnoreCase) ||
00039 TString(options).Contains("pgf77",TString::kIgnoreCase)) {
00040 const Char_t *pgf77 = "libpgf77VMC";
00041 if (gSystem->DynamicPathName(pgf77,kTRUE) ) {
00042 gSystem->Load(pgf77); cout << " " << pgf77 << " + ";
00043 }
00044 }
00045 if (!TString(options).Contains("nodefault",TString::kIgnoreCase) ||
00046 TString(options).Contains("cern",TString::kIgnoreCase)) {
00047 gSystem->Load("libminicern"); cout << "libminicern";
00048 }
00049 if (!TString(options).Contains("nodefault",TString::kIgnoreCase) ||
00050 TString(options).Contains("mysql",TString::kIgnoreCase)) {
00051 Char_t *mysql = "libmysqlclient";
00052 Char_t *libs[] = {"", "/usr/mysql/lib/","/usr/lib/", 0};
00053
00054 Int_t i = 0;
00055 while ((libs[i])) {
00056 TString lib(libs[i]);
00057 lib += mysql;
00058 lib = gSystem->ExpandPathName(lib.Data());
00059 if (gSystem->DynamicPathName(lib,kTRUE)) {
00060 gSystem->Load(lib.Data()); cout << " + " << lib.Data() << endl;
00061 break;
00062 }
00063 i++;
00064 }
00065 }
00066 }
00067
00068 #ifdef UseLogger
00069
00070 Bool_t needLogger = kFALSE;
00071 if (!TString(options).Contains("-logger",TString::kIgnoreCase)) {
00072 needLogger = gSystem->Load("liblog4cxx.so") <= 0;
00073 }
00074 #endif
00075 gSystem->Load("libSt_base");
00076 #ifdef UseLogger
00077 if (needLogger) {
00078 gSystem->Load("libStStarLogger.so");
00079 gROOT->ProcessLine("StLoggerManager::StarLoggerInit();");
00080 }
00081 #endif
00082 gSystem->Load("libHtml");
00083 gSystem->Load("libStChain");
00084 gSystem->Load("libStUtilities");
00085 gSystem->Load("libStBFChain");
00086 gSystem->Load("libStChallenger");
00087 }
00088
00089 void bfc(Int_t First, Int_t Last,
00090 const Char_t *Chain,
00091 const Char_t *infile,
00092 const Char_t *outfile,
00093 const Char_t *TreeFile)
00094 {
00095
00096
00097
00098
00099 if (gClassTable->GetID("StBFChain") < 0) Load(Chain);
00100 chain = new StBFChain(); cout << "Create chain " << chain->GetName() << endl;
00101 TString tChain(Chain);
00102 chain->cd();
00103 chain->SetDebug(1);
00104 if (Last < -3) return;
00105 chain->SetFlags(Chain);
00106 if (tChain == "" || ! tChain.CompareTo("ittf",TString::kIgnoreCase)) Usage();
00107 chain->Set_IO_Files(infile,outfile);
00108 if (TreeFile) chain->SetTFile(new TFile(TreeFile,"RECREATE"));
00109 gMessMgr->QAInfo() << Form("Process [First=%6i/Last=%6i/Total=%6i] Events",First,Last,Last-First+1) << endm;
00110 if (Last < -2) return;
00111 if (chain->Load() > kStOk) {
00112 gMessMgr->Error() << "Problems with loading of shared library(ies)" << endm;
00113 gSystem->Exit(1);
00114 }
00115 if (Last < -1) return;
00116 if (chain->Instantiate() > kStOk) {
00117 gMessMgr->Error() << "Problems with instantiation of Maker(s)" << endm;
00118 gSystem->Exit(1);
00119 }
00120 if (Last < 0) return;
00121 StMaker *dbMk = chain->GetMaker("db");
00122 if (dbMk) dbMk->SetDebug(1);
00123
00124 dbMk->SetFlavor("simfgt", "vertexSeed");
00125
00126 dbMk->SetFlavor("sim","eemcPMTcal");
00127 dbMk->SetFlavor("sim","eemcPIXcal");
00128 dbMk->SetFlavor("sim","eemcPMTped");
00129 dbMk->SetFlavor("sim","eemcPMTstat");
00130 dbMk->SetFlavor("sim","eemcPMTname");
00131 dbMk->SetFlavor("sim","eemcADCconf");
00132
00133 dbMk->SetFlavor("sim","bemcPed");
00134 dbMk->SetFlavor("sim","bemcStatus");
00135 dbMk->SetFlavor("sim","bemcCalib");
00136 dbMk->SetFlavor("sim","bemcGain");
00137
00138 #if 1
00139 gSystem->Load("StEEmcA2EMaker");
00140 gSystem->Load("StEEmcPoolEEmcFilterMaker");
00141
00142 StEEmcA2EMaker *EEa2eMK=new StEEmcA2EMaker("EE_A2E");
00143 EEa2eMK->database("eeDb");
00144 EEa2eMK->source("StEventMaker",2);
00145 EEa2eMK->scale(1.0);
00146
00147
00148
00149 StEEmcFilterMaker *eeFlt1Mk=new StEEmcFilterMaker("EEmcFilterPreTPC");
00150 eeFlt1Mk->setEtThres(14.);
00151 eeFlt1Mk->setFixedVertex(-60.);
00152
00153
00154 StEEmcFilterMaker *eeFlt2Mk=new StEEmcFilterMaker("EEmcFilterPostTPC");
00155 eeFlt2Mk->setEtThres(16.);
00156 eeFlt2Mk->setZvertCut(-60.,15.);
00157
00158
00159
00160 StMaker *tpcMk = chain->GetMaker("tpcChain");
00161 chain->AddAfter("eefs",tpcMk);
00162
00163 chain->AddAfter("eefs",eeFlt1Mk);
00164 chain->AddAfter("eefs",EEa2eMK);
00165 chain->AddBefore("MuDst",eeFlt2Mk);
00166
00167 #endif
00168 chain->ls(3);
00169
00170 #if 0
00171
00172 Char_t *myMaker = "St_TLA_Maker";
00173 if (gClassTable->GetID(myMaker) < 0) {
00174 gSystem->Load(myMaker);
00175 }
00176 StMaker *myMk = chain->GetMaker(myMaker);
00177 if (myMk) delete myMk;
00178 myMk = chain->New(myMaker,"before");
00179 if (myMk) {
00180 Char_t *before = "tpc_hits";
00181 StMaker *tclmk = chain->GetMaker(before);
00182 if (tclmk) chain->AddBefore(before,myMk);
00183 }
00184
00185 myMk = chain->New(myMaker,"after");
00186 if (myMk) {
00187 Char_t *after = "tpc_hits";
00188 StMaker *tclmk = chain->GetMaker(after);
00189 if (tclmk) chain->AddAfter(after,myMk);
00190 }
00191
00192
00193
00194
00195 if (chain->GetOption("TpcT0")) {
00196 StTpcT0Maker *t0mk = (StTpcT0Maker *) chain->GetMaker("TpcT0");
00197 if (t0mk) t0mk->SetDesiredEntries(10);
00198 }
00199 #endif
00200 {
00201 TDatime t;
00202 gMessMgr->QAInfo() << Form("Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
00203 }
00204 gMessMgr->QAInfo() << Form("Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
00205 gMessMgr->QAInfo() << Form("with %s", chain->GetCVS()) << endm;
00206
00207 TAttr::SetDebug(0);
00208 chain->SetAttr(".Privilege",0,"*" );
00209 chain->SetAttr(".Privilege",1,"StIOInterFace::*" );
00210 chain->SetAttr(".Privilege",1,"St_geant_Maker::*");
00211 Int_t iInit = chain->Init();
00212 if (iInit >= kStEOF) {chain->FatalErr(iInit,"on init"); return;}
00213 if (Last == 0) return;
00214 StEvtHddr *hd = (StEvtHddr*)chain->GetDataSet("EvtHddr");
00215 if (hd) hd->SetRunNumber(-2);
00216
00217 chain->EventLoop(First,Last,0);
00218 gMessMgr->QAInfo() << "Run completed " << endm;
00219 gSystem->Exec("date");
00220 }
00221
00222 void bfc(Int_t Last,
00223 const Char_t *Chain,
00224 const Char_t *infile,
00225 const Char_t *outfile,
00226 const Char_t *TreeFile)
00227 {
00228 bfc(1,Last,Chain,infile,outfile,TreeFile);
00229 }
00230
00231 void Usage() {
00232 printf ("============= \t U S A G E =============\n");
00233 printf ("bfc(Int_t First,Int_t Last,const Char_t *Chain,const Char_t *infile,const Char_t *outfile,const Char_t *TreeFile)\n");
00234 printf ("bfc(Int_t Last,const Char_t *Chain,const Char_t *infile,const Char_t *outfile,const Char_t *TreeFile)\n");
00235 printf ("bfc(const Char_t *ChainShort,Int_t Last,const Char_t *infile,const Char_t *outfile)\n");
00236 printf ("where\n");
00237 printf (" First \t- First event to process\t(Default = 1)\n");
00238 printf (" Last \t- Last event to process\t(Default = 1)\n");
00239 printf (" Chain \t- Chain specification \t(without First & Last: Default is \"\" which gives this message)\n");
00240 printf (" \t \t with First || Last: Default is \"gstar tfs\")\n");
00241 printf (" infile \t- Name of Input file \t(Default = 0, i.e. use preset file names depending on Chain)\n");
00242 printf (" outfile \t- Name of Output file \t(Default = 0, i.e. define Output file name from Input one)\n");
00243 printf (" outfile \t- Name of Tree File \t(Default = 0, i.e. define Output file name from Input one (tags TNtuple))\n");
00244 printf (" ChainShort\t- Short cut for chain \t(Default = \"\" -> print out of this message)\n");
00245 gSystem->Exit(1);
00246 }
00247
00248 void bfc(const Char_t *Chain="ittf") {
00249 bfc(-2,Chain);
00250 }