40 #include <Riostream.h> 42 #include <TGraphErrors.h> 44 #include <TFileMerger.h> 45 #include <TMultiGraph.h> 50 #include <TGridCollection.h> 52 #include <TGridResult.h> 53 #include <TClonesArray.h> 54 #include <TObjString.h> 70 if (fTrigger==
"EMC") file =
"/scratch/alicehp2/germain/QA/"+period+
"/"+ pass +
"/runlist.txt" ;
71 else file =
"/scratch/alicehp2/germain/QA/"+period+
"/"+ pass +
"/runlistMB.txt" ;
74 pFile = fopen(file.Data(),
"r");
77 cout <<
" fcalo: " << fCalorimeter <<
"; period: " << period <<
"; pass: " << pass <<
" trigger "<<fTrigger<< endl;
78 char outfilename [100] ;
91 ncols = fscanf(pFile,
"%d %d ",&p,&q);
100 const Int_t nRun = nlines ;
119 TDirectoryFile *
dir;
127 TH3D * fhNCellsPerCluster ;
132 TH2F * NCellsPerCluster[n];
149 Double_t CellPerClusterMeanSM[n][nRun] ;
150 Double_t CellPerClusterRMSSM[n][nRun] ;
155 TString namefile =
"/scratch/alicehp2/germain/QA/"+period+
"/"+pass+
"/"+ fCalorimeter + period + pass + fTrigger+
"data.txt";
157 fstream QAData(namefile, ios::out);
159 cout <<
" namefile " << namefile << endl;
160 cout <<
" nRun " << nRun <<
" index(nRun) " << index[nRun-1] << endl;
162 for(
Int_t i = 0 ; i < nRun ; i++){
166 TString name =
"/scratch/alicehp2/germain/QA/"+period +
"/"+ pass +
"/";
170 f = TFile::Open(name.Data(),
"read") ;
175 if(fTrigger==
"EMC"){ dir = (TDirectoryFile *)f->Get(
"CaloQA_EMC7");
176 outputList = (
TList*)dir->Get(
"CaloQA_EMC7");
179 dir = (TDirectoryFile *)f->Get(
"CaloQA_default");
180 outputList = (
TList*)dir->Get(
"CaloQA_default");
186 fhNEvents =(TH1F *)outputList->FindObject(
"hNEvents");
187 nEvent[i]=fhNEvents->GetEntries();
188 cout <<
" Run " << RunId[i]<<
" nevent " << nEvent[i]<< endl;
189 if( nEvent[i] == 0) continue ;
190 if( nEvent[i] < 2) continue ;
191 fhE = (TH1F *)outputList->FindObject(fCalorimeter+
"_hE");
195 for(
Int_t ibin = fhE->FindBin(0.3) ; ibin <fhE->FindBin(50.) ; ibin++){
196 energy+=fhE->GetBinCenter(ibin)*fhE->GetBinContent(ibin);
198 EtotalMean[i]=energy/fhE->Integral(fhE->FindBin(0.3), fhE->FindBin(50.)) ;
199 EtotalRMS[i]=fhE->GetMeanError();
206 for(
Int_t ism = 0 ; ism < n ; ism++)
208 TString nameNCell = Form(
"%s_hNCells_Mod%d",fCalorimeter.Data(),ism);
210 TString nameNCluster = Form(
"%s_hNClusters_Mod%d",fCalorimeter.Data(),ism);
211 TString nameNCellPerCluster = Form(
"%s_hNCellsPerCluster_Mod%d",fCalorimeter.Data(),ism);
212 TString nameE = Form(
"%s_hE_Mod%d",fCalorimeter.Data(),ism);
214 NCells[ism] = (TH1F*)outputList->FindObject(nameNCell.Data());
215 NClusters[ism] = (TH1F*)outputList->FindObject(nameNCluster.Data());
216 NCellsPerCluster[ism] = (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data());
217 E[ism] = (TH1F*)outputList->FindObject(nameE.Data());
218 CellMeanSM[ism][i]=NCells[ism]->GetMean();
219 CellRMSSM[ism][i]=NCells[ism]->GetMeanError();
220 ClusterMeanSM[ism][i]=NClusters[ism]->GetMean();
221 ClusterRMSSM[ism][i]=NClusters[ism]->GetMeanError();
222 CellPerClusterMeanSM[ism][i]=NCellsPerCluster[ism]->GetMean(2);
223 CellPerClusterRMSSM[ism][i]=NCellsPerCluster[ism]->GetMeanError(2);
225 ECell1MeanSM[ism][i] =NCellsPerCluster[ism]->ProjectionX(
"",2,300,
"")->Integral(5,100)/(nEvent[i]);
226 ECell1RMSSM[ism][i] =NCellsPerCluster[ism]->ProjectionX(
"",2,300,
"")->GetMeanError();
228 for(
Int_t ibin = E[ism]->FindBin(0.3) ; ibin <E[ism]->FindBin(50.) ; ibin++){
229 energySM+=E[ism]->GetBinCenter(ibin)*(E[ism]->GetBinContent(ibin));
231 EtotalMeanSM[ism][i]=energySM/(E[ism]->Integral(E[ism]->FindBin(0.3),E[ism]->FindBin(50.)));
233 EtotalRMSSM[ism][i]=E[ism]->GetMeanError();
236 fhNCells = (TH1F*)NCells[ism]->Clone(
"NCells");
237 fhNClusters = (TH1F*)NClusters[ism]->Clone(
"NClusters");
240 fhNCells->Add(NCells[ism],1);
241 fhNClusters->Add(NClusters[ism],1);
244 ClusterMean[i]=fhNClusters->GetMean();
245 ClusterRMS[i]=fhNClusters->GetMeanError();
246 CellMean[i]=fhNCells->GetMean();
247 CellRMS[i]=fhNCells->GetMeanError();
248 outputList->Clear() ;
258 QAData <<i+1<<
" "<< RunId[i] <<
" "<< nEvent[i]
279 TString base =
"/scratch/alicehp2/germain/QA/";
286 TString ClusterAverages ; ClusterAverages = base +
"ClusterAverages.gif";
287 TString Entries ; Entries = base +
"Nentries.gif";
288 TString ClusterAveragesEnergy ; ClusterAveragesEnergy = base +
"ClusterAveragesEnergy.gif";
289 TString ClusterAveragesEntries ; ClusterAveragesEntries = base +
"ClusterAveragesEntries.gif";
290 TString ClusterAveragesCells ; ClusterAveragesCells = base +
"ClusterAveragescells.gif";
293 cout <<
"c11 nEvents" << endl;
296 cout <<
" index(0)" << index[nRun-1] <<
" index(20) " << index[20] <<endl;
297 TH1F * dummy =
new TH1F(
"dummy",
"dummy", nRun, 0., nRun+0.5);
299 dummy->SetTitle(
"") ;
300 dummy->SetStats(kFALSE) ;
301 dummy->SetAxisRange(0., nRun,
"X") ;
303 for(
Int_t i = 0 ; i < nRun ; i++){
306 cout <<
" run "<< RunId[i] <<
" label " <<label << endl;
308 dummy->GetXaxis()->SetBinLabel(i+1,label.Data());
309 dummy->GetXaxis()->LabelsOption(
"v");
315 TCanvas * c11 =
new TCanvas(
"nEvents",
"nEvents", 1000, 500);
316 c11->SetFillColor(0);
317 c11->SetBorderSize(0);
318 c11->SetFrameBorderMode(0);
319 gStyle->SetOptStat(0);
323 dummy->GetXaxis()->SetTitleOffset(0.05);
324 dummy->GetYaxis()->SetTitle(
"N_{events}");
325 dummy->SetMinimum(1.) ;
326 dummy->SetMaximum(1.e6) ;
329 nEvents->SetMarkerStyle(20);
330 nEvents->SetMarkerColor(1);
331 nEvents->SetLineColor(2);
332 nEvents->Draw(
"same PL") ;
336 if (fTrigger==
"MB")sprintf(outfilename,
"nEventMB.gif");
337 if (fTrigger==
"EMC")sprintf(outfilename,
"nEventEMC.gif");
340 c11->SaveAs(Entries);
343 cout <<
"c1 Aver NCell" << endl;
345 TCanvas * c1 =
new TCanvas(
"AverNCell",
"AverNCell", 600, 600);
348 c1->SetBorderSize(0);
349 c1->SetFrameBorderMode(0);
350 gStyle->SetOptStat(0);
351 TH1F * h1 = (TH1F*)dummy->Clone(
"");
352 h1->GetXaxis()->SetTitle(
"RUN Index");
353 h1->GetYaxis()->SetTitle(
"<N_{cells}>");
355 h1->SetMaximum(10.) ;
356 if(fCalorimeter==
"EMCAL") h1->SetMaximum(5.) ;
361 AverNcells->SetMarkerColor(1);
362 AverNcells->SetMarkerStyle(20);
363 AverNcells->Draw(
"same P") ;
364 for(
Int_t ism = 0 ; ism < n ; ism++){
365 AverNcellsSM[ism] =
new TGraphErrors(nRun, x, CellMeanSM[ism], xe, CellRMSSM[ism]);
366 AverNcellsSM[ism]->SetMarkerColor(ism+2);
367 AverNcellsSM[ism]->SetMarkerStyle(21+ism);
368 AverNcellsSM[ism]->Draw(
"same P");
373 TLegend * l1 =
new TLegend(0.4, 0.6, 0.75, 0.85);
375 l1->SetBorderSize(0);
376 l1->SetTextSize(0.02);
377 l1->AddEntry(AverNcells,
"<# of cells>",
"") ;
378 l1->AddEntry(AverNcells, Form(
"det = %s",fCalorimeter.Data()),
"") ;
379 l1->AddEntry(AverNcells,
"average",
"p");
380 for(
Int_t ism = 0 ; ism < n ; ism++){
381 TString projname = Form(
"SM_ %d",ism);
382 l1->AddEntry(AverNcellsSM[ism],projname.Data(),
"p");
388 TCanvas * c200 =
new TCanvas(
"ClusterAverages",
"ClusterAverages", 1000, 500);
389 c200->SetFillColor(0);
390 c200->SetBorderSize(0);
391 c200->SetFrameBorderMode(0);
394 gPad->SetLeftMargin(0.08);
395 gPad->SetRightMargin(0.02);
398 TH1F * h2 = (TH1F*)dummy->Clone(
"");
400 h2->GetYaxis()->SetTitle(
"<N_{clusters}>/event");
402 if (fTrigger==
"EMC") h2->SetMaximum(70) ;
403 else h2->SetMaximum(50) ;
408 AverNclusters->SetMarkerStyle(20);
409 AverNclusters->SetMarkerColor(1);
410 AverNclusters->Draw(
"same P") ;
412 for(
Int_t ism = 0 ; ism < n ; ism++){
413 AverNclustersSM[ism] =
new TGraphErrors(nRun, x, ClusterMeanSM[ism], xe, ClusterRMSSM[ism]);
414 AverNclustersSM[ism]->SetMarkerColor(ism+2);
415 AverNclustersSM[ism]->SetMarkerStyle(21+ism);
417 AverNclustersSM[ism]->Draw(
"same P");
421 TLegend * l200 =
new TLegend(0.4, 0.6, 0.75, 0.85);
422 l200->SetFillColor(0);
423 l200->SetBorderSize(0);
424 l200->SetTextSize(0.02);
425 l200->AddEntry(AverNclusters,
"<# of clusters>",
"") ;
426 l200->AddEntry(AverNclusters, Form(
"det = %s",fCalorimeter.Data()),
"") ;
427 l200->AddEntry(AverNclusters,
"average",
"p");
429 for(
Int_t ism = 0 ; ism < n ; ism++){
430 TString projname = Form(
"SM_ %d",ism);
431 l200->AddEntry(AverNclustersSM[ism],projname.Data(),
"p");
436 c200->SaveAs(ClusterAveragesEntries);
438 TCanvas * c201 =
new TCanvas(
"ClusterAveragesEnergy",
"ClusterAveragesEnergy", 1000, 500);
439 c201->SetFillColor(0);
440 c201->SetBorderSize(0);
441 c201->SetFrameBorderMode(0);
445 gPad->SetLeftMargin(0.08);
446 gPad->SetRightMargin(0.02);
450 TH1F * h3 = (TH1F*)dummy->Clone(
"");
452 h3->GetYaxis()->SetTitle(
"<E> (GeV)");
453 h3->SetMinimum(0.2) ;
458 AverE->SetMarkerStyle(20);
459 AverE->SetMarkerColor(1);
460 AverE->Draw(
"same P");
462 for(
Int_t ism = 0 ; ism < n ; ism++){
463 AverESM[ism] =
new TGraphErrors(nRun, x, EtotalMeanSM[ism], xe, EtotalRMSSM[ism]);
464 AverESM[ism]->SetMarkerColor(ism+2);
465 AverESM[ism]->SetMarkerStyle(21+ism);
466 AverESM[ism]->Draw(
"same P");
470 TLegend * l3 =
new TLegend(0.4, 0.6, 0.75, 0.85);
472 l3->SetBorderSize(0);
473 l3->SetTextSize(0.02);
474 l3->AddEntry(AverE,
"<E>",
"") ;
475 l3->AddEntry(AverE, Form(
"det = %s",fCalorimeter.Data()),
"") ;
476 l3->AddEntry(AverE,
"average",
"p");
478 for(
Int_t ism = 0 ; ism < n ; ism++){
479 TString projname = Form(
"SM_ %d",ism);
480 l3->AddEntry(AverESM[ism],projname.Data(),
"p");
485 c201->SaveAs(ClusterAveragesEnergy);
488 TCanvas * c202 =
new TCanvas(
"ClusterAveragesCells",
"ClusterAveragesCells", 1000, 500);
489 c202->SetFillColor(0);
490 c202->SetBorderSize(0);
491 c202->SetFrameBorderMode(0);
494 gPad->SetLeftMargin(0.08);
495 gPad->SetRightMargin(0.02);
500 TH1F * h4 = (TH1F*)dummy->Clone(
"");
502 h4->GetYaxis()->SetTitle(
"<N_{CellsPerCluster}>");
503 h4->SetMinimum(1.5) ;
504 h4->SetMaximum(5.5) ;
509 AverCellPerCluster->SetMarkerStyle(20);
510 AverCellPerCluster->SetMarkerColor(1);
512 for(
Int_t ism = 0 ; ism < n ; ism++){
513 AverNcellsPerClusterSM[ism] =
new TGraphErrors(nRun, x, CellPerClusterMeanSM[ism], xe, CellPerClusterRMSSM[ism]);
514 AverNcellsPerClusterSM[ism]->SetMarkerColor(ism+2);
515 AverNcellsPerClusterSM[ism]->SetMarkerStyle(21+ism);
516 AverNcellsPerClusterSM[ism]->Draw(
"same P");
520 TLegend * l4 =
new TLegend(0.4, 0.6, 0.75, 0.85);
522 l4->SetBorderSize(0);
523 l4->SetTextSize(0.02);
524 l4->AddEntry(AverCellPerCluster,
"<# of cells per cluster>",
"") ;
525 l4->AddEntry(AverCellPerCluster, Form(
"det = %s",fCalorimeter.Data()),
"") ;
526 l4->AddEntry(AverCellPerCluster,
"average",
"p");
528 for(
Int_t ism = 0 ; ism < n ; ism++){
529 TString projname = Form(
"SM_ %d",ism);
530 l4->AddEntry(AverNcellsPerClusterSM[ism],projname.Data(),
"p");
535 c202->SaveAs(ClusterAveragesCells);
void trendingCluster(TString fCalorimeter="EMCAL", TString period="LHC11h", TString pass="pass1_HLT", const Int_t n=10, TString fTrigger="MB")
Double_t nEvents
plot quality messages
TFile * file
TList with histograms for a given trigger.