From f81e865d7b2fc028c298a75f374043acbf97df3b Mon Sep 17 00:00:00 2001 From: masera Date: Sun, 18 Mar 2012 10:15:29 +0000 Subject: [PATCH] Coverity + TPaveText added to histograms at creation time (PG Cerello) --- ITS/AliITSQASDDChecker.cxx | 112 ++++++++------------------------ ITS/AliITSQASDDChecker.h | 6 +- ITS/AliITSQASDDDataMakerRec.cxx | 59 ++++++++++++++--- 3 files changed, 80 insertions(+), 97 deletions(-) diff --git a/ITS/AliITSQASDDChecker.cxx b/ITS/AliITSQASDDChecker.cxx index 4424cb84d96..dbf8ad79a93 100644 --- a/ITS/AliITSQASDDChecker.cxx +++ b/ITS/AliITSQASDDChecker.cxx @@ -72,10 +72,6 @@ fImage(NULL), fHighSDDValue[ibit]=0.; } for(Int_t i=0;i(hdata)){ - hlayer[layer1]=(TH2*)((dynamic_cast(hdata))->Clone()); - hlayer[layer1]->SetName(Form("%s_copy",hname.Data())); - int modmay=hlayer[layer1]->GetNbinsY(); - TH1D* hproj= hlayer[layer1]->ProjectionY(); - Double_t ladcontent=0; - for(Int_t i=1;i<=modmay;i++) {//loop on the ladders - ladcontent=hproj->GetBinContent(i); - if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++; - else filledladders[layer1]++;}//end for - AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3 - delete hproj; - hproj=NULL; - }//end if htemp + TH2* htemp=dynamic_cast(hdata); + if(htemp){ + hlayer[layer1]=(TH2*)((dynamic_cast(hdata))->Clone()); + hlayer[layer1]->SetName(Form("%s_copy",hname.Data())); + int modmay=hlayer[layer1]->GetNbinsY(); + TH1D* hproj= hlayer[layer1]->ProjectionY(); + Double_t ladcontent=0; + for(Int_t i=1;i<=modmay;i++) {//loop on the ladders + ladcontent=hproj->GetBinContent(i); + if(AliITSQADataMakerRec::AreEqual(ladcontent,0.)) emptyladders[layer1]++; + else filledladders[layer1]++;}//end for + AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer1], filledladders[layer1]));//end else layer 3 + delete hproj; + hproj=NULL; + }//end if htemp }//end else entries !=0 }//end check on phiz @@ -527,24 +512,16 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l //TPaveText *pave[2]={0,0}; next.Begin(); - for(Int_t lay=0;lay<2; lay++) if(fPaveTextRaw[lay]) { delete fPaveTextRaw[lay]; fPaveTextRaw[lay] = NULL; } while( (hdata=dynamic_cast(next())) ) { if (hdata){ TString hname=hdata->GetName(); if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){ if(hname.Contains("NORM"))continue; //AliInfo("========================================Found histo 11\n"); - Int_t lay=0; - if(hname.Contains("3"))lay=0; - else if(hname.Contains("4"))lay=1; - fPaveTextRaw[lay]=new TPaveText(0.3,0.9,0.9,0.99,"NDC"); - //fPaveTextRaw[lay]->AddText(hname.Data()); - fPaveTextRaw[lay]->AddText(results1.Data()); - fPaveTextRaw[lay]->AddText(results2.Data()); - fPaveTextRaw[lay]->SetFillColor(color); - fPaveTextRaw[lay]->SetBorderSize(1); - fPaveTextRaw[lay]->SetLineWidth(1); - //hdata->GetListOfFunctions()->Add(pave[lay]); + TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave")); + ptext->Clear(); + ptext->AddText(results1.Data()); + ptext->AddText(results2.Data()); } else if(hname.Contains("SDDRawDataCheck")) { //AliInfo("========================================Found histo\n"); @@ -588,7 +565,6 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l ((TH1F*)hdata)->SetBinContent(42,emptyactivemoduleperlayer[1]); ((TH1F*)hdata)->SetBinContent(43,exactivedrperlayer[1]); ((TH1F*)hdata)->SetBinContent(44,emptyactivedrperlayer[1]); - //hdata->GetListOfFunctions()->Add(pave[0]); //break; } }//if hdata @@ -999,7 +975,6 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l //TPaveText *pave[2]={0,0}; next.Begin(); - for(Int_t lay=0;lay<2; lay++) if(fPaveTextRec[lay]) { delete fPaveTextRec[lay]; fPaveTextRec[lay] = NULL; } while( (hdata=dynamic_cast(next())) ) { @@ -1008,16 +983,10 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l if(hname.Contains("SDDModPatternL3RP") || hname.Contains("SDDModPatternL4RP")){ if(hname.Contains("NORM"))continue; //AliInfo("========================================Found histo 11\n"); - Int_t lay=0; - if(hname.Contains("3"))lay=0; - else if(hname.Contains("4"))lay=1; - fPaveTextRec[lay]=new TPaveText(0.3,0.88,0.9,0.99,"NDC"); - fPaveTextRec[lay]->AddText(results1.Data()); - fPaveTextRec[lay]->AddText(results2.Data()); - fPaveTextRec[lay]->SetFillColor(color); - fPaveTextRec[lay]->SetBorderSize(1); - fPaveTextRec[lay]->SetLineWidth(1); - //hdata->GetListOfFunctions()->Add(pave[lay]); + TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave")); + ptext->Clear(); + ptext->AddText(results1.Data()); + ptext->AddText(results2.Data()); } else if(hname.Contains("SDDRecPointCheck")) @@ -1351,28 +1320,14 @@ Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDE gPad->SetRightMargin(0.15); gPad->SetLeftMargin(0.05); hist->SetStats(0); - hist->SetOption("box") ; + hist->SetOption("colz") ; ////hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025); //gPad->Update(); } - if(hname.Contains("SDDphizL3")) hist->GetListOfFunctions()->Add(fPaveTextRaw[0]); - if(hname.Contains("SDDphizL4")) hist->GetListOfFunctions()->Add(fPaveTextRaw[1]); hist->DrawCopy(); fImage[esIndex]->cd(++npad) ; fImage[esIndex]->cd(npad)->SetBorderMode(0) ; - if(hname.Contains("SDDphizL3")) { - hist->GetListOfFunctions()->Clear(); - hist->GetListOfFunctions()->Delete(); - delete fPaveTextRaw[0]; - fPaveTextRaw[0] = NULL; - } - if(hname.Contains("SDDphizL4")) { - hist->GetListOfFunctions()->Clear(); - hist->GetListOfFunctions()->Delete(); - delete fPaveTextRaw[1]; - fPaveTextRaw[1] = NULL; - } } } fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; @@ -1443,29 +1398,16 @@ Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TAS gPad->SetRightMargin(0.15); gPad->SetLeftMargin(0.05); hist->SetStats(0); - hist->SetOption("box") ; + hist->SetOption("colz") ; //// TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette"); //paletta->SetLabelSize(0.025); //gPad->Update(); } - if(hname.Contains("SDDModPatternL3RP")) hist->GetListOfFunctions()->Add(fPaveTextRaw[0]); - if(hname.Contains("SDDModPatternL4RP")) hist->GetListOfFunctions()->Add(fPaveTextRaw[1]); + hist->DrawCopy(); fImage[esIndex]->cd(++npad) ; fImage[esIndex]->cd(npad)->SetBorderMode(0) ; - if(hname.Contains("SDDModPatternL3RP")) { - hist->GetListOfFunctions()->Clear(); - hist->GetListOfFunctions()->Delete(); - delete fPaveTextRec[0]; - fPaveTextRec[0] = NULL; - } - if(hname.Contains("SDDModPatternL4RP")) { - hist->GetListOfFunctions()->Clear(); - hist->GetListOfFunctions()->Delete(); - delete fPaveTextRec[1]; - fPaveTextRec[1] = NULL; - } - } + } } fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; } diff --git a/ITS/AliITSQASDDChecker.h b/ITS/AliITSQASDDChecker.h index f833dd848f4..30c9c92fdeb 100644 --- a/ITS/AliITSQASDDChecker.h +++ b/ITS/AliITSQASDDChecker.h @@ -69,16 +69,14 @@ public: TCanvas ** fImage ; //[AliRecoParam::kNSpecies] TPaveText * fPaveText[AliRecoParam::kNSpecies] ; //[AliRecoParam::kNSpecies] - TPaveText * fPaveTextRaw[2] ; // PaveText for Raw Data - TPaveText * fPaveTextRec[2] ; // PaveText for RecPoints Int_t fESforCheck; //eventspecie of the list to check static const Int_t fgknSDDmodules = 260; // number of SDD modules static const Int_t fgkmodoffset = 240; // number of SPD modules - ClassDef(AliITSQASDDChecker,7) // description + ClassDef(AliITSQASDDChecker,8) // description }; -#endif // AliITSQASDDChecker_H \ No newline at end of file +#endif // AliITSQASDDChecker_H diff --git a/ITS/AliITSQASDDDataMakerRec.cxx b/ITS/AliITSQASDDDataMakerRec.cxx index c94cb41594d..32a4f6e2e1a 100644 --- a/ITS/AliITSQASDDDataMakerRec.cxx +++ b/ITS/AliITSQASDDDataMakerRec.cxx @@ -32,6 +32,7 @@ #include #include #include +#include //#include // --- Standard library --- @@ -421,32 +422,58 @@ Int_t AliITSQASDDDataMakerRec::InitRaws() fSDDhRawsTask = 0; if(fkOnline){AliInfo("Book Online Histograms for SDD\n");} else {AliInfo("Book Offline Histograms for SDD\n ");} - TH1F *h0 = new TH1F("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5); //0 + + TPaveText *PaveText0=new TPaveText(0.3,0.88,0.9,0.99,"NDC"); + PaveText0->AddText(""); + PaveText0->SetFillColor(kMagenta+2); + PaveText0->SetTextColor(kWhite); + PaveText0->SetBorderSize(1); + PaveText0->SetLineWidth(1); + + TH1F *h0 = new TH1F("SDDModPattern","HW Modules pattern",fgknSDDmodules,239.5,499.5); //0 h0->GetXaxis()->SetTitle("Module Number"); h0->GetYaxis()->SetTitle("Counts"); h0->SetOption("bar1"); h0->SetBarOffset(0.01); h0->SetBarWidth(0.95); h0->SetFillColor(45); + h0->GetListOfFunctions()->Add(PaveText0); + rv = fAliITSQADataMakerRec->Add2RawsList(h0,0+offsRW, expert, !image, !saveCorr); fSDDhRawsTask++; - + + TPaveText *PaveText1=new TPaveText(0.3,0.88,0.9,0.99,"NDC"); + PaveText1->AddText(""); + PaveText1->SetFillColor(kMagenta+2); + PaveText1->SetTextColor(kWhite); + PaveText1->SetBorderSize(1); + PaveText1->SetLineWidth(1); + //zPhi distribution using ladder and modules numbers TH2F *hphil3 = new TH2F("SDDphizL3","SDD #varphiz Layer3 ",12,0.5,6.5,14,0.5,14.5);//1 hphil3->GetXaxis()->SetTitle("z[Module Number L3 ]"); hphil3->GetYaxis()->SetTitle("#varphi[ Ladder Number L3]"); hphil3->SetStats(0); + hphil3->GetListOfFunctions()->Add(PaveText1); rv = fAliITSQADataMakerRec->Add2RawsList(hphil3,1+offsRW, !expert, image, !saveCorr); fSDDhRawsTask++; - + + TPaveText *PaveText2=new TPaveText(0.3,0.88,0.9,0.99,"NDC"); + PaveText2->AddText(""); + PaveText2->SetFillColor(kMagenta+2); + PaveText2->SetTextColor(kWhite); + PaveText2->SetBorderSize(1); + PaveText2->SetLineWidth(1); + TH2F *hphil4 = new TH2F("SDDphizL4","SDD #varphiz Layer4 ",16,0.5,8.5,22,0.5,22.5); //2 hphil4->GetXaxis()->SetTitle("z[Module Number L4]"); hphil4->GetYaxis()->SetTitle("#varphi[Ladder Number L4]"); hphil4->SetStats(0); + hphil4->GetListOfFunctions()->Add(PaveText2); rv = fAliITSQADataMakerRec->Add2RawsList(hphil4,2+offsRW, !expert, image, !saveCorr); fSDDhRawsTask++; - - //normalized histograms + + //normalized histograms TH1F *h0norm = new TH1F("SDDModPatternNORM","NORM HW Modules pattern",fgknSDDmodules,239.5,499.5); //3 h0norm->GetXaxis()->SetTitle("Module Number"); h0norm->GetYaxis()->SetTitle("Counts"); @@ -910,16 +937,32 @@ Int_t AliITSQASDDDataMakerRec::InitRecPoints() rv = fAliITSQADataMakerRec->Add2RecPointsList(h6,6 +offsRP, expert, !image);// expert NO image fSDDhRecPointsTask++; - + TPaveText *PaveText7=new TPaveText(0.3,0.88,0.9,0.99,"NDC"); + PaveText7->AddText(""); + PaveText7->SetFillColor(kMagenta+2); + PaveText7->SetTextColor(kWhite); + PaveText7->SetBorderSize(1); + PaveText7->SetLineWidth(1); + + TH2F *h7 = new TH2F("SDDModPatternL3RP","Modules pattern L3 RP",12,0.5,6.5,14,0.5,14.5); //position number 7 h7->GetXaxis()->SetTitle("z[#Module L3 ]"); h7->GetYaxis()->SetTitle("#varphi[#Ladder L3]"); + h7->GetListOfFunctions()->Add(PaveText7); rv = fAliITSQADataMakerRec->Add2RecPointsList(h7,7 +offsRP, !expert, image);// expert NO image fSDDhRecPointsTask++; - TH2F *h8 = new TH2F("SDDModPatternL4RP","Modules pattern L4 RP",16,0.5,8.5,22,0.5,22.5); //position number 8 + TPaveText *PaveText8=new TPaveText(0.3,0.88,0.9,0.99,"NDC"); + PaveText8->AddText(""); + PaveText8->SetFillColor(kMagenta+2); + PaveText8->SetTextColor(kWhite); + PaveText8->SetBorderSize(1); + PaveText8->SetLineWidth(1); + + TH2F *h8 = new TH2F("SDDModPatternL4RP","Modules pattern L4 RP",16,0.5,8.5,22,0.5,22.5); //position number 8 h8->GetXaxis()->SetTitle("[#Module L3 ]"); h8->GetYaxis()->SetTitle("#varphi[#Ladder L4]"); + h8->GetListOfFunctions()->Add(PaveText8); rv = fAliITSQADataMakerRec->Add2RecPointsList(h8,8 +offsRP, !expert, image);// expert NO image fSDDhRecPointsTask++; @@ -1411,4 +1454,4 @@ Int_t AliITSQASDDDataMakerRec::GetNumberOfEvents(AliQAv1::TASKINDEX_t task, Int_ { //return the number of the processed events for a given task and trigger class (-1 for all) return fAliITSQADataMakerRec->GetEvCountTotal(task, trigCl); -} +} \ No newline at end of file -- 2.43.0