X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=TPC%2FAliTPCCalibViewer.cxx;h=ee3cb3087adf1931a5fe8c3b1d36885bd3cffb75;hb=456126adc89cfdcdf696dbd7847230bf2ee41ac7;hp=d6c2279a499c029fe0c9fdb90f164d489cb549b6;hpb=ac7becc3ca631b5df6e2cb542dd035a516e55a90;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCCalibViewer.cxx b/TPC/AliTPCCalibViewer.cxx index d6c2279a499..ee3cb3087ad 100644 --- a/TPC/AliTPCCalibViewer.cxx +++ b/TPC/AliTPCCalibViewer.cxx @@ -36,33 +36,34 @@ // // ROOT includes // -#include + #include -#include -#include -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include +//#include #include #include -#include +#include +#include +#include #include -#include "TTreeStream.h" -#include "TFile.h" -#include "TKey.h" -#include "TGraph.h" -#include "TDirectory.h" -#include "AliTPCCalibPulser.h" -#include "AliTPCCalibPedestal.h" -#include "AliTPCCalibCE.h" -#include "TFriendElement.h" -// #include "TObjArray.h" -// #include "TObjString.h" -// #include "TString.h" -// #include "AliTPCCalPad.h" +//#include +#include +#include +#include +#include +#include "AliTPCCalibCE.h" +#include "AliMathBase.h" +#include "AliTPCCalPad.h" +#include "AliTPCCalROC.h" +#include "AliTPCCalibPedestal.h" +#include "AliTPCCalibPulser.h" // // AliRoot includes @@ -110,7 +111,7 @@ AliTPCCalibViewer::AliTPCCalibViewer(const AliTPCCalibViewer &c) } //_____________________________________________________________________________ -AliTPCCalibViewer::AliTPCCalibViewer(TTree* tree) +AliTPCCalibViewer::AliTPCCalibViewer(TTree *const tree) :TObject(), fTree(0), fFile(0), @@ -130,7 +131,7 @@ AliTPCCalibViewer::AliTPCCalibViewer(TTree* tree) } //_____________________________________________________________________________ -AliTPCCalibViewer::AliTPCCalibViewer(char* fileName, char* treeName) +AliTPCCalibViewer::AliTPCCalibViewer(const char* fileName, const char* treeName) :TObject(), fTree(0), fFile(0), @@ -211,7 +212,7 @@ void AliTPCCalibViewer::Delete(Option_t* option) { } -const char* AliTPCCalibViewer::AddAbbreviations(char* c, Bool_t printDrawCommand){ +const char* AliTPCCalibViewer::AddAbbreviations(const Char_t *c, Bool_t printDrawCommand){ // Replace all "" with "" (Adds forgotten "~") // but take care on the statistical information, like "CEQmean_Mean" // and also take care on correct given variables, like "CEQmean~" @@ -304,8 +305,10 @@ const char* AliTPCCalibViewer::AddAbbreviations(char* c, Bool_t printDrawCommand str.ReplaceAll(removeString, ""); if (printDrawCommand) std::cout << "The string looks now like: " << str.Data() << std::endl; - delete varSort; - delete normSort; + delete [] varLengths; + delete [] normLengths; + delete [] varSort; + delete [] normSort; return str.Data(); } @@ -417,9 +420,7 @@ Int_t AliTPCCalibViewer::EasyDraw(const char* drawCommand, Int_t sector, const c // writeDrawCommand: write the command, that is passed to TTree::Draw // if (sector >= 0 && sector < 72) { - char sectorChr[3]; - sprintf(sectorChr, "%i", sector); - return EasyDraw(drawCommand, sectorChr, cuts, drawOptions, writeDrawCommand); + return EasyDraw(drawCommand, Form("%i", sector), cuts, drawOptions, writeDrawCommand); } Error("EasyDraw","The TPC contains only sectors between 0 and 71."); return -1; @@ -500,9 +501,7 @@ Int_t AliTPCCalibViewer::EasyDraw1D(const char* drawCommand, Int_t sector, const // if (sector >= 0 && sector < 72) { - char sectorChr[3]; - sprintf(sectorChr, "%i", sector); - return EasyDraw1D(drawCommand, sectorChr, cuts, drawOptions, writeDrawCommand); + return EasyDraw1D(drawCommand, Form("%i",sector), cuts, drawOptions, writeDrawCommand); } Error("EasyDraw","The TPC contains only sectors between 0 and 71."); return -1; @@ -550,9 +549,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, Int_t sector, con // "plotMean", "plotMedian" and "plotLTM": what kind of lines do you want to see? // if (sector >= 0 && sector < 72) { - char sectorChr[3]; - sprintf(sectorChr, "%i", sector); - return DrawHisto1D(drawCommand, sectorChr, cuts, sigmas, plotMean, plotMedian, plotLTM); + return DrawHisto1D(drawCommand, Form("%i", sector), cuts, sigmas, plotMean, plotMedian, plotLTM); } Error("DrawHisto1D","The TPC contains only sectors between 0 and 71."); return -1; @@ -596,9 +593,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, const char* secto Double_t sigma = TMath::RMS(entries, values); Double_t maxY = htemp->GetMaximum(); - char c[500]; TLegend * legend = new TLegend(.7,.7, .99, .99, "Statistical information"); -// sprintf(c, "%s, sector: %i", type, sector); //fListOfObjectsToBeDeleted->Add(legend); if (plotMean) { @@ -609,8 +604,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, const char* secto line->SetLineWidth(2); line->SetLineStyle(1); line->Draw(); - sprintf(c, "Mean: %f", mean); - legend->AddEntry(line, c, "l"); + legend->AddEntry(line, Form("Mean: %f", mean), "l"); // draw sigma lines for (Int_t i = 0; i < nsigma.GetNoElements(); i++) { TLine* linePlusSigma = new TLine(mean + nsigma[i] * sigma, 0, mean + nsigma[i] * sigma, maxY); @@ -623,8 +617,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, const char* secto lineMinusSigma->SetLineColor(kRed); lineMinusSigma->SetLineStyle(2 + i); lineMinusSigma->Draw(); - sprintf(c, "%i #sigma = %f",(Int_t)(nsigma[i]), (Float_t)(nsigma[i] * sigma)); - legend->AddEntry(lineMinusSigma, c, "l"); + legend->AddEntry(lineMinusSigma, Form("%i #sigma = %f",(Int_t)(nsigma[i]), (Float_t)(nsigma[i] * sigma)), "l"); } } if (plotMedian) { @@ -635,8 +628,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, const char* secto line->SetLineWidth(2); line->SetLineStyle(1); line->Draw(); - sprintf(c, "Median: %f", median); - legend->AddEntry(line, c, "l"); + legend->AddEntry(line, Form("Median: %f", median), "l"); // draw sigma lines for (Int_t i = 0; i < nsigma.GetNoElements(); i++) { TLine* linePlusSigma = new TLine(median + nsigma[i] * sigma, 0, median + nsigma[i]*sigma, maxY); @@ -649,8 +641,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, const char* secto lineMinusSigma->SetLineColor(kBlue); lineMinusSigma->SetLineStyle(2 + i); lineMinusSigma->Draw(); - sprintf(c, "%i #sigma = %f",(Int_t)(nsigma[i]), (Float_t)(nsigma[i] * sigma)); - legend->AddEntry(lineMinusSigma, c, "l"); + legend->AddEntry(lineMinusSigma, Form("%i #sigma = %f",(Int_t)(nsigma[i]), (Float_t)(nsigma[i] * sigma)), "l"); } } if (plotLTM) { @@ -663,8 +654,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, const char* secto line->SetLineWidth(2); line->SetLineStyle(1); line->Draw(); - sprintf(c, "LTM: %f", ltm); - legend->AddEntry(line, c, "l"); + legend->AddEntry(line, Form("LTM: %f", ltm), "l"); // draw sigma lines for (Int_t i = 0; i < nsigma.GetNoElements(); i++) { TLine* linePlusSigma = new TLine(ltm + nsigma[i] * ltmRms, 0, ltm + nsigma[i] * ltmRms, maxY); @@ -678,8 +668,7 @@ Int_t AliTPCCalibViewer::DrawHisto1D(const char* drawCommand, const char* secto lineMinusSigma->SetLineColor(kGreen+2); lineMinusSigma->SetLineStyle(2+i); lineMinusSigma->Draw(); - sprintf(c, "%i #sigma = %f", (Int_t)(nsigma[i]), (Float_t)(nsigma[i] * ltmRms)); - legend->AddEntry(lineMinusSigma, c, "l"); + legend->AddEntry(lineMinusSigma, Form("%i #sigma = %f", (Int_t)(nsigma[i]), (Float_t)(nsigma[i] * ltmRms)), "l"); } } if (!plotMean && !plotMedian && !plotLTM) return -1; @@ -698,7 +687,7 @@ Int_t AliTPCCalibViewer::SigmaCut(const char* drawCommand, Int_t sector, const c // sigmaMax: up to which sigma around the mean/median/LTM the histogram is generated (in units of sigma, Begin_Latex t #sigma End_Latex) // sigmaStep: the binsize of the generated histogram // Begin_Latex - // f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #frac{#int_{#mu}^{#mu + t #sigma} f(x, #mu, #sigma) dx + #int_{#mu}^{#mu - t #sigma} f(x, #mu, #sigma) dx }{ #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx } + // f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = (#int_{#mu}^{#mu + t #sigma} f(x, #mu, #sigma) dx + #int_{#mu}^{#mu - t #sigma} f(x, #mu, #sigma) dx) / (#int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx) // End_Latex // // @@ -710,9 +699,7 @@ Int_t AliTPCCalibViewer::SigmaCut(const char* drawCommand, Int_t sector, const c // plotMean/plotMedian/plotLTM: specifies where to put the center // if (sector >= 0 && sector < 72) { - char sectorChr[3]; - sprintf(sectorChr, "%i", sector); - return SigmaCut(drawCommand, sectorChr, cuts, sigmaMax, plotMean, plotMedian, plotLTM, pm, sigmas, sigmaStep); + return SigmaCut(drawCommand, Form("%i", sector), cuts, sigmaMax, plotMean, plotMedian, plotLTM, pm, sigmas, sigmaStep); } Error("SigmaCut","The TPC contains only sectors between 0 and 71."); return -1; @@ -795,7 +782,7 @@ Int_t AliTPCCalibViewer::SigmaCut(const char* drawCommand, const char* sector, c cutHistoLTM->SetLineColor(kGreen+2); legend->AddEntry(cutHistoLTM, "LTM", "l"); cutHistoLTM->SetTitle(Form("%s, cumulative; Multiples of #sigma; Fraction of included data", htemp->GetTitle())); - if (plotMean && cutHistoMean || plotMedian && cutHistoMedian) cutHistoLTM->Draw("same"); + if ((plotMean && cutHistoMean) || (plotMedian && cutHistoMedian)) cutHistoLTM->Draw("same"); else cutHistoLTM->Draw(); DrawLines(cutHistoLTM, nsigma, legend, kGreen+2, pm); } @@ -867,6 +854,9 @@ Int_t AliTPCCalibViewer::SigmaCutNew(const char* drawCommand, const char* sector DrawLines(cutGraphMean, nsigma, legend, kRed, kTRUE); } } + delete [] index; + delete [] xarray; + delete [] yarray; /* if (plotMedian) { cutHistoMedian = AliTPCCalibViewer::SigmaCut(htemp, median, sigma, sigmaMax, sigmaStep, pm); @@ -909,13 +899,11 @@ Int_t AliTPCCalibViewer::Integrate(const char* drawCommand, Int_t sector, // "sigmaStep": the binsize of the generated histogram, -1 means, that the maximal reasonable stepsize is used // The actual work is done on the array. /* Begin_Latex - f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #frac{#int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx}{ #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx } + f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx / #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx End_Latex */ if (sector >= 0 && sector < 72) { - char sectorChr[3]; - sprintf(sectorChr, "%i", sector); - return Integrate(drawCommand, sectorChr, cuts, sigmaMax, plotMean, plotMedian, plotLTM, sigmas, sigmaStep); + return Integrate(drawCommand, Form("%i", sector), cuts, sigmaMax, plotMean, plotMedian, plotLTM, sigmas, sigmaStep); } Error("Integrate","The TPC contains only sectors between 0 and 71."); return -1; @@ -932,7 +920,7 @@ Int_t AliTPCCalibViewer::IntegrateOld(const char* drawCommand, const char* secto // "sigmaStep": the binsize of the generated histogram, -1 means, that the maximal reasonable stepsize is used // The actual work is done on the array. /* Begin_Latex - f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #frac{#int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx}{ #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx } + f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx / #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx End_Latex */ @@ -996,7 +984,7 @@ Int_t AliTPCCalibViewer::IntegrateOld(const char* drawCommand, const char* secto integralHistoLTM->SetLineColor(kGreen+2); legend->AddEntry(integralHistoLTM, "LTM", "l"); integralHistoLTM->SetTitle(Form("%s, integrated; Multiples of #sigma; Fraction of included data", htemp->GetTitle())); - if (plotMean && integralHistoMean || plotMedian && integralHistoMedian) integralHistoLTM->Draw("same"); + if ((plotMean && integralHistoMean) || (plotMedian && integralHistoMedian)) integralHistoLTM->Draw("same"); else integralHistoLTM->Draw(); DrawLines(integralHistoLTM, nsigma, legend, kGreen+2, kTRUE); } @@ -1016,7 +1004,7 @@ Int_t AliTPCCalibViewer::Integrate(const char* drawCommand, const char* sector, // "sigmaStep": the binsize of the generated histogram, -1 means, that the maximal reasonable stepsize is used // The actual work is done on the array. /* Begin_Latex - f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #frac{#int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx}{ #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx } + f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx / #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx End_Latex */ @@ -1104,11 +1092,15 @@ Int_t AliTPCCalibViewer::Integrate(const char* drawCommand, const char* sector, integralGraphLTM->SetLineColor(kGreen+2); legend->AddEntry(integralGraphLTM, "LTM", "l"); integralGraphLTM->SetTitle(Form("%s, integrated; Multiples of #sigma; Fraction of included data", htemp->GetTitle())); - if (plotMean && integralGraphMean || plotMedian && integralGraphMedian) integralGraphLTM->Draw("samelu"); + if ((plotMean && integralGraphMean) || (plotMedian && integralGraphMedian)) integralGraphLTM->Draw("samelu"); else integralGraphLTM->Draw("alu"); DrawLines(integralGraphLTM, nsigma, legend, kGreen+2, kTRUE); } } + delete [] index; + delete [] xarray; + delete [] yarray; + if (!plotMean && !plotMedian && !plotLTM) return -1; legend->Draw(); return entries; @@ -1122,7 +1114,6 @@ void AliTPCCalibViewer::DrawLines(TH1F *histogram, TVectorF nsigma, TLegend *leg // // start to draw the lines, loop over requested sigmas - char c[500]; for (Int_t i = 0; i < nsigma.GetNoElements(); i++) { if (!pm) { Int_t bin = histogram->GetXaxis()->FindBin(nsigma[i]); @@ -1136,8 +1127,7 @@ void AliTPCCalibViewer::DrawLines(TH1F *histogram, TVectorF nsigma, TLegend *leg lineLeft->SetLineColor(color); lineLeft->SetLineStyle(2 + i); lineLeft->Draw(); - sprintf(c, "Fraction(%f #sigma) = %f",nsigma[i], histogram->GetBinContent(bin)); - legend->AddEntry(lineLeft, c, "l"); + legend->AddEntry(lineLeft, Form("Fraction(%f #sigma) = %f",nsigma[i], histogram->GetBinContent(bin)), "l"); } else { // if (pm) Int_t bin = histogram->GetXaxis()->FindBin(nsigma[i]); @@ -1151,8 +1141,7 @@ void AliTPCCalibViewer::DrawLines(TH1F *histogram, TVectorF nsigma, TLegend *leg lineLeft1->SetLineColor(color); lineLeft1->SetLineStyle(2 + i); lineLeft1->Draw(); - sprintf(c, "Fraction(+%f #sigma) = %f",nsigma[i], histogram->GetBinContent(bin)); - legend->AddEntry(lineLeft1, c, "l"); + legend->AddEntry(lineLeft1, Form("Fraction(+%f #sigma) = %f",nsigma[i], histogram->GetBinContent(bin)), "l"); bin = histogram->GetXaxis()->FindBin(-nsigma[i]); TLine* lineUp2 = new TLine(-nsigma[i], 0, -nsigma[i], histogram->GetBinContent(bin)); //fListOfObjectsToBeDeleted->Add(lineUp2); @@ -1164,8 +1153,7 @@ void AliTPCCalibViewer::DrawLines(TH1F *histogram, TVectorF nsigma, TLegend *leg lineLeft2->SetLineColor(color); lineLeft2->SetLineStyle(2 + i); lineLeft2->Draw(); - sprintf(c, "Fraction(-%f #sigma) = %f",nsigma[i], histogram->GetBinContent(bin)); - legend->AddEntry(lineLeft2, c, "l"); + legend->AddEntry(lineLeft2, Form("Fraction(-%f #sigma) = %f",nsigma[i], histogram->GetBinContent(bin)), "l"); } } // for (Int_t i = 0; i < nsigma.GetNoElements(); i++) } @@ -1178,7 +1166,6 @@ void AliTPCCalibViewer::DrawLines(TGraph *graph, TVectorF nsigma, TLegend *legen // // start to draw the lines, loop over requested sigmas - char c[500]; for (Int_t i = 0; i < nsigma.GetNoElements(); i++) { if (!pm) { TLine* lineUp = new TLine(nsigma[i], 0, nsigma[i], graph->Eval(nsigma[i])); @@ -1191,8 +1178,7 @@ void AliTPCCalibViewer::DrawLines(TGraph *graph, TVectorF nsigma, TLegend *legen lineLeft->SetLineColor(color); lineLeft->SetLineStyle(2 + i); lineLeft->Draw(); - sprintf(c, "Fraction(%f #sigma) = %f",nsigma[i], graph->Eval(nsigma[i])); - legend->AddEntry(lineLeft, c, "l"); + legend->AddEntry(lineLeft, Form("Fraction(%f #sigma) = %f",nsigma[i], graph->Eval(nsigma[i])), "l"); } else { // if (pm) TLine* lineUp1 = new TLine(nsigma[i], 0, nsigma[i], graph->Eval(nsigma[i])); @@ -1205,8 +1191,7 @@ void AliTPCCalibViewer::DrawLines(TGraph *graph, TVectorF nsigma, TLegend *legen lineLeft1->SetLineColor(color); lineLeft1->SetLineStyle(2 + i); lineLeft1->Draw(); - sprintf(c, "Fraction(+%f #sigma) = %f",nsigma[i], graph->Eval(nsigma[i])); - legend->AddEntry(lineLeft1, c, "l"); + legend->AddEntry(lineLeft1, Form("Fraction(+%f #sigma) = %f",nsigma[i], graph->Eval(nsigma[i])), "l"); TLine* lineUp2 = new TLine(-nsigma[i], 0, -nsigma[i], graph->Eval(-nsigma[i])); //fListOfObjectsToBeDeleted->Add(lineUp2); lineUp2->SetLineColor(color); @@ -1217,8 +1202,7 @@ void AliTPCCalibViewer::DrawLines(TGraph *graph, TVectorF nsigma, TLegend *legen lineLeft2->SetLineColor(color); lineLeft2->SetLineStyle(2 + i); lineLeft2->Draw(); - sprintf(c, "Fraction(-%f #sigma) = %f",nsigma[i], graph->Eval(-nsigma[i])); - legend->AddEntry(lineLeft2, c, "l"); + legend->AddEntry(lineLeft2, Form("Fraction(-%f #sigma) = %f",nsigma[i], graph->Eval(-nsigma[i])), "l"); } } // for (Int_t i = 0; i < nsigma.GetNoElements(); i++) } @@ -1250,7 +1234,7 @@ Int_t AliTPCCalibViewer::GetBin(Float_t value, Int_t nbins, Double_t binLow, Dou } -Double_t AliTPCCalibViewer::GetLTM(Int_t n, Double_t *array, Double_t *sigma, Double_t fraction){ +Double_t AliTPCCalibViewer::GetLTM(Int_t n, const Double_t *const array, Double_t *const sigma, Double_t fraction){ // // returns the LTM and sigma // @@ -1269,7 +1253,7 @@ Double_t AliTPCCalibViewer::GetLTM(Int_t n, Double_t *array, Double_t *sigma, Do } -TH1F* AliTPCCalibViewer::SigmaCut(TH1F *histogram, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep, Bool_t pm) { +TH1F* AliTPCCalibViewer::SigmaCut(TH1F *const histogram, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep, Bool_t pm) { // // Creates a cumulative histogram Begin_Latex S(t, #mu, #sigma) End_Latex, where you can see, how much of the data are inside sigma-intervals around the mean value // The data of the distribution Begin_Latex f(x, #mu, #sigma) End_Latex are given in 'histogram' @@ -1279,22 +1263,22 @@ TH1F* AliTPCCalibViewer::SigmaCut(TH1F *histogram, Float_t mean, Float_t sigma, // pm: Decide weather Begin_Latex t > 0 End_Latex (first case) or Begin_Latex t End_Latex arbitrary (secound case) // The actual work is done on the array. /* Begin_Latex - f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #frac{#int_{#mu}^{#mu + t #sigma} f(x, #mu, #sigma) dx + #int_{#mu}^{#mu - t #sigma} f(x, #mu, #sigma) dx }{ #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx } , for t > 0 + f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = (#int_{#mu}^{#mu + t #sigma} f(x, #mu, #sigma) dx + #int_{#mu}^{#mu - t #sigma} f(x, #mu, #sigma) dx) / (#int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx), for t > 0 or - f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #frac{#int_{#mu}^{#mu + t #sigma} f(x, #mu, #sigma) dx}{ #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx } + f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #int_{#mu}^{#mu + t #sigma} f(x, #mu, #sigma) dx / #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx End_Latex - begin_macro(source) + Begin_Macro(source) { Float_t mean = 0; Float_t sigma = 1.5; Float_t sigmaMax = 4; gROOT->SetStyle("Plain"); - TH1F *distribution = new TH1F("Distribution1", "Distribution f(x, #mu, #sigma)", 1000,-5,5); + TH1F *distribution = new TH1F("Distrib1", "Distribution f(x, #mu, #sigma)", 1000,-5,5); TRandom rand(23); for (Int_t i = 0; i <50000;i++) distribution->Fill(rand.Gaus(mean, sigma)); Float_t *ar = distribution->GetArray(); - TCanvas* macro_example_canvas = new TCanvas("macro_example_canvas_SigmaCut", "", 350, 350); + TCanvas* macro_example_canvas = new TCanvas("cAliTPCCalibViewer1", "", 350, 350); macro_example_canvas->Divide(0,3); TVirtualPad *pad1 = macro_example_canvas->cd(1); pad1->SetGridy(); @@ -1314,7 +1298,7 @@ TH1F* AliTPCCalibViewer::SigmaCut(TH1F *histogram, Float_t mean, Float_t sigma, shistPM->Draw(); return macro_example_canvas; } - end_macro + End_Macro */ Float_t *array = histogram->GetArray(); @@ -1325,7 +1309,7 @@ TH1F* AliTPCCalibViewer::SigmaCut(TH1F *histogram, Float_t mean, Float_t sigma, } -TH1F* AliTPCCalibViewer::SigmaCut(Int_t n, Float_t *array, Float_t mean, Float_t sigma, Int_t nbins, Float_t binLow, Float_t binUp, Float_t sigmaMax, Float_t sigmaStep, Bool_t pm){ +TH1F* AliTPCCalibViewer::SigmaCut(Int_t n, const Float_t *array, Float_t mean, Float_t sigma, Int_t nbins, Float_t binLow, Float_t binUp, Float_t sigmaMax, Float_t sigmaStep, Bool_t pm){ // // Creates a histogram Begin_Latex S(t, #mu, #sigma) End_Latex, where you can see, how much of the data are inside sigma-intervals around the mean value // The data of the distribution Begin_Latex f(x, #mu, #sigma) End_Latex are given in 'array', 'n' specifies the length of the array @@ -1398,7 +1382,7 @@ TH1F* AliTPCCalibViewer::SigmaCut(Int_t n, Float_t *array, Float_t mean, Float_t } -TH1F* AliTPCCalibViewer::SigmaCut(Int_t n, Double_t *array, Double_t mean, Double_t sigma, Int_t nbins, Double_t *xbins, Double_t sigmaMax){ +TH1F* AliTPCCalibViewer::SigmaCut(Int_t n, const Double_t *array, Double_t mean, Double_t sigma, Int_t nbins, const Double_t *xbins, Double_t sigmaMax){ // // SigmaCut for variable binsize // NOT YET IMPLEMENTED !!! @@ -1417,7 +1401,7 @@ TH1F* AliTPCCalibViewer::SigmaCut(Int_t n, Double_t *array, Double_t mean, Doubl } -TH1F* AliTPCCalibViewer::Integrate(TH1F *histogram, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep){ +TH1F* AliTPCCalibViewer::Integrate(TH1F *const histogram, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep){ // // Creates an integrated histogram Begin_Latex S(t, #mu, #sigma) End_Latex, out of the input distribution distribution Begin_Latex f(x, #mu, #sigma) End_Latex, given in "histogram" // "mean" and "sigma" are Begin_Latex #mu End_Latex and Begin_Latex #sigma End_Latex of the distribution in "histogram", to be specified by the user @@ -1426,20 +1410,20 @@ TH1F* AliTPCCalibViewer::Integrate(TH1F *histogram, Float_t mean, Float_t sigma, // "sigmaStep": the binsize of the generated histogram, -1 means, that the maximal reasonable stepsize is used // The actual work is done on the array. /* Begin_Latex - f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #frac{#int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx}{ #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx } + f(x, #mu, #sigma) #Rightarrow S(t, #mu, #sigma) = #int_{-#infty}^{#mu + t #sigma} f(x, #mu, #sigma) dx / #int_{-#infty}^{+#infty} f(x, #mu, #sigma) dx End_Latex - begin_macro(source) + Begin_Macro(source) { Float_t mean = 0; Float_t sigma = 1.5; Float_t sigmaMax = 4; gROOT->SetStyle("Plain"); - TH1F *distribution = new TH1F("Distribution2", "Distribution f(x, #mu, #sigma)", 1000,-5,5); + TH1F *distribution = new TH1F("Distrib2", "Distribution f(x, #mu, #sigma)", 1000,-5,5); TRandom rand(23); for (Int_t i = 0; i <50000;i++) distribution->Fill(rand.Gaus(mean, sigma)); Float_t *ar = distribution->GetArray(); - TCanvas* macro_example_canvas = new TCanvas("macro_example_canvas_Integrate", "", 350, 350); + TCanvas* macro_example_canvas = new TCanvas("cAliTPCCalibViewer2", "", 350, 350); macro_example_canvas->Divide(0,2); TVirtualPad *pad1 = macro_example_canvas->cd(1); pad1->SetGridy(); @@ -1454,7 +1438,7 @@ TH1F* AliTPCCalibViewer::Integrate(TH1F *histogram, Float_t mean, Float_t sigma, return macro_example_canvas_Integrate; } - end_macro + End_Macro */ @@ -1466,7 +1450,7 @@ TH1F* AliTPCCalibViewer::Integrate(TH1F *histogram, Float_t mean, Float_t sigma, } -TH1F* AliTPCCalibViewer::Integrate(Int_t n, Float_t *array, Int_t nbins, Float_t binLow, Float_t binUp, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep){ +TH1F* AliTPCCalibViewer::Integrate(Int_t n, const Float_t *const array, Int_t nbins, Float_t binLow, Float_t binUp, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep){ // Creates an integrated histogram Begin_Latex S(t, #mu, #sigma) End_Latex, out of the input distribution distribution Begin_Latex f(x, #mu, #sigma) End_Latex, given in "histogram" // "mean" and "sigma" are Begin_Latex #mu End_Latex and Begin_Latex #sigma End_Latex of the distribution in "histogram", to be specified by the user // sigmaMax: up to which sigma around the mean/median/LTM you want to integrate @@ -1535,7 +1519,7 @@ TH1F* AliTPCCalibViewer::Integrate(Int_t n, Float_t *array, Int_t nbins, Float_t //_____________________________________________________________________________ -AliTPCCalPad* AliTPCCalibViewer::GetCalPadOld(const char* desiredData, char* cuts, char* calPadName) const { +AliTPCCalPad* AliTPCCalibViewer::GetCalPadOld(const char* desiredData, const char* cuts, const char* calPadName) const { // // creates a AliTPCCalPad out of the 'desiredData' // the functionality of EasyDraw1D is used @@ -1561,7 +1545,7 @@ AliTPCCalPad* AliTPCCalibViewer::GetCalPadOld(const char* desiredData, char* cut //_____________________________________________________________________________ -AliTPCCalPad* AliTPCCalibViewer::GetCalPad(const char* desiredData, char* cuts, char* calPadName) const { +AliTPCCalPad* AliTPCCalibViewer::GetCalPad(const char* desiredData, const char* cuts, const char* calPadName) const { // // creates a AliTPCCalPad out of the 'desiredData' // the functionality of EasyDraw1D is used @@ -1594,7 +1578,7 @@ AliTPCCalPad* AliTPCCalibViewer::GetCalPad(const char* desiredData, char* cuts, } //_____________________________________________________________________________ -AliTPCCalROC* AliTPCCalibViewer::GetCalROC(const char* desiredData, UInt_t sector, char* cuts) const { +AliTPCCalROC* AliTPCCalibViewer::GetCalROC(const char* desiredData, UInt_t sector, const char* cuts) const { // // creates a AliTPCCalROC out of the desiredData // the functionality of EasyDraw1D is used @@ -1789,7 +1773,10 @@ TString* AliTPCCalibViewer::Fit(const char* drawCommand, const char* formula, co if (i < dim) centries = fTree->Draw(((TObjString*)formulaTokens->At(i))->GetName(), cutStr.Data(), "goff"); else centries = fTree->Draw(drawStr.Data(), cutStr.Data(), "goff"); - if (entries != centries) return new TString("An ERROR has occured during fitting!"); + if (entries != centries) { + delete [] values; + return new TString("An ERROR has occured during fitting!"); + } values[i] = new Double_t[entries]; memcpy(values[i], fTree->GetV1(), entries*sizeof(Double_t)); } @@ -1805,23 +1792,26 @@ TString* AliTPCCalibViewer::Fit(const char* drawCommand, const char* formula, co fitter->GetParameters(fitParam); fitter->GetCovarianceMatrix(covMatrix); chi2 = fitter->GetChisquare(); - chi2 = chi2; +// chi2 = chi2; - TString *preturnFormula = new TString(Form("( %f+",fitParam[0])), &returnFormula = *preturnFormula; + TString *preturnFormula = new TString(Form("( %e+",fitParam[0])), &returnFormula = *preturnFormula; for (Int_t iparam = 0; iparam < dim; iparam++) { - returnFormula.Append(Form("%s*(%f)",((TObjString*)formulaTokens->At(iparam))->GetName(),fitParam[iparam+1])); + returnFormula.Append(Form("%s*(%e)",((TObjString*)formulaTokens->At(iparam))->GetName(),fitParam[iparam+1])); if (iparam < dim-1) returnFormula.Append("+"); } returnFormula.Append(" )"); delete formulaTokens; delete fitter; - delete[] values; + for (Int_t i = 0; i < dim + 1; i++){ + delete [] values[i]; + } + delete [] values; return preturnFormula; } -void AliTPCCalibViewer::MakeTreeWithObjects(const char * fileName, TObjArray * array, const char * mapFileName) { +void AliTPCCalibViewer::MakeTreeWithObjects(const char *fileName, const TObjArray *const array, const char * mapFileName) { // // Write tree with all available information // im mapFileName is speciefied, the Map information are also written to the tree @@ -1970,7 +1960,7 @@ void AliTPCCalibViewer::MakeTreeWithObjects(const char * fileName, TObjArray * a } -void AliTPCCalibViewer::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad* outlierPad, Float_t ltmFraction) { +void AliTPCCalibViewer::MakeTree(const char * fileName, TObjArray * array, const char * mapFileName, AliTPCCalPad *const outlierPad, Float_t ltmFraction) { // // Write a tree with all available information // if mapFileName is speciefied, the Map information are also written to the tree @@ -1983,206 +1973,228 @@ void AliTPCCalibViewer::MakeTree(const char * fileName, TObjArray * array, const // // The tree out of this function is the basis for the AliTPCCalibViewer and the AliTPCCalibViewerGUI. - AliTPCROC* tpcROCinstance = AliTPCROC::Instance(); + AliTPCROC* tpcROCinstance = AliTPCROC::Instance(); - TObjArray* mapIROCs = 0; - TObjArray* mapOROCs = 0; - TVectorF *mapIROCArray = 0; - TVectorF *mapOROCArray = 0; - Int_t mapEntries = 0; - TString* mapNames = 0; - - if (mapFileName) { - TFile mapFile(mapFileName, "read"); - - TList* listOfROCs = mapFile.GetListOfKeys(); - mapEntries = listOfROCs->GetEntries()/2; - mapIROCs = new TObjArray(mapEntries*2); - mapOROCs = new TObjArray(mapEntries*2); - mapIROCArray = new TVectorF[mapEntries]; - mapOROCArray = new TVectorF[mapEntries]; - - mapNames = new TString[mapEntries]; - for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { - TString rocName(((TKey*)(listOfROCs->At(ivalue*2)))->GetName()); - rocName.Remove(rocName.Length()-4, 4); - mapIROCs->AddAt((AliTPCCalROC*)mapFile.Get((rocName + "IROC").Data()), ivalue); - mapOROCs->AddAt((AliTPCCalROC*)mapFile.Get((rocName + "OROC").Data()), ivalue); - mapNames[ivalue].Append(rocName); - } - - for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { - mapIROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(0)); - mapOROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(36)); + TObjArray* mapIROCs = 0; + TObjArray* mapOROCs = 0; + TVectorF *mapIROCArray = 0; + TVectorF *mapOROCArray = 0; + Int_t mapEntries = 0; + TString* mapNames = 0; + + if (mapFileName) { + TFile mapFile(mapFileName, "read"); + + TList* listOfROCs = mapFile.GetListOfKeys(); + mapEntries = listOfROCs->GetEntries()/2; + mapIROCs = new TObjArray(mapEntries*2); + mapOROCs = new TObjArray(mapEntries*2); + mapIROCArray = new TVectorF[mapEntries]; + mapOROCArray = new TVectorF[mapEntries]; + + mapNames = new TString[mapEntries]; + for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { + TString rocName(((TKey*)(listOfROCs->At(ivalue*2)))->GetName()); + rocName.Remove(rocName.Length()-4, 4); + mapIROCs->AddAt((AliTPCCalROC*)mapFile.Get((rocName + "IROC").Data()), ivalue); + mapOROCs->AddAt((AliTPCCalROC*)mapFile.Get((rocName + "OROC").Data()), ivalue); + mapNames[ivalue].Append(rocName); + } + + for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { + mapIROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(0)); + mapOROCArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(36)); - for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(0); ichannel++) - (mapIROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel); - for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(36); ichannel++) - (mapOROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel); - } - - } // if (mapFileName) + for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(0); ichannel++) + (mapIROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel); + for (UInt_t ichannel = 0; ichannel < tpcROCinstance->GetNChannels(36); ichannel++) + (mapOROCArray[ivalue])[ichannel] = ((AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel); + } + + } // if (mapFileName) - TTreeSRedirector cstream(fileName); - Int_t arrayEntries = 0; - if (array) arrayEntries = array->GetEntries(); - - TString* names = new TString[arrayEntries]; - for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) - names[ivalue].Append(((AliTPCCalPad*)array->At(ivalue))->GetName()); - - for (UInt_t isector = 0; isector < tpcROCinstance->GetNSectors(); isector++) { + TTreeSRedirector cstream(fileName); + Int_t arrayEntries = 0; + if (array) arrayEntries = array->GetEntries(); + + TString* names = new TString[arrayEntries]; + for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) + names[ivalue].Append(((AliTPCCalPad*)array->At(ivalue))->GetName()); + + for (UInt_t isector = 0; isector < tpcROCinstance->GetNSectors(); isector++) { // // get statistic for given sector // - TVectorF median(arrayEntries); - TVectorF mean(arrayEntries); - TVectorF rms(arrayEntries); - TVectorF ltm(arrayEntries); - TVectorF ltmrms(arrayEntries); - TVectorF medianWithOut(arrayEntries); - TVectorF meanWithOut(arrayEntries); - TVectorF rmsWithOut(arrayEntries); - TVectorF ltmWithOut(arrayEntries); - TVectorF ltmrmsWithOut(arrayEntries); - - TVectorF *vectorArray = new TVectorF[arrayEntries]; - for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) - vectorArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); - - for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { - AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); - AliTPCCalROC* calROC = calPad->GetCalROC(isector); - AliTPCCalROC* outlierROC = 0; - if (outlierPad) outlierROC = outlierPad->GetCalROC(isector); - if (calROC) { - median[ivalue] = calROC->GetMedian(); - mean[ivalue] = calROC->GetMean(); - rms[ivalue] = calROC->GetRMS(); - Double_t ltmrmsValue = 0; - ltm[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction); - ltmrms[ivalue] = ltmrmsValue; - if (outlierROC) { - medianWithOut[ivalue] = calROC->GetMedian(outlierROC); - meanWithOut[ivalue] = calROC->GetMean(outlierROC); - rmsWithOut[ivalue] = calROC->GetRMS(outlierROC); - ltmrmsValue = 0; - ltmWithOut[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction, outlierROC); - ltmrmsWithOut[ivalue] = ltmrmsValue; - } - } - else { - median[ivalue] = 0.; - mean[ivalue] = 0.; - rms[ivalue] = 0.; - ltm[ivalue] = 0.; - ltmrms[ivalue] = 0.; - medianWithOut[ivalue] = 0.; - meanWithOut[ivalue] = 0.; - rmsWithOut[ivalue] = 0.; - ltmWithOut[ivalue] = 0.; - ltmrmsWithOut[ivalue] = 0.; - } + TVectorF median(arrayEntries); + TVectorF mean(arrayEntries); + TVectorF rms(arrayEntries); + TVectorF ltm(arrayEntries); + TVectorF ltmrms(arrayEntries); + TVectorF medianWithOut(arrayEntries); + TVectorF meanWithOut(arrayEntries); + TVectorF rmsWithOut(arrayEntries); + TVectorF ltmWithOut(arrayEntries); + TVectorF ltmrmsWithOut(arrayEntries); + + TVectorF *vectorArray = new TVectorF[arrayEntries]; + for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++){ + vectorArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); + vectorArray[ivalue].SetUniqueID(array->UncheckedAt(ivalue)->GetUniqueID()); +// printf("UniqueID: %d\n",vectorArray[ivalue].GetUniqueID()); + } + + for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { + AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); + AliTPCCalROC* calROC = calPad->GetCalROC(isector); + AliTPCCalROC* outlierROC = 0; + if (outlierPad) outlierROC = outlierPad->GetCalROC(isector); + if (calROC) { + median[ivalue] = calROC->GetMedian(); + mean[ivalue] = calROC->GetMean(); + rms[ivalue] = calROC->GetRMS(); + Double_t ltmrmsValue = 0; + ltm[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction); + ltmrms[ivalue] = ltmrmsValue; + if (outlierROC) { + medianWithOut[ivalue] = calROC->GetMedian(outlierROC); + meanWithOut[ivalue] = calROC->GetMean(outlierROC); + rmsWithOut[ivalue] = calROC->GetRMS(outlierROC); + ltmrmsValue = 0; + ltmWithOut[ivalue] = calROC->GetLTM(<mrmsValue, ltmFraction, outlierROC); + ltmrmsWithOut[ivalue] = ltmrmsValue; + } } - + else { + median[ivalue] = 0.; + mean[ivalue] = 0.; + rms[ivalue] = 0.; + ltm[ivalue] = 0.; + ltmrms[ivalue] = 0.; + medianWithOut[ivalue] = 0.; + meanWithOut[ivalue] = 0.; + rmsWithOut[ivalue] = 0.; + ltmWithOut[ivalue] = 0.; + ltmrmsWithOut[ivalue] = 0.; + } + } + // // fill vectors of variable per pad // - TVectorF *posArray = new TVectorF[8]; - for (Int_t ivalue = 0; ivalue < 8; ivalue++) - posArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); - - Float_t posG[3] = {0}; - Float_t posL[3] = {0}; - Int_t ichannel = 0; - for (UInt_t irow = 0; irow < tpcROCinstance->GetNRows(isector); irow++) { - for (UInt_t ipad = 0; ipad < tpcROCinstance->GetNPads(isector, irow); ipad++) { - tpcROCinstance->GetPositionLocal(isector, irow, ipad, posL); - tpcROCinstance->GetPositionGlobal(isector, irow, ipad, posG); - posArray[0][ichannel] = irow; - posArray[1][ichannel] = ipad; - posArray[2][ichannel] = posL[0]; - posArray[3][ichannel] = posL[1]; - posArray[4][ichannel] = posG[0]; - posArray[5][ichannel] = posG[1]; - posArray[6][ichannel] = (Int_t)(ipad - (Double_t)(tpcROCinstance->GetNPads(isector, irow))/2); - posArray[7][ichannel] = ichannel; - + TVectorF *posArray = new TVectorF[8]; + for (Int_t ivalue = 0; ivalue < 8; ivalue++) + posArray[ivalue].ResizeTo(tpcROCinstance->GetNChannels(isector)); + + Float_t posG[3] = {0}; + Float_t posL[3] = {0}; + Int_t ichannel = 0; + for (UInt_t irow = 0; irow < tpcROCinstance->GetNRows(isector); irow++) { + for (UInt_t ipad = 0; ipad < tpcROCinstance->GetNPads(isector, irow); ipad++) { + tpcROCinstance->GetPositionLocal(isector, irow, ipad, posL); + tpcROCinstance->GetPositionGlobal(isector, irow, ipad, posG); + posArray[0][ichannel] = irow; + posArray[1][ichannel] = ipad; + posArray[2][ichannel] = posL[0]; + posArray[3][ichannel] = posL[1]; + posArray[4][ichannel] = posG[0]; + posArray[5][ichannel] = posG[1]; + posArray[6][ichannel] = (Int_t)(ipad - (Double_t)(tpcROCinstance->GetNPads(isector, irow))/2); + posArray[7][ichannel] = ichannel; + // loop over array containing AliTPCCalPads - for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { - AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); - AliTPCCalROC* calROC = calPad->GetCalROC(isector); - if (calROC) + for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { + AliTPCCalPad* calPad = (AliTPCCalPad*) array->At(ivalue); + AliTPCCalROC* calROC = calPad->GetCalROC(isector); + if (calROC) (vectorArray[ivalue])[ichannel] = calROC->GetValue(irow, ipad); - else - (vectorArray[ivalue])[ichannel] = 0; - } - ichannel++; - } + else + (vectorArray[ivalue])[ichannel] = 0; + } + ichannel++; } - + } + + cstream << "calPads" << + "sector=" << isector; + + for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { cstream << "calPads" << - "sector=" << isector; - - for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { - cstream << "calPads" << - (Char_t*)((names[ivalue] + "_Median=").Data()) << median[ivalue] << - (Char_t*)((names[ivalue] + "_Mean=").Data()) << mean[ivalue] << - (Char_t*)((names[ivalue] + "_RMS=").Data()) << rms[ivalue] << - (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue] << - (Char_t*)((names[ivalue] + "_RMS_LTM=").Data()) << ltmrms[ivalue]; - if (outlierPad) { - cstream << "calPads" << - (Char_t*)((names[ivalue] + "_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] << - (Char_t*)((names[ivalue] + "_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] << - (Char_t*)((names[ivalue] + "_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] << - (Char_t*)((names[ivalue] + "_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] << - (Char_t*)((names[ivalue] + "_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue]; - } + (Char_t*)((names[ivalue] + "_Median=").Data()) << median[ivalue] << + (Char_t*)((names[ivalue] + "_Mean=").Data()) << mean[ivalue] << + (Char_t*)((names[ivalue] + "_RMS=").Data()) << rms[ivalue] << + (Char_t*)((names[ivalue] + "_LTM=").Data()) << ltm[ivalue] << + (Char_t*)((names[ivalue] + "_RMS_LTM=").Data()) << ltmrms[ivalue]; + if (outlierPad) { + cstream << "calPads" << + (Char_t*)((names[ivalue] + "_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] << + (Char_t*)((names[ivalue] + "_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] << + (Char_t*)((names[ivalue] + "_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] << + (Char_t*)((names[ivalue] + "_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] << + (Char_t*)((names[ivalue] + "_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue]; } - - for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { - cstream << "calPads" << - (Char_t*)((names[ivalue] + ".=").Data()) << &vectorArray[ivalue]; + //timestamp and run, if given in title +/* TString title(((AliTPCCalPad*) array->At(ivalue))->GetTitle()); + TObjArray *arrtitle=title.Tokenize(","); + Int_t run=-1; + UInt_t time=0; + TIter next(arrtitle); + TObject *o=0; + while ( (o=next()) ){ + TString &entry=((TObjString*)o)->GetString(); + entry.Remove(TString::kBoth,' '); + entry.Remove(TString::kBoth,'\t'); + if (entry.BeginsWith("Run:")) { + run=entry(4,entry.Length()).Atoi(); + } else if (entry.BeginsWith("Time:")) { + time=entry(6,entry.Length()).Atoi(); + } } - - if (mapFileName) { - for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { + delete arrtitle;*/ + + } + + for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) { + cstream << "calPads" << + (Char_t*)((names[ivalue] + ".=").Data()) << &vectorArray[ivalue]; + } + + if (mapFileName) { + for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) { if (isector < 36) - cstream << "calPads" << - (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapIROCArray[ivalue]; + cstream << "calPads" << + (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapIROCArray[ivalue]; else - cstream << "calPads" << - (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapOROCArray[ivalue]; + cstream << "calPads" << + (Char_t*)((mapNames[ivalue] + ".=").Data()) << &mapOROCArray[ivalue]; } - } - - cstream << "calPads" << - "row.=" << &posArray[0] << - "pad.=" << &posArray[1] << - "lx.=" << &posArray[2] << - "ly.=" << &posArray[3] << - "gx.=" << &posArray[4] << - "gy.=" << &posArray[5] << - "rpad.=" << &posArray[6] << - "channel.=" << &posArray[7]; - - cstream << "calPads" << - "\n"; - - delete[] posArray; - delete[] vectorArray; - } - - - delete[] names; - if (mapFileName) { - delete mapIROCs; - delete mapOROCs; - delete[] mapIROCArray; - delete[] mapOROCArray; - delete[] mapNames; - } + } + + cstream << "calPads" << + "row.=" << &posArray[0] << + "pad.=" << &posArray[1] << + "lx.=" << &posArray[2] << + "ly.=" << &posArray[3] << + "gx.=" << &posArray[4] << + "gy.=" << &posArray[5] << + "rpad.=" << &posArray[6] << + "channel.=" << &posArray[7]; + + cstream << "calPads" << + "\n"; + + delete[] posArray; + delete[] vectorArray; + } + + + delete[] names; + if (mapFileName) { + delete mapIROCs; + delete mapOROCs; + delete[] mapIROCArray; + delete[] mapOROCArray; + delete[] mapNames; + } }