13 #pragma cling load("StarRoot")
14 #pragma cling load("St_base")
15 #pragma cling load("StChain")
16 #pragma cling load("StUtilities")
17 #pragma cling load("StBFChain")
19 #if !(defined(__CINT__) || defined(__CLING__)) || defined(__MAKECINT__)
23 #include "TClassTable.h"
24 #include "TApplication.h"
25 #include "TInterpreter.h"
26 #include "StBFChain.h"
27 #include "StMessMgr.h"
33 #if !defined(__CINT__) || defined(__CLING__)
43 void Load(
const Char_t *options=
"");
45 TString defChain(
"y2010,gstar,Test.default.ITTF,NosvtIT,NossdIT,-sfs,-ssdFast,sdt20100107.110000");
46 void bfc(Int_t First, Int_t Last,
const Char_t *Chain = defChain +
",Display",
47 const Char_t *infile=0,
const Char_t *outfile=0,
const Char_t *TreeFile=0);
49 void bfc(Int_t Last,
const Char_t *Chain = defChain,
50 const Char_t *infile=0,
const Char_t *outfile=0,
const Char_t *TreeFile=0);
53 void Load(
const Char_t *options)
55 cout <<
"Load system libraries\t";
56 int nodefault = TString(options).Contains(
"nodefault",TString::kIgnoreCase);
59 if ( TString(gProgName)!=
"root4star") {
60 if (!nodefault || TString(options).Contains(
"pgf77",TString::kIgnoreCase)) {
61 const Char_t *pgf77 =
"libpgf77VMC";
62 if (gSystem->DynamicPathName(pgf77,kTRUE) ) {
63 gSystem->Load(pgf77); cout <<
" " << pgf77 <<
" + ";
66 if (!nodefault || TString(options).Contains(
"cern" ,TString::kIgnoreCase)) {
67 gSystem->Load(
"libStarMiniCern");
68 cout <<
"libStarMiniCern" ;
72 if (!nodefault || TString(options).Contains(
"mysql",TString::kIgnoreCase)) {
73 const Char_t *mysql =
"libmysqlclient";
79 const Char_t *libsLocal[]= {
"",
81 "$OPTSTAR/lib/mysql/",
86 const Char_t *libsGlbal[]= {
"",
91 "$OPTSTAR/lib/mysql/",
96 if ( gSystem->Getenv(
"USE_LOCAL_MYSQL") ){
103 TString Arch( gSystem->GetBuildArch() );
105 if ( gSystem->Getenv(
"USE_64BITS") || Arch.Contains(
"x8664")) i64 = kTRUE;
109 TString lib(libs[i]);
111 if (i64) lib.ReplaceAll(
"/lib",
"/lib64");
113 lib = gSystem->ExpandPathName(lib.Data());
114 if (gSystem->DynamicPathName(lib,kTRUE)) {
115 gSystem->Load(lib.Data());
116 cout <<
" + " << mysql <<
" from " << lib.Data();
124 gSystem->Load(
"libSt_base");
126 if (gSystem->Load(
"liblog4cxx.so") >= 0) {
127 cout <<
" + liblog4cxx.so";
128 if(gSystem->Load(
"libStStarLogger.so") >= 0) {
129 cout <<
" + libStStarLogger.so";
130 gROOT->ProcessLine(
"StLoggerManager::StarLoggerInit();");
134 gSystem->Load(
"libStChain");
135 gSystem->Load(
"libStUtilities");
136 gSystem->Load(
"libStBFChain");
140 void bfc(Int_t First, Int_t Last,
142 const Char_t *infile,
143 const Char_t *outfile,
144 const Char_t *TreeFile)
151 chain =
new StBFChain(); cout <<
"Create chain " << chain->
GetName() << endl;
152 TString tChain(Chain);
155 if (Last < -3)
return;
157 if (tChain ==
"" || ! tChain.CompareTo(
"ittf",TString::kIgnoreCase)) Usage();
158 gMessMgr->QAInfo() << Form(
"Process [First=%6i/Last=%6i/Total=%6i] Events",First,Last,Last-First+1) << endm;
159 if (Last < -2)
return;
161 gMessMgr->Error() <<
"Problems with loading of shared library(ies)" << endm;
164 chain->Set_IO_Files(infile,outfile);
165 if (TreeFile) chain->SetTFile(
new TFile(TreeFile,
"RECREATE"));
167 if (Last < -1)
return;
169 gMessMgr->Error() <<
"Problems with instantiation of Maker(s)" << endm;
172 StMaker::lsMakers(chain);
173 if (Last < 0)
return;
174 StMaker *dbMk = chain->GetMaker(
"db");
175 if (dbMk) dbMk->SetDebug(1);
178 Char_t *myMaker =
"St_TLA_Maker";
179 if (gClassTable->GetID(myMaker) < 0) {
180 gSystem->Load(myMaker);
182 StMaker *myMk = chain->GetMaker(myMaker);
183 if (myMk)
delete myMk;
184 myMk = chain->New(myMaker,
"before");
186 Char_t *before =
"tpc_hits";
187 StMaker *tclmk = chain->GetMaker(before);
188 if (tclmk) chain->AddBefore(before,myMk);
191 myMk = chain->New(myMaker,
"after");
193 Char_t *after =
"tpc_hits";
194 StMaker *tclmk = chain->GetMaker(after);
195 if (tclmk) chain->AddAfter(after,myMk);
201 if (chain->GetOption(
"TpcT0")) {
202 StTpcT0Maker *t0mk = (StTpcT0Maker *) chain->GetMaker(
"TpcT0");
203 if (t0mk) t0mk->SetDesiredEntries(10);
208 gMessMgr->QAInfo() << Form(
"Run is started at Date/Time %i/%i",t.GetDate(),t.GetTime()) << endm;
210 gMessMgr->QAInfo() << Form(
"Run on %s in %s",gSystem->HostName(),gSystem->WorkingDirectory()) << endm;
211 gMessMgr->QAInfo() << Form(
"with %s", chain->GetCVS()) << endm;
214 chain->SetAttr(
".Privilege",0,
"*" );
215 chain->SetAttr(
".Privilege",1,
"StIOInterFace::*" );
216 chain->SetAttr(
".Privilege",1,
"St_geant_Maker::*");
217 chain->SetAttr(
".Privilege",1,
"StTpcDbMaker::*");
218 chain->SetAttr(
".Privilege",1,
"*::tpc_hits");
219 chain->SetAttr(
".Privilege",1,
"*::tpx_hits");
220 chain->SetAttr(
".Privilege",1,
"StTpcHitMover::*");
221 chain->SetAttr(
".Privilege",1,
"*::tpcChain");
222 chain->SetAttr(
".Privilege",1,
"StTriggerDataMaker::*");
223 chain->SetAttr(
".Privilege",1,
"StEventMaker::*");
224 Int_t iInit = chain->Init();
225 if (iInit >=
kStEOF) {chain->FatalErr(iInit,
"on init");
return;}
226 if (Last == 0)
return;
228 if (hd) hd->SetRunNumber(-2);
230 chain->EventLoop(First,Last,0);
231 gMessMgr->QAInfo() <<
"Run completed " << endm;
236 const Char_t *infile,
237 const Char_t *outfile,
238 const Char_t *TreeFile) {
239 bfc(1,Last,Chain,infile,outfile,TreeFile);
243 printf (
"============= \t U S A G E =============\n");
244 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");
245 printf (
"bfc(Int_t Last,const Char_t *Chain,const Char_t *infile,const Char_t *outfile,const Char_t *TreeFile)\n");
246 printf (
"bfc(const Char_t *ChainShort,Int_t Last,const Char_t *infile,const Char_t *outfile)\n");
248 printf (
" First \t- First event to process\t(Default = 1)\n");
249 printf (
" Last \t- Last event to process\t(Default = 1)\n");
250 printf (
" Chain \t- Chain specification \t(without First & Last: Default is \"\" which gives this message)\n");
251 printf (
" \t \t with First || Last: Default is \"gstar tfs\")\n");
252 printf (
" infile \t- Name of Input file \t(Default = 0, i.e. use preset file names depending on Chain)\n");
253 printf (
" outfile \t- Name of Output file \t(Default = 0, i.e. define Output file name from Input one)\n");
254 printf (
" outfile \t- Name of Tree File \t(Default = 0, i.e. define Output file name from Input one (tags TNtuple))\n");
255 printf (
" ChainShort\t- Short cut for chain \t(Default = \"\" -> print out of this message)\n");
259 void bfc(
const Char_t *Chain=
"ittf") {
virtual Int_t Instantiate()
Maker-instantiation handler.
void SetFlags(const Char_t *Chain="gstar tfs")
Scan all flags, check if they are correct, manipulate the comment if necessary.
virtual const char * GetName() const
special overload
virtual Int_t Load()
Routine handling library loading depending on chain options.