81 int makeFgtPedAndStat(
const Char_t *filenameIn =
"inputfile",
82 const Char_t *filenameOutbase =
"13025001",
83 Int_t runnumber = 13025001,
85 Short_t timeBinMask = 0x04,
87 Bool_t doOutputTxt = 1,
88 Bool_t doOutputPdf = 1,
89 Bool_t doOutputRoot = 1,
91 Bool_t cutShortEvents = 1 ){
97 cout <<
"Is Cosmic" << endl;
99 cout <<
"Is not cosmic" << endl;
105 std::string base(filenameOutbase), pedFile, statFile, txtFile, pdfFile, rootFile, logFile;
106 pedFile = base +
".FGT-ped-DB.dat";
107 statFile = base +
".FGT-stat-DB.dat";
109 txtFile = base +
".FGT-ped-stat.txt";
111 pdfFile = base +
".FGT-ped-stat.ps";
113 rootFile = base +
".FGT-ped-stat.root";
114 logFile = base +
".FGT-ped-stat-info.txt";
121 cout <<
"Constructing the chain" << endl;
122 analysisChain =
new StChain(
"eemcAnalysisChain");
124 std::string fgtDbMkrName =
"";
130 cout <<
"Loading St_db_Maker" << endl;
131 gSystem->Load(
"libStDb_Tables.so");
132 gSystem->Load(
"StDbLib.so");
133 gSystem->Load(
"St_db_Maker");
134 gSystem->Load(
"StDbBroker");
136 TString dir0 =
"MySQL:StarDb";
137 TString dir1 =
"$STAR/StarDb";
139 dbMkr->SetDateTime(20120125,80350);
142 fgtDbMkrName = fgtDbMkr->
GetName();
149 cout <<
"Constructing the daq reader" << endl;
151 daqRdr->setIsCosmic( isCosmic );
152 daqRdr->cutShortEvents( cutShortEvents );
154 cout <<
"Constructing the Ped Maker" << endl;
156 pedMkr->setToSaveToFile( pedFile.data() );
157 pedMkr->setTimeBinMask( timeBinMask );
158 pedMkr->setFgtDbMkrName( fgtDbMkrName );
159 pedMkr->setNumBins( 100 );
160 pedMkr->setMaxAdc( 1200 );
161 pedMkr->setNumSmooth( 0 );
163 cout <<
"Constructing the Status Maker" << endl;
165 statMkr->setToSaveToFile( statFile.data() );
166 statMkr->setTimeBin( timeBin );
167 statMkr->setMaxDeadPerApv(128);
169 cout <<
"Constructing the QA Maker" << endl;
170 qaMkr =
new StFgtPedStatQA(
"FgtPedStatQA",
"FgtPedMaker",
"FgtStatusMaker" );
171 qaMkr->setSaveTxtFile( txtFile.data() );
172 qaMkr->setSaveRootFile( rootFile.data() );
173 qaMkr->setSavePdfFile( pdfFile.data() );
174 qaMkr->setTimeBin( timeBin );
179 cout <<
"Initializing" << endl;
180 ierr = analysisChain->Init();
183 cout <<
"Error initializing" << endl;
190 cout <<
"max nevents = " << nevents << endl;
191 for(
int i=0; i<nevents && !ierr; ++i ){
194 cout <<
"\ton event number " << i << endl;
197 analysisChain->
Clear();
200 ierr = analysisChain->
Make();
204 fgtDbMkr->printFgtDumpCSV1(
"fgtMapDump.csv");
208 cout <<
"finish" << endl;
213 std::ofstream fout( logFile.data() );
215 fout <<
"Log file generated by 'makeFgtPedAndStat' for run number " << runnumber << endl << endl;
216 fout <<
"CVS Ids: "<< endl;
217 fout <<
"\t$Id: makeFgtPedAndStat.C,v 1.6 2012/11/12 23:22:56 rfatemi Exp $" << endl;
219 fout <<
"\t" << fgtDbMkr->GetCVS() << endl;
220 fout <<
"\t" << daqRdr->GetCVS() << endl;
221 fout <<
"\t" << pedMkr->GetCVS() << endl;
222 fout <<
"\t" << statMkr->GetCVS() << endl;
223 fout <<
"\t" << qaMkr->GetCVS() << endl << endl;
226 fout <<
"This file was generated " << d.AsString() << endl << endl;
227 fout <<
"The following options were used in this macro " << endl;
228 fout <<
"\tfilenameIn = " << filenameIn << endl;
229 fout <<
"\tfilenameOutbase = " << filenameOutbase << endl;
230 fout <<
"\trunnumber = " << runnumber << endl;
231 fout <<
"\tnevents = " << nevents << endl;
232 fout <<
"\ttimeBinMask = " << timeBinMask << endl;
233 fout <<
"\ttimeBin = " << timeBin << endl;
234 fout <<
"\tdoOutputTxt = " << doOutputTxt << endl;
235 fout <<
"\tdoOutputPdf = " << doOutputPdf << endl;
236 fout <<
"\tdoOutputRoot = " << doOutputRoot << endl;
237 fout <<
"\tisCosmic = " << isCosmic << endl;
238 fout <<
"\tcutShortEvents = " << cutShortEvents << endl << endl;
241 std::stringstream ss;
242 fout <<
"Times given in the run log are " << endl;
243 ss <<
"lynx -dump 'http://online.star.bnl.gov/RunLogRun12/index.php?r=" << runnumber <<
"' | grep GMT";
244 FILE *f = gSystem->OpenPipe(ss.str().data(),
"r");
246 while((c=fgetc(f))!=EOF)
254 cout <<
"converting ps to pdf" << endl;
255 gSystem->Exec(( std::string(
"ps2pdf -dAutoRotatePages=/None ") + pdfFile ).
data());
258 cerr <<
"\tall done" << endl;
267 gSystem->Load(
"libPhysics");
268 gSystem->Load(
"St_base");
269 gSystem->Load(
"StChain");
270 gSystem->Load(
"StFgtUtil");
271 gSystem->Load(
"StUtilities");
272 gSystem->Load(
"StEvent");
273 cout <<
"loaded StEvent library" << endl;
275 gSystem->Load(
"RTS");
276 gSystem->Load(
"StFgtUtil");
277 gSystem->Load(
"StFgtDbMaker");
278 gSystem->Load(
"StFgtRawDaqReader");
279 gSystem->Load(
"StFgtPedMaker");
280 gSystem->Load(
"StFgtStatusMaker");
281 gSystem->Load(
"StFgtQaMakers");
virtual void Clear(Option_t *option="")
User defined functions.
virtual const char * GetName() const
special overload