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>
69 if (fTrigger==
"EMC") file =
"/scratch/alicehp2/germain/QA/"+period+
"/"+ pass +
"/runlist.txt" ;
70 else file =
"/scratch/alicehp2/germain/QA/"+period+
"/"+ pass +
"/runlistMB.txt" ;
73 pFile = fopen(file.Data(),
"r");
76 cout <<
" fcalo: " << fCalorimeter <<
"; period: " << period <<
"; pass: " << pass <<
" trigger "<<fTrigger<< endl;
77 char outfilename [100] ;
90 ncols = fscanf(pFile,
"%d %d ",&p,&q);
99 const Int_t nRun = nlines ;
118 TDirectoryFile *
dir;
126 TH3D * fhNCellsPerCluster ;
131 TH2F * NCellsPerCluster[n];
148 Double_t CellPerClusterMeanSM[n][nRun] ;
149 Double_t CellPerClusterRMSSM[n][nRun] ;
154 TString namefile =
"/scratch/alicehp2/germain/QA/"+period+
"/"+pass+
"/"+ fCalorimeter + period + pass + fTrigger+
"data.txt";
156 fstream QAData(namefile, ios::out);
158 cout <<
" namefile " << namefile << endl;
159 cout <<
" nRun " << nRun <<
" index(nRun) " << index[nRun-1] << endl;
161 for(
Int_t i = 0 ; i < nRun ; i++){
165 TString name =
"/scratch/alicehp2/germain/QA/"+period +
"/"+ pass +
"/";
169 f = TFile::Open(name.Data(),
"read") ;
174 if(fTrigger==
"EMC"){ dir = (TDirectoryFile *)f->Get(
"CaloQA_EMC7");
175 outputList = (
TList*)dir->Get(
"CaloQA_EMC7");
178 dir = (TDirectoryFile *)f->Get(
"CaloQA_default");
179 outputList = (
TList*)dir->Get(
"CaloQA_default");
185 fhNEvents =(TH1F *)outputList->FindObject(
"hNEvents");
186 nEvent[i]=fhNEvents->GetEntries();
187 cout <<
" Run " << RunId[i]<<
" nevent " << nEvent[i]<< endl;
188 if( nEvent[i] == 0) continue ;
189 if( nEvent[i] < 2) continue ;
190 fhE = (TH1F *)outputList->FindObject(fCalorimeter+
"_hE");
194 for(
Int_t ibin = fhE->FindBin(0.3) ; ibin <fhE->FindBin(50.) ; ibin++){
195 energy+=fhE->GetBinCenter(ibin)*fhE->GetBinContent(ibin);
197 EtotalMean[i]=energy/fhE->Integral(fhE->FindBin(0.3), fhE->FindBin(50.)) ;
198 EtotalRMS[i]=fhE->GetMeanError();
203 for(
Int_t ism = 0 ; ism < n ; ism++){
204 TString nameNCell = Form(
"%s_hNCells_Mod%d",fCalorimeter.Data(),ism);
206 TString nameNCluster = Form(
"%s_hNClusters_Mod%d",fCalorimeter.Data(),ism);
207 TString nameNCellPerCluster = Form(
"%s_hNCellsPerCluster_Mod%d",fCalorimeter.Data(),ism);
208 TString nameE = Form(
"%s_hE_Mod%d",fCalorimeter.Data(),ism);
210 NCells[ism] = (TH1F*)outputList->FindObject(nameNCell.Data());
211 NClusters[ism] = (TH1F*)outputList->FindObject(nameNCluster.Data());
212 NCellsPerCluster[ism] = (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data());
213 E[ism] = (TH1F*)outputList->FindObject(nameE.Data());
214 CellMeanSM[ism][i]=NCells[ism]->GetMean();
215 CellRMSSM[ism][i]=NCells[ism]->GetMeanError();
216 ClusterMeanSM[ism][i]=NClusters[ism]->GetMean();
217 ClusterRMSSM[ism][i]=NClusters[ism]->GetMeanError();
218 CellPerClusterMeanSM[ism][i]=NCellsPerCluster[ism]->GetMean(2);
219 CellPerClusterRMSSM[ism][i]=NCellsPerCluster[ism]->GetMeanError(2);
221 ECell1MeanSM[ism][i] =NCellsPerCluster[ism]->ProjectionX(
"",2,300,
"")->Integral(5,100)/(nEvent[i]);
222 ECell1RMSSM[ism][i] =NCellsPerCluster[ism]->ProjectionX(
"",2,300,
"")->GetMeanError();
224 for(
Int_t ibin = E[ism]->FindBin(0.3) ; ibin <E[ism]->FindBin(50.) ; ibin++){
225 energySM+=E[ism]->GetBinCenter(ibin)*(E[ism]->GetBinContent(ibin));
227 EtotalMeanSM[ism][i]=energySM/(E[ism]->Integral(E[ism]->FindBin(0.3),E[ism]->FindBin(50.)));
229 EtotalRMSSM[ism][i]=E[ism]->GetMeanError();
232 fhNCells = (TH1F*)NCells[ism]->Clone(
"NCells");
233 fhNClusters = (TH1F*)NClusters[ism]->Clone(
"NClusters");
236 fhNCells->Add(NCells[ism],1);
237 fhNClusters->Add(NClusters[ism],1);
240 ClusterMean[i]=fhNClusters->GetMean();
241 ClusterRMS[i]=fhNClusters->GetMeanError();
242 CellMean[i]=fhNCells->GetMean();
243 CellRMS[i]=fhNCells->GetMeanError();
244 outputList->Clear() ;
254 QAData <<i+1<<
" "<< RunId[i] <<
" "<< nEvent[i]
275 TString base =
"/scratch/alicehp2/germain/QA/";
282 TString ClusterAverages ; ClusterAverages = base +
"ClusterAverages.gif";
283 TString Entries ; Entries = base +
"Nentries.gif";
284 TString ClusterAveragesEnergy ; ClusterAveragesEnergy = base +
"ClusterAveragesEnergy.gif";
285 TString ClusterAveragesEntries ; ClusterAveragesEntries = base +
"ClusterAveragesEntries.gif";
286 TString ClusterAveragesCells ; ClusterAveragesCells = base +
"ClusterAveragescells.gif";
289 cout <<
"c11 nEvents" << endl;
292 cout <<
" index(0)" << index[nRun-1] <<
" index(20) " << index[20] <<endl;
293 TH1F * dummy =
new TH1F(
"dummy",
"dummy", nRun, 0., nRun+0.5);
295 dummy->SetTitle(
"") ;
296 dummy->SetStats(kFALSE) ;
297 dummy->SetAxisRange(0., nRun,
"X") ;
299 for(
Int_t i = 0 ; i < nRun ; i++){
302 cout <<
" run "<< RunId[i] <<
" label " <<label << endl;
304 dummy->GetXaxis()->SetBinLabel(i+1,label.Data());
305 dummy->GetXaxis()->LabelsOption(
"v");
311 TCanvas * c11 =
new TCanvas(
"nEvents",
"nEvents", 1000, 500);
312 c11->SetFillColor(0);
313 c11->SetBorderSize(0);
314 c11->SetFrameBorderMode(0);
315 gStyle->SetOptStat(0);
319 dummy->GetXaxis()->SetTitleOffset(0.05);
320 dummy->GetYaxis()->SetTitle(
"N_{events}");
321 dummy->SetMinimum(1.) ;
322 dummy->SetMaximum(1.e6) ;
325 nEvents->SetMarkerStyle(20);
326 nEvents->SetMarkerColor(1);
327 nEvents->SetLineColor(2);
328 nEvents->Draw(
"same PL") ;
332 if (fTrigger==
"MB")sprintf(outfilename,
"nEventMB.gif");
333 if (fTrigger==
"EMC")sprintf(outfilename,
"nEventEMC.gif");
336 c11->SaveAs(Entries);
339 cout <<
"c1 Aver NCell" << endl;
341 TCanvas * c1 =
new TCanvas(
"AverNCell",
"AverNCell", 600, 600);
344 c1->SetBorderSize(0);
345 c1->SetFrameBorderMode(0);
346 gStyle->SetOptStat(0);
347 TH1F * h1 = (TH1F*)dummy->Clone(
"");
348 h1->GetXaxis()->SetTitle(
"RUN Index");
349 h1->GetYaxis()->SetTitle(
"<N_{cells}>");
351 h1->SetMaximum(10.) ;
352 if(fCalorimeter==
"EMCAL") h1->SetMaximum(5.) ;
357 AverNcells->SetMarkerColor(1);
358 AverNcells->SetMarkerStyle(20);
359 AverNcells->Draw(
"same P") ;
360 for(
Int_t ism = 0 ; ism < n ; ism++){
361 AverNcellsSM[ism] =
new TGraphErrors(nRun, x, CellMeanSM[ism], xe, CellRMSSM[ism]);
362 AverNcellsSM[ism]->SetMarkerColor(ism+2);
363 AverNcellsSM[ism]->SetMarkerStyle(21+ism);
364 AverNcellsSM[ism]->Draw(
"same P");
369 TLegend * l1 =
new TLegend(0.4, 0.6, 0.75, 0.85);
371 l1->SetBorderSize(0);
372 l1->SetTextSize(0.02);
373 l1->AddEntry(AverNcells,
"<# of cells>",
"") ;
374 l1->AddEntry(AverNcells, Form(
"det = %s",fCalorimeter.Data()),
"") ;
375 l1->AddEntry(AverNcells,
"average",
"p");
376 for(
Int_t ism = 0 ; ism < n ; ism++){
377 TString projname = Form(
"SM_ %d",ism);
378 l1->AddEntry(AverNcellsSM[ism],projname.Data(),
"p");
384 TCanvas * c200 =
new TCanvas(
"ClusterAverages",
"ClusterAverages", 1000, 500);
385 c200->SetFillColor(0);
386 c200->SetBorderSize(0);
387 c200->SetFrameBorderMode(0);
390 gPad->SetLeftMargin(0.08);
391 gPad->SetRightMargin(0.02);
394 TH1F * h2 = (TH1F*)dummy->Clone(
"");
396 h2->GetYaxis()->SetTitle(
"<N_{clusters}>/event");
398 if (fTrigger==
"EMC") h2->SetMaximum(70) ;
399 else h2->SetMaximum(50) ;
404 AverNclusters->SetMarkerStyle(20);
405 AverNclusters->SetMarkerColor(1);
406 AverNclusters->Draw(
"same P") ;
408 for(
Int_t ism = 0 ; ism < n ; ism++){
409 AverNclustersSM[ism] =
new TGraphErrors(nRun, x, ClusterMeanSM[ism], xe, ClusterRMSSM[ism]);
410 AverNclustersSM[ism]->SetMarkerColor(ism+2);
411 AverNclustersSM[ism]->SetMarkerStyle(21+ism);
413 AverNclustersSM[ism]->Draw(
"same P");
417 TLegend * l200 =
new TLegend(0.4, 0.6, 0.75, 0.85);
418 l200->SetFillColor(0);
419 l200->SetBorderSize(0);
420 l200->SetTextSize(0.02);
421 l200->AddEntry(AverNclusters,
"<# of clusters>",
"") ;
422 l200->AddEntry(AverNclusters, Form(
"det = %s",fCalorimeter.Data()),
"") ;
423 l200->AddEntry(AverNclusters,
"average",
"p");
425 for(
Int_t ism = 0 ; ism < n ; ism++){
426 TString projname = Form(
"SM_ %d",ism);
427 l200->AddEntry(AverNclustersSM[ism],projname.Data(),
"p");
432 c200->SaveAs(ClusterAveragesEntries);
434 TCanvas * c201 =
new TCanvas(
"ClusterAveragesEnergy",
"ClusterAveragesEnergy", 1000, 500);
435 c201->SetFillColor(0);
436 c201->SetBorderSize(0);
437 c201->SetFrameBorderMode(0);
441 gPad->SetLeftMargin(0.08);
442 gPad->SetRightMargin(0.02);
446 TH1F * h3 = (TH1F*)dummy->Clone(
"");
448 h3->GetYaxis()->SetTitle(
"<E> (GeV)");
449 h3->SetMinimum(0.2) ;
454 AverE->SetMarkerStyle(20);
455 AverE->SetMarkerColor(1);
456 AverE->Draw(
"same P");
458 for(
Int_t ism = 0 ; ism < n ; ism++){
459 AverESM[ism] =
new TGraphErrors(nRun, x, EtotalMeanSM[ism], xe, EtotalRMSSM[ism]);
460 AverESM[ism]->SetMarkerColor(ism+2);
461 AverESM[ism]->SetMarkerStyle(21+ism);
462 AverESM[ism]->Draw(
"same P");
466 TLegend * l3 =
new TLegend(0.4, 0.6, 0.75, 0.85);
468 l3->SetBorderSize(0);
469 l3->SetTextSize(0.02);
470 l3->AddEntry(AverE,
"<E>",
"") ;
471 l3->AddEntry(AverE, Form(
"det = %s",fCalorimeter.Data()),
"") ;
472 l3->AddEntry(AverE,
"average",
"p");
474 for(
Int_t ism = 0 ; ism < n ; ism++){
475 TString projname = Form(
"SM_ %d",ism);
476 l3->AddEntry(AverESM[ism],projname.Data(),
"p");
481 c201->SaveAs(ClusterAveragesEnergy);
484 TCanvas * c202 =
new TCanvas(
"ClusterAveragesCells",
"ClusterAveragesCells", 1000, 500);
485 c202->SetFillColor(0);
486 c202->SetBorderSize(0);
487 c202->SetFrameBorderMode(0);
490 gPad->SetLeftMargin(0.08);
491 gPad->SetRightMargin(0.02);
496 TH1F * h4 = (TH1F*)dummy->Clone(
"");
498 h4->GetYaxis()->SetTitle(
"<N_{CellsPerCluster}>");
499 h4->SetMinimum(1.5) ;
500 h4->SetMaximum(5.5) ;
505 AverCellPerCluster->SetMarkerStyle(20);
506 AverCellPerCluster->SetMarkerColor(1);
508 for(
Int_t ism = 0 ; ism < n ; ism++){
509 AverNcellsPerClusterSM[ism] =
new TGraphErrors(nRun, x, CellPerClusterMeanSM[ism], xe, CellPerClusterRMSSM[ism]);
510 AverNcellsPerClusterSM[ism]->SetMarkerColor(ism+2);
511 AverNcellsPerClusterSM[ism]->SetMarkerStyle(21+ism);
512 AverNcellsPerClusterSM[ism]->Draw(
"same P");
516 TLegend * l4 =
new TLegend(0.4, 0.6, 0.75, 0.85);
518 l4->SetBorderSize(0);
519 l4->SetTextSize(0.02);
520 l4->AddEntry(AverCellPerCluster,
"<# of cells per cluster>",
"") ;
521 l4->AddEntry(AverCellPerCluster, Form(
"det = %s",fCalorimeter.Data()),
"") ;
522 l4->AddEntry(AverCellPerCluster,
"average",
"p");
524 for(
Int_t ism = 0 ; ism < n ; ism++){
525 TString projname = Form(
"SM_ %d",ism);
526 l4->AddEntry(AverNcellsPerClusterSM[ism],projname.Data(),
"p");
531 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.