84 int makeFgtPedAndStat(
const Char_t *filenameIn =
"inputfile",
85 const Char_t *filenameOutbase =
"13025001",
86 Int_t runnumber = 13025001,
88 Short_t timeBinMask = 0x0,
90 Bool_t doOutputTxt = 1,
91 Bool_t doOutputPdf = 1,
92 Bool_t doOutputRoot = 1,
94 Bool_t cutShortEvents = 1 ){
100 cout <<
"Is Cosmic" << endl;
102 cout <<
"Is not cosmic" << endl;
108 std::string base(filenameOutbase), pedFile, statFile, txtFile, pdfFile, rootFile, logFile;
109 pedFile = base +
".FGT-ped-DB.dat";
110 statFile = base +
".FGT-stat-DB.dat";
112 txtFile = base +
".FGT-ped-stat.txt";
114 pdfFile = base +
".FGT-ped-stat.ps";
116 rootFile = base +
".FGT-ped-stat.root";
117 logFile = base +
".FGT-ped-stat-info.txt";
124 cout <<
"Constructing the chain" << endl;
125 analysisChain =
new StChain(
"eemcAnalysisChain");
127 std::string fgtDbMkrName =
"";
133 cout <<
"Loading St_db_Maker" << endl;
134 gSystem->Load(
"libStDb_Tables.so");
135 gSystem->Load(
"StDbLib.so");
136 gSystem->Load(
"St_db_Maker");
137 gSystem->Load(
"StDbBroker");
139 TString dir0 =
"MySQL:StarDb";
140 TString dir1 =
"$STAR/StarDb";
142 dbMkr->SetDateTime(20121127,000000);
145 fgtDbMkrName = fgtDbMkr->
GetName();
152 cout <<
"Constructing the daq reader" << endl;
154 daqRdr->setIsCosmic( isCosmic );
155 daqRdr->cutShortEvents( cutShortEvents );
157 cout <<
"Constructing the Ped Maker" << endl;
159 pedMkr->setToSaveToFile( pedFile.data() );
160 pedMkr->setTimeBinMask( timeBinMask );
161 pedMkr->setFgtDbMkrName( fgtDbMkrName );
162 pedMkr->setNumBins( 4200 );
163 pedMkr->setMaxAdc( 4200 );
164 pedMkr->setNumSmooth( 0 );
166 cout <<
"Constructing the Status Maker" << endl;
168 statMkr->setToSaveToFile( statFile.data() );
169 statMkr->setTimeBin( timeBin );
170 statMkr->setMaxDeadPerApv(128);
172 cout <<
"Constructing the QA Maker" << endl;
173 qaMkr =
new StFgtPedStatQA(
"FgtPedStatQA",
"FgtPedMaker",
"FgtStatusMaker" );
174 qaMkr->setSaveTxtFile( txtFile.data() );
175 qaMkr->setSaveRootFile( rootFile.data() );
176 qaMkr->setSavePdfFile( pdfFile.data() );
177 qaMkr->setTimeBin( timeBin );
182 cout <<
"Initializing" << endl;
183 ierr = analysisChain->Init();
186 cout <<
"Error initializing" << endl;
193 cout <<
"max nevents = " << nevents << endl;
194 for(
int i=0; i<nevents && !ierr; ++i ){
197 cout <<
"\ton event number " << i << endl;
200 analysisChain->
Clear();
203 ierr = analysisChain->
Make();
207 fgtDbMkr->printFgtDumpCSV1(
"fgtMapDump.csv");
211 cout <<
"finish" << endl;
216 std::ofstream fout( logFile.data() );
218 fout <<
"Log file generated by 'makeFgtPedAndStat' for run number " << runnumber << endl << endl;
219 fout <<
"CVS Ids: "<< endl;
220 fout <<
"\t$Id: makeFgtPedAndStat.C,v 1.1 2013/02/10 14:51:29 akio Exp $" << endl;
222 fout <<
"\t" << fgtDbMkr->GetCVS() << endl;
223 fout <<
"\t" << daqRdr->GetCVS() << endl;
224 fout <<
"\t" << pedMkr->GetCVS() << endl;
225 fout <<
"\t" << statMkr->GetCVS() << endl;
226 fout <<
"\t" << qaMkr->GetCVS() << endl << endl;
229 fout <<
"This file was generated " << d.AsString() << endl << endl;
230 fout <<
"The following options were used in this macro " << endl;
231 fout <<
"\tfilenameIn = " << filenameIn << endl;
232 fout <<
"\tfilenameOutbase = " << filenameOutbase << endl;
233 fout <<
"\trunnumber = " << runnumber << endl;
234 fout <<
"\tnevents = " << nevents << endl;
235 fout <<
"\ttimeBinMask = " << timeBinMask << endl;
236 fout <<
"\ttimeBin = " << timeBin << endl;
237 fout <<
"\tdoOutputTxt = " << doOutputTxt << endl;
238 fout <<
"\tdoOutputPdf = " << doOutputPdf << endl;
239 fout <<
"\tdoOutputRoot = " << doOutputRoot << endl;
240 fout <<
"\tisCosmic = " << isCosmic << endl;
241 fout <<
"\tcutShortEvents = " << cutShortEvents << endl << endl;
244 std::stringstream ss;
245 fout <<
"Times given in the run log are " << endl;
246 ss <<
"lynx -dump 'http://online.star.bnl.gov/RunLogRun12/index.php?r=" << runnumber <<
"' | grep GMT";
247 FILE *f = gSystem->OpenPipe(ss.str().data(),
"r");
249 while((c=fgetc(f))!=EOF)
257 cout <<
"converting ps to pdf" << endl;
258 gSystem->Exec(( std::string(
"ps2pdf -dAutoRotatePages=/None ") + pdfFile ).
data());
261 cerr <<
"\tall done" << endl;
270 gSystem->Load(
"libPhysics");
271 gSystem->Load(
"St_base");
272 gSystem->Load(
"StChain");
273 gSystem->Load(
"StFgtUtil");
274 gSystem->Load(
"StUtilities");
275 gSystem->Load(
"StEvent");
276 cout <<
"loaded StEvent library" << endl;
278 gSystem->Load(
"RTS");
279 gSystem->Load(
"StFgtUtil");
280 gSystem->Load(
"StFgtDbMaker");
281 gSystem->Load(
"StFgtRawDaqReader");
282 gSystem->Load(
"StFgtPedMaker");
283 gSystem->Load(
"StFgtStatusMaker");
284 gSystem->Load(
"StFgtQaMakers");
virtual void Clear(Option_t *option="")
User defined functions.
virtual const char * GetName() const
special overload