1 #if !defined(__CINT__) || defined(__MAKECINT__)
3 #include "AliEMCALGeometry.h"
7 #include <TDirectory.h>
12 #include <TGraphErrors.h>
17 #include <TObjString.h>
52 const Int_t NRGBs = 5;
53 const Int_t NCont = 255;
55 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
56 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
57 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
58 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
59 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
60 gStyle->SetNumberContours(NCont);
69 if (par[2] != 0.) gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) / (2*par[2]*par[2]) );
71 else gaus = 99999999.;
73 Double_t back = par[3] + par[4]*x[0] + par[5]*x[0]*x[0];
82 Double_t gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) / (2*par[2]*par[2]) );
84 Double_t back = par[3] + par[4]*x[0];
96 levy = par[0] * TMath::Exp( -par[1]/x[0]) * TMath::Power(x[0], -par[2]) ;
106 if(QAPATH.IsNull()) QAPATH = QAPATHF;
107 if(! QAPATH.BeginsWith(
"./")) { QAPATH = QAPATH + RunId +
"/";}
109 AliLog::SetGlobalLogLevel(AliLog::kError);
110 TFile *f =
new TFile(filename);
111 AliLog::SetGlobalLogLevel(AliLog::kInfo);
113 if (f->IsZombie()) {Error(__FUNCTION__,Form(
"Error openning the input file %s",filename));
return -1;}
119 TPMERegexp name_re(
"CaloQA_\\w+");
120 TObjLink* link = f->GetListOfKeys()->FirstLink();
124 TString name = link->GetObject()->GetName();
125 if (name_re.Match(name))
127 TriggersList->Add(link->GetObject());
128 if(
TString(filename).Contains(
"barrel") && ! name.Contains(
"default")) TriggersList->Remove(link->GetObject());
129 if(
TString(filename).Contains(
"outer") && ! name.Contains(
"EMC")) TriggersList->Remove(link->GetObject());
133 }
else {TriggersList->Add(
new TObjString(fTrigger.Data()));}
135 if(!TriggersList->GetEntries()) {Error(__FUNCTION__,
"No trigger found!");
return -2;}
137 int nSM =
FindNumberOfSM(f,((TObjString*)TriggersList->Last())->GetString(),period);
138 if (nSM<0) {Error(__FUNCTION__,
"Could not find the number of super modules!");
return -3;}
139 Info(__FUNCTION__,Form(
"%i super modules were discuvered",nSM));
141 if (nSM <= 4) { nSM=4; GeomName =
"EMCAL_FIRSTYEARv1";}
142 else if (nSM <= 10) { nSM=10; GeomName =
"EMCAL_COMPLETEv1";}
143 else if (nSM <= 12) { nSM=12; GeomName =
"EMCAL_COMPLETE12SMv1";}
144 else {nSM = 20; GeomName =
"EMCAL_COMPLETE12SMv1_DCAL_8SM";}
146 AliEMCALGeometry *geom =
new AliEMCALGeometry(GeomName.Data(),
"EMCAL");
147 Info(__FUNCTION__,Form(
"Using %i super modules and the Geometry %s",nSM,GeomName.Data()));
149 TFile *fout =
new TFile(
TString( QAPATH + period+
"_"+pass + fTrigger+
"_"+ (Long_t)RunId.Atoi() +
"_QAplots.root").
Data(),
"RECREATE");
151 if((system.IsNull()) && (period.EndsWith(
"h"))) {system =
"PbPb";}
154 TIter next(TriggersList);
157 fTrigger=
TString(obj->GetName());
158 ret -=
DrawOccupancy(RunId.Atoi(),period,pass,fTrigger,system,f,fout,geom,SavePlots);
159 ret -=
DrawRun(RunId.Atoi(),period,pass,fTrigger,f,fout,SavePlots,nSM,filter);
161 ret-=
TrendingEMCALTree(RunId.Atoi(),fCalorimeter,system,period,pass,nSM,TriggersList,f,fout,SavePlots);
176 gStyle->SetOptStat(0);
177 TH1::AddDirectory(kFALSE);
178 TH2D *hEnergyMapReal =
new TH2D(
"hEnergyMapReal",
"",96,-48,48,120,-0,120);
179 TH2D *hOccupancyMapReal =
new TH2D(
"hOccupancyMapReal",
"",96,-48,48,120,-0,120);
180 hEnergyMapReal->SetXTitle(
"eta (bin)");
181 hEnergyMapReal->SetYTitle(
"phi (bin)");
182 hEnergyMapReal->SetZTitle(
"E(GeV)/event");
183 hEnergyMapReal->GetYaxis()->SetTitleOffset(1.2);
184 hEnergyMapReal->GetZaxis()->SetLabelSize(0.02);
185 hEnergyMapReal->GetZaxis()->SetTitleOffset(1.36);
187 hOccupancyMapReal->SetXTitle(
"eta (bin)");
188 hOccupancyMapReal->SetYTitle(
"phi (bin)");
189 hOccupancyMapReal->GetYaxis()->SetTitleOffset(1.2);
190 hOccupancyMapReal->GetZaxis()->SetLabelSize(0.02);
192 Int_t nSupMod, nModule, nIphi, nIeta;
198 Int_t mask[1] = {2222222};
200 TH2F *hCellAmplitude;
206 if(!fTrigger.Contains(
"QA")) {
210 Bool_t dirok = f->cd(direct);
211 if (!dirok) { Error(__FUNCTION__,Form(
"No input drectory %s",direct.Data()));
return -1;}
212 TList *outputList = (
TList*)gDirectory->Get(direct);
213 if(!outputList){ Error(__FUNCTION__,
"No input list! ");
return -1;}
214 outputList->SetOwner();
216 fout->mkdir(Form(
"%s/%s/%ld/%s/%s",period.Data(),pass.Data(),run,
"RunLevelQA",fTrigger.Data()));
218 fout->Cd(Form(
"%s/%s/%ld/%s/%s",period.Data(),pass.Data(),run,
"RunLevelQA",fTrigger.Data()));
220 hNEvents =(TH1F *)outputList->FindObject(
"hNEvents");
221 if(!hNEvents){ Error(__FUNCTION__,Form(
"hNEvent histogram not found for trigger %s ",fTrigger.Data()));
return -2;}
222 Events = (
Int_t)hNEvents->GetEntries();
223 if(Events==0){ Error(__FUNCTION__,Form(
"No event in trigger %s",fTrigger.Data()));
return -3;}
225 TH1F* hE =(TH1F *)outputList->FindObject(
"EMCAL_hE");
226 if (!hE || (!hE->GetEntries())) { Error(__FUNCTION__,Form(
"hE Histogram not found or it is empty for trigger %s, EMCAL was not in this run?",fTrigger.Data()));
return -4;}
231 if (fTrigger.Contains(
"EMC")) Eth=20.;
235 if (fTrigger.Contains(
"EMC")) Eth=5.;
238 hCellAmplitude =(
TH2F *)outputList->FindObject(
"EMCAL_hAmpId");
240 for(
Int_t i = 0; i < geom->GetNCells() ; i++){
244 for (
Int_t j = 1; j <= hCellAmplitude->GetNbinsX(); j++)
246 Double_t E = hCellAmplitude->GetXaxis()->GetBinCenter(j);
247 Double_t N = hCellAmplitude->GetBinContent(j, i+1);
249 if (E < 0.3)
continue;
258 if(n!=0) {
if(mask[n]<=mask[n-1]) Warning(__FUNCTION__,
"The list of bad cells is not sorted !!");}
259 if(i==mask[n]){n++ ;
continue; }
261 geom->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
262 geom->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
264 realbinphi = 120-(nSupMod/2)*24 -iphi -1;
265 if (nSupMod%2==0) realbineta= 48-ieta -1;
266 if (nSupMod%2==1) realbineta= -ieta -1;
268 hEnergyMapReal->Fill(realbineta,realbinphi,Esum/(
Double_t)Events);
272 cout <<
" Run: " << run <<
" trigger: " << fTrigger <<
" N_events: "<<Events<<endl;
274 TPMERegexp r(
"_\\w+");
275 TString Energy; Energy = QAPATH +
"MapEnergy" + fTrigger(r) +
".pdf";
276 TString Energy2; Energy2 = QAPATH +
"MapEnergy" + fTrigger(r) +
".png";
277 TString Entries; Entries = QAPATH +
"MapEntries" + fTrigger(r) +
".pdf";
278 TString Entries2; Entries2 = QAPATH +
"MapEntries" + fTrigger(r) +
".png";
280 TCanvas *c1 =
new TCanvas(
"Energymap",
"Energy Map",600,600);
283 c1->SetRightMargin(0.14);
286 if(fTrigger.Contains(
"EMC")) { title +=
" EMC ";}
else {title +=
" MB ";}
287 title +=
" Summed energy map";
288 hEnergyMapReal->SetTitle(title);
289 AutoZoom(hEnergyMapReal,
"miny")->DrawCopy(
"colz");
291 if(SavePlots==2) c1->SaveAs(Energy);
292 if(SavePlots) c1->SaveAs(Energy2);
312 if (outputList) {outputList->Delete();}
314 delete hEnergyMapReal;
315 delete hOccupancyMapReal;
325 if(!fTrigger.Contains(
"QA")) {
331 if(!direct) { Error(__FUNCTION__,Form(
"No input directory %s",direct.Data()));
return -1;}
332 TList *outputList = (
TList*)gDirectory->Get(direct);
333 if(!outputList){ Error(__FUNCTION__,Form(
"No input list! %s",direct.Data()));
return -2;}
334 outputList->SetOwner();
337 fout->mkdir(Form(
"%s/%s/%ld/%s",period.Data(),pass.Data(),run,fTrigger.Data()));
339 fout->Cd(Form(
"%s/%s/%ld/%s",period.Data(),pass.Data(),run,fTrigger.Data()));
343 fout->Cd(Form(
"%s/%s/%ld/%s/%s",period.Data(),pass.Data(),run,
"RunLevelQA",fTrigger.Data()));
347 gStyle->SetPalette(1);
350 TH1::AddDirectory(kFALSE);
353 const char* legend=
"";
354 TPMERegexp r(
"_\\w+");
356 if (fTrigger.Contains(
"EMC")){ legend = Form(
" Run %d EMC ",(
int)run);}
357 else legend = Form(
" Run %d MB ",(
int)run);
359 TH1F* hNEvents =(TH1F *)outputList->FindObject(
"hNEvents");
360 if(!hNEvents){ Error(__FUNCTION__,Form(
"hNEvent histogram not found for trigger %s ",fTrigger.Data()));
return -3;}
362 if(Events==0){ Error(__FUNCTION__,Form(
"No event in trigger %s",fTrigger.Data()));
return -4 ;}
364 TH1F* hE =(TH1F *)outputList->FindObject(
"EMCAL_hE");
365 if (!hE || (!hE->GetEntries())) { Error(__FUNCTION__,Form(
"hE Histogram not found or it is empty for trigger %s, EMCAL was not in this run?",fTrigger.Data()));
return -4;}
368 TCanvas* c00 =
new TCanvas(
"Occupancy map",
"Occupancy", 600, 600);
370 c00->SetFillColor(0);
371 c00->SetBorderSize(0);
372 c00->SetFrameBorderMode(0);
374 TH2F* hOccupancyMapReal =(
TH2F *)outputList->FindObject(
"EMCAL_hEtaPhi");
375 if(!hOccupancyMapReal) { Error(__FUNCTION__,Form(
"EMCAL_hEtaPhi: Histogram for trigger %s not found!",fTrigger.Data()));
return -5;}
376 FormatRunHisto(hOccupancyMapReal,Form(
"Occupancy %s",legend),
"phi (bin)");
377 hOccupancyMapReal->SetXTitle(
"eta (bin)");
379 AutoZoom(hOccupancyMapReal,
"all")->DrawCopy(
"colz");
380 outfilename = QAPATH +
"OccupancyMap" + fTrigger(r) +
".pdf" ;
381 outfilename2 = QAPATH +
"OccupancyMap" + fTrigger(r) +
".png" ;
383 if(SavePlots==2) c00->SaveAs(outfilename);
384 if(SavePlots) c00->SaveAs(outfilename2);
388 TCanvas* c0 =
new TCanvas(
"Grid Cell",
"Occupancy from Grid Cells", 600, 600);
391 c0->SetBorderSize(0);
392 c0->SetFrameBorderMode(0);
394 TH2F* hGridCells =(
TH2F *)outputList->FindObject(
"EMCAL_hGridCells");
395 if(!hGridCells) { Error(__FUNCTION__,Form(
"EMCAL_hGridCells: Histogram for trigger %s not found!",fTrigger.Data()));
return -5;}
396 FormatRunHisto(hGridCells,Form(
"Occupancy from Grid Cells %s",legend),
"phi row columns");
397 hGridCells->SetXTitle(
"eta row columns");
399 AutoZoom(hGridCells,
"all")->DrawCopy(
"colz");
400 outfilename = QAPATH +
"GridCells" + fTrigger(r) +
".pdf" ;
401 outfilename2 = QAPATH +
"GridCells" + fTrigger(r) +
".png" ;
403 if(SavePlots==2) c0->SaveAs(outfilename);
404 if(SavePlots) c0->SaveAs(outfilename2);
411 TCanvas* c1 =
new TCanvas(
"TimeVsE",
"Cluster Time Vs Energy", 600, 600);
414 c1->SetBorderSize(0);
415 c1->SetFrameBorderMode(0);
417 TH2F* hClusterTimeEnergy =(
TH2F *)outputList->FindObject(
"EMCAL_hClusterTimeEnergy");
418 if(!hClusterTimeEnergy) { Error(__FUNCTION__,Form(
"EMCAL_hClusterTimeEnergy: Histogram for trigger %s not found!",fTrigger.Data()));
return -5;}
419 FormatRunHisto(hClusterTimeEnergy,Form(
"Time Vs Energy%s",legend),
"EMCAL ToF(ns)");
421 AutoZoom(hClusterTimeEnergy,
"maxx")->DrawCopy(
"colz");
422 outfilename = QAPATH +
"TimeRun" + fTrigger(r) +
".pdf" ;
423 outfilename2 = QAPATH +
"TimeRun" + fTrigger(r) +
".png" ;
425 if(SavePlots==2) c1->SaveAs(outfilename);
426 if(SavePlots) c1->SaveAs(outfilename2);
433 TCanvas* c1a =
new TCanvas(
"TimeVsAbsId",
"Cell Id Vs time ", 600, 600);
435 c1a->SetFillColor(0);
436 c1a->SetBorderSize(0);
437 c1a->SetFrameBorderMode(0);
439 TH2F* hTimeAbsId =(
TH2F *)outputList->FindObject(
"EMCAL_hTimeId");
440 if(!hTimeAbsId) { Error(__FUNCTION__,Form(
"EMCAL_hTimeId: Histogram for trigger %s not found!",fTrigger.Data()));
return -5;}
441 FormatRunHisto(hTimeAbsId,Form(
"cell Id Vs Time%s",legend),
"cell absId");
442 hTimeAbsId->RebinY(16);
443 hTimeAbsId->SetMinimum(32);
444 AutoZoom(hTimeAbsId,
"maxx")->DrawCopy(
"colz");
445 outfilename = QAPATH +
"TimeAbsIdRun" + fTrigger(r) +
".pdf" ;
446 outfilename2 = QAPATH +
"TimeAbsRun" + fTrigger(r) +
".png" ;
448 if(SavePlots==2) c1a->SaveAs(outfilename);
449 if(SavePlots) c1a->SaveAs(outfilename2);
473 TCanvas* c1b =
new TCanvas(
"EVsAbsId",
"Cell Id Vs E ", 600, 600);
475 c1b->SetFillColor(0);
476 c1b->SetBorderSize(0);
477 c1b->SetFrameBorderMode(0);
479 TH2F* hEAbsId =(
TH2F *)outputList->FindObject(
"EMCAL_hAmpId");
480 if(!hEAbsId) { Error(__FUNCTION__,Form(
"EMCAL_hAmpId: Histogram for trigger %s not found!",fTrigger.Data()));
return -5;}
481 FormatRunHisto(hEAbsId,Form(
"cell Id Vs E%s",legend),
"cell absId");
483 hEAbsId->SetMinimum(32);
485 AutoZoom(hEAbsId,
"maxx")->DrawCopy(
"colz");
486 outfilename = QAPATH +
"EAbsIdRun" + fTrigger(r) +
".pdf" ;
487 outfilename2 = QAPATH +
"EAbsIdRun" + fTrigger(r) +
".png" ;
489 if(SavePlots==2) c1b->SaveAs(outfilename);
490 if(SavePlots) c1b->SaveAs(outfilename2);
515 if(pass!=
"muon_calo_pass1"){
517 TCanvas * c2 =
new TCanvas(
"ClusterVsTrack ",
"Correlation calo Mult Vs Track Multiplicity", 600, 600);
520 c2->SetBorderSize(0);
521 c2->SetFrameBorderMode(0);
523 TH2F* hClusterVsTrack =(
TH2F *)outputList->FindObject(
"EMCAL_hCaloTrackMNClusters");
524 FormatRunHisto(hClusterVsTrack,Form(
"N cluster Vs N track%s",legend));
526 AutoZoom(hClusterVsTrack,
"maxx,maxy",1)->DrawCopy(
"colz");
527 outfilename = QAPATH +
"CaloTrackMult" + fTrigger(r) +
".pdf";
528 outfilename2 = QAPATH +
"CaloTrackMult" + fTrigger(r) +
".png";
530 if(SavePlots==2) c2->SaveAs(outfilename);
531 if(SavePlots) c2->SaveAs(outfilename2);
538 TCanvas* c3 =
new TCanvas(
"ClusterEVsTrack ",
"Correlation E calo Vs Track Multiplicity", 600, 600);
541 c3->SetBorderSize(0);
542 c3->SetFrameBorderMode(0);
544 TH2F* hClusterEVsTrack =(
TH2F*)outputList->FindObject(
"EMCAL_hCaloTrackMEClusters");
545 FormatRunHisto(hClusterEVsTrack,Form(
"Sum E cluster Vs N track%s",legend));
547 AutoZoom(hClusterEVsTrack,
"maxx,maxy",1)->DrawCopy(
"colz");
548 outfilename = QAPATH +
"ETrackMult" + fTrigger(r) +
".pdf";
549 outfilename2 = QAPATH +
"ETrackMult" + fTrigger(r) +
".png";
551 if(SavePlots==2) c3->SaveAs(outfilename);
552 if(SavePlots) c3->SaveAs(outfilename2);
561 TCanvas* c4 =
new TCanvas(
"ClusterEVsV0 ",
"Correlation E calo Vs V0 signal", 600, 600);
564 c4->SetBorderSize(0);
565 c4->SetFrameBorderMode(0);
567 TH2F* hClusterEVsV0S =(
TH2F*)outputList->FindObject(
"EMCAL_hCaloV0SEClusters");
568 FormatRunHisto(hClusterEVsV0S,Form(
"Sum E cluster Vs V0 signal%s",legend));
570 AutoZoom(hClusterEVsV0S,
"maxx,maxy",1)->DrawCopy(
"colz");
571 outfilename = QAPATH +
"EVsV0s" + fTrigger(r) +
".pdf";
572 outfilename2 = QAPATH +
"EVsV0s" + fTrigger(r) +
".png";
573 if(SavePlots==2) c4->SaveAs(outfilename);
574 if(SavePlots) c4->SaveAs(outfilename2);
578 TCanvas* c6 =
new TCanvas(
"SumCellEvsSM",
"sum cell energy vs SM", 600, 600);
581 c6->SetBorderSize(0);
582 c6->SetFrameBorderMode(0);
583 TH2F* hSumCellEVsSM =(
TH2F*)outputList->FindObject(
"EMCAL_hSumCellsAmp_Mod");
584 FormatRunHisto(hSumCellEVsSM,Form(
"Sum cell energy vs SM%s",legend));
586 AutoZoom(hSumCellEVsSM,
"maxx,maxy",1)->DrawCopy(
"colz");
587 outfilename = QAPATH +
"SumCellEVsSM" + fTrigger(r) +
".pdf";
588 outfilename2 = QAPATH +
"SumCellEVsSM" + fTrigger(r) +
".png";
589 if(SavePlots==2) c6->SaveAs(outfilename);
590 if(SavePlots) c6->SaveAs(outfilename2);
598 TCanvas* c5 =
new TCanvas(
"CellsperCluster",
"Nb of cells per cluster for each SM", 600, 600);
601 c5->SetBorderSize(0);
602 c5->SetFrameBorderMode(0);
603 Bool_t mod3=0;
if (nSM%3) mod3=1;
604 c5->Divide(3,(nSM/3)+mod3);
606 for (
int ism = 0; ism < nSM; ism++)
610 if(
TString(Form(
"Nb cells per clus%s Mod %d",legend,ism)).Length() > 60) { Error(__FUNCTION__,
"Title too long!");
return -6;}
611 AutoZoom(
HistoPerMod((
TH2F*)outputList->FindObject(Form(
"EMCAL_hNCellsPerCluster_Mod%i",ism)),Form(
"Nb of cells per cluster%s Mod %d",legend,ism)),
"all",1)->DrawCopy(
"colz");
614 outfilename = QAPATH +
"CellsperClusterSM" + fTrigger(r) +
".pdf";
615 outfilename2 = QAPATH +
"CellsperClusterSM" + fTrigger(r) +
".png";
616 if(SavePlots==2) c5->SaveAs(outfilename);
617 if(SavePlots) c5->SaveAs(outfilename2);
622 if (outputList) outputList->Delete();
633 if (n<=12) {aCalorimeter = fCalorimeter;}
else {aCalorimeter =
TString(
"EMCAL_and_DCAL");}
680 TFile* ftree =
new TFile(Form(
"%s/trending.root",QAPATH.Data()),
"RECREATE");
682 TTree *tree =
new TTree(
"trending",
"Trending QA Tree");
683 tree->Branch(
"fDate",&now);
684 tree->Branch(
"fCalorimeter",&aCalorimeter);
685 tree->Branch(
"system",&system);
686 tree->Branch(
"period",&period);
687 tree->Branch(
"pass",&pass);
688 tree->Branch(
"fTrigger",&fTrigger);
689 tree->Branch(
"run",&RunId,
"run/I");
690 tree->Branch(
"xe",&xe,
"xe/D");
692 tree->Branch(
"Nevent",&Nevent,
"Nevent/D");
693 tree->Branch(
"NMatchClustersP",&NMatchClustersP,
"NMatchClustersP/D");
694 tree->Branch(
"NMatchClustersPRMS",&NMatchClustersPRMS,
"NMatchClustersPRMS/D");
695 tree->Branch(
"CellMean",&CellMean,
"CellMean/D");
696 tree->Branch(
"CellRMS",&CellRMS,
"CellRMS/D");
697 tree->Branch(
"ClusterMean",&ClusterMean,
"ClusterMean/D");
698 tree->Branch(
"ClusterRMS",&ClusterRMS,
"ClusterRMS/D");
699 tree->Branch(
"EtotalMean",&EtotalMean,
"EtotalMean/D");
700 tree->Branch(
"EtotalRMS",&EtotalRMS,
"EtotalRMS/D");
702 tree->Branch(
"CellPerClusterMean",&CellPerClusterMean,
"CellPerClusterMean/D");
703 tree->Branch(
"CellPerClusterRMS",&CellPerClusterRMS,
"CellPerClusterRMS/D");
705 tree->Branch(
"Npi0EMCAL",&Npi0EMCAL,
"Npi0EMCAL/D");
706 tree->Branch(
"Npi0EMCALErr",&Npi0EMCALErr,
"Npi0EMCALErr/D");
707 tree->Branch(
"Npi0DCAL",&Npi0DCAL,
"Npi0DCAL/D");
708 tree->Branch(
"Npi0DCALErr",&Npi0DCALErr,
"Npi0DCALErr/D");
709 tree->Branch(
"MeanPosEMCAL",&MeanPosEMCAL,
"MeanPosEMCAL/D");
710 tree->Branch(
"MeanPosEMCALErr",&MeanPosEMCALErr,
"MeanPosEMCALErr/D");
711 tree->Branch(
"MeanPosDCAL",&MeanPosDCAL,
"MeanPosDCAL/D");
712 tree->Branch(
"MeanPosDCALErr",&MeanPosDCALErr,
"MeanPosDCALErr/D");
713 tree->Branch(
"WidthEMCAL",&WidthEMCAL,
"WidthEMCAL/D");
714 tree->Branch(
"WidthEMCALErr",&WidthEMCALErr,
"WidthEMCALErr/D");
715 tree->Branch(
"WidthDCAL",&WidthDCAL,
"WidthDCAL/D");
716 tree->Branch(
"WidthDCALErr",&WidthDCALErr,
"WidthDCALErr/D");
717 tree->Branch(
"Chi2NdfPi0EMCAL",&Chi2NdfPi0EMCAL,
"Chi2NdfPi0EMCAL/D");
718 tree->Branch(
"Chi2NdfPi0DCAL",&Chi2NdfPi0DCAL,
"Chi2NdfPi0DCAL/D");
719 tree->Branch(
"NggEMCAL",&NggEMCAL,
"NggEMCAL/D");
720 tree->Branch(
"NggEMCALErr",&NggEMCALErr,
"NggEMCALErr/D");
721 tree->Branch(
"NggDCAL",&NggDCAL,
"NggDCAL/D");
722 tree->Branch(
"NggDCALErr",&NggDCALErr,
"NggDCALErr/D");
723 tree->Branch(
"SignifEMCAL",&SignifEMCAL,
"SignifEMCAL/D");
724 tree->Branch(
"SignifDCALErr",&SignifDCALErr,
"SignifDCALErr/D");
725 tree->Branch(
"SignifEMCAL",&SignifEMCAL,
"SignifEMCAL/D");
726 tree->Branch(
"SignifDCALErr",&SignifDCALErr,
"SignifDCALErr/D");
728 tree->Branch(
"nSM",&n,
"nSM/I");
738 Double_t CellPerClusterMeanSM[nMax];
750 tree->Branch(
"CellMeanSM",CellMeanSM,TString::Format(
"CellMeanSM[%i]/D",nMax));
751 tree->Branch(
"CellRMSSM",CellRMSSM,TString::Format(
"CellRMSSM[%i]/D",nMax));
752 tree->Branch(
"ClusterMeanSM",ClusterMeanSM,TString::Format(
"ClusterMeanSM[%i]/D",nMax));
753 tree->Branch(
"ClusterTotSM",ClusterTotSM,TString::Format(
"ClusterTotSM[%i]/D",nMax));
754 tree->Branch(
"ClusterRMSSM",ClusterRMSSM,TString::Format(
"ClusterRMSSM[%i]/D",nMax));
755 tree->Branch(
"EtotalMeanSM",EtotalMeanSM,TString::Format(
"EtotalMeanSM[%i]/D",nMax));
756 tree->Branch(
"EtotalRMSSM",EtotalRMSSM,TString::Format(
"EtotalRMSSM[%i]/D",nMax));
757 tree->Branch(
"CellPerClusterMeanSM",CellPerClusterMeanSM,TString::Format(
"CellPerClusterMeanSM[%i]/D",nMax));
758 tree->Branch(
"CellPerClusterRMSSM",CellPerClusterRMSSM,TString::Format(
"CellPerClusterRMSSM[%i]/D",nMax));
759 tree->Branch(
"ECell1MeanSM",ECell1MeanSM,TString::Format(
"ECell1MeanSM[%i]/D",nMax));
760 tree->Branch(
"ECell1RMSSM",ECell1RMSSM,TString::Format(
"ECell1RMSSM[%i]/D",nMax));
762 tree->Branch(
"MeanPosSM",MeanPosSM,TString::Format(
"MeanPosSM[%i]/D",nMax));
763 tree->Branch(
"MeanPosErrSM",MeanPosErrSM,TString::Format(
"MeanPosErrSM[%i]/D",nMax));
764 tree->Branch(
"WidthSM",WidthSM,TString::Format(
"WidthSM[%i]/D",nMax));
765 tree->Branch(
"WidthErrSM",WidthErrSM,TString::Format(
"WidthErrSM[%i]/D",nMax));
766 tree->Branch(
"Npi0SM",Npi0SM,TString::Format(
"Npi0SM[%i]/D",nMax));
767 tree->Branch(
"Npi0ErrSM",Npi0ErrSM,TString::Format(
"Npi0ErrSM[%i]/D",nMax));
769 TF1* fitMass =
new TF1(
"fitMass",
pi0massP2,100,250,6);
770 fitMass->SetParName(0,
"A");
771 fitMass->SetParName(1,
"m_{0}");
772 fitMass->SetParName(2,
"sigma");
773 fitMass->SetParName(3,
"a_{0}");
774 fitMass->SetParName(4,
"a_{1}");
775 fitMass->SetParName(5,
"a_{2}");
776 fitMass->SetParLimits(0, 1.e-5,1.e5);
777 fitMass->SetParLimits(1, 0.11, 0.16);
778 fitMass->SetParLimits(2, 0.001,0.06);
784 TH1F* fhNClusters = 0x0;
786 TH1F* fhNCells = 0x0;
790 TH2F* NCellsPerCluster[n];
800 TPMERegexp r(
"_\\w+");
801 TIter next(TriggersList);
805 fTrigger=
TString(obj->GetName());
806 TString namefile = QAPATH + period +
"_" + pass + fTrigger(r).Data() +
"_" + RunId +
"_data.txt";
807 ofstream QAData(namefile, ios::app);
814 NMatchClustersPRMS=0;
821 CellPerClusterMean=0;
850 memset (CellMeanSM, 0,
sizeof (
Double_t) * nMax);
851 memset (CellRMSSM, 0,
sizeof (
Double_t) * nMax);
852 memset (ClusterMeanSM, 0,
sizeof (
Double_t) * nMax);
853 memset (ClusterTotSM, 0,
sizeof (
Double_t) * nMax);
854 memset (ClusterRMSSM, 0,
sizeof (
Double_t) * nMax);
855 memset (EtotalMeanSM, 0,
sizeof (
Double_t) * nMax);
856 memset (EtotalRMSSM, 0,
sizeof (
Double_t) * nMax);
857 memset (CellPerClusterMeanSM, 0,
sizeof (
Double_t) * nMax);
858 memset (CellPerClusterRMSSM, 0,
sizeof (
Double_t) * nMax);
859 memset (ECell1MeanSM, 0,
sizeof (
Double_t) * nMax);
860 memset (ECell1RMSSM, 0,
sizeof (
Double_t) * nMax);
862 memset (MeanPosSM, 0,
sizeof (
Double_t) * nMax);
863 memset (MeanPosErrSM, 0,
sizeof (
Double_t) * nMax);
864 memset (WidthSM, 0,
sizeof (
Double_t) * nMax);
865 memset (WidthErrSM, 0,
sizeof (
Double_t) * nMax);
866 memset (Npi0SM, 0,
sizeof (
Double_t) * nMax);
867 memset (Npi0ErrSM, 0,
sizeof (
Double_t) * nMax);
870 if(!fTrigger.Contains(
"QA")) {
875 Bool_t dirok = f->cd(dirname);
876 if(!dirok) { Error(__FUNCTION__,Form(
"No input directory %s",dirname.Data())); tree->Fill(); ftree->cd(); tree->Write(); ret= -1;
continue;}
877 outputList = (
TList*)gDirectory->Get(dirname);
878 if(!outputList){ Error(__FUNCTION__,Form(
"No input list! %s",dirname.Data())); tree->Fill(); ftree->cd(); tree->Write(); ret=-2;
continue;;}
879 outputList->SetOwner();
882 fhNEvents =(TH1F *)outputList->FindObject(
"hNEvents");
883 if(!fhNEvents){ Error(__FUNCTION__,Form(
"NEvent histogram not found for trigger %s",fTrigger.Data())); tree->Fill(); ftree->cd(); tree->Write(); ret=-3;
continue;}
884 Nevent=fhNEvents->GetEntries();
885 if(Nevent==0) {Error(__FUNCTION__,Form(
"No event in trigger %s",fTrigger.Data())); tree->Fill(); ftree->cd(); tree->Write(); ret=-4;
continue;}
886 if(Nevent<20) {Error(__FUNCTION__,Form(
"Less than 20 events in trigger %s",fTrigger.Data())); tree->Fill(); ftree->cd(); tree->Write(); ret=-5;
continue;}
887 TH1F* hE =(TH1F *)outputList->FindObject(
"EMCAL_hE");
888 if (!hE || (!hE->GetEntries())) { Error(__FUNCTION__,Form(
"hE Histogram not found or it is empty for trigger %s, EMCAL was not in this run?",fTrigger.Data())); EtotalMean=0; tree->Fill(); ftree->cd(); tree->Write(); ret=-4;
continue;}
891 fhE = (TH1F *)outputList->FindObject(fCalorimeter+
"_hE");
893 fhECharged = (TH1F *)outputList->FindObject(fCalorimeter+
"_hECharged");
895 for(
Int_t ibin = fhE->FindBin(0.6) ; ibin <fhE->FindBin(50.) ; ibin++){
896 energy+=fhE->GetBinCenter(ibin)*fhE->GetBinContent(ibin);
898 if(fhE->Integral(fhE->FindBin(0.6), fhE->FindBin(50.))==0){Error(__FUNCTION__,Form(
"Not enough events")); tree->Fill(); ftree->cd(); tree->Write(); ret=-6;
continue;}
899 EtotalMean=energy/fhE->Integral(fhE->FindBin(0.6), fhE->FindBin(50.)) ;
900 EtotalRMS=fhE->GetMeanError();
902 TString nameNCell = Form(
"%s_hNCells_Mod",fCalorimeter.Data());
903 TString nameNCluster = Form(
"%s_hNClusters_Mod",fCalorimeter.Data());
904 TString nameE = Form(
"%s_hE_Mod",fCalorimeter.Data());
905 TH2F* hNCellsMod= (
TH2F*)outputList->FindObject(nameNCell.Data());
906 TH2F* hNClusterMod=(
TH2F*)outputList->FindObject(nameNCluster.Data());
907 TH2F* hEMod=(
TH2F*)outputList->FindObject(nameE.Data());
909 if (!hNCellsMod || !hNClusterMod || !hEMod) {Error(__FUNCTION__,
"A requiered histogram was not found (the imput QAresult.root might be too old)!"); tree->Fill(); ftree->cd(); tree->Write(); ret=-7;
continue;}
911 TCanvas* c1 =
new TCanvas(
"Pi0InvMassSM",
"Pi0 Invariant Mass for each SM", 600, 600);
912 gStyle->SetOptStat(1);
913 gStyle->SetOptFit(1);
916 c1->SetBorderSize(0);
917 c1->SetFrameBorderMode(0);
919 Bool_t mod3=0;
if (n%3) mod3=1;
920 c1->Divide(3,n/3+mod3);
924 for(
Int_t ism = 0 ; ism < n ; ism++){
925 cout <<
"#########################"<< endl;
926 cout <<
" Super Module " << ism <<
" Run " << RunId << endl;
928 nameNCellPerCluster = Form(
"%s_hNCellsPerCluster_Mod%d",fCalorimeter.Data(),ism);
929 NCellsPerCluster[ism] = (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data());
930 if(! (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data()) ) { Error(__FUNCTION__,Form(
"NCellsPerCluster histogram not found for super module %i",ism));ret=-8;
continue;}
931 NCellsPerCluster[ism] = (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data());
933 NCells[ism] = (TH1F*)hNCellsMod->ProjectionX(Form(
"NCells%d",ism),ism+1,ism+1,
"");
934 NClusters[ism] = (TH1F*)hNClusterMod->ProjectionX(Form(
"NClusters%d",ism),ism+1,ism+1,
"");
935 E[ism] = (TH1F*)hEMod->ProjectionX(Form(
"E%d",ism),ism+1,ism+1,
"");
936 CellMeanSM[ism]=NCells[ism]->GetMean();
938 CellRMSSM[ism]=NCells[ism]->GetMeanError();
940 binmax = NClusters[ism]->GetNbinsX();
941 for(
Int_t ibin = 1 ;ibin <=binmax ;ibin++)
942 { ClusterTotSM[ism]+=(NClusters[ism]->GetBinCenter(ibin))*(NClusters[ism]->GetBinContent(ibin));
944 if (NClusters[ism]->GetEntries()>0)
945 ClusterTotSM[ism]= ClusterTotSM[ism]/NClusters[ism]->GetEntries();
948 ClusterMeanSM[ism]=NClusters[ism]->GetMean();
949 ClusterRMSSM[ism]=NClusters[ism]->GetMeanError();
950 CellPerClusterMeanSM[ism]=NCellsPerCluster[ism]->GetMean(2);
951 CellPerClusterRMSSM[ism]=NCellsPerCluster[ism]->GetMeanError(2);
953 ECell1MeanSM[ism] =NCellsPerCluster[ism]->ProjectionX(
"",2,50,
"")->Integral(5,50)/(Nevent);
954 ECell1RMSSM[ism] =NCellsPerCluster[ism]->ProjectionX(
"",2,50,
"")->GetMeanError();
956 for(
Int_t ibin = E[ism]->FindBin(0.6) ; ibin <E[ism]->FindBin(50.) ; ibin++){
957 energySM+=E[ism]->GetBinCenter(ibin)*(E[ism]->GetBinContent(ibin));
959 if(E[ism]->Integral(E[ism]->FindBin(0.6),E[ism]->FindBin(50.))==0){Error(__FUNCTION__,Form(
"Energy: Not enough events/SM"));
continue;}
960 EtotalMeanSM[ism]=energySM/(E[ism]->Integral(E[ism]->FindBin(0.6),E[ism]->FindBin(50.)));
962 EtotalRMSSM[ism]=E[ism]->GetMeanError();
965 fhNCells = (TH1F*)NCells[ism]->Clone(
"NCells");
966 fhNClusters = (TH1F*)NClusters[ism]->Clone(
"NClusters");
969 fhNCells->Add(NCells[ism],1);
970 fhNClusters->Add(NClusters[ism],1);
975 TString namePair = Form(
"%s_hIM_Mod%d",fCalorimeter.Data(),ism);
976 IM[ism] = (
TH2F*)outputList->FindObject(namePair.Data());
979 TString projname = Form(
"SM_%d",ism);
980 MggSM[ism] = (TH1F *)IM[ism]->ProjectionY(projname.Data(), 2, 20,
"") ;
983 if(MggSM[ism]->GetEntries()>100) {
984 fitMass->SetParameter(0, MggSM[ism]->GetBinContent(MggSM[ism]->GetMaximumBin()));
985 fitMass->SetParameter(1, mPDG);
986 fitMass->SetParameter(2, 15.);
987 fitMass->SetParameter(3,0.);
988 fitMass->SetParameter(4,MggSM[ism]->GetBinContent(MggSM[ism]->FindBin(0.11)));
989 fitMass->SetParameter(5,MggSM[ism]->GetBinContent(MggSM[ism]->FindBin(0.20)));
991 if(MggSM[ism]->GetEntries()<1000){ MggSM[ism]->Rebin(5);}
else {MggSM[ism]->Rebin();}
992 MggSM[ism]->Fit(
"fitMass",
"WL R +",
"",0.1, 0.30);
993 MggSM[ism]->SetTitle(Form(
"Pi0 Mass for super module %i",ism));
994 MggSM[ism]->SetTitleSize(0.1);
995 MggSM[ism]->SetXTitle(
"Pi0 Mass");
996 MggSM[ism]->SetYTitle(
"Nb of entries");
997 MggSM[ism]->GetXaxis()->SetLabelSize(0.05);
998 MggSM[ism]->GetXaxis()->SetTitleSize(0.07);
999 MggSM[ism]->GetXaxis()->SetTitleOffset(0.68);
1000 MggSM[ism]->GetYaxis()->SetLabelSize(0.05);
1001 MggSM[ism]->GetYaxis()->SetTitleSize(0.06);
1002 MggSM[ism]->GetYaxis()->SetTitleOffset(0.78);
1004 MeanPosSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParameter(1)*1000;
1005 MeanPosErrSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParError(1)*1000;
1006 WidthSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2)*1000;
1007 WidthErrSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParError(2)*1000;
1008 Npi0SM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParameter(0)*(MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2))*TMath::Sqrt(2*TMath::Pi())/(Nevent*MggSM[ism]->GetBinWidth(1));
1009 Npi0ErrSM[ism] = TMath::Sqrt((MggSM[ism]->GetFunction(
"fitMass")->GetParError(0)/MggSM[ism]->GetFunction(
"fitMass")->GetParameter(0))*(MggSM[ism]->GetFunction(
"fitMass")->GetParError(0)/MggSM[ism]->GetFunction(
"fitMass")->GetParameter(0))
1010 +(MggSM[ism]->GetFunction(
"fitMass")->GetParError(2)/MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2))*(MggSM[ism]->GetFunction(
"fitMass")->GetParError(2)/MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2)));
1011 Npi0ErrSM[ism] = 0.;
1014 else { Info(__FUNCTION__,Form(
"Not enough events for Pi0 fit and trending for super module %i",ism));} ;
1018 TCanvas* c2 =
new TCanvas(
"Pi0InvMassEMCAL",
"Pi0 Invariant Mass in EMCAL", 600, 600);
1019 c2->SetFillColor(0);
1020 c2->SetBorderSize(0);
1021 c2->SetFrameBorderMode(0);
1024 fhIM = (
TH2F *)outputList->FindObject(fCalorimeter+
"_hIM");
1026 fhMggEMCAL = (TH1F *)fhIM->ProjectionY(
"MggEMCAL", 2, 20,
"") ;
1027 if(fhMggEMCAL->GetEntries()==0) {Error(__FUNCTION__,
"The Pi0 histogram in EMCAL is empty !"); tree->Fill(); ret=-8;
continue;}
1028 fitMass->SetParameter(0, 4500);
1029 fitMass->SetParameter(1, mPDG);
1030 fitMass->SetParameter(2, 0.01);
1031 fitMass->SetParameter(3,0.);
1032 fitMass->SetParameter(4,fhMggEMCAL->GetBinContent(fhMggEMCAL->FindBin(0.11)));
1033 fitMass->SetParameter(5,fhMggEMCAL->GetBinContent(fhMggEMCAL->FindBin(0.20)));
1035 if(fhMggEMCAL->GetEntries()<5000){
1036 fhMggEMCAL->Rebin(5);}
1037 else fhMggEMCAL->Rebin();
1039 fhMggEMCAL->Fit(
"fitMass",
"L R +",
"", 0.05, 0.20);
1041 fhMggEMCAL->SetTitle(
"Pi0 Mass in EMCAL");
1042 fhMggEMCAL->SetTitleSize(0.1);
1043 fhMggEMCAL->SetXTitle(
"Pi0 Mass");
1044 fhMggEMCAL->SetYTitle(
"Nb of entries");
1045 fhMggEMCAL->GetXaxis()->SetLabelSize(0.03);
1046 fhMggEMCAL->GetXaxis()->SetTitleSize(0.03);
1047 fhMggEMCAL->GetXaxis()->SetTitleOffset(1.3);
1048 fhMggEMCAL->GetYaxis()->SetLabelSize(0.03);
1049 fhMggEMCAL->GetYaxis()->SetTitleSize(0.03);
1050 fhMggEMCAL->GetYaxis()->SetTitleOffset(1.3);
1052 MeanPosEMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(1)*1000;
1053 MeanPosEMCALErr = fhMggEMCAL->GetFunction(
"fitMass")->GetParError(1)*1000;
1054 WidthEMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(2)*1000;
1055 WidthEMCALErr = fhMggEMCAL->GetFunction(
"fitMass")->GetParError(2)*1000;
1056 Chi2NdfPi0EMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetChisquare()/fhMggEMCAL->GetFunction(
"fitMass")->GetNDF();
1057 Npi0EMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(0)*fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(2)*TMath::Sqrt(2*TMath::Pi())/(Nevent*fhMggEMCAL->GetBinWidth(10));
1058 Npi0EMCALErr = TMath::Sqrt((fhMggEMCAL->GetFunction(
"fitMass")->GetParError(0)/fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(0))*(fhMggEMCAL->GetFunction(
"fitMass")->GetParError(0)/fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(0))+(WidthEMCALErr/WidthEMCAL)*(WidthEMCALErr/WidthEMCAL));
1060 NggEMCAL = fhMggEMCAL->GetFunction(
"fitMass")->Integral(0.11, 0.16)/(Nevent*fhMggEMCAL->GetBinWidth(10));
1061 NggEMCALErr = fhMggEMCAL->GetFunction(
"fitMass")->IntegralError(0.11, 0.16)/(fhMggEMCAL->Integral()*fhMggEMCAL->GetBinWidth(10));
1062 SignifEMCAL = Npi0EMCAL/NggEMCAL;
1063 SignifEMCALErr = TMath::Sqrt((Npi0EMCALErr/Npi0EMCAL*(Npi0EMCALErr/Npi0EMCAL)+(NggEMCALErr/NggEMCAL*(NggEMCALErr/NggEMCAL))));
1064 SignifEMCALErr = SignifEMCAL*SignifEMCALErr;
1066 TCanvas* c3 =
new TCanvas(
"Pi0InvMassDCAL",
"Pi0 Invariant Mass in DCAL", 600, 600);
1067 c3->SetFillColor(0);
1068 c3->SetBorderSize(0);
1069 c3->SetFrameBorderMode(0);
1071 fhIMDCAL = (
TH2F *)outputList->FindObject(fCalorimeter+
"_hIMDCAL");
1085 fhMggDCAL = (TH1F *)fhIMDCAL->ProjectionY(
"MggDCAL", 2, 20,
"") ;
1086 if(fhMggDCAL->GetEntries()==0) {Error(__FUNCTION__,
"The Pi0 histogram in DCAL is empty !"); tree->Fill(); ret=-8;
continue;}
1087 fitMass->SetParameter(0, 4500);
1088 fitMass->SetParameter(1, mPDG);
1089 fitMass->SetParameter(2, 0.01);
1090 fitMass->SetParameter(3,0.);
1091 fitMass->SetParameter(4,fhMggDCAL->GetBinContent(fhMggDCAL->FindBin(0.11)));
1092 fitMass->SetParameter(5,fhMggDCAL->GetBinContent(fhMggDCAL->FindBin(0.20)));
1094 if(fhMggDCAL->GetEntries()<5000){
1095 fhMggDCAL->Rebin(5);}
1096 else fhMggDCAL->Rebin();
1098 fhMggDCAL->Fit(
"fitMass",
"L R +",
"", 0.05, 0.20);
1100 fhMggDCAL->SetTitle(
"Pi0 Mass in DCAL");
1101 fhMggDCAL->SetTitleSize(0.1);
1102 fhMggDCAL->SetXTitle(
"Pi0 Mass");
1103 fhMggDCAL->SetYTitle(
"Nb of entries");
1104 fhMggDCAL->GetXaxis()->SetLabelSize(0.03);
1105 fhMggDCAL->GetXaxis()->SetTitleSize(0.03);
1106 fhMggDCAL->GetXaxis()->SetTitleOffset(1.3);
1107 fhMggDCAL->GetYaxis()->SetLabelSize(0.03);
1108 fhMggDCAL->GetYaxis()->SetTitleSize(0.03);
1109 fhMggDCAL->GetYaxis()->SetTitleOffset(1.3);
1111 MeanPosDCAL = fhMggDCAL->GetFunction(
"fitMass")->GetParameter(1)*1000;
1112 MeanPosDCALErr = fhMggDCAL->GetFunction(
"fitMass")->GetParError(1)*1000;
1113 WidthDCAL = fhMggDCAL->GetFunction(
"fitMass")->GetParameter(2)*1000;
1114 WidthDCALErr = fhMggDCAL->GetFunction(
"fitMass")->GetParError(2)*1000;
1115 Chi2NdfPi0DCAL = fhMggDCAL->GetFunction(
"fitMass")->GetChisquare()/fhMggDCAL->GetFunction(
"fitMass")->GetNDF();
1116 Npi0DCAL = fhMggDCAL->GetFunction(
"fitMass")->GetParameter(0)*fhMggDCAL->GetFunction(
"fitMass")->GetParameter(2)*TMath::Sqrt(2*TMath::Pi())/(Nevent*fhMggDCAL->GetBinWidth(10));
1117 Npi0DCALErr = TMath::Sqrt((fhMggDCAL->GetFunction(
"fitMass")->GetParError(0)/fhMggDCAL->GetFunction(
"fitMass")->GetParameter(0))*(fhMggDCAL->GetFunction(
"fitMass")->GetParError(0)/fhMggDCAL->GetFunction(
"fitMass")->GetParameter(0))+(WidthDCALErr/WidthDCAL)*(WidthDCALErr/WidthDCAL));
1119 NggDCAL = fhMggDCAL->GetFunction(
"fitMass")->Integral(0.11, 0.16)/(Nevent*fhMggDCAL->GetBinWidth(10));
1120 NggDCALErr = fhMggDCAL->GetFunction(
"fitMass")->IntegralError(0.11, 0.16)/(fhMggDCAL->Integral()*fhMggDCAL->GetBinWidth(10));
1121 SignifDCAL = Npi0DCAL/NggDCAL;
1122 SignifDCALErr = TMath::Sqrt((Npi0DCALErr/Npi0DCAL*(Npi0DCALErr/Npi0DCAL)+(NggDCALErr/NggDCAL*(NggDCALErr/NggDCAL))));
1123 SignifDCALErr = SignifDCAL*SignifDCALErr;
1127 cout<<
"******************"<<endl;
1129 NTClusters=fhE->IntegralAndError(fhE->GetXaxis()->FindBin(0.),fhE->GetXaxis()->FindBin(200.),NTClustersRMS);
1130 cout<<
"********************************** nb total de clusters ***************************************************"<<endl;
1131 NCClusters=fhECharged->IntegralAndError(fhECharged->GetXaxis()->FindBin(0.),fhECharged->GetXaxis()->FindBin(50.),NCClustersRMS);
1132 if(NTClusters!=0)NMatchClustersP = NCClusters/NTClusters;
1133 else{NMatchClustersP=0;}
1136 NMatchClustersPRMS = NMatchClustersP* TMath::Sqrt(TMath::Power(NCClustersRMS/NCClusters,2)+TMath::Power(NTClustersRMS/NTClusters,2));
1137 else{NMatchClustersPRMS=1;}
1138 ClusterMean=fhNClusters->GetMean();
1139 ClusterRMS=fhNClusters->GetMeanError();
1140 CellMean=fhNCells->GetMean();
1141 CellRMS=fhNCells->GetMeanError();
1144 TString outfilename = QAPATH +
"Pi0InvMassEMCAL" + fTrigger(r) +
".pdf";
1145 TString outfilename2 = QAPATH +
"Pi0InvMassEMCAL" + fTrigger(r) +
".png";
1146 if(SavePlots==2) c2->SaveAs(outfilename);
1147 if(SavePlots) c2->SaveAs(outfilename2);
1149 outfilename = QAPATH +
"Pi0InvMassSM" + fTrigger(r) +
".pdf";
1150 outfilename2 = QAPATH +
"Pi0InvMassSM" + fTrigger(r) +
".png";
1151 if(SavePlots==2) c1->SaveAs(outfilename);
1152 if(SavePlots) c1->SaveAs(outfilename2);
1154 cout<<
"************************************************** "<<n<<
" **************************************************"<<endl;
1158 TString outfilename4 = QAPATH +
"Pi0InvMassDCAL" + fTrigger(r) +
".pdf";
1159 TString outfilename5= QAPATH +
"Pi0InvMassDCAL" + fTrigger(r) +
".png";
1160 if(SavePlots==2) c3->SaveAs(outfilename4);
1161 if(SavePlots) c3->SaveAs(outfilename5);
1166 fout->Cd(Form(
"%s/%s/%ld/%s/%s",period.Data(),pass.Data(),RunId,
"RunLevelQA",fTrigger.Data()));
1169 if(fhIMDCAL) c3->Write();
1172 if(fhIMDCAL)
delete c3;
1173 if (outputList) outputList->Delete() ;
1175 QAData << RunId<<
" "<< Nevent
1194 if(!aHisto) {Error(__FUNCTION__,Form(
"The histogram with title \"%s\" was not found!",title));
return new TH2F();}
1195 aHisto->SetStats(kFALSE);
1196 aHisto->SetTitle(title);
1197 aHisto->SetStats(kFALSE);
1198 aHisto->SetYTitle(YTitle);
1199 aHisto->GetYaxis()->SetTitleOffset(1.2);
1200 aHisto->GetYaxis()->SetLabelSize(0.03);
1201 aHisto->GetZaxis()->SetLabelSize(0.02);
1211 if(!hTmpPerMod) {Error(__FUNCTION__,Form(
"The histogram with title \"%s\" was not found!",title));
return new TH2F();}
1212 hTmpPerMod->SetStats(kFALSE);
1213 hTmpPerMod->SetTitle(title);
1214 hTmpPerMod->SetTitleSize(0.1);
1215 hTmpPerMod->GetXaxis()->SetTitleOffset(1.1);
1216 hTmpPerMod->GetXaxis()->SetTitleSize(0.05);
1217 hTmpPerMod->GetXaxis()->SetLabelSize(0.06);
1218 hTmpPerMod->GetYaxis()->SetTitleOffset(1.1);
1219 hTmpPerMod->GetYaxis()->SetTitleSize(0.05);
1220 hTmpPerMod->GetYaxis()->SetLabelSize(0.06);
1221 hTmpPerMod->GetZaxis()->SetLabelSize(0.04);
1238 int maxX = H->GetNbinsX();
1239 int New_minX = minX;
1240 int New_maxX = maxX;
1243 int maxY = H->GetNbinsY();
1244 int New_minY = minY;
1245 int New_maxY = maxY;
1247 if (opt.Contains(
"all")) opt =
TString(
"minx,maxx,miny,maxy");
1249 if (opt.Contains(
"maxx"))
1252 for (New_maxX = maxX;New_maxX >=minX; New_maxX--)
1254 for (
int i_y = maxY; i_y >= minY;i_y--)
1255 { c = H->GetBinContent(New_maxX,i_y);
if (c>EntryMin)
break;}
1256 if (c>EntryMin)
break;
1260 if (opt.Contains(
"maxy"))
1263 for (New_maxY = maxY;New_maxY >=minY;New_maxY--)
1265 for (
int i_x=maxX; i_x>=minX;i_x--)
1266 { c = H->GetBinContent(i_x, New_maxY );
if (c>EntryMin)
break;}
1267 if (c>EntryMin)
break;
1272 if (opt.Contains(
"minx"))
1275 for (New_minX = minX;New_minX <=maxX; New_minX++)
1277 for (
int i_y = minY; i_y <= maxY;i_y++)
1278 { c = H->GetBinContent(New_minX,i_y);
if (c>EntryMin)
break;}
1279 if (c>EntryMin)
break;
1283 if (opt.Contains(
"miny"))
1285 for (New_minY = minY;New_minY <=maxY;New_minY++)
1287 for (
int i_x=minX; i_x<=maxX;i_x++)
1288 { c = H->GetBinContent(i_x, New_minY );
if (c>EntryMin)
break;}
1289 if (c>EntryMin)
break;
1293 if (New_maxX!=-1 && New_maxY!=-1) H->GetXaxis()->SetRange(New_minX - shiftX , New_maxX + shiftX);
1294 if (New_maxX!=-1 && New_maxY!=-1) H->GetYaxis()->SetRange(New_minY - shiftY , New_maxY + shiftY);
1305 if(!fTrigger.Contains(
"QA")) {
1312 if ( year == 2010 ) { nSMt=4; }
1313 else if ( year == 2011 || year == 2012 ) { nSMt=10; }
1314 else if ( year == 2013 || year == 2014 ) { nSMt=12; }
1318 Bool_t dirok = f->cd(direct);
1319 if (!dirok) { Error(__FUNCTION__,Form(
"No input directory %s, the number SMs will be returned based on the year!",direct.Data()));}
1320 else { outputList = (
TList*)gDirectory->Get(direct);}
1321 if(!outputList) { Error(__FUNCTION__,
"No input list, the number SMs will be returned based on the year! ");}
1323 outputList->SetOwner();
1324 TH2F* hNSM =(
TH2F *)outputList->FindObject(
"EMCAL_hE_Mod");
1325 if (!hNSM || (!hNSM->GetEntries())) { Error(__FUNCTION__,
"hNSM Histogram not found or it is empty, the number SMs will be returned based on the year!");}
1327 nSMt = hNSM->GetYaxis()->GetBinUpEdge(hNSM->FindLastBinAbove(0,2));
1330 if (outputList) {outputList->Delete();}
TH2F * FormatRunHisto(TH2F *aHisto, const char *title, const char *YTitle="")
Int_t DrawOccupancy(Long_t run, TString period, TString pass, TString fTrigger, TString system, TFile *f, TFile *fout, AliEMCALGeometry *geom, Int_t SavePlots)
int FindNumberOfSM(TFile *f, TString fTrigger, TString period)
Double_t pi0massP1(Double_t *x, Double_t *par)
Double_t pi0massP2(Double_t *x, Double_t *par)
Int_t DrawRun(Long_t run, TString period, TString pass, TString fTrigger, TFile *f, TFile *fout, Int_t SavePlots, Int_t nSM, Bool_t kFilter)
Int_t TrendingEMCALTree(Long_t RunId, TString fCalorimeter, TString system, TString period, TString pass, const int n, TList *TriggersList, TFile *f, TFile *fout, Int_t SavePlots)
TH2 * AutoZoom(TH2 *H, Option_t *aType="all", Int_t EntryMin=0)
TH2F * HistoPerMod(TH2F *name, const char *title)
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Double_t fitE(Double_t *x, Double_t *par)
int CreateEMCALRunQA(const char *filename, TString RunId, TString period, TString pass, Int_t SavePlots=0, Bool_t filter=0, TString fTrigger="", TString system="", TString fCalorimeter="EMCAL")