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("y2005h,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
00053
00054
00055 Char_t *libs[] = {"", "/usr/mysql/lib/","/usr/lib/", 0};
00056
00057 Int_t i = 0;
00058 while ((libs[i])) {
00059 TString lib(libs[i]);
00060 lib += mysql;
00061 lib = gSystem->ExpandPathName(lib.Data());
00062 if (gSystem->DynamicPathName(lib,kTRUE)) {
00063 gSystem->Load(lib.Data()); cout << " + " << lib.Data() << endl;
00064 break;
00065 }
00066 i++;
00067 }
00068 }
00069 }
00070
00071 #ifdef UseLogger
00072
00073 Bool_t needLogger = kFALSE;
00074 if (!TString(options).Contains("-logger",TString::kIgnoreCase)) {
00075 needLogger = gSystem->Load("liblog4cxx.so") <= 0;
00076 }
00077 #endif
00078 gSystem->Load("libSt_base");
00079 #ifdef UseLogger
00080 if (needLogger) {
00081 gSystem->Load("libStStarLogger.so");
00082 gROOT->ProcessLine("StLoggerManager::StarLoggerInit();");
00083 }
00084 #endif
00085 gSystem->Load("libHtml");
00086 gSystem->Load("libStChain");
00087 gSystem->Load("libStUtilities");
00088 gSystem->Load("libStBFChain");
00089 gSystem->Load("libStChallenger");
00090 }
00091
00092 void bfc(Int_t First, Int_t Last,
00093 const Char_t *Chain,
00094 const Char_t *infile,
00095 const Char_t *outfile,
00096 const Char_t *TreeFile)
00097 {
00098
00099
00100
00101
00102 if (gClassTable->GetID("StBFChain") < 0) Load(Chain);
00103 chain = new StBFChain(); cout << "Create chain " << chain->GetName() << endl;
00104 TString tChain(Chain);
00105 chain->cd();
00106 chain->SetDebug(1);
00107 if (Last < -3) return;
00108 chain->SetFlags(Chain);
00109 if (tChain == "" || ! tChain.CompareTo("ittf",TString::kIgnoreCase)) Usage();
00110 chain->Set_IO_Files(infile,outfile);
00111 if (TreeFile) chain->SetTFile(new TFile(TreeFile,"RECREATE"));
00112 gMessMgr->QAInfo() << Form("Process [First=%6i/Last=%6i/Total=%6i] Events",First,Last,Last-First+1) << endm;
00113 if (Last < -2) return;
00114 if (chain->Load() > kStOk) {
00115 gMessMgr->Error() << "Problems with loading of shared library(ies)" << endm;
00116 gSystem->Exit(1);
00117 }
00118 if (Last < -1) return;
00119 if (chain->Instantiate() > kStOk) {
00120 gMessMgr->Error() << "Problems with instantiation of Maker(s)" << endm;
00121 gSystem->Exit(1);
00122 }
00123 if (Last < 0) return;
00124 StMaker *dbMk = chain->GetMaker("db");
00125 if (dbMk) dbMk->SetDebug(1);
00126 #if 0
00127
00128 Char_t *myMaker = "St_TLA_Maker";
00129 if (gClassTable->GetID(myMaker) < 0) {
00130 gSystem->Load(myMaker);
00131 }
00132 StMaker *myMk = chain->GetMaker(myMaker);
00133 if (myMk) delete myMk;
00134 myMk = chain->New(myMaker,"before");
00135 if (myMk) {
00136 Char_t *before = "tpc_hits";
00137 StMaker *tclmk = chain->GetMaker(before);
00138 if (tclmk) chain->AddBefore(before,myMk);
00139 }
00140
00141 myMk = chain->New(myMaker,"after");
00142 if (myMk) {
00143 Char_t *after = "tpc_hits";
00144 StMaker *tclmk = chain->GetMaker(after);
00145 if (tclmk) chain->AddAfter(after,myMk);
00146 }
00147
00148
00149
00150
00151 if (chain->GetOption("TpcT0")) {
00152 StTpcT0Maker *t0mk = (StTpcT0Maker *) chain->GetMaker("TpcT0");
00153 if (t0mk) t0mk->SetDesiredEntries(10);
00154 }
00155 #endif
00156 {
00157 TDatime t;
00158 gMessMgr->QAInfo() << Form("Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
00159 }
00160 gMessMgr->QAInfo() << Form("Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
00161 gMessMgr->QAInfo() << Form("with %s", chain->GetCVS()) << endm;
00162
00163 TAttr::SetDebug(0);
00164 chain->SetAttr(".Privilege",0,"*" );
00165 chain->SetAttr(".Privilege",1,"StIOInterFace::*" );
00166 chain->SetAttr(".Privilege",1,"St_geant_Maker::*");
00167 chain->SetAttr(".Privilege",1,"StTpcDbMaker::*");
00168 chain->SetAttr(".Privilege",1,"*::tpc_hits");
00169 chain->SetAttr(".Privilege",1,"*::tpx_hits");
00170 chain->SetAttr(".Privilege",1,"StTpcHitMover::*");
00171 chain->SetAttr(".Privilege",1,"*::tpcChain");
00172 chain->SetAttr(".Privilege",1,"StTriggerDataMaker::*");
00173
00174
00175 TString &fnameOut1=chain->GetFileOut();
00176 cout<<"AAA"<<fnameOut1<<endl;
00177 TString fnameOut2=fnameOut1;
00178 fnameOut2.ReplaceAll(".root",".fgt");
00179
00180 cout<<"FGT output core="<<fnameOut2<<endl;
00181
00182 gSystem->Load("libStEEmcPoolFgtSandbox1");
00183 StFgtSlowSimuMaker *myMkSM=new StFgtSlowSimuMaker;
00184 StFgtClustFindMaker *myMkCL=new StFgtClustFindMaker;
00185 StFgtClustEvalMaker *myMkEV=new StFgtClustEvalMaker;
00186
00187 Char_t *after = "geant"; StMaker *xMk = chain->GetMaker(after); assert(xMk);
00188
00189 chain->AddAfter(after,myMkEV);
00190 chain->AddAfter(after,myMkCL);
00191 chain->AddAfter(after,myMkSM);
00192
00193
00194 HList=new TObjArray;
00195 myMkSM->setHList(HList); myMkCL->setHList(HList); myMkEV->setHList(HList);
00196 myMkSM->initFrankModel("StRoot/StEEmcPool/FgtSandbox1/macros/BichselELossProbHighBG.dat");
00197
00198
00199 myMkSM->useOnlyDisk(0);
00200 myMkSM->setRadStripGain(1.00,0.03);
00201 myMkSM->setPhiStripGain(1.00,0.03);
00202 myMkSM->setStripThresh(1.);
00203 myMkSM->setHexGemLatice(0.014, 60.);
00204 myMkSM->setTransDiffusion(0.017);
00205
00206 myMkCL->setSeedStripThres(30.);
00207 myMkCL->setStripNoiseSigma(12.);
00208
00209
00210 chain->ls(3);
00211
00212
00213 Int_t iInit = chain->Init();
00214
00215
00216
00217
00218 if (iInit >= kStEOF) {chain->FatalErr(iInit,"on init"); return;}
00219 if (Last == 0) return;
00220 StEvtHddr *hd = (StEvtHddr*)chain->GetDataSet("EvtHddr");
00221 if (hd) hd->SetRunNumber(-2);
00222
00223 chain->EventLoop(First,Last,0);
00224 gMessMgr->QAInfo() << "Run completed " << endm;
00225 gSystem->Exec("date");
00226
00227
00228
00229 {
00230 TDatime t;
00231 gMessMgr->QAInfo() << Form("Run is finished at Date/Time %i/%i",
00232 t.GetDate(),t.GetTime()) << endm;
00233 }
00234 myMkSM->saveHisto(fnameOut2);
00235
00236
00237
00238
00239 }
00240
00241 void bfc(Int_t Last,
00242 const Char_t *Chain,
00243 const Char_t *infile,
00244 const Char_t *outfile,
00245 const Char_t *TreeFile)
00246 {
00247 bfc(1,Last,Chain,infile,outfile,TreeFile);
00248 }
00249
00250 void Usage() {
00251 printf ("============= \t U S A G E =============\n");
00252 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");
00253 printf ("bfc(Int_t Last,const Char_t *Chain,const Char_t *infile,const Char_t *outfile,const Char_t *TreeFile)\n");
00254 printf ("bfc(const Char_t *ChainShort,Int_t Last,const Char_t *infile,const Char_t *outfile)\n");
00255 printf ("where\n");
00256 printf (" First \t- First event to process\t(Default = 1)\n");
00257 printf (" Last \t- Last event to process\t(Default = 1)\n");
00258 printf (" Chain \t- Chain specification \t(without First & Last: Default is \"\" which gives this message)\n");
00259 printf (" \t \t with First || Last: Default is \"gstar tfs\")\n");
00260 printf (" infile \t- Name of Input file \t(Default = 0, i.e. use preset file names depending on Chain)\n");
00261 printf (" outfile \t- Name of Output file \t(Default = 0, i.e. define Output file name from Input one)\n");
00262 printf (" outfile \t- Name of Tree File \t(Default = 0, i.e. define Output file name from Input one (tags TNtuple))\n");
00263 printf (" ChainShort\t- Short cut for chain \t(Default = \"\" -> print out of this message)\n");
00264 gSystem->Exit(1);
00265 }
00266
00267 void bfc(const Char_t *Chain="ittf") {
00268 bfc(-2,Chain);
00269 }