52 int fgtRawSpectraQA(
const Char_t *filenameIn =
"testfile.daq",
53 const Char_t *filebaseOut =
"testfile.rawQA",
54 Int_t date = 20120115,
56 Float_t pedRelThres = 0,
60 Bool_t cutShortEvents = 1 ){
69 cout <<
"Constructing the chain" << endl;
70 analysisChain =
new StChain(
"eemcAnalysisChain");
80 cout <<
"Constructing St_db_Maker" << endl;
82 TString dir0 =
"MySQL:StarDb";
83 TString dir1 =
"$STAR/StarDb";
85 dbMkr->SetDateTime(date,time);
87 cout <<
"Constructing StFgtDbMaker" << endl;
94 cout <<
"Constructing the daq reader" << endl;
96 daqRdr->setIsCosmic( 0 );
97 daqRdr->cutShortEvents( cutShortEvents );
104 cout <<
"Constructing the QA Makers" << endl;
106 qaMkr->setTimeBin( 2 );
109 analysisChain->
ls(4);
111 cout <<
"Initializing" << endl;
112 ierr = analysisChain->Init();
115 cout <<
"Error initializing" << endl;
122 cout <<
"max nevents = " << nevents << endl;
123 for(
int i=0; i<nevents && !ierr; ++i ){
126 cout <<
"\ton event number " << i << endl;
129 analysisChain->
Clear();
132 ierr = analysisChain->
Make();
139 cout <<
"finish" << endl;
142 cout <<
"Making plots" << endl;
144 gROOT->SetStyle(
"Plain");
145 gStyle->SetOptStat(0);
146 gStyle->SetPalette(1);
148 can =
new TCanvas(
"fgtRawQA",
"fgtRawQA", 850, 1100);
152 can->Print( (std::string(filebaseOut) +
".ps[").
data() );
156 cout <<
"First hist at " << qaMkr->getHist(0) << endl;
158 cout <<
"Finding max" << endl;
162 for( Int_t idx = 0; idx < 48; ++idx ){
163 if( qaMkr->getHist(idx) )
164 if( qaMkr->getHist(idx)->GetMaximum() > max )
165 max = qaMkr->getHist(idx)->GetMaximum();
169 cout <<
"Max is " << max << endl;
172 const Char_t dummyNames[4][20] = {
"dummy1",
"dummy2",
"dummy3",
"dummy4" };
174 Float_t xMin = qaMkr->getHist(0)->GetXaxis()->GetXmin();
175 Float_t xMax = qaMkr->getHist(0)->GetXaxis()->GetXmax();
176 Float_t yMin = qaMkr->getHist(0)->GetYaxis()->GetXmin();
177 Float_t yMax = qaMkr->getHist(0)->GetYaxis()->GetXmax();
179 for( Int_t i=0; i<4; ++i )
180 dummy[i] =
new TH2F( dummyNames[i],
"", 5, xMin, xMax, 1, yMin, yMax );
182 std::stringstream ss;
186 for( Int_t rdo = 1; rdo < 3; ++rdo ){
187 for( Int_t arm = 0; arm < 6; ++arm ){
188 for( Int_t startIdx = 0; startIdx < 4; ++startIdx, ++idx ){
189 for( Int_t oct = 0; oct < 1; ++oct ){
191 cout <<
"rdo/arm/disc/oct = " << rdo <<
'/' << arm <<
'/' << startIdx <<
'/' << oct << endl;
192 if( qaMkr->getHist(idx)->GetEntries() > 0 ){
194 gPad->SetLeftMargin( 0.06 );
195 gPad->SetRightMargin( 0.05 );
196 gPad->SetBottomMargin( 0.11 );
198 qaMkr->getHist(idx)->SetMaximum( max );
199 dummy[subpad-1]->GetXaxis()->SetTitleOffset(0.9);
200 dummy[subpad-1]->GetXaxis()->SetTitleSize(0.06);
201 dummy[subpad-1]->GetXaxis()->SetLabelSize(0.06);
202 dummy[subpad-1]->GetYaxis()->SetTitleOffset(0.55);
203 dummy[subpad-1]->GetYaxis()->SetTitleSize(0.06);
204 dummy[subpad-1]->GetYaxis()->SetLabelSize(0.06);
209 for( Int_t i = 0; i<5; ++i ){
212 ss <<
"channels in APV ";
213 dummy[subpad-1]->GetXaxis()->SetBinLabel( i+1, ss.str().data() );
215 dummy[subpad-1]->GetXaxis()->SetNdivisions(222,0);
216 dummy[subpad-1]->SetMinimum( 0 );
217 dummy[subpad-1]->SetMaximum( max );
218 dummy[subpad-1]->SetTitle( qaMkr->getHist(idx)->GetTitle() );
219 qaMkr->getHist(idx)->SetTitle(
"");
221 dummy[subpad-1]->GetYaxis()->SetTitle( qaMkr->getHist(idx)->GetYaxis()->GetTitle() );
222 qaMkr->getHist(idx)->GetYaxis()->SetTitle(
"");
223 dummy[subpad-1]->Draw(
"COLZ");
225 qaMkr->getHist(idx)->Draw(
"COLZ SAME");
230 TPaveText *title = (TPaveText*)(gPad->GetPrimitive(
"title"));
232 title->SetX1NDC( 0.045 );
233 title->SetX2NDC( 0.55 );
234 title->SetY1NDC( 0.91 ) ;
235 title->SetY2NDC( 0.999 );
236 title->SetBorderSize(0);
237 title->SetTextAlign( 12 );
238 title->SetTextColor(kBlue);
242 TPave *palette = (TPave*)(gPad->GetPrimitive(
"palette"));
244 palette->SetX1NDC( 0.955 );
245 palette->SetX2NDC( 0.985 );
252 can->Print( (std::string(filebaseOut) +
".ps").
data() );
261 can->Print( (std::string(filebaseOut) +
".ps").
data() );
262 can->Print( (std::string(filebaseOut) +
".ps]").
data() );
264 gSystem->Exec(( std::string(
"ps2pdf -dAutoRotatePages=/None ") + filebaseOut +
".ps" ).
data());
267 cerr <<
"\tall done" << endl;
276 gSystem->Load(
"libPhysics");
277 gSystem->Load(
"St_base");
278 gSystem->Load(
"StChain");
279 gSystem->Load(
"StFgtUtil");
280 gSystem->Load(
"StUtilities");
281 gSystem->Load(
"StEvent");
282 cout <<
"loaded StEvent library" << endl;
284 gSystem->Load(
"libStDb_Tables.so");
285 gSystem->Load(
"StDbLib.so");
286 gSystem->Load(
"St_db_Maker");
287 gSystem->Load(
"StDbBroker");
288 cout <<
"loaded DB libraries" << endl;
290 gSystem->Load(
"RTS");
291 gSystem->Load(
"StFgtUtil");
292 gSystem->Load(
"StFgtDbMaker");
293 gSystem->Load(
"StFgtA2CMaker");
294 gSystem->Load(
"StFgtRawDaqReader");
295 gSystem->Load(
"StFgtPedMaker");
296 gSystem->Load(
"StFgtQaMakers");
297 cout <<
"loaded FGT libraries" << endl;
virtual void Clear(Option_t *option="")
User defined functions.
virtual void ls(Option_t *option="") const