1 #if !defined(__CINT__) || defined(__MAKECINT__)
3 #include "AliEMCALGeometry.h"
7 #include <TDirectory.h>
12 #include <TGraphErrors.h>
17 #include <TObjString.h>
53 const Int_t NRGBs = 5;
54 const Int_t NCont = 255;
56 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
57 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
58 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
59 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
60 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
61 gStyle->SetNumberContours(NCont);
71 gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) / (2*par[2]*par[2]) );
75 Double_t back = par[3] + par[4]*x[0] + par[5]*x[0]*x[0];
84 Double_t gaus = par[0] * TMath::Exp( -(x[0]-par[1])*(x[0]-par[1]) / (2*par[2]*par[2]) );
85 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]) ;
109 if(! QAPATH.BeginsWith(
"./"))
110 QAPATH = QAPATH + RunId +
"/";
112 AliLog::SetGlobalLogLevel(AliLog::kError);
113 TFile *f =
new TFile(filename);
114 AliLog::SetGlobalLogLevel(AliLog::kInfo);
117 Error(__FUNCTION__, Form(
"Error openning the input file %s", filename));
124 TPMERegexp name_re(
"CaloQA_\\w+");
125 TObjLink* link = f->GetListOfKeys()->FirstLink();
128 TString name = link->GetObject()->GetName();
129 if(name_re.Match(name)){
130 TriggersList->Add(link->GetObject());
131 if(
TString(filename).Contains(
"barrel") && ! name.Contains(
"default")) TriggersList->Remove(link->GetObject());
132 if(
TString(filename).Contains(
"outer") && ! name.Contains(
"EMC")) TriggersList->Remove(link->GetObject());
138 TriggersList->Add(
new TObjString(fTrigger.Data()));
141 if(!TriggersList->GetEntries()){
142 Error(__FUNCTION__,
"No trigger found!");
146 int nSM =
FindNumberOfSM(f, ((TObjString*)TriggersList->Last())->GetString(), period);
149 Error(__FUNCTION__,
"Could not find the number of super modules!");
152 Info(__FUNCTION__, Form(
"%i super modules were discovered", nSM));
155 if(nSM <= 4) { nSM = 4; GeomName =
"EMCAL_FIRSTYEARv1"; }
156 else if(nSM <= 10){ nSM = 10; GeomName =
"EMCAL_COMPLETEv1"; }
157 else if(nSM <= 12){ nSM = 12; GeomName =
"EMCAL_COMPLETE12SMv1"; }
158 else { nSM = 20; GeomName =
"EMCAL_COMPLETE12SMv1_DCAL_8SM";}
160 AliEMCALGeometry *geom =
new AliEMCALGeometry(GeomName.Data(),
"EMCAL");
161 Info(__FUNCTION__, Form(
"Using %i super modules and the Geometry %s", nSM, GeomName.Data()));
163 TFile *
fout =
new TFile(
TString( QAPATH + period+
"_"+pass + fTrigger+
"_"+ (Long_t)RunId.Atoi() +
"_QAplots.root").
Data(),
"RECREATE");
165 if((system.IsNull()) && (period.EndsWith(
"h")))
169 TIter next(TriggersList);
171 fTrigger=
TString(obj->GetName());
172 ret -=
DrawOccupancy(RunId.Atoi(), period, pass, fTrigger, system, f,
fout, geom, SavePlots);
173 ret -=
DrawRun(RunId.Atoi(), period, pass, fTrigger, f,
fout, SavePlots, nSM, filter);
175 ret-=
TrendingEMCALTree(RunId.Atoi(), fCalorimeter, system, period, pass, nSM, TriggersList, f,
fout, SavePlots);
189 gStyle->SetOptStat(0);
191 TH1::AddDirectory(kFALSE);
192 TH2D *hEnergyMapReal =
new TH2D(
"hEnergyMapReal",
"", 96, -48, 48, 120, -0, 120);
193 TH2D *hOccupancyMapReal =
new TH2D(
"hOccupancyMapReal",
"", 96, -48, 48, 120, -0, 120);
195 hEnergyMapReal->SetXTitle(
"#eta (bin)");
196 hEnergyMapReal->SetYTitle(
"#varphi (bin)");
197 hEnergyMapReal->SetZTitle(
"E (GeV)/event");
198 hEnergyMapReal->GetYaxis()->SetTitleOffset(1.2);
199 hEnergyMapReal->GetZaxis()->SetLabelSize(0.02);
200 hEnergyMapReal->GetZaxis()->SetTitleOffset(1.36);
202 hOccupancyMapReal->SetXTitle(
"#eta (bin)");
203 hOccupancyMapReal->SetYTitle(
"#varphi (bin)");
204 hOccupancyMapReal->GetYaxis()->SetTitleOffset(1.2);
205 hOccupancyMapReal->GetZaxis()->SetLabelSize(0.02);
207 Int_t nSupMod, nModule, nIphi, nIeta;
213 Int_t mask[1] = {2222222};
215 TH2F *hCellAmplitude;
221 if(!fTrigger.Contains(
"QA")){
226 Bool_t dirok = f->cd(direct);
228 Error(__FUNCTION__, Form(
"No input drectory %s", direct.Data()));
232 TList *outputList = (
TList*)gDirectory->Get(direct);
234 Error(__FUNCTION__,
"No input list! ");
237 outputList->SetOwner();
239 fout->mkdir(Form(
"%s/%s/%ld/%s/%s", period.Data(), pass.Data(), run,
"RunLevelQA", fTrigger.Data()));
241 fout->Cd(Form(
"%s/%s/%ld/%s/%s", period.Data(), pass.Data(), run,
"RunLevelQA", fTrigger.Data()));
243 hNEvents = (TH1F *)outputList->FindObject(
"hNEvents");
245 Error(__FUNCTION__, Form(
"hNEvent histogram not found for trigger %s ", fTrigger.Data()));
249 Events = (
Int_t)hNEvents->GetEntries();
251 Error(__FUNCTION__, Form(
"No event in trigger %s", fTrigger.Data()));
255 TH1F* hE = (TH1F *)outputList->FindObject(
"EMCAL_hE");
256 if(!hE || (!hE->GetEntries())){
257 Error(__FUNCTION__, Form(
"hE Histogram not found or it is empty for trigger %s, EMCal was not in this run?", fTrigger.Data()));
264 if(fTrigger.Contains(
"EMC"))
269 if(fTrigger.Contains(
"EMC"))
273 hCellAmplitude = (
TH2F *)outputList->FindObject(
"EMCAL_hAmpId");
275 for(
Int_t i = 0; i < geom->GetNCells() ; i++){
279 for(
Int_t j = 1; j <= hCellAmplitude->GetNbinsX(); j++){
280 Double_t E = hCellAmplitude->GetXaxis()->GetBinCenter(j);
281 Double_t N = hCellAmplitude->GetBinContent(j, i+1);
294 if(mask[n]<=mask[n-1])
295 Warning(__FUNCTION__,
"The list of bad cells is not sorted !!");
303 geom->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
304 geom->GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta, iphi, ieta);
306 realbinphi = 120-(nSupMod/2)*24 -iphi -1;
308 realbineta= 48-ieta -1;
310 realbineta= -ieta -1;
312 hEnergyMapReal->Fill(realbineta, realbinphi, Esum/(
Double_t)Events);
316 cout <<
" Run: " << run <<
" trigger: " << fTrigger <<
" N_events: "<<Events<<endl;
318 TPMERegexp r(
"_\\w+");
319 TString Energy; Energy = QAPATH +
"MapEnergy" + fTrigger(r) +
".pdf";
320 TString Energy2; Energy2 = QAPATH +
"MapEnergy" + fTrigger(r) +
".png";
321 TString Entries; Entries = QAPATH +
"MapEntries" + fTrigger(r) +
".pdf";
322 TString Entries2; Entries2 = QAPATH +
"MapEntries" + fTrigger(r) +
".png";
324 TCanvas *c1 =
new TCanvas(
"Energymap",
"Energy Map", 600, 600);
327 c1->SetRightMargin(0.14);
331 if(fTrigger.Contains(
"EMC"))
335 title +=
" Summed energy map";
337 hEnergyMapReal->SetTitle(title);
338 AutoZoom(hEnergyMapReal,
"miny")->DrawCopy(
"colz");
365 outputList->Delete();
366 delete hEnergyMapReal;
367 delete hOccupancyMapReal;
376 if(!fTrigger.Contains(
"QA")){
383 Error(__FUNCTION__, Form(
"No input directory %s", direct.Data()));
387 TList *outputList = (
TList*)gDirectory->Get(direct);
389 Error(__FUNCTION__, Form(
"No input list! %s", direct.Data()));
392 outputList->SetOwner();
395 fout->mkdir(Form(
"%s/%s/%ld/%s", period.Data(), pass.Data(), run, fTrigger.Data()));
397 fout->Cd(Form(
"%s/%s/%ld/%s", period.Data(), pass.Data(), run, fTrigger.Data()));
401 fout->Cd(Form(
"%s/%s/%ld/%s/%s", period.Data(), pass.Data(), run,
"RunLevelQA", fTrigger.Data()));
404 gStyle->SetPalette(1);
408 TH1::AddDirectory(kFALSE);
411 const char* legend=
"";
412 TPMERegexp r(
"_\\w+");
414 if(fTrigger.Contains(
"EMC"))
415 legend = Form(
" Run %d EMC ", (
int)run);
417 legend = Form(
" Run %d MB ", (
int)run);
419 TH1F* hNEvents =(TH1F *)outputList->FindObject(
"hNEvents");
421 Error(__FUNCTION__, Form(
"hNEvent histogram not found for trigger %s ", fTrigger.Data()));
427 Error(__FUNCTION__, Form(
"No event in trigger %s", fTrigger.Data()));
431 TH1F* hE =(TH1F *)outputList->FindObject(
"EMCAL_hE");
432 if(!hE || (!hE->GetEntries())){
433 Error(__FUNCTION__, Form(
"hE Histogram not found or it is empty for trigger %s, EMCal was not in this run?", fTrigger.Data()));
437 TCanvas* c00 =
new TCanvas(
"Occupancy map",
"Occupancy", 600, 600);
439 c00->SetFillColor(0);
440 c00->SetBorderSize(0);
441 c00->SetFrameBorderMode(0);
443 TH2F* hOccupancyMapReal =(
TH2F *)outputList->FindObject(
"EMCAL_hEtaPhi");
444 if(!hOccupancyMapReal){
445 Error(__FUNCTION__, Form(
"EMCAL_hEtaPhi: Histogram for trigger %s not found!", fTrigger.Data()));
448 FormatRunHisto(hOccupancyMapReal, Form(
"Occupancy%s", legend),
"#varphi (bin)");
449 hOccupancyMapReal->SetXTitle(
"#eta (bin)");
451 AutoZoom(hOccupancyMapReal,
"all")->DrawCopy(
"colz");
452 outfilename = QAPATH +
"OccupancyMap" + fTrigger(r) +
".pdf" ;
453 outfilename2 = QAPATH +
"OccupancyMap" + fTrigger(r) +
".png" ;
456 c00->SaveAs(outfilename);
458 c00->SaveAs(outfilename2);
462 TCanvas* c0 =
new TCanvas(
"Grid Cell",
"Occupancy from Grid Cells", 600, 600);
465 c0->SetBorderSize(0);
466 c0->SetFrameBorderMode(0);
468 TH2F* hGridCells =(
TH2F *)outputList->FindObject(
"EMCAL_hGridCells");
470 Error(__FUNCTION__, Form(
"EMCAL_hGridCells: Histogram for trigger %s not found!", fTrigger.Data()));
473 FormatRunHisto(hGridCells, Form(
"Occupancy from Grid Cells%s", legend),
"#varphi row columns");
474 hGridCells->SetXTitle(
"#eta row columns");
475 AutoZoom(hGridCells,
"all")->DrawCopy(
"colz");
477 outfilename = QAPATH +
"GridCells" + fTrigger(r) +
".pdf" ;
478 outfilename2 = QAPATH +
"GridCells" + fTrigger(r) +
".png" ;
481 c0->SaveAs(outfilename);
483 c0->SaveAs(outfilename2);
487 TCanvas* c1 =
new TCanvas(
"TimeVsE",
"Cluster Time vs. Energy", 600, 600);
490 c1->SetBorderSize(0);
491 c1->SetFrameBorderMode(0);
493 TH2F* hClusterTimeEnergy =(
TH2F *)outputList->FindObject(
"EMCAL_hClusterTimeEnergy");
494 if(!hClusterTimeEnergy){
495 Error(__FUNCTION__, Form(
"EMCAL_hClusterTimeEnergy: Histogram for trigger %s not found!", fTrigger.Data()));
498 FormatRunHisto(hClusterTimeEnergy, Form(
"Time vs. Energy%s", legend),
"EMCal ToF (ns)");
499 AutoZoom(hClusterTimeEnergy,
"maxx")->DrawCopy(
"colz");
501 outfilename = QAPATH +
"TimeRun" + fTrigger(r) +
".pdf" ;
502 outfilename2 = QAPATH +
"TimeRun" + fTrigger(r) +
".png" ;
505 c1->SaveAs(outfilename);
507 c1->SaveAs(outfilename2);
512 TCanvas* c1a =
new TCanvas(
"TimeVsAbsId",
"Cell Id vs. time ", 600, 600);
514 c1a->SetFillColor(0);
515 c1a->SetBorderSize(0);
516 c1a->SetFrameBorderMode(0);
518 TH2F* hTimeAbsId =(
TH2F *)outputList->FindObject(
"EMCAL_hTimeId");
520 Error(__FUNCTION__, Form(
"EMCAL_hTimeId: Histogram for trigger %s not found!", fTrigger.Data()));
523 FormatRunHisto(hTimeAbsId, Form(
"Cell ID vs. Time%s", legend),
"Cell AbsID");
524 hTimeAbsId->RebinY(16);
525 hTimeAbsId->SetMinimum(32);
526 AutoZoom(hTimeAbsId,
"maxx")->DrawCopy(
"colz");
528 outfilename = QAPATH +
"TimeAbsIdRun" + fTrigger(r) +
".pdf" ;
529 outfilename2 = QAPATH +
"TimeAbsRun" + fTrigger(r) +
".png" ;
532 c1a->SaveAs(outfilename);
534 c1a->SaveAs(outfilename2);
561 TCanvas* c1b =
new TCanvas(
"EVsAbsId",
"Cell Id vs. Energy", 600, 600);
563 c1b->SetFillColor(0);
564 c1b->SetBorderSize(0);
565 c1b->SetFrameBorderMode(0);
567 TH2F* hEAbsId =(
TH2F *)outputList->FindObject(
"EMCAL_hAmpId");
569 Error(__FUNCTION__, Form(
"EMCAL_hAmpId: Histogram for trigger %s not found!", fTrigger.Data()));
572 FormatRunHisto(hEAbsId, Form(
"Cell ID vs. Energy%s", legend),
"Cell AbsID");
574 hEAbsId->SetMinimum(32);
575 AutoZoom(hEAbsId,
"maxx")->DrawCopy(
"colz");
577 outfilename = QAPATH +
"EAbsIdRun" + fTrigger(r) +
".pdf" ;
578 outfilename2 = QAPATH +
"EAbsIdRun" + fTrigger(r) +
".png" ;
581 c1b->SaveAs(outfilename);
583 c1b->SaveAs(outfilename2);
609 if(pass!=
"muon_calo_pass1"){
610 TCanvas * c2 =
new TCanvas(
"ClusterVsTrack ",
"Correlation calo Mult vs. Track Multiplicity", 600, 600);
613 c2->SetBorderSize(0);
614 c2->SetFrameBorderMode(0);
616 TH2F* hClusterVsTrack =(
TH2F *)outputList->FindObject(
"EMCAL_hCaloTrackMNClusters");
617 FormatRunHisto(hClusterVsTrack, Form(
"#it{N} clusters vs. #it{N} tracks%s", legend),
"#it{N} clusters");
618 AutoZoom(hClusterVsTrack,
"maxx, maxy", 1)->DrawCopy(
"colz");
620 outfilename = QAPATH +
"CaloTrackMult" + fTrigger(r) +
".pdf";
621 outfilename2 = QAPATH +
"CaloTrackMult" + fTrigger(r) +
".png";
625 c2->SaveAs(outfilename);
627 c2->SaveAs(outfilename2);
631 TCanvas* c3 =
new TCanvas(
"ClusterEVsTrack ",
"Correlation #it{E} calo vs. Track Multiplicity", 600, 600);
634 c3->SetBorderSize(0);
635 c3->SetFrameBorderMode(0);
637 TH2F* hClusterEVsTrack =(
TH2F*)outputList->FindObject(
"EMCAL_hCaloTrackMEClusters");
638 FormatRunHisto(hClusterEVsTrack, Form(
"Sum #it{E} clusters vs. #it{N} tracks%s", legend),
"#Sigma#it{E} clusters");
639 AutoZoom(hClusterEVsTrack,
"maxx, maxy", 1)->DrawCopy(
"colz");
641 outfilename = QAPATH +
"ETrackMult" + fTrigger(r) +
".pdf";
642 outfilename2 = QAPATH +
"ETrackMult" + fTrigger(r) +
".png";
646 c3->SaveAs(outfilename);
648 c3->SaveAs(outfilename2);
654 TCanvas* c4 =
new TCanvas(
"ClusterEVsV0 ",
"Correlation #it{E} calo vs. V0 signal", 600, 600);
657 c4->SetBorderSize(0);
658 c4->SetFrameBorderMode(0);
660 TH2F* hClusterEVsV0S =(
TH2F*)outputList->FindObject(
"EMCAL_hCaloV0SEClusters");
661 FormatRunHisto(hClusterEVsV0S, Form(
"Sum #it{E} clusters vs. V0 signal%s", legend),
"#Sigma#it{E} clusters");
662 AutoZoom(hClusterEVsV0S,
"maxx, maxy", 1)->DrawCopy(
"colz");
664 outfilename = QAPATH +
"EVsV0s" + fTrigger(r) +
".pdf";
665 outfilename2 = QAPATH +
"EVsV0s" + fTrigger(r) +
".png";
668 c4->SaveAs(outfilename);
670 c4->SaveAs(outfilename2);
674 TCanvas* c6 =
new TCanvas(
"SumCellEvsSM",
"sum cell energy vs. SM", 600, 600);
677 c6->SetBorderSize(0);
678 c6->SetFrameBorderMode(0);
680 TH2F* hSumCellEVsSM =(
TH2F*)outputList->FindObject(
"EMCAL_hSumCellsAmp_Mod");
681 FormatRunHisto(hSumCellEVsSM, Form(
"Sum #it{E} cells vs. SM%s", legend),
"SM number");
682 AutoZoom(hSumCellEVsSM,
"maxx, maxy", 1)->DrawCopy(
"colz");
684 outfilename = QAPATH +
"SumCellEVsSM" + fTrigger(r) +
".pdf";
685 outfilename2 = QAPATH +
"SumCellEVsSM" + fTrigger(r) +
".png";
688 c6->SaveAs(outfilename);
690 c6->SaveAs(outfilename2);
694 TCanvas* c5 =
new TCanvas(
"CellsperCluster",
"Nb of cells per cluster for each SM", 600, 600);
697 c5->SetBorderSize(0);
698 c5->SetFrameBorderMode(0);
703 c5->Divide(3, (nSM/3)+mod3);
705 for(
int ism = 0; ism < nSM; ism++){
709 if(
TString(Form(
"Nb cells per clus%s Mod %d", legend, ism)).Length() > 60){
710 Error(__FUNCTION__,
"Title too long!");
714 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");
717 outfilename = QAPATH +
"CellsperClusterSM" + fTrigger(r) +
".pdf";
718 outfilename2 = QAPATH +
"CellsperClusterSM" + fTrigger(r) +
".png";
721 c5->SaveAs(outfilename);
723 c5->SaveAs(outfilename2);
727 outputList->Delete();
738 aCalorimeter = fCalorimeter;
740 aCalorimeter =
TString(
"EMCAL_and_DCAL");
788 TFile* ftree =
new TFile(Form(
"%s/trending.root", QAPATH.Data()),
"RECREATE");
790 TTree *tree =
new TTree(
"trending",
"Trending QA Tree");
791 tree->Branch(
"fDate", &now);
792 tree->Branch(
"fCalorimeter", &aCalorimeter);
793 tree->Branch(
"system", &system);
794 tree->Branch(
"period", &period);
795 tree->Branch(
"pass", &pass);
796 tree->Branch(
"fTrigger", &fTrigger);
797 tree->Branch(
"run", &RunId,
"run/I");
798 tree->Branch(
"xe", &xe,
"xe/D");
800 tree->Branch(
"Nevent", &Nevent,
"Nevent/D");
801 tree->Branch(
"NMatchClustersP", &NMatchClustersP,
"NMatchClustersP/D");
802 tree->Branch(
"NMatchClustersPRMS", &NMatchClustersPRMS,
"NMatchClustersPRMS/D");
803 tree->Branch(
"CellMean", &CellMean,
"CellMean/D");
804 tree->Branch(
"CellRMS", &CellRMS,
"CellRMS/D");
805 tree->Branch(
"ClusterMean", &ClusterMean,
"ClusterMean/D");
806 tree->Branch(
"ClusterRMS", &ClusterRMS,
"ClusterRMS/D");
807 tree->Branch(
"EtotalMean", &EtotalMean,
"EtotalMean/D");
808 tree->Branch(
"EtotalRMS", &EtotalRMS,
"EtotalRMS/D");
810 tree->Branch(
"CellPerClusterMean", &CellPerClusterMean,
"CellPerClusterMean/D");
811 tree->Branch(
"CellPerClusterRMS", &CellPerClusterRMS,
"CellPerClusterRMS/D");
813 tree->Branch(
"Npi0EMCAL", &Npi0EMCAL,
"Npi0EMCAL/D");
814 tree->Branch(
"Npi0EMCALErr", &Npi0EMCALErr,
"Npi0EMCALErr/D");
815 tree->Branch(
"Npi0DCAL", &Npi0DCAL,
"Npi0DCAL/D");
816 tree->Branch(
"Npi0DCALErr", &Npi0DCALErr,
"Npi0DCALErr/D");
817 tree->Branch(
"MeanPosEMCAL", &MeanPosEMCAL,
"MeanPosEMCAL/D");
818 tree->Branch(
"MeanPosEMCALErr", &MeanPosEMCALErr,
"MeanPosEMCALErr/D");
819 tree->Branch(
"MeanPosDCAL", &MeanPosDCAL,
"MeanPosDCAL/D");
820 tree->Branch(
"MeanPosDCALErr", &MeanPosDCALErr,
"MeanPosDCALErr/D");
821 tree->Branch(
"WidthEMCAL", &WidthEMCAL,
"WidthEMCAL/D");
822 tree->Branch(
"WidthEMCALErr", &WidthEMCALErr,
"WidthEMCALErr/D");
823 tree->Branch(
"WidthDCAL", &WidthDCAL,
"WidthDCAL/D");
824 tree->Branch(
"WidthDCALErr", &WidthDCALErr,
"WidthDCALErr/D");
825 tree->Branch(
"Chi2NdfPi0EMCAL", &Chi2NdfPi0EMCAL,
"Chi2NdfPi0EMCAL/D");
826 tree->Branch(
"Chi2NdfPi0DCAL", &Chi2NdfPi0DCAL,
"Chi2NdfPi0DCAL/D");
827 tree->Branch(
"NggEMCAL", &NggEMCAL,
"NggEMCAL/D");
828 tree->Branch(
"NggEMCALErr", &NggEMCALErr,
"NggEMCALErr/D");
829 tree->Branch(
"NggDCAL", &NggDCAL,
"NggDCAL/D");
830 tree->Branch(
"NggDCALErr", &NggDCALErr,
"NggDCALErr/D");
831 tree->Branch(
"SignifEMCAL", &SignifEMCAL,
"SignifEMCAL/D");
832 tree->Branch(
"SignifDCALErr", &SignifDCALErr,
"SignifDCALErr/D");
833 tree->Branch(
"SignifEMCAL", &SignifEMCAL,
"SignifEMCAL/D");
834 tree->Branch(
"SignifDCALErr", &SignifDCALErr,
"SignifDCALErr/D");
836 tree->Branch(
"nSM", &n,
"nSM/I");
846 Double_t CellPerClusterMeanSM[nMax];
858 tree->Branch(
"CellMeanSM", CellMeanSM, TString::Format(
"CellMeanSM[%i]/D", nMax));
859 tree->Branch(
"CellRMSSM", CellRMSSM, TString::Format(
"CellRMSSM[%i]/D", nMax));
860 tree->Branch(
"ClusterMeanSM", ClusterMeanSM, TString::Format(
"ClusterMeanSM[%i]/D", nMax));
861 tree->Branch(
"ClusterTotSM", ClusterTotSM, TString::Format(
"ClusterTotSM[%i]/D", nMax));
862 tree->Branch(
"ClusterRMSSM", ClusterRMSSM, TString::Format(
"ClusterRMSSM[%i]/D", nMax));
863 tree->Branch(
"EtotalMeanSM", EtotalMeanSM, TString::Format(
"EtotalMeanSM[%i]/D", nMax));
864 tree->Branch(
"EtotalRMSSM", EtotalRMSSM, TString::Format(
"EtotalRMSSM[%i]/D", nMax));
865 tree->Branch(
"CellPerClusterMeanSM", CellPerClusterMeanSM, TString::Format(
"CellPerClusterMeanSM[%i]/D", nMax));
866 tree->Branch(
"CellPerClusterRMSSM", CellPerClusterRMSSM, TString::Format(
"CellPerClusterRMSSM[%i]/D", nMax));
867 tree->Branch(
"ECell1MeanSM", ECell1MeanSM, TString::Format(
"ECell1MeanSM[%i]/D", nMax));
868 tree->Branch(
"ECell1RMSSM", ECell1RMSSM, TString::Format(
"ECell1RMSSM[%i]/D", nMax));
870 tree->Branch(
"MeanPosSM", MeanPosSM, TString::Format(
"MeanPosSM[%i]/D", nMax));
871 tree->Branch(
"MeanPosErrSM", MeanPosErrSM, TString::Format(
"MeanPosErrSM[%i]/D", nMax));
872 tree->Branch(
"WidthSM", WidthSM, TString::Format(
"WidthSM[%i]/D", nMax));
873 tree->Branch(
"WidthErrSM", WidthErrSM, TString::Format(
"WidthErrSM[%i]/D", nMax));
874 tree->Branch(
"Npi0SM", Npi0SM, TString::Format(
"Npi0SM[%i]/D", nMax));
875 tree->Branch(
"Npi0ErrSM", Npi0ErrSM, TString::Format(
"Npi0ErrSM[%i]/D", nMax));
877 TF1* fitMass =
new TF1(
"fitMass",
pi0massP2, 100, 250, 6);
878 fitMass->SetParName(0,
"A");
879 fitMass->SetParName(1,
"m_{0}");
880 fitMass->SetParName(2,
"sigma");
881 fitMass->SetParName(3,
"a_{0}");
882 fitMass->SetParName(4,
"a_{1}");
883 fitMass->SetParName(5,
"a_{2}");
884 fitMass->SetParLimits(0, 1.e-5, 1.e5);
885 fitMass->SetParLimits(1, 0.11, 0.16);
886 fitMass->SetParLimits(2, 0.001, 0.06);
892 TH1F* fhNClusters = 0x0;
894 TH1F* fhNCells = 0x0;
898 TH2F* NCellsPerCluster[n];
908 TPMERegexp r(
"_\\w+");
909 TIter next(TriggersList);
913 fTrigger=
TString(obj->GetName());
914 TString namefile = QAPATH + period +
"_" + pass + fTrigger(r).Data() +
"_" + RunId +
"_data.txt";
915 ofstream QAData(namefile, ios::app);
922 NMatchClustersPRMS=0;
929 CellPerClusterMean=0;
958 memset (CellMeanSM, 0,
sizeof (
Double_t) * nMax);
959 memset (CellRMSSM, 0,
sizeof (
Double_t) * nMax);
960 memset (ClusterMeanSM, 0,
sizeof (
Double_t) * nMax);
961 memset (ClusterTotSM, 0,
sizeof (
Double_t) * nMax);
962 memset (ClusterRMSSM, 0,
sizeof (
Double_t) * nMax);
963 memset (EtotalMeanSM, 0,
sizeof (
Double_t) * nMax);
964 memset (EtotalRMSSM, 0,
sizeof (
Double_t) * nMax);
965 memset (CellPerClusterMeanSM, 0,
sizeof (
Double_t) * nMax);
966 memset (CellPerClusterRMSSM, 0,
sizeof (
Double_t) * nMax);
967 memset (ECell1MeanSM, 0,
sizeof (
Double_t) * nMax);
968 memset (ECell1RMSSM, 0,
sizeof (
Double_t) * nMax);
970 memset (MeanPosSM, 0,
sizeof (
Double_t) * nMax);
971 memset (MeanPosErrSM, 0,
sizeof (
Double_t) * nMax);
972 memset (WidthSM, 0,
sizeof (
Double_t) * nMax);
973 memset (WidthErrSM, 0,
sizeof (
Double_t) * nMax);
974 memset (Npi0SM, 0,
sizeof (
Double_t) * nMax);
975 memset (Npi0ErrSM, 0,
sizeof (
Double_t) * nMax);
978 if(!fTrigger.Contains(
"QA")){
983 Bool_t dirok = f->cd(dirname);
985 Error(__FUNCTION__, Form(
"No input directory %s", dirname.Data()));
986 tree->Fill(); ftree->cd();
992 outputList = (
TList*)gDirectory->Get(dirname);
994 Error(__FUNCTION__, Form(
"No input list! %s", dirname.Data()));
995 tree->Fill(); ftree->cd();
1000 outputList->SetOwner();
1003 fhNEvents =(TH1F *)outputList->FindObject(
"hNEvents");
1005 Error(__FUNCTION__, Form(
"NEvent histogram not found for trigger %s", fTrigger.Data()));
1006 tree->Fill(); ftree->cd();
1007 tree->Write(); ret=-3;
1011 Nevent=fhNEvents->GetEntries();
1014 Error(__FUNCTION__, Form(
"No event in trigger %s", fTrigger.Data()));
1015 tree->Fill(); ftree->cd();
1021 Error(__FUNCTION__, Form(
"Less than 20 events in trigger %s", fTrigger.Data()));
1022 tree->Fill(); ftree->cd();
1028 TH1F* hE =(TH1F *)outputList->FindObject(
"EMCAL_hE");
1029 if(!hE || (!hE->GetEntries())){
1030 Error(__FUNCTION__, Form(
"hE Histogram not found or it is empty for trigger %s, EMCal was not in this run?", fTrigger.Data())); EtotalMean=0;
1031 tree->Fill(); ftree->cd();
1038 fhE = (TH1F *)outputList->FindObject(fCalorimeter+
"_hE");
1039 fhECharged = (TH1F *)outputList->FindObject(fCalorimeter+
"_hECharged");
1043 for(
Int_t ibin = fhE->FindBin(0.6) ; ibin <fhE->FindBin(50.) ; ibin++){
1044 energy+=fhE->GetBinCenter(ibin)*fhE->GetBinContent(ibin);
1047 if(fhE->Integral(fhE->FindBin(0.6), fhE->FindBin(50.))==0){
1048 Error(__FUNCTION__, Form(
"Not enough events"));
1049 tree->Fill(); ftree->cd();
1055 EtotalMean=energy/fhE->Integral(fhE->FindBin(0.6), fhE->FindBin(50.)) ;
1056 EtotalRMS=fhE->GetMeanError();
1058 TString nameNCell = Form(
"%s_hNCells_Mod", fCalorimeter.Data());
1059 TString nameNCluster = Form(
"%s_hNClusters_Mod", fCalorimeter.Data());
1060 TString nameE = Form(
"%s_hE_Mod", fCalorimeter.Data());
1061 TH2F* hNCellsMod= (
TH2F*)outputList->FindObject(nameNCell.Data());
1062 TH2F* hNClusterMod=(
TH2F*)outputList->FindObject(nameNCluster.Data());
1063 TH2F* hEMod=(
TH2F*)outputList->FindObject(nameE.Data());
1065 if(!hNCellsMod || !hNClusterMod || !hEMod){
1066 Error(__FUNCTION__,
"A requiered histogram was not found (the imput QAresult.root might be too old)!");
1067 tree->Fill(); ftree->cd();
1076 if(fTrigger.Contains(
"EMC"))
1077 trig_title +=
"EMC";
1082 TCanvas* c_TimeSM_BC0 =
new TCanvas(
"TimeSM_BC0",
"Cell Time (for BC/4=0) for each SM", 1200, 1200);
1083 c_TimeSM_BC0->SetFillColor(0);
1084 c_TimeSM_BC0->SetBorderSize(0);
1085 c_TimeSM_BC0->SetFrameBorderMode(0);
1089 c_TimeSM_BC0->Divide(3, n/3+mod3_BC0);
1091 TH2F* hTimeSM_BC0 = (
TH2F*)outputList->FindObject(
"EMCAL_hTimePerSM_BC0");
1092 TH1F* hTimeSM_BC0_proj[n];
1096 cout <<
"---------------------" << endl;
1097 cout <<
" BC/4=0 | Run " << RunId << endl;
1098 for(
Int_t ism = 0 ; ism < n ; ism++){
1099 c_TimeSM_BC0->cd(ism+1);
1100 gPad->SetTopMargin(0.1);
1101 gPad->SetBottomMargin(0.15);
1104 TimeSM_BC0_projName = Form(
"SM_%d", ism);
1105 hTimeSM_BC0_proj[ism] = (TH1F *)hTimeSM_BC0->ProjectionX(TimeSM_BC0_projName.Data(), ism+1, ism+1,
"") ;
1106 hTimeSM_BC0_proj[ism]->Draw(
"hist");
1108 hTimeSM_BC0_proj[ism]->SetTitle(Form(
"#it{t}_{cell} for super module %i (BC/4=0) %s", ism, trig_title.Data()));
1109 hTimeSM_BC0_proj[ism]->SetTitleSize(0.1);
1110 hTimeSM_BC0_proj[ism]->SetXTitle(
"#it{t}_{cell} (ns)");
1111 hTimeSM_BC0_proj[ism]->SetYTitle(
"Nb of entries");
1112 hTimeSM_BC0_proj[ism]->SetStats(kTRUE);
1114 hTimeSM_BC0_proj[ism]->GetXaxis()->SetRangeUser(400, 900);
1115 hTimeSM_BC0_proj[ism]->GetXaxis()->SetLabelSize(0.05);
1116 hTimeSM_BC0_proj[ism]->GetXaxis()->SetLabelOffset(0.015);
1117 hTimeSM_BC0_proj[ism]->GetXaxis()->SetTitleSize(0.075);
1118 hTimeSM_BC0_proj[ism]->GetXaxis()->SetTitleOffset(0.9);
1120 hTimeSM_BC0_proj[ism]->GetYaxis()->SetLabelSize(0.05);
1121 hTimeSM_BC0_proj[ism]->GetYaxis()->SetTitleSize(0.06);
1122 hTimeSM_BC0_proj[ism]->GetYaxis()->SetTitleOffset(0.6);
1125 TString outfilename_BC0 = QAPATH +
"TimeSM_BC0" + fTrigger(r) +
".pdf";
1126 TString outfilename2_BC0 = QAPATH +
"TimeSM_BC0" + fTrigger(r) +
".png";
1128 c_TimeSM_BC0->SaveAs(outfilename_BC0);
1130 c_TimeSM_BC0->SaveAs(outfilename2_BC0);
1134 TCanvas* c_TimeSM_BC1 =
new TCanvas(
"TimeSM_BC1",
"Cell Time (for BC/4=1) for each SM", 1200, 1200);
1135 c_TimeSM_BC1->SetFillColor(0);
1136 c_TimeSM_BC1->SetBorderSize(0);
1137 c_TimeSM_BC1->SetFrameBorderMode(0);
1141 c_TimeSM_BC1->Divide(3, n/3+mod3_BC1);
1143 TH2F* hTimeSM_BC1 = (
TH2F*)outputList->FindObject(
"EMCAL_hTimePerSM_BC1");
1144 TH1F* hTimeSM_BC1_proj[n];
1148 cout <<
"---------------------" << endl;
1149 cout <<
" BC/4=1 | Run " << RunId << endl;
1150 for(
Int_t ism = 0 ; ism < n ; ism++){
1151 c_TimeSM_BC1->cd(ism+1);
1152 gPad->SetTopMargin(0.1);
1153 gPad->SetBottomMargin(0.15);
1156 TimeSM_BC1_projName = Form(
"SM_%d", ism);
1157 hTimeSM_BC1_proj[ism] = (TH1F *)hTimeSM_BC1->ProjectionX(TimeSM_BC1_projName.Data(), ism+1, ism+1,
"") ;
1158 hTimeSM_BC1_proj[ism]->Draw(
"hist");
1160 hTimeSM_BC1_proj[ism]->SetTitle(Form(
"#it{t}_{cell} for super module %i (BC/4=1) %s", ism, trig_title.Data()));
1161 hTimeSM_BC1_proj[ism]->SetTitleSize(0.1);
1162 hTimeSM_BC1_proj[ism]->SetXTitle(
"#it{t}_{cell} (ns)");
1163 hTimeSM_BC1_proj[ism]->SetYTitle(
"Nb of entries");
1164 hTimeSM_BC1_proj[ism]->SetStats(kTRUE);
1166 hTimeSM_BC1_proj[ism]->GetXaxis()->SetRangeUser(400, 900);
1167 hTimeSM_BC1_proj[ism]->GetXaxis()->SetLabelSize(0.05);
1168 hTimeSM_BC1_proj[ism]->GetXaxis()->SetLabelOffset(0.015);
1169 hTimeSM_BC1_proj[ism]->GetXaxis()->SetTitleSize(0.075);
1170 hTimeSM_BC1_proj[ism]->GetXaxis()->SetTitleOffset(0.9);
1172 hTimeSM_BC1_proj[ism]->GetYaxis()->SetLabelSize(0.05);
1173 hTimeSM_BC1_proj[ism]->GetYaxis()->SetTitleSize(0.06);
1174 hTimeSM_BC1_proj[ism]->GetYaxis()->SetTitleOffset(0.6);
1177 TString outfilename_BC1 = QAPATH +
"TimeSM_BC1" + fTrigger(r) +
".pdf";
1178 TString outfilename2_BC1 = QAPATH +
"TimeSM_BC1" + fTrigger(r) +
".png";
1180 c_TimeSM_BC1->SaveAs(outfilename_BC1);
1182 c_TimeSM_BC1->SaveAs(outfilename2_BC1);
1186 TCanvas* c_TimeSM_BC2 =
new TCanvas(
"TimeSM_BC2",
"Cell Time (for BC/4=2) for each SM", 1200, 1200);
1187 c_TimeSM_BC2->SetFillColor(0);
1188 c_TimeSM_BC2->SetBorderSize(0);
1189 c_TimeSM_BC2->SetFrameBorderMode(0);
1193 c_TimeSM_BC2->Divide(3, n/3+mod3_BC2);
1195 TH2F* hTimeSM_BC2 = (
TH2F*)outputList->FindObject(
"EMCAL_hTimePerSM_BC2");
1196 TH1F* hTimeSM_BC2_proj[n];
1200 cout <<
"---------------------" << endl;
1201 cout <<
" BC/4=2 | Run " << RunId << endl;
1202 for(
Int_t ism = 0 ; ism < n ; ism++){
1203 c_TimeSM_BC2->cd(ism+1);
1204 gPad->SetTopMargin(0.1);
1205 gPad->SetBottomMargin(0.15);
1208 TimeSM_BC2_projName = Form(
"SM_%d", ism);
1209 hTimeSM_BC2_proj[ism] = (TH1F *)hTimeSM_BC2->ProjectionX(TimeSM_BC2_projName.Data(), ism+1, ism+1,
"") ;
1210 hTimeSM_BC2_proj[ism]->Draw(
"hist");
1212 hTimeSM_BC2_proj[ism]->SetTitle(Form(
"#it{t}_{cell} for super module %i (BC/4=2) %s", ism, trig_title.Data()));
1213 hTimeSM_BC2_proj[ism]->SetTitleSize(0.1);
1214 hTimeSM_BC2_proj[ism]->SetXTitle(
"#it{t}_{cell} (ns)");
1215 hTimeSM_BC2_proj[ism]->SetYTitle(
"Nb of entries");
1216 hTimeSM_BC2_proj[ism]->SetStats(kTRUE);
1218 hTimeSM_BC2_proj[ism]->GetXaxis()->SetRangeUser(400, 900);
1219 hTimeSM_BC2_proj[ism]->GetXaxis()->SetLabelSize(0.05);
1220 hTimeSM_BC2_proj[ism]->GetXaxis()->SetLabelOffset(0.015);
1221 hTimeSM_BC2_proj[ism]->GetXaxis()->SetTitleSize(0.075);
1222 hTimeSM_BC2_proj[ism]->GetXaxis()->SetTitleOffset(0.9);
1224 hTimeSM_BC2_proj[ism]->GetYaxis()->SetLabelSize(0.05);
1225 hTimeSM_BC2_proj[ism]->GetYaxis()->SetTitleSize(0.06);
1226 hTimeSM_BC2_proj[ism]->GetYaxis()->SetTitleOffset(0.6);
1229 TString outfilename_BC2 = QAPATH +
"TimeSM_BC2" + fTrigger(r) +
".pdf";
1230 TString outfilename2_BC2 = QAPATH +
"TimeSM_BC2" + fTrigger(r) +
".png";
1232 c_TimeSM_BC2->SaveAs(outfilename_BC2);
1234 c_TimeSM_BC2->SaveAs(outfilename2_BC2);
1238 TCanvas* c_TimeSM_BC3 =
new TCanvas(
"TimeSM_BC3",
"Cell Time (for BC/4=3) for each SM", 1200, 1200);
1239 c_TimeSM_BC3->SetFillColor(0);
1240 c_TimeSM_BC3->SetBorderSize(0);
1241 c_TimeSM_BC3->SetFrameBorderMode(0);
1245 c_TimeSM_BC3->Divide(3, n/3+mod3_BC3);
1247 TH2F* hTimeSM_BC3 = (
TH2F*)outputList->FindObject(
"EMCAL_hTimePerSM_BC3");
1248 TH1F* hTimeSM_BC3_proj[n];
1252 cout <<
"---------------------" << endl;
1253 cout <<
" BC/4=3 | Run " << RunId << endl;
1254 for(
Int_t ism = 0 ; ism < n ; ism++){
1255 c_TimeSM_BC3->cd(ism+1);
1256 gPad->SetTopMargin(0.1);
1257 gPad->SetBottomMargin(0.15);
1260 TimeSM_BC3_projName = Form(
"SM_%d", ism);
1261 hTimeSM_BC3_proj[ism] = (TH1F *)hTimeSM_BC3->ProjectionX(TimeSM_BC3_projName.Data(), ism+1, ism+1,
"") ;
1262 hTimeSM_BC3_proj[ism]->Draw(
"hist");
1264 hTimeSM_BC3_proj[ism]->SetTitle(Form(
"#it{t}_{cell} for super module %i (BC/4=3) %s", ism, trig_title.Data()));
1265 hTimeSM_BC3_proj[ism]->SetTitleSize(0.1);
1266 hTimeSM_BC3_proj[ism]->SetXTitle(
"#it{t}_{cell} (ns)");
1267 hTimeSM_BC3_proj[ism]->SetYTitle(
"Nb of entries");
1268 hTimeSM_BC3_proj[ism]->SetStats(kTRUE);
1270 hTimeSM_BC3_proj[ism]->GetXaxis()->SetRangeUser(400, 900);
1271 hTimeSM_BC3_proj[ism]->GetXaxis()->SetLabelSize(0.05);
1272 hTimeSM_BC3_proj[ism]->GetXaxis()->SetLabelOffset(0.015);
1273 hTimeSM_BC3_proj[ism]->GetXaxis()->SetTitleSize(0.075);
1274 hTimeSM_BC3_proj[ism]->GetXaxis()->SetTitleOffset(0.9);
1276 hTimeSM_BC3_proj[ism]->GetYaxis()->SetLabelSize(0.05);
1277 hTimeSM_BC3_proj[ism]->GetYaxis()->SetTitleSize(0.06);
1278 hTimeSM_BC3_proj[ism]->GetYaxis()->SetTitleOffset(0.6);
1281 TString outfilename_BC3 = QAPATH +
"TimeSM_BC3" + fTrigger(r) +
".pdf";
1282 TString outfilename2_BC3 = QAPATH +
"TimeSM_BC3" + fTrigger(r) +
".png";
1284 c_TimeSM_BC3->SaveAs(outfilename_BC3);
1286 c_TimeSM_BC3->SaveAs(outfilename2_BC3);
1291 TCanvas* c1 =
new TCanvas(
"Pi0InvMassSM",
"Pi0 Invariant Mass for each SM", 600, 600);
1292 gStyle->SetOptStat(1);
1293 gStyle->SetOptFit(1);
1294 c1->SetFillColor(0);
1295 c1->SetBorderSize(0);
1296 c1->SetFrameBorderMode(0);
1302 c1->Divide(3, n/3+mod3);
1306 for(
Int_t ism = 0 ; ism < n ; ism++){
1307 cout <<
"#########################"<< endl;
1308 cout <<
" Super Module " << ism <<
" Run " << RunId << endl;
1311 nameNCellPerCluster = Form(
"%s_hNCellsPerCluster_Mod%d", fCalorimeter.Data(), ism);
1312 NCellsPerCluster[ism] = (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data());
1314 if(! (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data()) ){
1315 Error(__FUNCTION__, Form(
"NCellsPerCluster histogram not found for super module %i", ism));
1320 NCellsPerCluster[ism] = (
TH2F*)outputList->FindObject(nameNCellPerCluster.Data());
1321 NCells[ism] = (TH1F*)hNCellsMod->ProjectionX(Form(
"NCells%d", ism), ism+1, ism+1,
"");
1322 NClusters[ism] = (TH1F*)hNClusterMod->ProjectionX(Form(
"NClusters%d", ism), ism+1, ism+1,
"");
1323 E[ism] = (TH1F*)hEMod->ProjectionX(Form(
"E%d", ism), ism+1, ism+1,
"");
1325 CellMeanSM[ism]=NCells[ism]->GetMean();
1326 CellRMSSM[ism]=NCells[ism]->GetMeanError();
1329 binmax = NClusters[ism]->GetNbinsX();
1330 for(
Int_t ibin = 1 ;ibin <=binmax ;ibin++){
1331 ClusterTotSM[ism]+=(NClusters[ism]->GetBinCenter(ibin))*(NClusters[ism]->GetBinContent(ibin));
1333 if(NClusters[ism]->GetEntries()>0)
1334 ClusterTotSM[ism]= ClusterTotSM[ism]/NClusters[ism]->GetEntries();
1337 ClusterMeanSM[ism]=NClusters[ism]->GetMean();
1338 ClusterRMSSM[ism]=NClusters[ism]->GetMeanError();
1339 CellPerClusterMeanSM[ism]=NCellsPerCluster[ism]->GetMean(2);
1340 CellPerClusterRMSSM[ism]=NCellsPerCluster[ism]->GetMeanError(2);
1342 ECell1MeanSM[ism] =NCellsPerCluster[ism]->ProjectionX(
"", 2, 50,
"")->Integral(5, 50)/(Nevent);
1343 ECell1RMSSM[ism] =NCellsPerCluster[ism]->ProjectionX(
"", 2, 50,
"")->GetMeanError();
1346 for(
Int_t ibin = E[ism]->FindBin(0.6) ; ibin <E[ism]->FindBin(50.) ; ibin++){
1347 energySM+=E[ism]->GetBinCenter(ibin)*(E[ism]->GetBinContent(ibin));
1350 if(E[ism]->Integral(E[ism]->FindBin(0.6), E[ism]->FindBin(50.))==0){
1351 Error(__FUNCTION__, Form(
"Energy: Not enough events/SM"));
1355 EtotalMeanSM[ism]=energySM/(E[ism]->Integral(E[ism]->FindBin(0.6), E[ism]->FindBin(50.)));
1356 EtotalRMSSM[ism]=E[ism]->GetMeanError();
1359 fhNCells = (TH1F*)NCells[ism]->Clone(
"NCells");
1360 fhNClusters = (TH1F*)NClusters[ism]->Clone(
"NClusters");
1363 fhNCells->Add(NCells[ism], 1);
1364 fhNClusters->Add(NClusters[ism], 1);
1369 TString namePair = Form(
"%s_hIM_Mod%d", fCalorimeter.Data(), ism);
1370 IM[ism] = (
TH2F*)outputList->FindObject(namePair.Data());
1373 TString projname = Form(
"SM_%d", ism);
1374 MggSM[ism] = (TH1F *)IM[ism]->ProjectionY(projname.Data(), 2, 20,
"") ;
1376 if(MggSM[ism]->GetEntries()>100){
1377 fitMass->SetParameter(0, MggSM[ism]->GetBinContent(MggSM[ism]->GetMaximumBin()));
1378 fitMass->SetParameter(1, mPDG);
1379 fitMass->SetParameter(2, 15.);
1380 fitMass->SetParameter(3, 0.);
1381 fitMass->SetParameter(4, MggSM[ism]->GetBinContent(MggSM[ism]->FindBin(0.11)));
1382 fitMass->SetParameter(5, MggSM[ism]->GetBinContent(MggSM[ism]->FindBin(0.20)));
1384 if(MggSM[ism]->GetEntries()<1000)
1385 MggSM[ism]->Rebin(5);
1387 MggSM[ism]->Rebin();
1389 MggSM[ism]->Fit(
"fitMass",
"WL R +",
"", 0.1, 0.30);
1390 MggSM[ism]->SetTitle(Form(
"Pi0 Mass for super module %i", ism));
1391 MggSM[ism]->SetTitleSize(0.1);
1392 MggSM[ism]->SetXTitle(
"Pi0 Mass");
1393 MggSM[ism]->SetYTitle(
"Nb of entries");
1394 MggSM[ism]->GetXaxis()->SetLabelSize(0.05);
1395 MggSM[ism]->GetXaxis()->SetTitleSize(0.07);
1396 MggSM[ism]->GetXaxis()->SetTitleOffset(0.68);
1397 MggSM[ism]->GetYaxis()->SetLabelSize(0.05);
1398 MggSM[ism]->GetYaxis()->SetTitleSize(0.06);
1399 MggSM[ism]->GetYaxis()->SetTitleOffset(0.78);
1401 MeanPosSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParameter(1)*1000;
1402 MeanPosErrSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParError(1)*1000;
1403 WidthSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2)*1000;
1404 WidthErrSM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParError(2)*1000;
1405 Npi0SM[ism] = MggSM[ism]->GetFunction(
"fitMass")->GetParameter(0)*(MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2))*TMath::Sqrt(2*TMath::Pi())/(Nevent*MggSM[ism]->GetBinWidth(1));
1406 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))
1407 +(MggSM[ism]->GetFunction(
"fitMass")->GetParError(2)/MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2))*(MggSM[ism]->GetFunction(
"fitMass")->GetParError(2)/MggSM[ism]->GetFunction(
"fitMass")->GetParameter(2)));
1408 Npi0ErrSM[ism] = 0.;
1412 Info(__FUNCTION__, Form(
"Not enough events for Pi0 fit and trending for super module %i", ism));
1416 TCanvas* c2 =
new TCanvas(
"Pi0InvMassEMCAL",
"Pi0 Invariant Mass in EMCal", 600, 600);
1417 c2->SetFillColor(0);
1418 c2->SetBorderSize(0);
1419 c2->SetFrameBorderMode(0);
1422 fhIM = (
TH2F *)outputList->FindObject(fCalorimeter+
"_hIM");
1424 fhMggEMCAL = (TH1F *)fhIM->ProjectionY(
"MggEMCAL", 2, 20,
"") ;
1426 if(fhMggEMCAL->GetEntries()==0){
1427 Error(__FUNCTION__,
"The Pi0 histogram in EMCal is empty !"); tree->Fill();
1432 fitMass->SetParameter(0, 4500);
1433 fitMass->SetParameter(1, mPDG);
1434 fitMass->SetParameter(2, 0.01);
1435 fitMass->SetParameter(3, 0.);
1436 fitMass->SetParameter(4, fhMggEMCAL->GetBinContent(fhMggEMCAL->FindBin(0.11)));
1437 fitMass->SetParameter(5, fhMggEMCAL->GetBinContent(fhMggEMCAL->FindBin(0.20)));
1439 if(fhMggEMCAL->GetEntries()<5000)
1440 fhMggEMCAL->Rebin(5);
1442 fhMggEMCAL->Rebin();
1444 fhMggEMCAL->Fit(
"fitMass",
"L R +",
"", 0.05, 0.20);
1446 fhMggEMCAL->SetTitle(
"Pi0 Mass in EMCal");
1447 fhMggEMCAL->SetTitleSize(0.1);
1448 fhMggEMCAL->SetXTitle(
"Pi0 Mass");
1449 fhMggEMCAL->SetYTitle(
"Nb of entries");
1450 fhMggEMCAL->GetXaxis()->SetLabelSize(0.03);
1451 fhMggEMCAL->GetXaxis()->SetTitleSize(0.03);
1452 fhMggEMCAL->GetXaxis()->SetTitleOffset(1.3);
1453 fhMggEMCAL->GetYaxis()->SetLabelSize(0.03);
1454 fhMggEMCAL->GetYaxis()->SetTitleSize(0.03);
1455 fhMggEMCAL->GetYaxis()->SetTitleOffset(1.3);
1457 MeanPosEMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(1)*1000;
1458 MeanPosEMCALErr = fhMggEMCAL->GetFunction(
"fitMass")->GetParError(1)*1000;
1459 WidthEMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(2)*1000;
1460 WidthEMCALErr = fhMggEMCAL->GetFunction(
"fitMass")->GetParError(2)*1000;
1461 Chi2NdfPi0EMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetChisquare()/fhMggEMCAL->GetFunction(
"fitMass")->GetNDF();
1462 Npi0EMCAL = fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(0)*fhMggEMCAL->GetFunction(
"fitMass")->GetParameter(2)*TMath::Sqrt(2*TMath::Pi())/(Nevent*fhMggEMCAL->GetBinWidth(10));
1463 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));
1465 NggEMCAL = fhMggEMCAL->GetFunction(
"fitMass")->Integral(0.11, 0.16)/(Nevent*fhMggEMCAL->GetBinWidth(10));
1466 NggEMCALErr = fhMggEMCAL->GetFunction(
"fitMass")->IntegralError(0.11, 0.16)/(fhMggEMCAL->Integral()*fhMggEMCAL->GetBinWidth(10));
1467 SignifEMCAL = Npi0EMCAL/NggEMCAL;
1468 SignifEMCALErr = TMath::Sqrt((Npi0EMCALErr/Npi0EMCAL*(Npi0EMCALErr/Npi0EMCAL)+(NggEMCALErr/NggEMCAL*(NggEMCALErr/NggEMCAL))));
1469 SignifEMCALErr = SignifEMCAL*SignifEMCALErr;
1471 TCanvas* c3 =
new TCanvas(
"Pi0InvMassDCAL",
"Pi0 Invariant Mass in DCal", 600, 600);
1472 c3->SetFillColor(0);
1473 c3->SetBorderSize(0);
1474 c3->SetFrameBorderMode(0);
1476 fhIMDCAL = (
TH2F *)outputList->FindObject(fCalorimeter+
"_hIMDCAL");
1489 fhMggDCAL = (TH1F *)fhIMDCAL->ProjectionY(
"MggDCAL", 2, 20,
"") ;
1490 if(fhMggDCAL->GetEntries()==0){
1491 Error(__FUNCTION__,
"The Pi0 histogram in DCal is empty !"); tree->Fill();
1496 fitMass->SetParameter(0, 4500);
1497 fitMass->SetParameter(1, mPDG);
1498 fitMass->SetParameter(2, 0.01);
1499 fitMass->SetParameter(3, 0.);
1500 fitMass->SetParameter(4, fhMggDCAL->GetBinContent(fhMggDCAL->FindBin(0.11)));
1501 fitMass->SetParameter(5, fhMggDCAL->GetBinContent(fhMggDCAL->FindBin(0.20)));
1503 if(fhMggDCAL->GetEntries()<5000)
1504 fhMggDCAL->Rebin(5);
1508 fhMggDCAL->Fit(
"fitMass",
"L R +",
"", 0.05, 0.20);
1510 fhMggDCAL->SetTitle(
"Pi0 Mass in DCal");
1511 fhMggDCAL->SetTitleSize(0.1);
1512 fhMggDCAL->SetXTitle(
"Pi0 Mass");
1513 fhMggDCAL->SetYTitle(
"Nb of entries");
1514 fhMggDCAL->GetXaxis()->SetLabelSize(0.03);
1515 fhMggDCAL->GetXaxis()->SetTitleSize(0.03);
1516 fhMggDCAL->GetXaxis()->SetTitleOffset(1.3);
1517 fhMggDCAL->GetYaxis()->SetLabelSize(0.03);
1518 fhMggDCAL->GetYaxis()->SetTitleSize(0.03);
1519 fhMggDCAL->GetYaxis()->SetTitleOffset(1.3);
1521 MeanPosDCAL = fhMggDCAL->GetFunction(
"fitMass")->GetParameter(1)*1000;
1522 MeanPosDCALErr = fhMggDCAL->GetFunction(
"fitMass")->GetParError(1)*1000;
1523 WidthDCAL = fhMggDCAL->GetFunction(
"fitMass")->GetParameter(2)*1000;
1524 WidthDCALErr = fhMggDCAL->GetFunction(
"fitMass")->GetParError(2)*1000;
1525 Chi2NdfPi0DCAL = fhMggDCAL->GetFunction(
"fitMass")->GetChisquare()/fhMggDCAL->GetFunction(
"fitMass")->GetNDF();
1526 Npi0DCAL = fhMggDCAL->GetFunction(
"fitMass")->GetParameter(0)*fhMggDCAL->GetFunction(
"fitMass")->GetParameter(2)*TMath::Sqrt(2*TMath::Pi())/(Nevent*fhMggDCAL->GetBinWidth(10));
1527 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));
1529 NggDCAL = fhMggDCAL->GetFunction(
"fitMass")->Integral(0.11, 0.16)/(Nevent*fhMggDCAL->GetBinWidth(10));
1530 NggDCALErr = fhMggDCAL->GetFunction(
"fitMass")->IntegralError(0.11, 0.16)/(fhMggDCAL->Integral()*fhMggDCAL->GetBinWidth(10));
1531 SignifDCAL = Npi0DCAL/NggDCAL;
1532 SignifDCALErr = TMath::Sqrt((Npi0DCALErr/Npi0DCAL*(Npi0DCALErr/Npi0DCAL)+(NggDCALErr/NggDCAL*(NggDCALErr/NggDCAL))));
1533 SignifDCALErr = SignifDCAL*SignifDCALErr;
1536 cout<<
"******************"<<endl;
1540 NTClusters=fhE->IntegralAndError(fhE->GetXaxis()->FindBin(0.), fhE->GetXaxis()->FindBin(200.), NTClustersRMS);
1541 NCClusters=fhECharged->IntegralAndError(fhECharged->GetXaxis()->FindBin(0.), fhECharged->GetXaxis()->FindBin(50.), NCClustersRMS);
1544 NMatchClustersP = NCClusters/NTClusters;
1550 NMatchClustersPRMS = NMatchClustersP* TMath::Sqrt(TMath::Power(NCClustersRMS/NCClusters, 2)+TMath::Power(NTClustersRMS/NTClusters, 2));
1552 NMatchClustersPRMS=1;
1554 ClusterMean=fhNClusters->GetMean();
1555 ClusterRMS=fhNClusters->GetMeanError();
1556 CellMean=fhNCells->GetMean();
1557 CellRMS=fhNCells->GetMeanError();
1561 TString outfilename = QAPATH +
"Pi0InvMassEMCAL" + fTrigger(r) +
".pdf";
1562 TString outfilename2 = QAPATH +
"Pi0InvMassEMCAL" + fTrigger(r) +
".png";
1564 c2->SaveAs(outfilename);
1566 c2->SaveAs(outfilename2);
1568 outfilename = QAPATH +
"Pi0InvMassSM" + fTrigger(r) +
".pdf";
1569 outfilename2 = QAPATH +
"Pi0InvMassSM" + fTrigger(r) +
".png";
1571 c1->SaveAs(outfilename);
1573 c1->SaveAs(outfilename2);
1577 TString outfilename4 = QAPATH +
"Pi0InvMassDCAL" + fTrigger(r) +
".pdf";
1578 TString outfilename5= QAPATH +
"Pi0InvMassDCAL" + fTrigger(r) +
".png";
1580 c3->SaveAs(outfilename4);
1582 c3->SaveAs(outfilename5);
1586 fout->Cd(Form(
"%s/%s/%ld/%s/%s", period.Data(), pass.Data(), RunId,
"RunLevelQA", fTrigger.Data()));
1589 if(hTimeSM_BC0) c_TimeSM_BC0->Write();
1590 if(hTimeSM_BC1) c_TimeSM_BC1->Write();
1591 if(hTimeSM_BC2) c_TimeSM_BC2->Write();
1592 if(hTimeSM_BC3) c_TimeSM_BC3->Write();
1601 if(fhIMDCAL)
delete c3;
1602 if(hTimeSM_BC0)
delete c_TimeSM_BC0;
1603 if(hTimeSM_BC1)
delete c_TimeSM_BC1;
1604 if(hTimeSM_BC2)
delete c_TimeSM_BC2;
1605 if(hTimeSM_BC3)
delete c_TimeSM_BC3;
1606 if(outputList) outputList->Delete();
1608 QAData << RunId <<
" " << Nevent
1626 Error(__FUNCTION__, Form(
"The histogram with title \"%s\" was not found!", title));
1630 aHisto->SetStats(kFALSE);
1631 aHisto->SetTitle(title);
1632 aHisto->SetStats(kFALSE);
1633 aHisto->SetYTitle(YTitle);
1634 aHisto->GetYaxis()->SetTitleOffset(1.2);
1635 aHisto->GetYaxis()->SetLabelSize(0.03);
1636 aHisto->GetZaxis()->SetLabelSize(0.02);
1646 Error(__FUNCTION__, Form(
"The histogram with title \"%s\" was not found!", title));
1650 hTmpPerMod->SetStats(kFALSE);
1651 hTmpPerMod->SetTitle(title);
1652 hTmpPerMod->SetTitleSize(0.1);
1653 hTmpPerMod->GetXaxis()->SetTitleOffset(1.1);
1654 hTmpPerMod->GetXaxis()->SetTitleSize(0.05);
1655 hTmpPerMod->GetXaxis()->SetLabelSize(0.06);
1656 hTmpPerMod->GetYaxis()->SetTitleOffset(1.1);
1657 hTmpPerMod->GetYaxis()->SetTitleSize(0.05);
1658 hTmpPerMod->GetYaxis()->SetLabelSize(0.06);
1659 hTmpPerMod->GetZaxis()->SetLabelSize(0.04);
1675 int maxX = H->GetNbinsX();
1676 int New_minX = minX;
1677 int New_maxX = maxX;
1680 int maxY = H->GetNbinsY();
1681 int New_minY = minY;
1682 int New_maxY = maxY;
1684 if(opt.Contains(
"all")) opt =
TString(
"minx, maxx, miny, maxy");
1686 if(opt.Contains(
"maxx")){
1687 for(New_maxX = maxX;New_maxX >=minX; New_maxX--){
1689 for(
int i_y = maxY; i_y >= minY;i_y--){
1690 c = H->GetBinContent(New_maxX, i_y);
1699 if(opt.Contains(
"maxy")){
1700 for(New_maxY = maxY;New_maxY >=minY;New_maxY--){
1702 for(
int i_x=maxX; i_x>=minX;i_x--){
1703 c = H->GetBinContent(i_x, New_maxY );
1712 if(opt.Contains(
"minx")){
1713 for(New_minX = minX;New_minX <=maxX; New_minX++){
1715 for(
int i_y = minY; i_y <= maxY;i_y++){
1716 c = H->GetBinContent(New_minX, i_y);
1725 if(opt.Contains(
"miny")){
1726 for(New_minY = minY;New_minY <=maxY;New_minY++){
1728 for(
int i_x=minX; i_x<=maxX;i_x++){
1729 c = H->GetBinContent(i_x, New_minY );
1738 if(New_maxX!=-1 && New_maxY!=-1)
1739 H->GetXaxis()->SetRange(New_minX - shiftX, New_maxX + shiftX);
1740 if(New_maxX!=-1 && New_maxY!=-1)
1741 H->GetYaxis()->SetRange(New_minY - shiftY, New_maxY + shiftY);
1751 if(!fTrigger.Contains(
"QA")){
1758 if ( year == 2010 ) { nSMt=4; }
1759 else if( year == 2011 || year == 2012 ){ nSMt=10; }
1760 else if( year == 2013 || year == 2014 ){ nSMt=12; }
1764 Bool_t dirok = f->cd(direct);
1774 Error(__FUNCTION__, Form(
"No input directory %s, the number SMs will be returned based on the year!", direct.Data()));
1776 outputList = (
TList*)gDirectory->Get(direct);
1779 Error(__FUNCTION__,
"No input list, the number SMs will be returned based on the year! ");
1781 outputList->SetOwner();
1782 TH2F* hNSM =(
TH2F *)outputList->FindObject(
"EMCAL_hE_Mod");
1783 if(!hNSM || (!hNSM->GetEntries()))
1784 Error(__FUNCTION__,
"hNSM Histogram not found or it is empty, the number SMs will be returned based on the year!");
1786 nSMt = hNSM->GetYaxis()->GetBinUpEdge(hNSM->FindLastBinAbove(0, 2));
1790 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)
TFile * fout
input train file
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")